feat(wallet): add TransactionController to wallet package - #8975
Merged
Conversation
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
4 times, most recently
from
June 2, 2026 21:23
c3042bb to
9677e31
Compare
matthewwalsh0
added a commit
that referenced
this pull request
Jun 2, 2026
matthewwalsh0
added a commit
that referenced
this pull request
Jun 3, 2026
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
from
June 3, 2026 09:02
58d79cc to
0069b11
Compare
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
from
June 3, 2026 12:36
4bf9b25 to
2aac690
Compare
matthewwalsh0
changed the base branch from
main
to
chore/remove-deprecated-tx-options
June 3, 2026 12:36
matthewwalsh0
force-pushed
the
chore/remove-deprecated-tx-options
branch
from
June 4, 2026 16:24
de6504d to
bfc8a1a
Compare
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
5 times, most recently
from
June 16, 2026 20:45
26ad858 to
5c48b39
Compare
matthewwalsh0
marked this pull request as ready for review
June 16, 2026 20:58
matthewwalsh0
temporarily deployed
to
default-branch
June 16, 2026 20:59 — with
GitHub Actions
Inactive
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
2 times, most recently
from
July 1, 2026 10:27
3711bf1 to
3149fd2
Compare
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
3 times, most recently
from
July 1, 2026 11:37
3d4c0ed to
c97a549
Compare
Member
Author
|
@metamaskbot publish-preview |
Merged
7 tasks
matthewwalsh0
force-pushed
the
feat/wallet-wire-transaction-controller
branch
from
July 3, 2026 14:56
c97a549 to
fb9db90
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
FrederikBolding
approved these changes
Jul 6, 2026
Member
Author
|
@metamaskbot publish-preview |
pull Bot
pushed a commit
to Reality2byte/metamask-extension
that referenced
this pull request
Jul 9, 2026
…k#43182) ## **Description** TransactionController is now initialized through `@metamask/wallet`. To support this: - Extension-specific setup (options, event listeners, background API bindings) moved into `app/scripts/wallet-init`. - A new `InitializeWalletRequest` type passes extension dependencies into wallet initialization. - TransactionController removed from the old `messenger-client-init` path. Background and UI behaviour is unchanged — the same state keys and API surface are preserved. Note: Some `InitializeWalletRequest` properties are broader than needed for TransactionController specifically, so unnecessary properties will be removed in future. Depends on MetaMask/core#8975. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** 1. `yarn install` 2. `yarn lint:tsc` 3. Build and load the extension; confirm transactions work end-to-end. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **High Risk** > Moves core transaction controller startup and background API wiring to the wallet package; regressions could break signing, publishing, state persistence, or UI transaction flows despite preserved store keys. > > **Overview** > **TransactionController** is no longer created through `messenger-client-init`; it is owned by `@metamask/wallet` (`^7.0.0`) with extension-specific wiring under `app/scripts/wallet-init`. > > `initializeWallet` now takes an `InitializeWalletRequest` (including `getFlatState`, `getPermittedAccounts`, and `getTransactionMetricsRequest`) and passes `transactionController` instance options built from `getTransactionControllerInstanceOptions`, plus `setupTransactionControllerListeners` for metrics subscriptions. Background API methods are exposed via `getTransactionControllerApi(this.txController)` merged into the extension API. `MetaMaskController` resolves the controller with `wallet.getInstance('TransactionController')` and keeps the same persisted/mem store keys (`TransactionController` / `TxController`). > > The init messenger module moves to `wallet-init/messengers` (controller messenger factory removed; init messenger types exported). Transaction hooks and containers update imports to that path. `TransactionController` is dropped from `MESSENGER_FACTORIES` and related init typing; Lavamoat policies allow `@metamask/transaction-controller` from `@metamask/wallet`. Tests shift from the old init test file to `wallet-init` coverage. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 20571a5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
4 tasks
pull Bot
pushed a commit
to Reality2byte/core
that referenced
this pull request
Jul 14, 2026
…allet (MetaMask#9509) ## Explanation `TransactionController` was wired into `@metamask/wallet` in MetaMask#8975, which left the daemon's wallet factory with a stubbed slot: `// TODO(MetaMask#8975): add the transactionController slot once it is wired`. Until now the daemon still *constructed* the controller (it runs during `wallet.init()`), but only with the controller's implicit defaults, because `buildInstanceOptions` passed no `transactionController` options. This PR populates that slot so the daemon's transaction configuration is explicit and reviewable alongside the other wired slots. ## What changed `buildInstanceOptions` now sets: ```ts transactionController: { disableSwaps: true, hooks: {}, }, ``` - **`disableSwaps: true`** — the headless CLI has no swaps feature, so the swaps-specific post-processing a full wallet client runs would only produce data nothing reads. This mirrors mobile's choice; the extension keeps swaps enabled because it ships the full Swaps UI. - **`hooks: {}`** — no CLI-specific transaction hooks. The controller's built-in publish path already broadcasts through the wired `NetworkController` provider (the default `publish` hook returns an undefined hash, and the controller then falls back to its own network-client broadcast), and the remaining hooks (metrics, notifications, gas-fee tokens) are client-UI concerns the daemon has no equivalent for. - Every other option (`getPermittedAccounts`, `isSimulationEnabled`, `trace`, …) is left at the controller's default. This is a configuration change only — no new command surface. Mutating RPC (sign/send) hardening remains future work (see the retry-idempotency note in the wallet-cli plan). ### Client references for the `disableSwaps` posture - Extension (`disableSwaps: false`): [`app/scripts/wallet-init/instance-options/transaction-controller.ts`](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/wallet-init/instance-options/transaction-controller.ts) - Mobile (`disableSwaps: true`): [`app/core/Engine/wallet-init/instance-options/transaction-controller.ts`](https://github.com/MetaMask/metamask-mobile/blob/main/app/core/Engine/wallet-init/instance-options/transaction-controller.ts) ## References - Wires the consumer side of MetaMask#8975. ## Testing - Unit (`wallet-factory.test.ts`): asserts the wired slot values. - Integration (`wallet-factory.integration.test.ts`): the real `Wallet` path constructs and runs with the new options. - Gates: full test suite at 100% coverage, dep-subtree build/type-check, ESLint, oxfmt, changelog validation — all green. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, `CHANGELOG.md`) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for affected packages](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes (n/a — no breaking changes) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small, explicit daemon configuration change with no new RPC surface; swaps processing is disabled in a headless host where it was previously left at wallet defaults (swaps on). > > **Overview** > The daemon’s `buildInstanceOptions` **replaces the `transactionController` TODO** with an explicit slot configuration so headless CLI behavior is documented alongside the other wired controllers. > > **`disableSwaps: true`** turns off swaps-specific transaction post-processing the CLI has no surface for (aligned with mobile; extension keeps swaps on). **`hooks: {}`** declares no client-specific transaction hooks—publish still uses the controller’s default path through `NetworkController`; metrics/notifications-style hooks are omitted for the headless daemon. Other `TransactionController` options stay at controller defaults. > > `wallet-factory.test.ts` asserts these values on the real wallet construction call, and `CHANGELOG.md` records the addition. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0f8d304. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Adds
TransactionControllerto the@metamask/walletpackage. Wallet initializes the controller during setup; consumers pass platform-specific options viainstanceOptions.transactionController.References
MetaMask/metamask-extension#43182
Checklist
Note
Medium Risk
Expands the default wallet controller graph into transaction submission/signing paths via delegated Keyring and Approval actions; breaking for consumers that assumed TransactionController was not part of default init.
Overview
BREAKING: Default
@metamask/walletsetup now bootsTransactionControlleralongside the other core controllers, so consumers get transaction state and messenger actions without wiring it themselves.A new initialization module constructs the controller from optional
instanceOptions.transactionController(including a defaultdisableSwaps: false), restores persisted state, and delegates parent messenger access for signing, approvals, accounts, network clients, gas estimates, and feature flags.Walletintegration tests assertTransactionController:getStateis available on the root messenger.Also adds the
@metamask/transaction-controllerdependency, TypeScript project references, CODEOWNERS for the new init path, changelog entry, and focused unit tests for registration, default state, and state hydration.Reviewed by Cursor Bugbot for commit 2e54b30. Bugbot is set up for automated code reviews on this repo. Configure here.