Use getAccounts in runTx

pull/1/head
Alex Beregszaszi 8 years ago
parent 1b8a723d18
commit 3974f9aa3e
  1. 15
      src/universal-dapp.js

@ -723,12 +723,21 @@ UniversalDApp.prototype.runTx = function (args, cb) {
// NOTE: getAddress should be async
if (self.getAddress) {
tx.from = self.getAddress()
} else if (self.executionContext.isVM()) {
tx.from = Object.keys(self.accounts)[0]
callback()
} else {
tx.from = self.web3.eth.accounts[0]
self.getAccounts(function (err, ret) {
if (err) {
return callback(err)
}
if (ret.length === 0) {
return callback('No accounts available')
}
tx.from = ret[0]
callback()
})
}
},
// run transaction
function (callback) {

Loading…
Cancel
Save