Openzeppelin-contracts: TypeError: web3.currentProvider.sendAsync is not a function

Created on 1 Jan 2019  路  1Comment  路  Source: OpenZeppelin/openzeppelin-contracts

Executing await time.increase(123) throws

TypeError: web3.currentProvider.sendAsync is not a function

馃捇 Environment

Using [email protected] and trying to execute the statement above inside a truffle test run. OS is Ubuntu 18.04.1 with [email protected]

馃摑 Details

Console-logging web3.currentProvider returns undefined.

馃敘 Code to reproduce bug

Just a Truffle JS test file including following lines.

const time = require("openzeppelin-solidity/test/helpers/time");
await time.increase(123);

Most helpful comment

Hey there @ferittuncer, thanks for reporting this!

It looks like this is one of the web3 1.0.0 breaking changes, sendAsync is no more, and we should now use send. I've actually extracted the testing helpers into their own package (https://github.com/OpenZeppelin/openzeppelin-test-helpers - still in beta, I plan on releasing a non-beta version either this or next week, after I migrate all of OpenZeppelin to use it) where that issue has been fixed. There's no documentation yet, but if you're courageous, you can install it via npm, and take a look at the test files to see how each function is used. time.increase should require no changes on your side :)

Cheers!

>All comments

Hey there @ferittuncer, thanks for reporting this!

It looks like this is one of the web3 1.0.0 breaking changes, sendAsync is no more, and we should now use send. I've actually extracted the testing helpers into their own package (https://github.com/OpenZeppelin/openzeppelin-test-helpers - still in beta, I plan on releasing a non-beta version either this or next week, after I migrate all of OpenZeppelin to use it) where that issue has been fixed. There's no documentation yet, but if you're courageous, you can install it via npm, and take a look at the test files to see how each function is used. time.increase should require no changes on your side :)

Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maraoz picture maraoz  路  3Comments

LogvinovLeon picture LogvinovLeon  路  4Comments

bh2smith picture bh2smith  路  4Comments

xiaoyao1991 picture xiaoyao1991  路  3Comments

golivax picture golivax  路  4Comments