3.0.4 • Published 2 years ago
@morpho-labs/ethers-multicall v3.0.4
ethers-multicall
⚡🚀 Call multiple view functions, from multiple Smart Contracts, in a single RPC query!
Querying an RPC endpoint can be very costly (100+ queries) when loading data from multiple smart contracts. With multicall, batch these queries into a single, on-chain query, without additional over-head!
This is the standalone package of the library formerly created & used by Zapper.
Install
npm install @morpho-labs/ethers-multicall
yarn add @morpho-labs/ethers-multicall
Usage
import { ethers } from "ethers";
import { EthersMulticall } from "@morpho-labs/ethers-multicall";
const provider = new ethers.providers.JsonRpcBatchProvider("...");
const multicall = new EthersMulticall(provider);
const uni = multicall.wrap(
new ethers.Contract("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", UniswapAbi)
); // make sure to always wrap contracts to benefit from multicalls
Promise.all([
uni.name(),
uni.symbol(),
uni.decimals(),
uni.inexistantFunction().catch(() => "default value"),
]).then(console.log);
3.0.4
2 years ago
4.0.0
2 years ago
3.0.3
2 years ago
3.0.2
2 years ago
3.0.1
3 years ago
3.0.0
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.3.4
3 years ago
1.3.3
3 years ago
1.3.2
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.0
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.0
3 years ago