Cant run a native Contract function, i get a HTTP Error 400 with following text:
{“code”:141,“error”:" is required, is required"}
what i am doing wrong?
Its a react component.
const RunNativeContract = () => {
const { runContractFunction, data, error, isLoading, isFetching } =
useApiContract({
chain: "bsc",
address: "0x23f7F3119d1b5b6c94a232680e2925703C4ebbF5",
functionName: "userInfo",
abi: Abi,
params: {
address: "0x71e0B02eA84C79689d246d32a4ca9dEafdb89829",
uint256: "2",
},
});
return (
<div>
{error && console.log(error)}
<button onClick={() => runContractFunction()} disabled={isFetching}>
Run contract function
</button>
{data && <pre>{JSON.stringify(data, null, 2)}</pre>}
</div>
);
};
ABI is:
export const ABI = [
{
"inputs": [
{ "internalType": "uint256", "name": "", "type": "uint256" },
{ "internalType": "address", "name": "", "type": "address" },
],
"name": "userInfo",
"outputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" },
{
"internalType": "uint256",
"name": "rewardLockedUp",
"type": "uint256",
},
{
"internalType": "uint256",
"name": "nextHarvestUntil",
"type": "uint256",
},
],
"stateMutability": "view",
"type": "function",
},
];