Commit 93d240df authored by chriseth's avatar chriseth

Merge pull request #151 from axic/patch/account-cleanup

Cosmetic cleanup of the account code
parents 2875a5bb f48306ca
...@@ -890,11 +890,7 @@ $(document).ready(function() { ...@@ -890,11 +890,7 @@ $(document).ready(function() {
} else $txOrigin.val('unknown'); } else $txOrigin.val('unknown');
} }
if (executionContext === 'vm') {
dapp.getAccounts(renderAccounts); dapp.getAccounts(renderAccounts);
} else {
web3.eth.getAccounts(renderAccounts);
}
$contractOutput.find('.title').click(function(ev){ $(this).closest('.contract').toggleClass('hide'); }); $contractOutput.find('.title').click(function(ev){ $(this).closest('.contract').toggleClass('hide'); });
$('#output').append( $contractOutput ); $('#output').append( $contractOutput );
......
...@@ -38,9 +38,13 @@ UniversalDApp.prototype.addAccount = function (privateKey, balance) { ...@@ -38,9 +38,13 @@ UniversalDApp.prototype.addAccount = function (privateKey, balance) {
}; };
UniversalDApp.prototype.getAccounts = function (cb) { UniversalDApp.prototype.getAccounts = function (cb) {
if (!this.vm) {
web3.eth.getAccounts(cb);
} else {
if (!this.accounts) return cb("No accounts?"); if (!this.accounts) return cb("No accounts?");
cb(null, Object.keys(this.accounts)); cb(null, Object.keys(this.accounts));
}
}; };
UniversalDApp.prototype.render = function () { UniversalDApp.prototype.render = function () {
......
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