Connect MetaMask to another Chrome Extension

I am trying to use a meta mask provider that allows me to connect to MetaMask from within a chrome extension. The wagmi libraries have changed and cannot see any example code of how to do this.

Am not sure if I need to use any of these:


Can anyone point me to some code for connecting a chrome extension to MetaMask.

Ultimately I would like Web3Modal from WalletConnect to find the provider.

Thank you for your time.

Hi @javaspeak if you are still looking please check this package for connecting to extensions GitHub - MetaMask/extension-provider: A module for allowing a WebExtension to access the web3 provider from an installed MetaMask instance

1 Like

Thanks for your answer.

In extension-provider/blob/master/index.js I see:

const metamaskPort = chrome.runtime.connect(currentMetaMaskId)
const pluginStream = new PortStream(metamaskPort)

The chrome namespace is not available in a tab application opened by the background script.

I want the wallet to connect to the extension address:


instead of the address that the content script happens to be in.

Can you advise how to do this?

Hi @javaspeak sorry for delay, where this root is coming from extension-provider/blob/master/index.js

Sorry I do not understand your question or statement.

I’m sorry I was asking where to find this file

It is the extension-provider github project:

Do not have sufficient privileges to paste a link - do not know why (hence modified link)

Is it possible for you to open an issue: Issues · MetaMask/extension-provider · GitHub

Thank you Oxroosh. Have raised an issue:

The link above is modified for it says new users do not have permissions to paste links.

Thanks yes it’s a security thing thank you again

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.