I want to access the balance of contract(i.e. 0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE
) and its totalSupply(state variable). I could access the balancec of this contract , but why I could not call its function i.e. getTotalSupply()
I have following code;
async function myContractAddress() {
myContAddr = '0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE';
web3.eth.getBalance(myContAddr).then(console.log);
tokens = await myContAddr.methods.getTotalSupply().call();
tokens = tokens.toString(10);
console.log("Toten supply is : ",tokens);
}
myContractAddress();
here is my error;
(node:6028) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getTotalSupply' of undefined
at myContractAddress (C:\Users\jj\Desktop\temp\deploy.js:36:39)
at C:\Users\jj\Desktop\temp\deploy.js:26:1
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6028) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejectio
id: 1)
(node:6028) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
cated. In the future, promise rejections that are not handled will terminate th
Node.js process with a non-zero exit code.
0 // actually this is my contract balance , which have shown