Commit 98aab3a1 authored by Iuri Matias's avatar Iuri Matias Committed by Aniket

add newAccount method to remix simulator accounts

parent 73a1cf45
......@@ -63,6 +63,15 @@ Accounts.prototype._addAccount = function (privateKey, balance) {
this.accounts[ethJSUtil.toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 }
}
Accounts.prototype.newAccount = (_passwordPromptCb, cb) => {
let privateKey
do {
privateKey = crypto.randomBytes(32)
} while (!isValidPrivate(privateKey))
this._addAccount(privateKey, '0x56BC75E2D63100000')
return cb(null, '0x' + privateToAddress(privateKey).toString('hex'))
}
Accounts.prototype.methods = function () {
return {
eth_accounts: this.eth_accounts.bind(this),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment