Commit a6f82070 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Add newAccount() method to universal-dapp for creating a new account

parent 26c4a968
......@@ -7,6 +7,7 @@ var ethJSABI = require('ethereumjs-abi');
var EthJSBlock = require('ethereumjs-block');
var BN = ethJSUtil.BN;
var EventManager = require('./lib/eventManager');
var crypto = require('crypto');
/*
trigger debugRequested
......@@ -49,6 +50,14 @@ UniversalDApp.prototype.reset = function (contracts, getAddress, getValue, getGa
}
};
UniversalDApp.prototype.newAccount = function () {
var privateKey;
do {
privateKey = crypto.randomBytes(32);
} while (!ethJSUtil.isValidPrivate(privateKey));
this._addAccount(privateKey);
};
UniversalDApp.prototype.addAccount = function (privateKey, balance) {
var self = 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