Commit e6cee02e authored by Alex Beregszaszi's avatar Alex Beregszaszi

Use getListAccounts() for async calls

parent 1d4cf17b
...@@ -84,18 +84,15 @@ UniversalDApp.prototype.getAccounts = function (cb) { ...@@ -84,18 +84,15 @@ UniversalDApp.prototype.getAccounts = function (cb) {
var self = this; var self = this;
if (!self.executionContext.isVM()) { if (!self.executionContext.isVM()) {
// TOOD: remove the try/catch if this is fixed: https://github.com/ethereum/web3.js/issues/442 // Weirdness of web3: listAccounts() is sync, `getListAccounts()` is async
try { // See: https://github.com/ethereum/web3.js/issues/442
self.web3.personal.listAccounts(function (err, res) { self.web3.personal.getListAccounts(function (err, res) {
if (err) { if (err) {
self.web3.eth.getAccounts(cb); self.web3.eth.getAccounts(cb);
} else { } else {
cb(err, res); cb(err, res);
} }
}); });
} catch (e) {
self.web3.eth.getAccounts(cb);
}
} else { } else {
if (!self.accounts) { if (!self.accounts) {
return cb('No accounts?'); return cb('No accounts?');
......
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