mirror of https://github.com/embarklabs/embark.git
Allow user to specify "random" as privateKey configuration. In such case embark generates some random privateKey for the account.
This commit is contained in:
parent
513154e427
commit
c60a2a6fed
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue