This is a simple extension that can be used for testing the use of MetaMask provider from another extension.
This repository provides 2 types of extension, that you can load using the different github branches:
main
branch is a Manifest V2 Chrome extension and should be paired with a MetaMask MV2 versionmv3
branch is a Manifest V3 Chrome extension and should be paired with a MetaMask MV3 version
There are 2 approaches trying different dependencies.
- The
extension/src/main.js
file contains the necessary code for importing MetaMask provider. - This function is then called on
extension/src/App.js
.
- The
background.js
file contains the necessary code for importing MetaMask provider from the background script.
- On the file
manifest.json
the extension is defined either as an MV2 or an MV3 type.
- Install MetaMask on Chrome
- Clone this repository
- Change to extension folder and install dependencies
cd extension npm i
- Build the extension
npm run extension
- Import extension root folder into Chrome
- Click Connect to MetaMask
- Check background console and verify that
window.ethereum
is injected correctly
To use this extension in firefox, change FIREFOX_ID
on patches/@metamask+providers**
.