I am following this tutorial. Everything worked fine. Now I want to getBalanceOf tokens on my nodejs app, but I keep getting this error:
tokenContract.methods.balanceOf is not a function.
My code is as follows:
var provider = new web3.providers.HttpProvider(node.url);
var w3 = new web3(provider);
var tokenContract = new w3.eth.Contract(abi, query.token_address);
console.log(tokenContract);
w3.eth.call({
to: query.pub_address,
data: tokenContract.methods.balanceOf(query.pub_address).encodeABI()
}).then(function(balance) {
console.log(balance);
}).catch(function(error) {
console.log(error)
reject(error)
})
If I check my tokenContract methods in console, by printing (tokenContract.methods) I see there is no balanceOf method exposed.
Any ideas?