diff --git a/lib/geth_commands.js b/lib/geth_commands.js index 46e0e1ad..88369d35 100644 --- a/lib/geth_commands.js +++ b/lib/geth_commands.js @@ -4,48 +4,6 @@ var GethCommands = function(options) { this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)"; }; -GethCommands.prototype.initGenesisCommmand = function() { - var config = this.config; - var cmd = "geth "; - - if (config.networkType === 'testnet') { - cmd += "--testnet "; - } else if (config.networkType === 'olympic') { - cmd += "--olympic "; - } - - if (config.datadir) { - cmd += "--datadir=\"" + config.datadir + "\" "; - } - - if (config.genesisBlock) { - cmd += "init \"" + config.genesisBlock + "\" "; - } - - return cmd; -}; - -GethCommands.prototype.newAccountCommand = function() { - var config = this.config; - var cmd = "geth "; - - if (config.networkType === 'testnet') { - cmd += "--testnet "; - } else if (config.networkType === 'olympic') { - cmd += "--olympic "; - } - - if (config.datadir) { - cmd += "--datadir=\"" + config.datadir + "\" "; - } - - if (config.account && config.account.password) { - cmd += "--password " + config.account.password + " "; - } - - return cmd + "account new "; -}; - GethCommands.prototype.commonOptions = function() { var config = this.config; var cmd = ""; @@ -69,6 +27,21 @@ GethCommands.prototype.commonOptions = function() { return cmd; }; +GethCommands.prototype.initGenesisCommmand = function() { + var config = this.config; + var cmd = "geth " + this.commonOptions(); + + if (config.genesisBlock) { + cmd += "init \"" + config.genesisBlock + "\" "; + } + + return cmd; +}; + +GethCommands.prototype.newAccountCommand = function() { + return "geth " + this.commonOptions() + "account new "; +}; + GethCommands.prototype.listAccountsCommand = function() { return "geth " + this.commonOptions() + "account list "; };