-
-
Notifications
You must be signed in to change notification settings - Fork 252
refactor: migrate PhishingController to @metamask/messenger
#6535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: migrate PhishingController to @metamask/messenger
#6535
Conversation
ed9948c to
8687d79
Compare
8687d79 to
0ab7b74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…r/phishing-controller
| PhishingControllerEvents | AllowedEvents, | ||
| AllowedActions['type'], | ||
| AllowedEvents['type'] | ||
| PhishingControllerEvents | AllowedEvents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing Type Parameter in Messenger Definition
The PhishingControllerMessenger type definition is missing the fourth type parameter that was present in the old RestrictedMessenger type. The new Messenger type from @metamask/messenger requires a fourth type parameter (parent messenger type) for child messengers. The current definition Messenger<typeof controllerName, PhishingControllerActions | AllowedActions, PhishingControllerEvents | AllowedEvents> should be Messenger<typeof controllerName, PhishingControllerActions | AllowedActions, PhishingControllerEvents | AllowedEvents, ParentMessengerType> where ParentMessengerType is the type of the parent messenger that this controller's messenger is derived from. Without this fourth parameter, the messenger delegation pattern used in tests (lines 84-88 in PhishingController.test.ts) may not work correctly with type safety.
Explanation
This PR migrates
PhishingControllerto the new@metamask/messengermessage bus, as opposed to the one exported from@metamask/base-controller.References
Checklist
Note
Migrates
PhishingControllerto use@metamask/messengerand renames metadata fieldanonymoustoincludeInDebugSnapshot.PhishingControllerto@metamask/messengerMessenger(replacesRestrictedMessengerfrom@metamask/base-controller).anonymoustoincludeInDebugSnapshot.packages/phishing-controller/src/PhishingController.ts):@metamask/base-controller/nextand@metamask/messenger.messagingSystemcalls withmessenger.registerActionHandler/messenger.subscribe.PhishingControllerMessengertype to useMessenger<...>.@metamask/messengerand delegateTransactionController:stateChange.deriveStateFromMetadatafrom@metamask/base-controller/nextand expectincludeInDebugSnapshot.@metamask/messengerand tsconfig references topackages/messenger.phishing_controller --> messengerand include@metamask/messengerin package list.Written by Cursor Bugbot for commit c2988bb. This will update automatically on new commits. Configure here.