Skip to content

Commit

Permalink
Merge pull request gitcoinco#4143 from gitcoinco/kevin/metamask-fixes-2
Browse files Browse the repository at this point in the history
handle non-metamask web3 browsers
  • Loading branch information
thelostone-mc authored Apr 9, 2019
2 parents 156dfd3 + 376df09 commit 808072f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/v2/js/metamask-approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var is_metamask_approved = is_metamask_approved || false;
var is_metamask_unlocked = is_metamask_unlocked || false;

async function metamaskApproval() {
if (window.ethereum) {
if (window.ethereum && window.ethereum._metamask) {
window.web3 = new Web3(ethereum);
is_metamask_approved = await window.ethereum._metamask.isApproved();
is_metamask_unlocked = await window.ethereum._metamask.isUnlocked();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ var listen_for_web3_changes = async function() {
}
}

if (window.ethereum && !document.has_checked_for_ethereum_enable) {
if (window.ethereum && !document.has_checked_for_ethereum_enable && window.ethereum._metamask) {
document.has_checked_for_ethereum_enable = true;
is_metamask_approved = await window.ethereum._metamask.isApproved();
is_metamask_unlocked = await window.ethereum._metamask.isUnlocked();
Expand Down

0 comments on commit 808072f

Please sign in to comment.