feat: adopt messenger-cli pattern for 4 controller packages#8391
Merged
cryptodev-2s merged 4 commits intomainfrom Apr 8, 2026
Merged
feat: adopt messenger-cli pattern for 4 controller packages#8391cryptodev-2s merged 4 commits intomainfrom
cryptodev-2s merged 4 commits intomainfrom
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
cryptodev-2s
commented
Apr 7, 2026
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…s, multichain-network, and ai-controllers Replace manually defined messenger action types and handlers with auto-generated ones via @metamask/messenger-cli.
397012d to
a78e4b2
Compare
cryptodev-2s
commented
Apr 7, 2026
Contributor
Author
|
@metamaskbot publish-preview |
salimtb
approved these changes
Apr 7, 2026
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Contributor
Author
|
Adding |
hmalik88
approved these changes
Apr 7, 2026
xavier-brochard
approved these changes
Apr 8, 2026
4 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 8, 2026
…8408) ## Explanation This adds `KeyringController:signTransaction` to `MESSENGER_EXPOSED_METHODS` and exports the type, as this was missed in #8391. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Expands the controller’s messenger API to allow remote callers to request transaction signatures, which is security-sensitive despite being a small change. Risk is mainly around new call surface/permissions and ensuring consumers handle the new action correctly. > > **Overview** > Enables `KeyringController:signTransaction` to be invoked through the `KeyringController` messenger by adding it to the exposed method allowlist. > > Adds and exports the corresponding `KeyringControllerSignTransactionAction` type (and updates the method-action union), and records the new messenger exposure in the package changelog. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 497b413. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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
Several controller packages still manually define messenger action types and register action handlers individually. The
@metamask/messenger-clitool automates this by scanning forMESSENGER_EXPOSED_METHODSand generating type-safe action type files.This PR migrates 4 packages to use the messenger-cli pattern:
keyring-controller— Replaces 20 manualregisterActionHandlercalls and 20 manually defined action types with a singleregisterMethodActionHandlerscall and auto-generated types.multichain-transactions-controller— ExposesupdateTransactionsForAccountas a new messenger action (previously public but not registered).multichain-network-controller— Replaces 2 manual handler registrations and manually defined action types with auto-generated ones.ai-controllers— Replaces 2 manual handler registrations and manually defined action types with auto-generated ones.All exported type names and shapes are unchanged — no breaking changes.
References
@metamask/messenger-clipackage:packages/messenger-cli/packages/sample-controllers/src/sample-gas-prices-controller.tsChecklist
Note
Medium Risk
Primarily a refactor of messenger action typing/registration, but it touches
keyring-controllersigning/vault-related messenger exposure; incorrectMESSENGER_EXPOSED_METHODSconfiguration could accidentally change which privileged methods are callable.Overview
Migrates
ai-controllers,keyring-controller,multichain-network-controller, andmultichain-transactions-controllerto the@metamask/messenger-clipattern by definingMESSENGER_EXPOSED_METHODS, generating*-method-action-types.ts, and switching tomessenger.registerMethodActionHandlersinstead of many manualregisterActionHandlercalls.Adds package scripts to check/generate messenger action types (and
tsxdevDependency) and updates exports so the generated action types remain available.multichain-transactions-controllernow actually exposesupdateTransactionsForAccountvia messenger, andmultichain-network-controllerchangelog notes exporting thegetNetworksWithTransactionActivityByAccountsaction type.Reviewed by Cursor Bugbot for commit 47dc390. Bugbot is set up for automated code reviews on this repo. Configure here.