Skip to content
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ linkStyle default opacity:0.5
name_controller --> controller_utils;
name_controller --> messenger;
network_controller --> base_controller;
network_controller --> connectivity_controller;
network_controller --> controller_utils;
network_controller --> eth_block_tracker;
network_controller --> eth_json_rpc_middleware;
Expand Down
9 changes: 9 additions & 0 deletions packages/network-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- **BREAKING:** NetworkController now requires `ConnectivityController:getState` action handler to be registered on the messenger ([#7627](https://github.com/MetaMask/core/pull/7627))
- The `NetworkController` now depends on the `ConnectivityController` to prevent retries and suppress events when the user is offline.
- When offline, RPC requests are not retried at the `RpcService` level, preventing unnecessary network calls and circuit breaker failures.
- When offline, `NetworkController:rpcEndpointUnavailable` and `NetworkController:rpcEndpointDegraded` events are suppressed since retries don't occur and circuit breakers don't trigger.
- You must register a `ConnectivityController:getState` action handler on your root messenger that returns an object with a `connectivityStatus` property (`'online'` or `'offline'`).
- You must delegate the `ConnectivityController:getState` action from your root messenger to the `NetworkControllerMessenger` using `rootMessenger.delegate({ messenger: networkControllerMessenger, actions: ['ConnectivityController:getState'] })`.

## [28.0.0]

### Changed
Expand Down
1 change: 1 addition & 0 deletions packages/network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"@metamask/base-controller": "^9.0.0",
"@metamask/connectivity-controller": "^0.0.0",
"@metamask/controller-utils": "^11.18.0",
"@metamask/eth-block-tracker": "^15.0.0",
"@metamask/eth-json-rpc-infura": "^10.3.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/network-controller/src/NetworkController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
ControllerStateChangeEvent,
} from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { ConnectivityControllerGetStateAction } from '@metamask/connectivity-controller';
import type { Partialize } from '@metamask/controller-utils';
import {
InfuraNetworkType,
Expand Down Expand Up @@ -729,7 +730,7 @@ export type NetworkControllerActions =
/**
* All actions that {@link NetworkController} calls internally.
*/
type AllowedActions = never;
type AllowedActions = ConnectivityControllerGetStateAction;

export type NetworkControllerMessenger = Messenger<
typeof controllerName,
Expand Down
Loading
Loading