aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-06-06 07:20:38 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-06-07 03:40:31 +0800
commitd6d7f4e875b161aa7284467a61f67989f76ec89e (patch)
treed0287504809489cec96a9673ffac41429cf14cd7 /packages/dev-utils
parent63caddea62453863de84a4b53e14fe3e61d3008f (diff)
downloaddexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.gz
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.bz2
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.lz
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.xz
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.zst
dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.zip
Update more things to work with both Geth and Ganache
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/src/blockchain_lifecycle.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/packages/dev-utils/src/blockchain_lifecycle.ts b/packages/dev-utils/src/blockchain_lifecycle.ts
index 6e7957f10..8e4ad81c7 100644
--- a/packages/dev-utils/src/blockchain_lifecycle.ts
+++ b/packages/dev-utils/src/blockchain_lifecycle.ts
@@ -1,4 +1,4 @@
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { uniqueVersionIds, Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -7,11 +7,6 @@ enum NodeType {
Ganache = 'GANACHE',
}
-// These are unique identifiers contained in the response of the
-// web3_clientVersion call.
-const GETH_VERSION_ID = 'Geth';
-const GANACHE_VERSION_ID = 'EthereumJS TestRPC';
-
export class BlockchainLifecycle {
private _web3Wrapper: Web3Wrapper;
private _snapshotIdsStack: number[];
@@ -54,9 +49,9 @@ export class BlockchainLifecycle {
}
private async _getNodeTypeAsync(): Promise<NodeType> {
const version = await this._web3Wrapper.getNodeVersionAsync();
- if (_.includes(version, GETH_VERSION_ID)) {
+ if (_.includes(version, uniqueVersionIds.geth)) {
return NodeType.Geth;
- } else if (_.includes(version, GANACHE_VERSION_ID)) {
+ } else if (_.includes(version, uniqueVersionIds.ganache)) {
return NodeType.Ganache;
} else {
throw new Error(`Unknown client version: ${version}`);