Open
Description
Ethers Version
6.6.2
Search Terms
connect, contract, migration, BaseContract
Describe the Problem
Since a Contract's connect method returns a BaseContract, it apparently doesn't have the methods from the abi - at least according to typescript (vs code?).
The error message is: Property 'setFee' does not exist on type 'BaseContract'.ts(2339)
(where setFee is the name of the function I'm calling).
Note that the code still runs fine.
Code Snippet
// this gives error
await contract.connect(randomWallet).setFee(ethers.ZeroAddress, 12);
// this is fine
await (contract.connect(randomWallet) as Contract).setFee(ethers.ZeroAddress, 12)
Contract ABI
["function setFee(address token, uint256 newFee)"]
Errors
Property 'setFee' does not exist on type 'BaseContract'.ts(2339)
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer), Hardhat
Environment (Other)
No response