Skip to content

Instantly share code, notes, and snippets.

@xavierlepretre
Created July 19, 2016 11:22
Show Gist options
  • Save xavierlepretre/ed82f210df0f9300493d5ca79893806a to your computer and use it in GitHub Desktop.
Save xavierlepretre/ed82f210df0f9300493d5ca79893806a to your computer and use it in GitHub Desktop.
Get the Promise of Web3 accounts
web3.eth.getAccountsPromise = function () {
return new Promise(function (resolve, reject) {
web3.eth.getAccounts(function (e, accounts) {
if (e != null) {
reject(e);
} else {
resolve(accounts);
}
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment