Skip to content

Conversation

@mikesposito
Copy link
Member

@mikesposito mikesposito commented Aug 26, 2025

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.

@mikesposito mikesposito 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 owners August 26, 2025 12:51
cursor[bot]

This comment was marked as outdated.

@mikesposito mikesposito requested a review from a team as a code owner August 28, 2025 09:52
@mikesposito mikesposito changed the title refactor: migrate ApprovalController to @metamask/messenger refactor: migrate {Approval,Transaction,Network}Controller to @metamask/messenger Aug 28, 2025
@mcmire
Copy link
Contributor

mcmire commented Aug 28, 2025

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

@mikesposito
Copy link
Member Author

mikesposito commented Sep 3, 2025

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 mikesposito force-pushed the mikesposito/messenger/approval-controller branch from 1292cb6 to 6210cf2 Compare September 3, 2025 10:03
@mikesposito mikesposito changed the title refactor: migrate {Approval,Transaction,Network}Controller to @metamask/messenger refactor: migrate {Approval,Transaction,Network}Controller and polling controllers to @metamask/messenger Sep 3, 2025
@mikesposito mikesposito force-pushed the mikesposito/messenger/approval-controller branch from c0c7c01 to f482a84 Compare September 3, 2025 13:06
@mikesposito mikesposito changed the title refactor: migrate {Approval,Transaction,Network}Controller and polling controllers to @metamask/messenger refactor: migrate {Approval,Transaction,Network,GasFee}Controller to @metamask/messenger Sep 3, 2025
@mikesposito mikesposito force-pushed the mikesposito/messenger/approval-controller branch from b961f39 to bf8b850 Compare September 3, 2025 16:12
@mikesposito mikesposito changed the title refactor: migrate {Approval,Transaction,Network,GasFee}Controller to @metamask/messenger refactor: migrate {Approval,Transaction,Network,GasFee,AssetsContract,Nft,Tokens}Controller messengers Sep 3, 2025
Comment on lines +94 to +99
export const StaticIntervalPollingControllerNext = <
PollingInput extends Json,
>() =>
StaticIntervalPollingControllerMixin<typeof BaseControllerNext, PollingInput>(
BaseControllerNext,
);
Copy link
Member Author

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
Contributor

mcmire commented Oct 7, 2025

Looks like there are conflicts :(

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikesposito mikesposito disabled auto-merge October 27, 2025 10:37
@mikesposito mikesposito added this pull request to the merge queue Oct 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 queue Oct 27, 2025
Merged via the queue into main with commit 1860493 Oct 27, 2025
256 of 257 checks passed
@FrederikBolding FrederikBolding deleted the mikesposito/messenger/approval-controller branch October 27, 2025 11:25
Sign up for free to 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.

6 participants