MetaMask / MetaMask/metamask-extension

[Epic] `MetamaskController` decomposition: Extract Extension-specific modules

Open
#41,737 2 comments 0 reactions 0 assignees View on GitHub
for-migration INVALID-ISSUE-TEMPLATE mig-epic-6-child mig-epic-66 team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Extract the five extension-specific modules from `MetamaskController`. All five live under `app/scripts/lib/` (not `wallet-services/`) because they touch browser APIs.

**Parent Epic:** [#41735 — `MetamaskController` decomposition](https://github.com/MetaMask/metamask-extension/issues/41735)

## Tickets

| # | Ticket | Size |
| --- | ---------------------------------------------------------- | ---- |
| B.1 | Extract `session-manager` | M |
| B.2 | Extract `connection-manager` | L |
| B.3 | Extract `hardware-wallet` | M |
| B.4 | Extract `controller-subscriptions` | M |
| B.5 | Extract `provider-engine` | L |

Each ticket delivers: (1) create the module directory, (2) port the method bodies from `metamask-controller.js` into the target module, (3) delete the `MetamaskController`-side originals and rewrite any `getApi()` entries to call `messenger.call('Module:action', ...)` directly — no forwarding stub (a method whose entire body is a single `this.controllerMessenger.call(...)` delegation) may remain after the PR lands, and (4) add unit tests. No separate "final deletion" or "integration verification" ticket exists — each extraction PR is complete on its own.

## Success bar

- All 5 modules extracted to `main` with full bodies and unit tests
- `MetamaskController` no longer holds method bodies for any of these domains
- B.4 depends on B.1 (needs `SessionManager:onLock` / `SessionManager:onUnlock` actions registered)
- B.5 depends on B.2 (needs `ConnectionManager` caller interface stable)

Contributor guide

Open the contributing guide

Research direction

Start in app/scripts/lib/metamask-controller.js and map the five listed domains to their extraction tickets. Read the parent epic and account for the B.4 dependency on B.1 and B.5 dependency on B.2 before choosing a ticket. Done means each module has full method bodies and unit tests, getApi() calls the module actions directly, and no listed method bodies or forwarding stubs remain in MetamaskController.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.