Skip to content
This repository was archived by the owner on Apr 18, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
700 changes: 700 additions & 0 deletions dist/multicall.cjs.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/multicall.cjs.js.map

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions dist/multicall.esm.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/multicall.esm.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions dist/multicall.esm.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/multicall.esm.mjs.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions dist/multicall.umd.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/multicall.umd.js.map

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function isEmpty(obj) {
return !obj || Object.keys(obj).length === 0;
}

export async function ethCall(rawData, { id, web3, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {
export async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {
const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData);
if (ws) {
log('Sending via WebSocket');
Expand Down Expand Up @@ -92,6 +92,32 @@ export async function ethCall(rawData, { id, web3, rpcUrl, block, multicallAddre
ws.onmessage = onMessage;
});
}
else if (ethers) {
log('Sending via ethers provider');
return ethers.send({
method: 'eth_call',
params: [
{
to: multicallAddress,
data: abiEncodedData
},
block || 'latest'
]
})
}
else if (provider) {
log('Sending via EIP-1193 provider');
return provider.request({
method: 'eth_call',
params: [
{
to: multicallAddress,
data: abiEncodedData
},
block || 'latest'
]
})
}
else if (web3) {
log('Sending via web3 provider');
return web3.eth.call({
Expand Down