Code:
const { native } = useMoralisWeb3Api();
const { farmAddress, farmAbi } = useFarm();
const options = {
chain: "bsc testnet",
address: farmAddress,
function_name: "getTokens",
abi: farmAbi,
};
const { fetch, data, error, isLoading } = useMoralisWeb3ApiCall(
native.runContractFunction,
options
);
Error:
TS2345: Argument of type '{ chain: string; address: any; function_name: string; abi: ({ anonymous: boolean; inputs: { indexed: boolean; internalType: string; name: string; type: string; }[]; name: string; type: string; outputs?: undefined; stateMutability?: undefined; } | { ...; } | { ...; })[]; }' is not assignable to parameter of type '{ chain?: "0x4" | "0x3" | "0x5" | "0x1" | "0x89" | "bsc testnet" | "eth" | "ropsten" | "rinkeby" | "goerli" | "kovan" | "0x2a" | "polygon" | "mumbai" | "0x13881" | "bsc" | "0x38" | ... 7 more ... | undefined; subdomain?: string | undefined; providerUrl?: string | undefined; function_name: string; } & { ...; }'.
Type '{ chain: string; address: any; function_name: string; abi: ({ anonymous: boolean; inputs: { indexed: boolean; internalType: string; name: string; type: string; }[]; name: string; type: string; outputs?: undefined; stateMutability?: undefined; } | { ...; } | { ...; })[]; }' is not assignable to type '{ chain?: "0x4" | "0x3" | "0x5" | "0x1" | "0x89" | "bsc testnet" | "eth" | "ropsten" | "rinkeby" | "goerli" | "kovan" | "0x2a" | "polygon" | "mumbai" | "0x13881" | "bsc" | "0x38" | "0x61" | ... 6 more ... | undefined; subdomain?: string | undefined; providerUrl?: string | undefined; function_name: string; }'.
Types of property 'chain' are incompatible.
Type 'string' is not assignable to type '"0x4" | "0x3" | "0x5" | "0x1" | "0x89" | "bsc testnet" | "eth" | "ropsten" | "rinkeby" | "goerli" | "kovan" | "0x2a" | "polygon" | "mumbai" | "0x13881" | "bsc" | "0x38" | "0x61" | ... 6 more ... | undefined'.
141 | const { fetch, data, error, isLoading } = useMoralisWeb3ApiCall(
142 | native.runContractFunction,
> 143 | options
| ^^^^^^^
144 | );