Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Setting default account in web3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Drwięga committed Dec 23, 2016
1 parent fd62442 commit 2ef58fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/src/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ import './dev.web3.html';

const http = new Web3.providers.HttpProvider('/rpc/');
const web3 = new Web3(http);
// set default account
web3.eth.getAccounts((err, accounts) => {
if (err || !accounts || !accounts[0]) {
return;
}

web3.eth.defaultAccount = accounts[0];
});

web3extensions(web3).map((extension) => web3._extend(extension));

Expand Down

0 comments on commit 2ef58fb

Please sign in to comment.