How to connect a Chrome extension made with React to Metamask and other wallets?

1.4k Views Asked by At

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

1

There are 1 best solutions below

2
On BEST ANSWER

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.