I'm still learning, so apologies if this is a very dumb question. . . I am calling a smart contract to retrieve an allowance value, but I'm not sure how to get to the integer value in the response. My code is:
const contract = new web3.eth.Contract(ContractAbi, CONTRACT_ADDRESS);
const allowance = await contract.methods.allowance(userAddress, STAKING_CONTRACT_ADDRESS);
alert(allowance);
The alert that is displayed in the browser is 'undefined'. I think I need it to be allowance.<something? but can't figure out what?
Thank you!
console.log
instead ofalert
to make sure that the problem is not a type issue.await contract.methods.allowance(userAddress, STAKING_CONTRACT_ADDRESS).call();