From b362e2c28e9cafa7335bced17ec61fba93b018e6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 8 Dec 2017 12:51:46 +0300 Subject: Refactor networkId out of web3Wrapper --- packages/contracts/deploy/src/deployer.ts | 2 +- packages/contracts/deploy/src/utils/network.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/deploy/src/deployer.ts b/packages/contracts/deploy/src/deployer.ts index 2d4f31949..4c8018ecc 100644 --- a/packages/contracts/deploy/src/deployer.ts +++ b/packages/contracts/deploy/src/deployer.ts @@ -31,7 +31,7 @@ export class Deployer { const jsonrpcUrl = `http://localhost:${this.jsonrpcPort}`; const web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl); this.defaults = opts.defaults; - this.web3Wrapper = new Web3Wrapper(web3Provider, this.networkId, this.defaults); + this.web3Wrapper = new Web3Wrapper(web3Provider, this.defaults); } /** * Loads contract artifact and deploys contract with given arguments. diff --git a/packages/contracts/deploy/src/utils/network.ts b/packages/contracts/deploy/src/utils/network.ts index fc8709e0f..f9776bb97 100644 --- a/packages/contracts/deploy/src/utils/network.ts +++ b/packages/contracts/deploy/src/utils/network.ts @@ -1,4 +1,5 @@ import {promisify} from '@0xproject/utils'; +import {Web3Wrapper} from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as Web3 from 'web3'; @@ -6,8 +7,8 @@ export const network = { async getNetworkIdIfExistsAsync(port: number): Promise { const url = `http://localhost:${port}`; const web3Provider = new Web3.providers.HttpProvider(url); - const web3 = new Web3(web3Provider); - const networkId = _.parseInt(await promisify(web3.version.getNetwork)()); + const web3Wrapper = new Web3Wrapper(web3Provider); + const networkId = web3Wrapper.getNetworkIdAsync(); return networkId; }, }; -- cgit