add more cmd line options to sim

This commit is contained in:
Iuri Matias 2017-12-27 17:48:33 -05:00
parent 33adaf360b
commit 174ba8ec9b
2 changed files with 16 additions and 4 deletions

View File

@ -106,7 +106,7 @@ class Cmd {
blockchain() {
program
.command('blockchain [environment]')
.option('-c, --client [client]', 'Use a specific ethereum client or simulator (supported: geth, parity, ethersim, testrpc')
.option('-c, --client [client]', 'Use a specific ethereum client or simulator (supported: geth, testrpc')
.description('run blockchain server (default: development)')
.action(function (env, options) {
embark.initConfig(env || 'development', {
@ -122,14 +122,24 @@ class Cmd {
.command('simulator [environment]')
.description('run a fast ethereum rpc simulator')
.option('--testrpc', 'use testrpc as the rpc simulator [default]')
.option('-p, --port [port]', 'port to run the rpc simulator (default: 8000)')
.option('-p, --port [port]', 'port to run the rpc simulator (default: 8545)')
.option('-h, --host [host]', 'host to run the rpc simulator (default: localhost)')
.option('-a, --accounts [numAccounts]', 'number of accounts (default: 10)')
.option('-e, --defaultBalanceEther [balance]', 'Amount of ether to assign each test account (default: 100)')
.option('-l, --gasLimit [gasLimit]', 'custom gas limit (default: 8000000)')
.action(function (env, options) {
embark.initConfig(env || 'development', {
embarkConfig: 'embark.json',
interceptLogs: false
});
embark.simulator({port: options.port, host: options.host});
embark.simulator({
port: options.port,
host: options.host,
numAccounts: options.numAccounts,
defaultBalance: options.balance,
gasLimit: options.gasLimit
});
});
}

View File

@ -10,7 +10,9 @@ class Simulator {
cmds.push("-p " + (this.blockchainConfig.rpcPort || options.port || 8545));
cmds.push("-h " + (this.blockchainConfig.rpcHost || options.host || 'localhost'));
cmds.push("-a " + (options.num || 10));
cmds.push("-a " + (options.numAccounts || 10));
cmds.push("-e " + (options.defaultBalance || 100));
cmds.push("-l " + (options.gasLimit || 8000000));
shelljs.exec('testrpc ' + cmds.join(' '), {async : true});
}