Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(snaps-registry): Define missing
getState
action, stateChange
…
…event (#2655) ## Explanation Fixes the `SnapsRegistryMessenger` type and the `JsonSnapsRegistry` class. Currently they 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@4ea1202 ## References - Fixes MetaMask/core#4579 - Blocks MetaMask/metamask-mobile#10441 ## Changelog ### `@metamask/snaps-controllers` ### Added - Define and export new types: `SnapsRegistryGetStateAction`, `SnapsRegistryStateChangeEvent` ([#2655](#2655)) ### Changed - `SnapsRegistryActions` is widened to include the `SnapsRegistry:getState` action ([#2655](#2655)) - `SnapsRegistryEvents` is widened to include the `SnapsRegistry:stateChange` event ([#2655](#2655))
- Loading branch information