This is the first time I work with web3 api, so I am totally lost. I use wagmi hook with react, trying to call a function from smart contract:
const id = 1;
const index = 1;
const { data, error, isError, isLoading } = useContractRead({
address: "0xADDRESS",
abi: [(...){
inputs: [
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "uint256", name: "index", type: "uint256" },
],
name: "isClaimed",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function",
},(...)],
functionName: "isClaimed",
args: [id, index],
});
and I get the IDE error: "Type 'number' is not assignable to type 'BigNumber'"
if I then
const id = BigNumber.from(1);
then I get error from the contract:
Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="isClaimed(uint256,uint256)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0) at Logger.makeError (index.ts:269:1) at Logger.throwError (index.ts:281:1) at Interface.decodeFunctionResult (interface.ts:427:1) at index.ts:400:1 at Generator.next () at fulfilled (index.ts:1:1)
I watched several tutorials and read articles about it but still have no idea what is the problem. Wagmi documentation doesn't tell me anything about it. ChatGPT nor Bing Chat are not helpful. Can anyone help?
------------ Edit: Additional Info ----------------
I have this in my App.txs:
const chains = [arbitrum, mainnet, polygon];
const projectId = "SOME_ID_OF_WALLETCONNECT_PROJECT_I_CREATED";
const { provider } = configureChains(chains, [w3mProvider({ projectId })]);
const wagmiClient = createClient({
autoConnect: true,
connectors: w3mConnectors({ projectId, version: 1, chains }),
provider,
});
Contract developer said that chain is Mumbai testing for polygon. I guess I am not connected to the correct chain then