|
|
|
@ -50,12 +50,16 @@ 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.newAccount = function (password) { |
|
|
|
|
if (!this.executionContext.isVM()) { |
|
|
|
|
this.web3.personal.newAccount(password); |
|
|
|
|
} else { |
|
|
|
|
var privateKey; |
|
|
|
|
do { |
|
|
|
|
privateKey = crypto.randomBytes(32); |
|
|
|
|
} while (!ethJSUtil.isValidPrivate(privateKey)); |
|
|
|
|
this._addAccount(privateKey); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
UniversalDApp.prototype._addAccount = function (privateKey, balance) { |
|
|
|
@ -80,7 +84,7 @@ UniversalDApp.prototype.getAccounts = function (cb) { |
|
|
|
|
var self = this; |
|
|
|
|
|
|
|
|
|
if (!self.executionContext.isVM()) { |
|
|
|
|
self.web3.eth.getAccounts(cb); |
|
|
|
|
self.web3.personal.getAccounts(cb); |
|
|
|
|
} else { |
|
|
|
|
if (!self.accounts) { |
|
|
|
|
return cb('No accounts?'); |
|
|
|
|