MetaMask / metamask-sdk

The simplest yet most secure way to connect your blockchain-based applications to millions of MetaMask Wallet users.
https://metamask.io/sdk/
Other
135 stars 87 forks source link

[Bug]: The Pure JS example doesn't work, fail to detect Metamask extension #916

Open jimgreen2013 opened 6 days ago

jimgreen2013 commented 6 days ago

SDK

Web

Provide environment information

I've tried firefox, chromium and Braver browser, my os is Linux/Fedora

MetaMask SDK Version

0.18.5

MetaMask Mobile app Version

Just web

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

image

Expected Behavior

image

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/MetaMask/metamask-sdk/tree/main/packages/examples/pure-javascript

To Reproduce

open the index.html and click connect

christopherferreira9 commented 3 days ago

Hi @jimgreen2013 ! I wasn't able to reproduce this using OSX. Will try to give this one a go using Linux. I'll get back to this issue as soon as possible.

jimgreen2013 commented 3 days ago

Hi @jimgreen2013 ! I wasn't able to reproduce this using OSX. Will try to give this one a go using Linux. I'll get back to this issue as soon as possible.

I try my best to do some investigation, here are my findings:

  1. the vue example worked as expected;
  2. The key difference is that the vue example successfully inject window.etherum and window.extension while the pureJs example only inject window.etherum.