Uh oh!
There was an error while loading. Please reload this page.
refactor: migrate PhishingController to @metamask/messenger - #6535
Conversation
ed9948c to
8687d79Compare8687d79 to
0ab7b74Compare
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…r/phishing-controller
| PhishingControllerEvents | AllowedEvents, | ||
| AllowedActions['type'], | ||
| AllowedEvents['type'] | ||
| PhishingControllerEvents | AllowedEvents |
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.