aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-07-04 18:07:05 +0800
committerJacob Evans <jacob@dekz.net>2018-07-04 18:29:54 +0800
commit5915f8430c252a341cac9c5ef645836efd4d7e92 (patch)
tree2d973f3b39d19247855a6320cc48858f0011df40 /packages/dev-utils
parent9e0f06d06055022fff80bbf7a8b6444f72f898ec (diff)
parentaeea3817a48473aec0eb378b0ad6cbe7e7877044 (diff)
downloaddexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar.gz
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar.bz2
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar.lz
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar.xz
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.tar.zst
dexon-sol-tools-5915f8430c252a341cac9c5ef645836efd4d7e92.zip
Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/package.json2
-rw-r--r--packages/dev-utils/src/blockchain_lifecycle.ts26
2 files changed, 10 insertions, 18 deletions
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 621053ed7..ebb2aeb41 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -53,7 +53,7 @@
"@0xproject/web3-wrapper": "^0.7.1",
"lodash": "^4.17.4",
"web3": "^0.20.0",
- "web3-provider-engine": "^14.0.4"
+ "web3-provider-engine": "14.0.6"
},
"publishConfig": {
"access": "public"
diff --git a/packages/dev-utils/src/blockchain_lifecycle.ts b/packages/dev-utils/src/blockchain_lifecycle.ts
index 587332f1a..9bd65ee5d 100644
--- a/packages/dev-utils/src/blockchain_lifecycle.ts
+++ b/packages/dev-utils/src/blockchain_lifecycle.ts
@@ -1,11 +1,6 @@
import { logUtils } from '@0xproject/utils';
-import { uniqueVersionIds, Web3Wrapper } from '@0xproject/web3-wrapper';
-import { includes } from 'lodash';
-
-enum NodeType {
- Geth = 'GETH',
- Ganache = 'GANACHE',
-}
+import { NodeType, Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as _ from 'lodash';
// HACK(albrow): 🐉 We have to do this so that debug.setHead works correctly.
// (Geth does not seem to like debug.setHead(0), so by sending some transactions
@@ -18,6 +13,7 @@ export class BlockchainLifecycle {
private _web3Wrapper: Web3Wrapper;
private _snapshotIdsStack: number[];
private _addresses: string[] = [];
+ private _nodeType: NodeType | undefined;
constructor(web3Wrapper: Web3Wrapper) {
this._web3Wrapper = web3Wrapper;
this._snapshotIdsStack = [];
@@ -61,16 +57,6 @@ export class BlockchainLifecycle {
throw new Error(`Unknown node type: ${nodeType}`);
}
}
- private async _getNodeTypeAsync(): Promise<NodeType> {
- const version = await this._web3Wrapper.getNodeVersionAsync();
- if (includes(version, uniqueVersionIds.geth)) {
- return NodeType.Geth;
- } else if (includes(version, uniqueVersionIds.ganache)) {
- return NodeType.Ganache;
- } else {
- throw new Error(`Unknown client version: ${version}`);
- }
- }
private async _mineMinimumBlocksAsync(): Promise<void> {
logUtils.warn('WARNING: minimum block number for tests not met. Mining additional blocks...');
if (this._addresses.length === 0) {
@@ -92,4 +78,10 @@ export class BlockchainLifecycle {
}
logUtils.warn('Done mining the minimum number of blocks.');
}
+ private async _getNodeTypeAsync(): Promise<NodeType> {
+ if (_.isUndefined(this._nodeType)) {
+ this._nodeType = await this._web3Wrapper.getNodeTypeAsync();
+ }
+ return this._nodeType;
+ }
}