cavanmflynn / ethers-multicall

Make multiple Ethereum network requests in a single HTTP query. ethcall for ethers v5.
MIT License
224 stars 99 forks source link

Error with receive functions #44

Open grallc opened 2 years ago

grallc commented 2 years ago

For some reasons, if the ABI contains a receive payable function with no further arguments, instantiating a new Contract will throw an TypeError: Cannot read property 'type' of null error. The problem seems to be coming from the Fragment from ethersprojects, but can also be fixed in the library.

Can be reproduced by using this ABI:

  const abi = [
    {
        constant: true,
        inputs: [],
        name: 'totalSupply',
        outputs: [
            {
                internalType: 'uint256',
                name: '',
                type: 'uint256'
            }
        ],
        payable: false,
        stateMutability: 'view',
        type: 'function'
    },
    {
      stateMutability: 'payable',
      type: 'receive'
    }
  ]

in the tests.

roffett commented 2 years ago

Met the same issues, fallback() payable throw the same err as well