This directory contains the MetaMask Desktop application, built with Electron, which can be paired with the Flask extension to improve its overall performance.
Build the React UI used by the Electron app:
yarn app build:ui
Build the Electron app:
yarn app build:app
Start the app:
yarn app start
Generate a suitable installer package for a specific operating system:
Platform | Type | Command |
---|---|---|
Windows | NSIS Installer | yarn app package:win |
MacOS | DMG Image | yarn app package:mac |
Linux | AppImage | yarn app package:linux |
The Electron application requires the MetaMask extension code to provide the controller and background logic.
Rather than duplicating the code, a Git submodule is used to dynamically include the code directly from the metamask-extension repository.
The submodule is automatically setup by the yarn setup
command.
Below are some additional commands to support working with the submodule.
Change the extension commit used by the submodule:
cd packages/app/submodules/extension
git checkout [COMMIT SHA OR BRANCH]
Re-register the submodule and update the local files:
yarn setup:submodule
Display the current commit referenced by the submodule:
git submodule status
Remove the submodule and local files:
git submodule deinit -all --force
yarn app test
Verify the behaviour of the extension when paired with the app:
yarn build:test:extension
yarn app test:e2e:extension
To verify the behaviour of the app itself, see the Playwright setup instructions.
Check for linting issues:
yarn app lint
Attempt to automatically fix linting issues:
yarn app lint:fix
The repository contains configuration files to support debugging the app within Visual Studio Code.
Configuration | Description |
---|---|
Electron - Main Process | Debug only the main Electron process which handles requests from the extension. |
Electron - Renderer Processes | Debug only the Electron renderer processes which correspond to each Electron window. |
Electron - All | Debug the Electron main and renderer processes simultaneously. |
- Open the
Run and Debug
view. - Run the desired configuration.
- Add breakpoints to any desired source files.
Note: Source maps are used to support debugging with the original TypeScript files rather than any transpiled files in the packages/app/dist
directory.
As each Electron window is ran in a Chrome instance, the Chrome developer tools can be used to debug the main renderer process.
- Set
DESKTOP_UI_DEBUG=1
inpackages/app/.metamaskrc
before building the UI. - When in the main Electron window, press
Command / Control + Shift + I
. - Use the
sources
tab to create breakpoints in any of the source files.
Environment variables can be specified using a .env
file in the packages/app
directory.
See .env.example for a list of available variables.
The app persists data for both user preferences and extension state.
To clear all persisted state:
yarn app clear:electron-state
Note: This will remove data for all Electron apps ran in development mode.