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