Skip to content

Commit 2d39895

Browse files
committed
refactor: migrate NameController to @metamask/messenger
1 parent b469c1f commit 2d39895

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

packages/name-controller/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12+
- **BREAKING:** Use new `Messenger` from `@metamask/messenger` ([#6541](https://github.com/MetaMask/core/pull/6541))
13+
- Previously, `NameController` accepted a `RestrictedMessenger` instance from `@metamask/base-controller`.
1214
- Bump `@metamask/utils` from `^11.2.0` to `^11.4.2` ([#6054](https://github.com/MetaMask/core/pull/6054))
1315
- Bump `@metamask/base-controller` from `^8.0.0` to `^8.3.0` ([#5722](https://github.com/MetaMask/core/pull/5722), [#6284](https://github.com/MetaMask/core/pull/6284), [#6355](https://github.com/MetaMask/core/pull/6355), [#6465](https://github.com/MetaMask/core/pull/6465))
1416
- Bump `@metamask/controller-utils` from `^11.5.0` to `^11.12.0` ([#5439](https://github.com/MetaMask/core/pull/5439), [#5583](https://github.com/MetaMask/core/pull/5583), [#5765](https://github.com/MetaMask/core/pull/5765), [#5812](https://github.com/MetaMask/core/pull/5812), [#5935](https://github.com/MetaMask/core/pull/5935), [#6069](https://github.com/MetaMask/core/pull/6069), [#6303](https://github.com/MetaMask/core/pull/6303))

packages/name-controller/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"dependencies": {
5151
"@metamask/base-controller": "^8.3.0",
5252
"@metamask/controller-utils": "^11.12.0",
53+
"@metamask/messenger": "^0.2.0",
5354
"@metamask/utils": "^11.4.2",
5455
"async-mutex": "^0.5.0"
5556
},

packages/name-controller/src/NameController.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type {
22
ControllerGetStateAction,
33
ControllerStateChangeEvent,
4-
RestrictedMessenger,
5-
} from '@metamask/base-controller';
6-
import { BaseController } from '@metamask/base-controller';
4+
} from '@metamask/base-controller/next';
5+
import { BaseController } from '@metamask/base-controller/next';
76
import { isSafeDynamicKey } from '@metamask/controller-utils';
7+
import type { Messenger } from '@metamask/messenger';
88

99
import type {
1010
NameProvider,
@@ -89,12 +89,10 @@ export type NameControllerActions = GetNameState;
8989

9090
export type NameControllerEvents = NameStateChange;
9191

92-
export type NameControllerMessenger = RestrictedMessenger<
92+
export type NameControllerMessenger = Messenger<
9393
typeof controllerName,
9494
NameControllerActions,
95-
NameControllerEvents,
96-
never,
97-
never
95+
NameControllerEvents
9896
>;
9997

10098
export type NameControllerOptions = {

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,6 +3956,7 @@ __metadata:
39563956
"@metamask/auto-changelog": "npm:^3.4.4"
39573957
"@metamask/base-controller": "npm:^8.3.0"
39583958
"@metamask/controller-utils": "npm:^11.12.0"
3959+
"@metamask/messenger": "npm:^0.2.0"
39593960
"@metamask/utils": "npm:^11.4.2"
39603961
"@types/jest": "npm:^27.4.1"
39613962
async-mutex: "npm:^0.5.0"

0 commit comments

Comments
 (0)