https://docs.moralis.io/moralis-dapp/web3-sdk/native#runcontractfunction
I build a frontend where you can enter a wallet address and a contract address into input fields.
I then build the options with:
const [StakingContractParams, setStakingContractParams] =
useState();
and then later in onSubmit:
const onSubmit = (e) => {
e.preventDefault();
if (!inputs.wallet && !inputs.token) {
alert("Please choose a token");
return;
}
// Set the Params for Staking pool
setStakingContractParams({
chain: "bsc",
address: inputs.wallet,
functionName: "userInfo",
abi: AbiUserInfo,
params: {
address: "0x71e0B02eA84C79689d246d32a4ca9dEafdb89829",
uint256: "2",
},
});
};
the call of the code above is in a seperate “componenten” inserted in the main app.
How can i just run this when there is a valid and complete “StakingContractParams”?