diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 602fee3aee..5f32039c2f 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -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;