1

I need to connect Metamask to a Chrome extension I'm doing. I'm not a crypto expert, I'm using ethers js and following some tutorials but the extension doesn't recognize that Metamask is in the browser. I run the same scripts in a normal web app (not Chrome extension) and everything works perfectly and I can interact with Metamask and all of that. I've been trying to understand why it's not working and I'm kind of lost at this point.

I've been reading the Chrome Developers documentation and it seems like there's a way to send messages with some data between two extensions. But I can't figure out how to introduce that to my project, and also the amount of data you can share seems to be limited somehow.

I've searched in Stack Overflow but I don't understand the answers to those questions. Or how to apply them to my case.

I found this but it looks that only works with MetaMask and not with other wallets: Connect to MetaMask via chrome extension

halfer
  • 19,824
  • 17
  • 99
  • 186
  • You can refer to my answer: https://stackoverflow.com/questions/71772564/web3-error-when-trying-to-call-contract-methods/71772653#71772653 – Liki Crus Apr 14 '22 at 17:00
  • 1
    The main problem that I'm having is that window.ethereum object is undefined inside the chrome extension app. But when I run all the code as a normal web app, it is there. So for some reason a Chrome extesion can't have access to the other extension in the same way that normal apps do. So thanks, but I think in this case I need someone expert developing google chrome apps. – Willo_Pixel Apr 14 '22 at 19:13

1 Answers1

0

Use https://github.com/MetaMask/extension-provider. You can do it simple! I can do it with my chrome extension + metamask easy. This lib helps a lot.

x8ing_
  • 16
  • 1