Skip to content

Multiple matching functions error when doing useContractFunction #1145

@Murphywes

Description

@Murphywes

const { send: sendDepositETH, state: stateDepositETH } = useContractFunction(GatewayContract, "depositETH")

There are 2 function with the same name but with different parameter lengths in the contract, I'm trying interact with this contract via useContractFunction, but got the following error.. Can anyone help me?

Error
multiple matching functions (argument="name", value="depositETH", code=INVALID_ARGUMENT, version=abi/5.6.4)
Call Stack
 Logger.makeError
  node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/logger/lib.esm/index.js:224:23
 Logger.throwError
  node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/logger/lib.esm/index.js:233:20
 Logger.throwArgumentError
  node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/logger/lib.esm/index.js:236:21
 Interface.getFunction
  node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/abi/lib.esm/interface.js:172:24
 eval
  core/dist/esm/src/hooks/useContractFunction.js:81:53
 handleClick
  src/components/SendEthForm/DepositEth.tsx:50:10
 HTMLUnknownElement.callCallback
  node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:3945:14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions