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.loginstead ofalertto make sure that the problem is not a type issue. – Paul Razvan Berg Jun 29 '21 at 10:21await contract.methods.allowance(userAddress, STAKING_CONTRACT_ADDRESS).call();– natewelch_ Jun 29 '21 at 17:06