diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-08 23:47:50 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-08 23:47:50 +0800 |
commit | e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7 (patch) | |
tree | b0db651ef7aba234ba6b07ff05695a366db734f8 /packages/contracts/deploy/cli.ts | |
parent | 36125c3539fce6f67d62ab3378bbf09653a1c3c1 (diff) | |
download | dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar.gz dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar.bz2 dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar.lz dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar.xz dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.tar.zst dexon-sol-tools-e0d79bd332a3f8a9cad5147f33b2bfaf49e6a5c7.zip |
Inline network module
Diffstat (limited to 'packages/contracts/deploy/cli.ts')
-rw-r--r-- | packages/contracts/deploy/cli.ts | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/packages/contracts/deploy/cli.ts b/packages/contracts/deploy/cli.ts index 0fdf85a9f..423523e21 100644 --- a/packages/contracts/deploy/cli.ts +++ b/packages/contracts/deploy/cli.ts @@ -1,10 +1,11 @@ +import {Web3Wrapper} from '@0xproject/web3-wrapper'; import {BigNumber} from 'bignumber.js'; import * as _ from 'lodash'; import * as path from 'path'; +import * as Web3 from 'web3'; import * as yargs from 'yargs'; import {commands} from './src/commands'; -import {network} from './src/utils/network'; import { CliOptions, CompilerOptions, @@ -37,10 +38,13 @@ async function onCompileCommand(args: CliOptions): Promise<void> { * @param argv Instance of process.argv provided by yargs. */ async function onMigrateCommand(argv: CliOptions): Promise<void> { - const networkIdIfExists = await network.getNetworkIdIfExistsAsync(argv.jsonrpcPort); + const url = `http://localhost:${argv.jsonrpcPort}`; + const web3Provider = new Web3.providers.HttpProvider(url); + const web3Wrapper = new Web3Wrapper(web3Provider); + const networkId = await web3Wrapper.getNetworkIdAsync(); const compilerOpts: CompilerOptions = { contractsDir: argv.contractsDir, - networkId: networkIdIfExists, + networkId, optimizerEnabled: argv.shouldOptimize ? 1 : 0, artifactsDir: argv.artifactsDir, }; @@ -53,7 +57,7 @@ async function onMigrateCommand(argv: CliOptions): Promise<void> { const deployerOpts = { artifactsDir: argv.artifactsDir, jsonrpcPort: argv.jsonrpcPort, - networkId: networkIdIfExists, + networkId, defaults, }; await commands.migrateAsync(deployerOpts); @@ -63,10 +67,13 @@ async function onMigrateCommand(argv: CliOptions): Promise<void> { * @param argv Instance of process.argv provided by yargs. */ async function onDeployCommand(argv: CliOptions): Promise<void> { - const networkIdIfExists = await network.getNetworkIdIfExistsAsync(argv.jsonrpcPort); + const url = `http://localhost:${argv.jsonrpcPort}`; + const web3Provider = new Web3.providers.HttpProvider(url); + const web3Wrapper = new Web3Wrapper(web3Provider); + const networkId = await web3Wrapper.getNetworkIdAsync(); const compilerOpts: CompilerOptions = { contractsDir: argv.contractsDir, - networkId: networkIdIfExists, + networkId, optimizerEnabled: argv.shouldOptimize ? 1 : 0, artifactsDir: argv.artifactsDir, }; @@ -79,7 +86,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> { const deployerOpts: DeployerOptions = { artifactsDir: argv.artifactsDir, jsonrpcPort: argv.jsonrpcPort, - networkId: networkIdIfExists, + networkId, defaults, }; const deployerArgsString = argv.args; |