0
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

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().

  • 1
    Also: 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. – flygoing Mar 16 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.