@kodex-data/multicall
Version:
`@kodex-data/multicall` is a JavaScript library that allows you to batch multiple Ethereum read-only calls into a single request, reducing the number of RPC calls and improving performance. It supports the `eth_call` method and the `multicall` contract, w
31 lines (30 loc) • 1.05 kB
TypeScript
import type * as T from './types';
import { BigNumber } from '@ethersproject/bignumber';
export default class MultiCall {
static MulticallAbi: T.JsonFragment[];
static isBigNumber: (input: any) => input is BigNumber;
static isResult: (input: any) => input is T.Result;
static Contracts: Map<number, string>;
provider?: T.Provider;
blockNumber?: BigNumber;
operations: T.Operation[];
constructor(provider?: T.Provider);
$fn: {
addOperation: (operation: T.Operation) => void;
aggregate: (provider?: T.Provider | undefined) => Promise<T.Operation[]>;
toCallParameters: () => {
targets: string[];
values: BigNumber[];
callDatas: string[];
};
toAggregatePayload: () => [string, string][];
};
balanceOf: {
add: (token: string, address: string) => void;
query: (provider?: T.Provider | undefined) => Promise<{
token: string;
holder: string;
value: BigNumber;
}[]>;
};
}