diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-27 07:11:16 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-27 07:11:16 +0800 |
commit | b055055253c53a9db4ec730d7285dce9c38e7a59 (patch) | |
tree | 057e6f24529b03f6d4565361bb2cef61836ab482 /packages/migrations/src/cli.ts | |
parent | ae570dba05cfc0d696c616d05804152791d29677 (diff) | |
parent | 6e3d70af566b9d1fcfce83a055793a08f19ee160 (diff) | |
download | dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar.gz dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar.bz2 dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar.lz dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar.xz dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.tar.zst dexon-sol-tools-b055055253c53a9db4ec730d7285dce9c38e7a59.zip |
Merge branch 'development' into feature/instant/token-picker-events
Diffstat (limited to 'packages/migrations/src/cli.ts')
-rw-r--r-- | packages/migrations/src/cli.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/migrations/src/cli.ts b/packages/migrations/src/cli.ts new file mode 100644 index 000000000..2404e7921 --- /dev/null +++ b/packages/migrations/src/cli.ts @@ -0,0 +1,38 @@ +#!/usr/bin/env node +import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders'; +import { logUtils } from '@0x/utils'; +import * as yargs from 'yargs'; + +import { runMigrationsAsync } from './migration'; + +const args = yargs + .option('rpc-url', { + describe: 'Endpoint where backing Ethereum JSON RPC interface is available', + type: 'string', + demandOption: false, + default: 'http://localhost:8545', + }) + .option('from', { + describe: 'Ethereum address from which to deploy the contracts', + type: 'string', + demandOption: true, + }) + .example( + '$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631', + 'Full usage example', + ).argv; + +(async () => { + const rpcSubprovider = new RPCSubprovider(args['rpc-url']); + const provider = new Web3ProviderEngine(); + provider.addProvider(rpcSubprovider); + provider.start(); + const txDefaults = { + from: args.from, + }; + await runMigrationsAsync(provider, txDefaults); + process.exit(0); +})().catch(err => { + logUtils.log(err); + process.exit(1); +}); |