diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-09 01:21:51 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-09 01:21:51 +0800 |
commit | af8d24d0eb5af781f4731b5559979f2b02579785 (patch) | |
tree | 6f429e6f2b3050de6dd7ce16e42c7f387bd5018a /packages/contracts/deploy/cli.ts | |
parent | ca85a97106ea6d09fbceafac8f9516945ccff399 (diff) | |
parent | 5eea829be9f5e8669c40dac965231051b668ed37 (diff) | |
download | dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.gz dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.bz2 dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.lz dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.xz dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.zst dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.zip |
Merge branch 'development' into feature/addSubproviders
* development:
Update README.md
Inline network module
Stop supporting different file extensions in abi-gen
Refactor networkId out of web3Wrapper
Update connect types in preperation for publishing
Fix CI command
Address feedback
Refactor web3Wrapper to a separate package
# Conflicts:
# package.json
# packages/website/ts/blockchain.ts
Diffstat (limited to 'packages/contracts/deploy/cli.ts')
-rw-r--r-- | packages/contracts/deploy/cli.ts | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/packages/contracts/deploy/cli.ts b/packages/contracts/deploy/cli.ts index 73a43b247..423523e21 100644 --- a/packages/contracts/deploy/cli.ts +++ b/packages/contracts/deploy/cli.ts @@ -1,9 +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, @@ -36,23 +38,26 @@ 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, }; await commands.compileAsync(compilerOpts); const defaults = { - gasPrice: argv.gasPrice, + gasPrice: new BigNumber(argv.gasPrice), from: argv.account, }; - const deployerOpts: DeployerOptions = { + const deployerOpts = { artifactsDir: argv.artifactsDir, jsonrpcPort: argv.jsonrpcPort, - networkId: networkIdIfExists, + networkId, defaults, }; await commands.migrateAsync(deployerOpts); @@ -62,23 +67,26 @@ 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, }; await commands.compileAsync(compilerOpts); const defaults = { - gasPrice: argv.gasPrice, + gasPrice: new BigNumber(argv.gasPrice), from: argv.account, }; const deployerOpts: DeployerOptions = { artifactsDir: argv.artifactsDir, jsonrpcPort: argv.jsonrpcPort, - networkId: networkIdIfExists, + networkId, defaults, }; const deployerArgsString = argv.args; |