Merge pull request #678 from hodlbank/blockchain-simulator-accounts

Applying simulatorAccounts configuration for "embark simulator" command
This commit is contained in:
Jonathan Rainville 2018-08-06 16:48:57 -04:00 committed by GitHub
commit e92984cebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -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) {