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