deployedContract.deploy({
data: bytecode,
arguments: [listOfCandidates.map(name => web3.utils.hexToAscii(Rama))]
}).send({
from: '0xfb9286cde20bbd5ed60ee3bb156f9d9938c5b151',
gas: 1500000,
gasPrice: web3.utils.toWei('0.00003', 'ether')
}).then((newContractInstance) => {
deployedContract.options.address = newContractInstance.options.address
console.log(newContractInstance.options.address)
});
TypeError: Cannot read property 'hexToAscii' of undefined
at deployedContract.deploy.arguments.listOfCandidates.map.name (repl:3:55)
at Array.map (<anonymous>)
1 Answer
You're most likely using Web3 0.x, while web3.utils.hexToAscii()
is a Web3 1.0 syntax. The equivalent for Web3 0.x would be web3.toAscii()
.
-
1Also: a recent web3.js release made it so the static Web3 import doesn't have the
utils
property anymore. You have to create an instance of web3 to get the utils property, which I can't tell if they're doing based on the code. Mar 16, 2019 at 16:17