Truffle: Where is `getData` or `encodeABI()` in truffle v5

Created on 26 Aug 2018  路  3Comments  路  Source: trufflesuite/truffle

const receiver = await ERC677Recipient.new();
console.log(receiver.doSomething)
{ [Function]
  call: [Function],
  sendTransaction: [Function],
  estimateGas: [Function],
  request: [Function] }

I'd expect to have encodeABI() function from web3 1.0

I had to use workaround:

const ERC677RecipientInstance = new web3.eth.Contract(ERC677Recipient.abi, receiver.address);
var callDoSomething123 = await ERC677RecipientInstance.methods.doSomething(123).encodeABI();

Most helpful comment

It should be available via the contract object:

receiver.contract  // <--- The underlying web3 instance. 
receiver.contract.methods.doSomething(123).encodeABI()

All 3 comments

It should be available via the contract object:

receiver.contract  // <--- The underlying web3 instance. 
receiver.contract.methods.doSomething(123).encodeABI()

Hi @rstormsf, can this be closed? Thanks!

Ok, perfect! thanks a lot

Was this page helpful?
0 / 5 - 0 ratings