add private key option to migration script (#1811)
This commit is contained in:
parent
54be45bedc
commit
8d9932fc42
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
import { PrivateKeyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
||||||
import { logUtils, providerUtils } from '@0x/utils';
|
import { logUtils, providerUtils } from '@0x/utils';
|
||||||
import * as yargs from 'yargs';
|
import * as yargs from 'yargs';
|
||||||
|
|
||||||
@ -17,14 +17,24 @@ const args = yargs
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
})
|
})
|
||||||
|
.option('pk', {
|
||||||
|
describe: 'Private key for the `from` address',
|
||||||
|
type: 'string',
|
||||||
|
})
|
||||||
.example(
|
.example(
|
||||||
'$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631',
|
'$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631 --pk 0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
|
||||||
'Full usage example',
|
'Full usage example',
|
||||||
).argv;
|
).argv;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
|
const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
|
||||||
const provider = new Web3ProviderEngine();
|
const provider = new Web3ProviderEngine();
|
||||||
|
|
||||||
|
if (args.pk !== undefined && args.pk !== '') {
|
||||||
|
const pkSubprovider = new PrivateKeyWalletSubprovider(args.pk as string);
|
||||||
|
provider.addProvider(pkSubprovider);
|
||||||
|
}
|
||||||
|
|
||||||
provider.addProvider(rpcSubprovider);
|
provider.addProvider(rpcSubprovider);
|
||||||
providerUtils.startProviderEngine(provider);
|
providerUtils.startProviderEngine(provider);
|
||||||
const normalizedFromAddress = (args.from as string).toLowerCase();
|
const normalizedFromAddress = (args.from as string).toLowerCase();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user