Hello. I try to make a read only contract call to check its balance but get this error:
Moralis Moralis.enableWeb3() already has been called, but is not finished yet
Here is my code:
const { Moralis } = useMoralis();
await Moralis.enableWeb3();
const options = {
contractAddress: "0x9652dB185714460cC6918117FD1E35593cD40450",
functionName: "getBalance",
abi: getBalanceAbi,
};
const balance = await Moralis.executeFunction(options);
And here is my function ABI:
export const getBalanceAbi = [
{
inputs: [],
name: "getBalance",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
];
What am I doing wrong and how can I call this function and save its result?
The chain is matic testnet. I’m using Moralis 1.5.9 SDK and react-moralis 1.3.5.
Thank you.