MetaMask / MetaMask/metamask-onboarding

Crash when PhantomApp in browser

Open
#104 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
150
Forks
55
PR merge metrics
No merged PRs in 30d

Description

Hello. When in browser exists another wallet (https://phantom.app/), it creates for some reason empty Proxy in `window.ethereum`, so when call `Onboarding.isMetaMaskInstalled` from

```
Onboarding.isMetaMaskInstalled = function () {
return Boolean(window.ethereum && window.ethereum.isMetaMask);
};
```

Receive crash:

```
VM5030:14 Uncaught TypeError: Reflect.get called on non-object
at Reflect.get ()
at Object.get (:14:24)
at Onboarding.isMetaMaskInstalled
```

As solution, can check `Object.keys(window.ethereum).length` before call `isMetaMask`...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Onboarding.isMetaMaskInstalled method shown in the issue and reproduce the crash with Phantom installed in a browser. Inspect how window.ethereum is accessed, then verify that the check no longer throws for Phantom's empty Proxy while still identifying a valid MetaMask provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.