In web3.js version 0.x:

The web3 module automatically determines the use of call or sendTransaction based on the method type.

So for example, instead of doing:


You can do:


In web3.js version 1.0, this no longer seems possible.

For the example above, you need to do:


So every function call becomes "lengthier", and in addition, the code which I have already written is not easily portable.

Is there any available wrapper for web3.js version 1.0, which allows using the same syntax as in web3.js version 0.x?

The relevant documentation for web3 v0.x is here.

The relevant documentation for web3 v1.0 is here.

Thank you!

1 Answer 1


As a workaround, you can automate the generating of the syntax in general by parsing the ABI, it holds all information about the function (name, modifier, inputs and outputs) necessary to generate the syntax needed. I did that for truffle and can really recommend doing so as it prevents you from doing mistakes when writing the commands manually.

  • Thanks, thought about this. It would be way "lengthier" than the current solution though. Jun 18, 2018 at 9:39
  • What do you mean "for Truffle"? Truffle already uses web3.js v0.x. Jun 18, 2018 at 9:40
  • It's a one time effort that's really worth it. It's a script that generates truffle syntax code to interact with the contract.
    – n1cK
    Jun 18, 2018 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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