embark/lib/cmds/simulator.js

23 lines
603 B
JavaScript
Raw Normal View History

2017-03-29 17:50:05 +00:00
let shelljs = require('shelljs');
2017-03-30 11:12:39 +00:00
class Simulator {
constructor(options) {
this.blockchainConfig = options.blockchainConfig;
}
2017-03-30 11:12:39 +00:00
run(options) {
let cmds = [];
2017-03-30 11:12:39 +00:00
cmds.push("-p " + (this.blockchainConfig.rpcPort || options.port || 8545));
cmds.push("-h " + (this.blockchainConfig.rpcHost || options.host || 'localhost'));
2017-12-27 22:48:33 +00:00
cmds.push("-a " + (options.numAccounts || 10));
cmds.push("-e " + (options.defaultBalance || 100));
cmds.push("-l " + (options.gasLimit || 8000000));
2017-03-30 11:26:03 +00:00
shelljs.exec('testrpc ' + cmds.join(' '), {async : true});
2017-03-30 11:12:39 +00:00
}
}
module.exports = Simulator;