Closed Voidcake closed 2 years ago
How to call methods from a Smart contracts: https://ethereum.org/en/developers/tutorials/calling-a-smart-contract-from-javascript/#:~:text=Call%3A%20Reading%20value%20from%20a%20smart%20contract,-The%20first%20example&text=You%20can%20access%20an%20instantiated,result%20of%20executing%20the%20function.
-> You can access an instantiated smart contract methods that you provided the ABI for as follows: yourContract.methods.methodname. By using the call function you’ll receive the result of executing the function.
Example:
daiToken.methods.balanceOf(senderAddress).call(function (err, res) {
if (err) {
console.log("An error occured", err)
return
}
console.log("The balance is: ", res)
})