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

Commit

Permalink
Merge pull request #2048 from kvhnuke/feature/update-metamask
Browse files Browse the repository at this point in the history
Feature/update metamask
  • Loading branch information
gamalielhere authored Sep 4, 2018
2 parents e8d98eb + bfa224f commit d70c0e3
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 241 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### New
- Add Metamask breaking change [#2048](https://github.com/kvhnuke/etherwallet/pull/2048)
- Add 0xinfra nodes [#2045](https://github.com/kvhnuke/etherwallet/pull/2045)
- nodes: add remote.akroma.io [#2046](https://github.com/kvhnuke/etherwallet/pull/2046)
- Add STB token and Add electrominer scammer address [#2047](https://github.com/kvhnuke/etherwallet/pull/2047)
Expand Down
8 changes: 8 additions & 0 deletions app/scripts/controllers/decryptWalletCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
return $scope.HDWallet.dPath;
};
$scope.scanMetamask = function() {
if (window.web3 === undefined) {
window.addEventListener('message', ({data}) => {
if (data && data.type && data.type === 'ETHEREUM_PROVIDER_SUCCESS') {
window.web3 = new Web3(ethereum);
}
});
window.postMessage({ type: 'ETHEREUM_PROVIDER_REQUEST', web3: true }, '*');
}
window.web3.eth.getAccounts(function (err, accounts) {
if (err) $scope.notifier.danger(err + '. Are you sure you are on a secure (SSL / HTTPS) connection?')
if (!accounts.length) {
Expand Down
Loading

0 comments on commit d70c0e3

Please sign in to comment.