Skip to content

Commit

Permalink
chore(address-book-controller): Rename ControllerMessenger to `Mess…
Browse files Browse the repository at this point in the history
…enger`

Rename `ControllerMessenger` to `Messenger` in the
`@metamask/address-book-controller` package. The `AddressBookControllerMessenger`
type export was renamed to `AddressBookMessenger`, but the old name is
preserved as an alias.

Relates to #4538
  • Loading branch information
Gudahtt committed Dec 20, 2024
1 parent f8e5f2e commit 5ab594d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/address-book-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079))
- Rename `AddressBookControllerMessenger` to `AddressBookMessenger` ([#5091](https://github.com/MetaMask/core/pull/5091))
- The old name is preserved as an alias, so this is not a breaking change.

## [6.0.2]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ControllerMessenger } from '@metamask/base-controller';
import { Messenger } from '@metamask/base-controller';
import { toHex } from '@metamask/controller-utils';

import type {
Expand All @@ -17,11 +17,11 @@ import {
* @returns A restricted controller messenger.
*/
function getRestrictedMessenger() {
const controllerMessenger = new ControllerMessenger<
const messenger = new Messenger<
AddressBookControllerActions,
AddressBookControllerEvents
>();
return controllerMessenger.getRestricted({
return messenger.getRestricted({
name: controllerName,
allowedActions: [],
allowedEvents: [],
Expand Down
8 changes: 4 additions & 4 deletions packages/address-book-controller/src/AddressBookController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
ControllerGetStateAction,
ControllerStateChangeEvent,
RestrictedControllerMessenger,
RestrictedMessenger,
} from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import {
Expand Down Expand Up @@ -122,7 +122,7 @@ export const getDefaultAddressBookControllerState =
/**
* The messenger of the {@link AddressBookController} for communication.
*/
export type AddressBookControllerMessenger = RestrictedControllerMessenger<
export type AddressBookMessenger = RestrictedMessenger<
typeof controllerName,
AddressBookControllerActions,
AddressBookControllerEvents,
Expand All @@ -136,7 +136,7 @@ export type AddressBookControllerMessenger = RestrictedControllerMessenger<
export class AddressBookController extends BaseController<
typeof controllerName,
AddressBookControllerState,
AddressBookControllerMessenger
AddressBookMessenger
> {
/**
* Creates an AddressBookController instance.
Expand All @@ -149,7 +149,7 @@ export class AddressBookController extends BaseController<
messenger,
state,
}: {
messenger: AddressBookControllerMessenger;
messenger: AddressBookMessenger;
state?: Partial<AddressBookControllerState>;
}) {
const mergedState = { ...getDefaultAddressBookControllerState(), ...state };
Expand Down
3 changes: 2 additions & 1 deletion packages/address-book-controller/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export type {
AddressBookControllerActions,
AddressBookControllerStateChangeEvent,
AddressBookControllerEvents,
AddressBookControllerMessenger,
AddressBookMessenger,
AddressBookMessenger as AddressBookControllerMessenger,
ContactEntry,
} from './AddressBookController';
export {
Expand Down

0 comments on commit 5ab594d

Please sign in to comment.