You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const ethereumMulticall = require("ethereum-multicall");
const { ethers } = require("ethers");
// let provider = ethers.getDefaultProvider();
async function go() {
// you can use any ethers provider context here this example is
// just shows passing in a default provider, ethers hold providers in
// other context like wallet, signer etc all can be passed in as well.
const multicall = new ethereumMulticall.Multicall({
nodeUrl: "https://bsc-pokt.nodies.app",
tryAggregate: true,
});
const contractCallContext = [
{
reference: "testContract2",
contractAddress: "0x55d398326f99059fF775485246999027B3197955",
abi: [
{
name: "totalSupply",
type: "function",
inputs: [],
outputs: [{ name: "", type: "uint256" }],
},
],
calls: [
{
reference: "fooTwoCall",
methodName: "totalSupply",
methodParameters: [],
},
],
},
];
const results = await multicall.call(contractCallContext);
console.log(results);
}
go();
Fail msg
/Users/js/node_modules/@ethersproject/logger/lib/index.js:238
var error = new Error(message);
^
Error: unable to determine stateMutability (argument="value", value={"name":"totalSupply","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256"}]}, code=INVALID_ARGUMENT, version=abi/5.7.0)
at Logger.makeError (/Users/js/node_modules/@ethersproject/logger/lib/index.js:238:21)
at Logger.throwError (/Users/ll/code/js/node_modules/@ethersproject/logger/lib/index.js:247:20)
at Logger.throwArgumentError (/Users/ll/code/js/node_modules/@ethersproject/logger/lib/index.js:250:21)
at verifyState (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:588:16)
at FunctionFragment.fromObject (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:728:21)
at Fragment.fromObject (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:371:41)
at Fragment.from (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:363:25)
at /Users/ll/code/js/node_modules/@ethersproject/abi/lib/interface.js:101:41
at Array.map (<anonymous>)
at new Interface (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/interface.js:100:65) {
reason: 'unable to determine stateMutability',
code: 'INVALID_ARGUMENT',
argument: 'value',
value: {
name: 'totalSupply',
type: 'function',
inputs: [],
outputs: [ { name: '', type: 'uint256' } ]
}
}
Node.js v18.17.1
Fail msg
"ethereum-multicall": "^2.21.0",
"ethers": "^5.7.0",
What's the matter with the code?
The text was updated successfully, but these errors were encountered: