mirror of https://github.com/embarklabs/embark.git
Merge pull request #678 from hodlbank/blockchain-simulator-accounts
Applying simulatorAccounts configuration for "embark simulator" command
This commit is contained in:
commit
e92984cebe
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue