From f1b267cc9fe7f6e5566dc2535b064b92aef92df1 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 6 Dec 2017 20:55:09 +0300 Subject: Refactor web3Wrapper to a separate package --- packages/contracts/deploy/src/deployer.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'packages/contracts/deploy/src/deployer.ts') diff --git a/packages/contracts/deploy/src/deployer.ts b/packages/contracts/deploy/src/deployer.ts index 48d175a42..2d4f31949 100644 --- a/packages/contracts/deploy/src/deployer.ts +++ b/packages/contracts/deploy/src/deployer.ts @@ -1,4 +1,6 @@ -import promisify = require('es6-promisify'); +import {TxData} from '@0xproject/types'; +import {promisify} from '@0xproject/utils'; +import {Web3Wrapper} from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as Web3 from 'web3'; @@ -11,7 +13,6 @@ import { DeployerOptions, } from './utils/types'; import {utils} from './utils/utils'; -import {Web3Wrapper} from './utils/web3_wrapper'; // Gas added to gas estimate to make sure there is sufficient gas for deployment. const EXTRA_GAS = 200000; @@ -21,7 +22,7 @@ export class Deployer { private artifactsDir: string; private jsonrpcPort: number; private networkId: number; - private defaults: Partial; + private defaults: Partial; constructor(opts: DeployerOptions) { this.artifactsDir = opts.artifactsDir; @@ -30,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.defaults); + this.web3Wrapper = new Web3Wrapper(web3Provider, this.networkId, this.defaults); } /** * Loads contract artifact and deploys contract with given arguments. @@ -171,7 +172,7 @@ export class Deployer { const block = await this.web3Wrapper.getBlockAsync('latest'); let gas: number; try { - const gasEstimate: number = await this.web3Wrapper.estimateGasAsync({data}); + const gasEstimate: number = await this.web3Wrapper.estimateGasAsync(data); gas = Math.min(gasEstimate + EXTRA_GAS, block.gasLimit); } catch (err) { gas = block.gasLimit; -- cgit v1.2.3 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts/deploy/src/deployer.ts') 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. -- cgit v1.2.3