Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix controllers with missing or incorrect messenger action/event types (
#4633) ## Explanation Fixes controllers and messengers in the core repo that do not fulfill their intended specifications correctly: - [Define the `*:getState` action using the `ControllerGetStateAction` utility type](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-the-getstate-action-using-the-controllergetstateaction-utility-type) - [Define the `*:stateChange` event using the `ControllerStateChangeEvent` utility type](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-the-statechange-event-using-the-controllerstatechangeevent-utility-type) - [Define and export a type union for internal action types](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-union-for-internal-action-types) - [Define and export a type union for internal event types](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-union-for-internal-event-types) - [Define and export a type for the controller's messenger](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-for-the-controllers-messenger) This also resolves downstream errors in mobile caused by `composable-controller` expecting all of its child controllers to have a `stateChange` event. - See MetaMask/metamask-mobile#10374 ## References - Fixes #4579 - Blocks MetaMask/metamask-mobile#10441 ## Changelog ### `@metamask/logging-controller` (major) ```md ### Added - Define and export new types: `LoggingControllerGetStateAction`, `LoggingControllerStateChangeEvent`, `LoggingControllerEvents` ([#4633](#4633)) ### Changed - **BREAKING:** `LoggingControllerMessenger` must allow internal events defined in the `LoggingControllerEvents` type ([#4633](#4633)) - `LoggingControllerActions` is widened to include the `LoggingController:getState` action ([#4633](#4633)) ``` ### `@metamask/phishing-controller` (major) ```md ### Added - Define and export new types: `PhishingControllerGetStateAction`, `PhishingControllerStateChangeEvent`, `PhishingControllerEvents` ([#4633](#4633)) ### Changed - **BREAKING:** `PhishingControllerMessenger` must allow internal events defined in the `PhishingControllerEvents` type ([#4633](#4633)) - `PhishingControllerActions` is widened to include the `PhishingController:getState` action ([#4633](#4633)) ``` ### `@metamask/notification-services-controller` (minor) ```md ### Added - Define and export new type `NotificationServicesControllerGetStateAction` ([#4633](#4633)) ### Fixed - Replace `getState` action in `NotificationServicesControllerActions` with correctly-defined `NotificationServicesControllerGetStateAction` type ([#4633](#4633)) ``` ### `@metamask/authentication-controller` (major) ```md ### Added - Define and export new types: `AuthenticationControllerGetStateAction`, `AuthenticationControllerStateChangeEvent`, `Events` ([#4633](#4633)) ### Changed - **BREAKING:** `AuthenticationControllerMessenger` must allow internal events defined in the `Events` type ([#4633](#4633)) - `AuthenticationControllerActions` is widened to include the `AuthenticationController:getState` action ([#4633](#4633)) ``` ### `@metamask/user-storage-controller` (major) ```md ### Added - Define and export new types: `UserStorageControllerGetStateAction`, `UserStorageControllerStateChangeEvent`, `Events` ([#4633](#4633)) ### Changed - **BREAKING:** `UserStorageControllerMessenger` must allow internal events defined in the `Events` type ([#4633](#4633)) - `UserStorageControllerActions` is widened to include the `UserStorageController:getState` action ([#4633](#4633)) ``` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
- Loading branch information