Skip to main content

Troubleshooting

Error in Multicall v1

Error: One of the calls reverted in Multicall v1.

One of the calls has failed on the blockchain. It might have ended up with a revert, or with some other error (e.g. division by zero).

With Multicall v2, we are able to decode more information from a failing call, including decoding Solidity Custom Errors.

In order to use Multicall v2, specify this in the config:

const config: Config = {
multicallVersion: 2 as const,
}

If useDApp does not have a Multicall v2 address for the chain you're using, you can provide it in the Config:

const config: Config = {
multicallVersion: 2 as const,
multicallAddresses: {
[ChainId]: MulticallV2Address,
},
}

With Multicall v2, you will have more information that might direct you to the root issue of a failing call.

Type mismatch when building

If when building an app you see errors about type mismatch in @ethersproject.

For example:

  $ yarn build
yarn run v1.22.10
$ tsc --noEmit && rimraf build && webpack --mode production --progress
src/components/Transactions/Forms.tsx:12:52 - error TS2345: Argument of type 'Interface' is not assignable to parameter of type 'ContractInterface'.
Property 'getError' is missing in type 'import("github.com/TrueFiEng/useDApp/packages/example/node_modules/@ethersproject/abi/lib/interface").Interface' but required in type 'import("github.com/TrueFiEng/useDApp/packages/example/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface").Interface'.

12 const contract = new Contract(wethContractAddress, wethInterface)
~~~~~~~~~~~~~

node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface.d.ts:53:5
53 getError(nameOrSignatureOrSighash: string): ErrorFragment;
~~~~~~~~
'getError' is declared here.


Found 1 error.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

It may be an error of yarn getting internal versions of @ethersproject that are higher then specified in useDApp. To fix this you need to add resolutions to your package.json with etherspoject packages that cause an error, with correct version. Resolutions force yarn to install specified versions of packages.

For example:

  "resolutions": {
"@ethersproject/abi": "5.2.0",
"@ethersproject/contracts": "5.6.0"
}