Ethereum Asked on February 16, 2021
I’m able to create an instance of a smart contract that I know works in Ganache using Truffle. But in my Javascript Nodejs app, with the syntax "let contractInstance = new web3.eth.Contract(abi)", when I call the contractInstance method "contractInstance.ownerOf", it says "ownerOf" is not a function. But I can see this in the ABI. Also get an undefined when I console log "contractInstance.address". Been "googling" this issue for hours and I’m coming up with nothing. Any help is greatly appreciated! Thanks.
The syntax contractInstance.contractMethod
is valid on web3.js v0.x.
Starting from web3.js v1.0, the syntax is contractInstance.methods.contractMethod
.
And in order to get the contract instance address, you can use contractInstance._address
.
Correct answer by goodvibration on February 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP