Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** `NetworkConnectionBannerControllerMessenger` now requires `ClientController:stateChange` to be delegated instead of `ClientController:stateChanged` ([#9893](https://github.com/MetaMask/core/pull/9893))
- Bump `@metamask/network-controller` from `^35.0.0` to `^35.0.1` ([#9758](https://github.com/MetaMask/core/pull/9758))
- Bump `@metamask/network-enablement-controller` from `^6.0.1` to `^6.0.3` ([#9740](https://github.com/MetaMask/core/pull/9740), [#9791](https://github.com/MetaMask/core/pull/9791))
- Bump `@metamask/keyring-controller` from `^27.1.0` to `^27.1.1` ([#9791](https://github.com/MetaMask/core/pull/9791))
Expand Down
2 changes: 1 addition & 1 deletion packages/network-connection-banner-controller/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ from the same failure start and must be greater than the degraded one.
The controller stays dormant after construction so the 5s / 30s escalation
timers do not run before a user is actually looking at the wallet (e.g. while
the app is still on the lock screen). It manages its own lifecycle by
subscribing to `ClientController:stateChanged` and
subscribing to `ClientController:stateChange` and
`KeyringController:unlock` / `KeyringController:lock`: evaluation runs only
while the client UI is open on an unlocked wallet. When either condition
stops holding, pending timers are cancelled and the banner state resets to
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -1843,7 +1843,8 @@ async function withController<ReturnValue>(
'NetworkEnablementController:stateChange',
// eslint-disable-next-line no-restricted-syntax -- awaiting upstream :stateChanged migration
'ConnectivityController:stateChange',
'ClientController:stateChanged',
// eslint-disable-next-line no-restricted-syntax -- awaiting upstream :stateChanged migration
'ClientController:stateChange',
'KeyringController:unlock',
'KeyringController:lock',
],
Expand All@@ -1857,7 +1858,7 @@ async function withController<ReturnValue>(
});

const setUiOpen = (isUiOpen: boolean): void => {
rootMessenger.publish('ClientController:stateChanged', { isUiOpen }, []);
rootMessenger.publish('ClientController:stateChange', { isUiOpen }, []);
};
const setKeyringUnlocked = (isUnlocked: boolean): void => {
rootMessenger.publish(
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@ import type {
} from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import { clientControllerSelectors } from '@metamask/client-controller';
import type { ClientControllerState } from '@metamask/client-controller';
import type { ClientControllerStateChangeEvent } from '@metamask/client-controller';
import {
CONNECTIVITY_STATUSES,
connectivityControllerSelectors,
Expand DownExpand Up@@ -264,16 +264,6 @@ export type NetworkConnectionBannerControllerStateChangedEvent =
export type NetworkConnectionBannerControllerEvents =
NetworkConnectionBannerControllerStateChangedEvent;

/**
* Published when the state of `ClientController` changes. Defined here
* because the `client-controller` package still exports the legacy
* `:stateChange` event type.
*/
type ClientControllerStateChangedEvent = ControllerStateChangedEvent<
'ClientController',
ClientControllerState
>;

/**
* Events from other messengers that
* {@link NetworkConnectionBannerControllerMessenger} subscribes to.
Expand All@@ -282,7 +272,7 @@ type AllowedEvents =
| NetworkControllerStateChangeEvent
| NetworkEnablementControllerStateChangeEvent
| ConnectivityControllerStateChangeEvent
| ClientControllerStateChangedEvent
| ClientControllerStateChangeEvent
| KeyringControllerUnlockEvent
| KeyringControllerLockEvent;

Expand DownExpand Up@@ -474,7 +464,8 @@ export class NetworkConnectionBannerController extends BaseController<
// Lifecycle: evaluate RPC health (and run the banner escalation timers)
// only while the client UI is open on an unlocked wallet.
this.messenger.subscribe(
'ClientController:stateChanged',
// eslint-disable-next-line no-restricted-syntax -- awaiting upstream :stateChanged migration
'ClientController:stateChange',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Does ClientController not publish both?

@cryptodev-2scryptodev-2sAug 17, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's marked as deprecated.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If remove it we get

Subscribing to ':stateChange' events is deprecated. Use ':stateChanged' instead.eslint[no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't referring to the eslint comment. I am curious why we are making this change in the first place and why we can't use :stateChanged in this controller? Is it not published by ClientController?

@cryptodev-2scryptodev-2sAug 17, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's not defined by ClientController because it still uses :stateChangehttps://github.com/MetaMask/core/blob/main/packages/client-controller/src/ClientController.ts#L82

(isUiOpen) => {
this.#isUiOpen = isUiOpen;
this.#updateLifecycle();
Expand Down