0

When I'm working whit web3 I have something like:

 var abi = [...];
var contract = new web3.eth.Contract(abi,"0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0");

then I use something like:

myContract.methods.myMethod(123).call(....

In truffle test I have a contract instance in hand, and I use

instance.myMethod(123)

without the "methods" indirection, what is different from the two contract instances?

3

The difference is that Truffle injects Web3.js 0.20 into the test script, whereas you are working with Web3.js 1.0.

Web3.js is a whole lot different from Web3.js 0.20.

2
  • in this case, which is best to learn and use? latest Web3.js ? – KitKarson May 30 '18 at 2:12
  • I would say so, yes. – Henk May 30 '18 at 8:46

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.