diff --git a/lib/cmds/simulator.js b/lib/cmds/simulator.js index 8254fd3db..a1a4d3dd3 100644 --- a/lib/cmds/simulator.js +++ b/lib/cmds/simulator.js @@ -32,6 +32,18 @@ class Simulator { cmds.push("--mnemonic \"" + (simulatorMnemonic) +"\""); } + // as ganache-cli documentation explains, the simulatorAccounts configuration overrides a mnemonic + let simulatorAccounts = this.blockchainConfig.simulatorAccounts || options.simulatorAccounts; + if (simulatorAccounts && simulatorAccounts.length > 0) { + let web3 = new (require('web3'))(); + let AccountParser = require('../utils/accountParser.js'); + let parsedAccounts = AccountParser.parseAccountsConfig(simulatorAccounts, web3, this.logger); + parsedAccounts.forEach((account) => { + let cmd = '--account="' + account.privateKey + ','+account.hexBalance + '"'; + cmds.push(cmd); + }); + } + // adding blocktime only if it is defined in the blockchainConfig or options let simulatorBlocktime = this.blockchainConfig.simulatorBlocktime || options.simulatorBlocktime; if (simulatorBlocktime) {