Skip to content

refactor: migrate {Approval,Transaction,Network,GasFee,AssetsContract,Nft,Tokens}Controller messengers - #6386

Merged
FrederikBolding merged 43 commits into
mainfrom
mikesposito/messenger/approval-controller
Oct 27, 2025
Merged

refactor: migrate {Approval,Transaction,Network,GasFee,AssetsContract,Nft,Tokens}Controller messengers#6386
FrederikBolding merged 43 commits into
mainfrom
mikesposito/messenger/approval-controller

Conversation

@mikesposito

@mikespositomikesposito commented Aug 26, 2025

Copy link
Copy Markdown
Member

Explanation

This PR migrates the ApprovalController, TransactionController, GasFeeController, NetworkController, AssetsContractController, TokensController and NftController classes to the new @metamask/messenger comm system along with their tests, as opposed to the one exported from @metamask/base-controller.

The three packages are being migrated together because the TransactionControllerIntegration.test.ts file ties them together.

References

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, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Migrates major controllers to the new @metamask/messenger with updated state metadata and tests, adds StaticIntervalPollingControllerNext, and updates package configs and changelogs (breaking).

  • Messaging/Controllers (BREAKING):
    • Migrate ApprovalController, TransactionController, NetworkController, GasFeeController, AssetsContractController, NftController, TokensController from RestrictedMessenger to new @metamask/messenger.
    • Replace @metamask/base-controller APIs with @metamask/base-controller/next where applicable; update state metadata keys (anonymous -> includeInDebugSnapshot).
    • Update controller messenger types, action/event registrations (this.messenger.registerActionHandler/subscribe/publish/call).
    • Refactor tests to use root and namespaced messengers with delegated actions/events.
  • Gas Fee/Pooling:
    • Add StaticIntervalPollingControllerNext; GasFeeController now extends it.
    • Export GasFeeMessenger type.
  • Configs/Deps:
    • Add @metamask/messenger dependency and TS project references across affected packages; adjust imports to /next variants.
    • Update README controller dependency graph to include messenger links.
  • Changelogs:
    • Note BREAKING changes for the controllers above; document new export in gas-fee-controller.
  • Misc:
    • Minor eslint threshold tweak; yarn.lock updates.

Written by Cursor Bugbot for commit c2dee6e. This will update automatically on new commits. Configure here.

@mikespositomikesposito mentioned this pull request Aug 26, 2025
43 tasks
@mikesposito
mikesposito marked this pull request as ready for review August 26, 2025 12:51
@mikesposito
mikesposito requested review from a team as code ownersAugust 26, 2025 12:51
cursor[bot]

This comment was marked as outdated.

@mikesposito
mikesposito requested a review from a team as a code ownerAugust 28, 2025 09:52
@mikespositomikesposito changed the title refactor: migrate ApprovalController to @metamask/messengerrefactor: migrate {Approval,Transaction,Network}Controller to @metamask/messengerAug 28, 2025
@mcmire

Copy link
Copy Markdown
Collaborator

It looks like these changes cause some issues with the gas-fee-controller tests :(

@mikesposito

mikesposito commented Sep 3, 2025

Copy link
Copy Markdown
MemberAuthor

It looks like these changes cause some issues with the gas-fee-controller tests :(

Ah, thanks for pointing that out! It looks like gas-fee-controller tests also initialize other controller instances in its tests, so it should be migrated as well in this PR. Unfortunately though, gas-fee-controller also depends on StaticIntervalPollingController from polling-controller, and migrating that will require migrating all other controllers doing polling

EDIT: I was able to go around this by adding a StaticIntervalPollingControllerNext export in polling-controller, so that I can migrate gas-fee-controller without having to migrate all other polling controllers. There are still other controllers depending on the ones being migrated in this PR though (i.e. mainly assets controllers)

@mikesposito
mikespositoforce-pushed the mikesposito/messenger/approval-controller branch from 1292cb6 to 6210cf2CompareSeptember 3, 2025 10:03
@mikespositomikesposito changed the title refactor: migrate {Approval,Transaction,Network}Controller to @metamask/messengerrefactor: migrate {Approval,Transaction,Network}Controller and polling controllers to @metamask/messengerSep 3, 2025
@mikesposito
mikespositoforce-pushed the mikesposito/messenger/approval-controller branch from c0c7c01 to f482a84CompareSeptember 3, 2025 13:06
@mikespositomikesposito changed the title refactor: migrate {Approval,Transaction,Network}Controller and polling controllers to @metamask/messengerrefactor: migrate {Approval,Transaction,Network,GasFee}Controller to @metamask/messengerSep 3, 2025
@mikesposito
mikespositoforce-pushed the mikesposito/messenger/approval-controller branch from b961f39 to bf8b850CompareSeptember 3, 2025 16:12
@mikespositomikesposito changed the title refactor: migrate {Approval,Transaction,Network,GasFee}Controller to @metamask/messengerrefactor: migrate {Approval,Transaction,Network,GasFee,AssetsContract,Nft,Tokens}Controller messengersSep 3, 2025
Comment on lines +94 to +99
export const StaticIntervalPollingControllerNext = <
PollingInput extends Json,
>() =>
StaticIntervalPollingControllerMixin<typeof BaseControllerNext, PollingInput>(
BaseControllerNext,
);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been added to untangle gas-fee-controller from other polling controllers, and is being removed in #6444

@mcmire

Copy link
Copy Markdown
Collaborator

Looks like there are conflicts :(

cursor[bot]

This comment was marked as outdated.

@cryptodev-2scryptodev-2s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mikesposito
mikesposito added this pull request to the merge queueOct 27, 2025
@FrederikBolding
FrederikBolding removed this pull request from the merge queue due to the queue being cleared Oct 27, 2025
@FrederikBolding
FrederikBolding added this pull request to the merge queueOct 27, 2025
Merged via the queue into main with commit 1860493Oct 27, 2025
256 of 257 checks passed
@FrederikBolding
FrederikBolding deleted the mikesposito/messenger/approval-controller branch October 27, 2025 11:25
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mikesposito@mcmire@cryptodev-2s@FrederikBolding@Gudahtt