Unverified Commit b7d56d54 by Nicolás Venturo Committed by GitHub

Added explicity pify dep, deprecating web3.eth. (#1532)

* Added explicity pify dep, deprecating web3.eth.

* Dropped promisify in favor of pify.
parent 41c540fb
......@@ -2403,6 +2403,14 @@
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"rimraf": "^2.2.8"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"delayed-stream": {
......@@ -2870,6 +2878,14 @@
"parse-json": "^2.2.0",
"pify": "^2.0.0",
"strip-bom": "^3.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"path-type": {
......@@ -2879,6 +2895,14 @@
"dev": true,
"requires": {
"pify": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"read-pkg": {
......@@ -4748,6 +4772,14 @@
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"graceful-fs": {
......@@ -5937,6 +5969,14 @@
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"strip-bom": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"loader-utils": {
......@@ -6966,6 +7006,14 @@
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"pathval": {
......@@ -6987,9 +7035,9 @@
"dev": true
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
"dev": true
},
"pinkie": {
......@@ -8927,6 +8975,14 @@
"strip-bom": "^2.0.0",
"strip-bom-stream": "^2.0.0",
"vinyl": "^1.1.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"web3": {
......
......@@ -51,6 +51,7 @@
"ethereumjs-util": "^6.0.0",
"ethjs-abi": "^0.2.1",
"ganache-cli": "6.1.8",
"pify": "^4.0.1",
"solidity-coverage": "^0.5.4",
"solium": "^1.1.8",
"truffle": "^4.1.13",
......
const { ethGetBalance } = require('./web3');
async function balanceDifference (account, promiseFunc) {
const balanceBefore = web3.eth.getBalance(account);
const balanceBefore = await ethGetBalance(account);
await promiseFunc();
const balanceAfter = web3.eth.getBalance(account);
const balanceAfter = await ethGetBalance(account);
return balanceAfter.minus(balanceBefore);
}
......
const SolidityEvent = require('web3/lib/web3/event.js');
const { ethGetTransactionReceipt } = require('./web3');
const BigNumber = web3.BigNumber;
const should = require('chai')
......@@ -23,7 +24,7 @@ async function inConstruction (contract, eventName, eventArgs = {}) {
}
async function inTransaction (txHash, emitter, eventName, eventArgs = {}) {
const receipt = await web3.eth.getTransactionReceipt(txHash);
const receipt = await ethGetTransactionReceipt(txHash);
const logs = decodeLogs(receipt.logs, emitter.events);
return inLogs(logs, eventName, eventArgs);
......
const { ethGetBlock } = require('./web3');
const { promisify } = require('util');
const pify = require('pify');
function advanceBlock () {
return promisify(web3.currentProvider.sendAsync)({
return pify(web3.currentProvider.sendAsync)({
jsonrpc: '2.0',
method: 'evm_mine',
});
......@@ -18,7 +18,7 @@ async function latest () {
async function increase (duration) {
if (duration < 0) throw Error(`Cannot increase time by a negative amount (${duration})`);
await promisify(web3.currentProvider.sendAsync)({
await pify(web3.currentProvider.sendAsync)({
jsonrpc: '2.0',
method: 'evm_increaseTime',
params: [duration],
......
......@@ -4,6 +4,7 @@ const ethAsync = pify(web3.eth);
module.exports = {
ethGetBalance: ethAsync.getBalance,
ethSendTransaction: ethAsync.sendTransaction,
ethGetBlock: ethAsync.getBlock,
ethGetTransactionReceipt: ethAsync.getTransactionReceipt,
ethSendTransaction: ethAsync.sendTransaction,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment