diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-07 01:55:09 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-07 01:55:09 +0800 |
commit | f1b267cc9fe7f6e5566dc2535b064b92aef92df1 (patch) | |
tree | c07a9dd32c5b959d33587ce2d38098dfe397badb /packages/contracts/deploy/src/deployer.ts | |
parent | 598f1dd2d8a89b0e3ab04b2917138997031bafc6 (diff) | |
download | dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar.gz dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar.bz2 dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar.lz dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar.xz dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.tar.zst dexon-sol-tools-f1b267cc9fe7f6e5566dc2535b064b92aef92df1.zip |
Refactor web3Wrapper to a separate package
Diffstat (limited to 'packages/contracts/deploy/src/deployer.ts')
-rw-r--r-- | packages/contracts/deploy/src/deployer.ts | 11 |
1 files changed, 6 insertions, 5 deletions
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<Web3.TxData>; + private defaults: Partial<TxData>; 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; |