From 11051553a932fe2a8416ad0bc70277de27334794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Mon, 1 Apr 2019 15:00:30 -0300 Subject: [PATCH] Add provider-engine support. (#24) * Add provider-engine support. * Update CHANGELOG.md --- CHANGELOG.md | 5 ++++- src/time.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b22d8..b61f2b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog +## 0.3.1 (unreleased) + * Add support for environments using `web3-provider-engine`. ([#24](https://github.com/OpenZeppelin/openzeppelin-test-helpers/pull/24)) + ## 0.3.0 (2019-03-19) * `chai` is no longer exported, and `should` is no longer automatically installed. ([#18](https://github.com/OpenZeppelin/openzeppelin-test-helpers/pull/18)) - + #### How to upgrade from 0.2 If you use Chai assertions in your project you should make sure to explicitly install it: `npm install chai`. If you need to access the `chai` instance you should now get it through `require('chai')`. If you use `should`-style assertions you should set it up manually now, by adding `require('chai/register-should')` in your tests, or e.g. in your Truffle config. Check out OpenZeppelin's upgrade commit in case it might be helpful: [`cf7375d`](https://github.com/OpenZeppelin/openzeppelin-solidity/commit/cf7375d6b873afc9f705e329db39e2ef389af9d2). diff --git a/src/time.js b/src/time.js index 1b0b86f..f22026b 100644 --- a/src/time.js +++ b/src/time.js @@ -2,7 +2,7 @@ const { BN } = require('./setup'); const { promisify } = require('util'); function advanceBlock () { - return promisify(web3.currentProvider.send)({ + return promisify(web3.currentProvider.send.bind(web3.currentProvider))({ jsonrpc: '2.0', method: 'evm_mine', }); @@ -27,7 +27,7 @@ async function increase (duration) { if (duration.isNeg()) throw Error(`Cannot increase time by a negative amount (${duration})`); - await promisify(web3.currentProvider.send)({ + await promisify(web3.currentProvider.send.bind(web3.currentProvider))({ jsonrpc: '2.0', method: 'evm_increaseTime', params: [duration.toNumber()],