Allow user to specify "random" as privateKey configuration. In such case embark generates some random privateKey for the account.

This commit is contained in:
hodlbank 2018-08-03 19:56:19 +00:00
parent 513154e427
commit c60a2a6fed
1 changed files with 6 additions and 0 deletions

View File

@ -47,6 +47,12 @@ class AccountParser {
if (accountConfig.balance) {
hexBalance = AccountParser.getHexBalance(accountConfig.balance, web3);
}
if (accountConfig.privateKey === 'random') {
let randomAccount = web3.eth.accounts.create();
accountConfig.privateKey = randomAccount.privateKey;
}
if (accountConfig.privateKey) {
if (!accountConfig.privateKey.startsWith('0x')) {
accountConfig.privateKey = '0x' + accountConfig.privateKey;