feat(config-registry-controller): add getNetworkConfigByCaip2ChainId - #9597
Merged
Conversation
getNetworkConfigByCaip2ChainIdgetNetworkConfigByCaip2ChainId
mikesposito
commented
Jul 22, 2026
mikesposito
marked this pull request as ready for review
July 22, 2026 12:45
mikesposito
temporarily deployed
to
default-branch
July 22, 2026 12:45 — with
GitHub Actions
Inactive
mikesposito
enabled auto-merge
July 22, 2026 12:52
maxime-oe
reviewed
Jul 22, 2026
| * @returns The network configuration if found, otherwise undefined. | ||
| */ | ||
| getNetworkConfigByCaip2ChainId( | ||
| caip2ChainId: string, |
Contributor
There was a problem hiding this comment.
Any chance we can do slightly better than string here as a type ? I often saw ${string}:${string}
Member
Author
There was a problem hiding this comment.
The state is typed Record<string, _> so the argument is matching the state key type, but we can change both
maxime-oe
approved these changes
Jul 22, 2026
pull Bot
pushed a commit
to firas9941/metamask-extension
that referenced
this pull request
Aug 4, 2026
…er` (MetaMask#44766) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ~~Using preview build from MetaMask/core#9611 Bumping `@metamask/network-enablement-controller` to `^6.0.0` ```markdown ## [6.0.0] ### Added - Expose missing public `NetworkEnablementController` method through its messenger ([MetaMask#9660](MetaMask/core#9660)) - The following action is now available: - `NetworkEnablementController:restoreEnabledNetworkMap` - Corresponding action type (`NetworkEnablementControllerRestoreEnabledNetworkMapAction`) is available as well. ### Changed - **BREAKING:** Popular-network classification is now augmented by `ConfigRegistryController` ([MetaMask#9611](MetaMask/core#9611)) - `NetworkEnablementControllerMessenger` now requires the `ConfigRegistryController:getState` action to be available. - Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.3.0` ([MetaMask#9568](MetaMask/core#9568), [MetaMask#9589](MetaMask/core#9589), [MetaMask#9593](MetaMask/core#9593), [MetaMask#9693](MetaMask/core#9693)) - Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([MetaMask#9676](MetaMask/core#9676)) - Bump `@metamask/config-registry-controller` from `^0.4.1` to `^1.0.0` ([MetaMask#9706](MetaMask/core#9706)) ``` and `@metamask/config-registry-controller` to `^1.0.0` ```markdown ## [1.0.0] ### Added - Add `ConfigRegistryControllerStateChangedEvent` (`ConfigRegistryController:stateChanged`) to the controller's events ([MetaMask#9595](MetaMask/core#9595)) - Add `ConfigRegistryController.getNetworkConfigByCaip2ChainId` method to retrieve a network config by its CAIP-2 chain ID ([MetaMask#9597](MetaMask/core#9597), [MetaMask#9606](MetaMask/core#9606)) - The method returns the network config if found, or `undefined` if not found. - The method is also accessible via the controller's messenger as `ConfigRegistryController:getNetworkConfigByCaip2ChainId`. ### Changed - **BREAKING:** `ConfigRegistryControllerState.configs.networks` is now a `Record<Caip2ChainId, RegistryNetworkConfig>` instead of a `Record<string, RegistryNetworkConfig>` ([MetaMask#9606](MetaMask/core#9606)) - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([MetaMask#9074](MetaMask/core#9074)) - Bump `@metamask/controller-utils` from `^12.1.1` to `^12.3.0` ([MetaMask#9083](MetaMask/core#9083), [MetaMask#9218](MetaMask/core#9218)) - Bump `@metamask/profile-sync-controller` from `^28.1.1` to `^28.3.0` ([MetaMask#9119](MetaMask/core#9119), [MetaMask#9463](MetaMask/core#9463)) - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([MetaMask#9129](MetaMask/core#9129)) - Bump `@metamask/polling-controller` from `^16.0.6` to `^16.0.8` ([MetaMask#9218](MetaMask/core#9218), [MetaMask#9349](MetaMask/core#9349)) - Bump `@metamask/messenger` from `^1.2.0` to `^2.0.0` ([MetaMask#9392](MetaMask/core#9392)) ### Removed - **BREAKING:** Removed `ConfigRegistryControllerStateChangeEvent` type in favor of `ConfigRegistryControllerStateChangedEvent` ([MetaMask#9595](MetaMask/core#9595)) ``` ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Related: https://consensyssoftware.atlassian.net/browse/WPN-1710 ## **Manual testing steps** 1. Verify the network switching and asset polling work same as before ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Popular-network behavior now depends on config registry state at runtime; incorrect messenger wiring would break network enablement, but the change is limited to dependency versions and one delegate action. > > **Overview** > Bumps **`@metamask/network-enablement-controller`** to `^6.0.0` and **`@metamask/config-registry-controller`** to `^1.0.0`, with lockfile updates. > > Wires **`NetworkEnablementController`** to the config registry by delegating **`ConfigRegistryController:getState`** on its messenger so v6 can use registry data for popular-network classification. > > Config-registry selector tests now build mock registry entries with the **`RegistryNetworkConfig`** type instead of untyped inline objects, matching the v1 typed `configs.networks` shape. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1ddf8cd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
n3ps
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Aug 5, 2026
…er` (#44766) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ~~Using preview build from MetaMask/core#9611 Bumping `@metamask/network-enablement-controller` to `^6.0.0` ```markdown ## [6.0.0] ### Added - Expose missing public `NetworkEnablementController` method through its messenger ([#9660](MetaMask/core#9660)) - The following action is now available: - `NetworkEnablementController:restoreEnabledNetworkMap` - Corresponding action type (`NetworkEnablementControllerRestoreEnabledNetworkMapAction`) is available as well. ### Changed - **BREAKING:** Popular-network classification is now augmented by `ConfigRegistryController` ([#9611](MetaMask/core#9611)) - `NetworkEnablementControllerMessenger` now requires the `ConfigRegistryController:getState` action to be available. - Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.3.0` ([#9568](MetaMask/core#9568), [#9589](MetaMask/core#9589), [#9593](MetaMask/core#9593), [#9693](MetaMask/core#9693)) - Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](MetaMask/core#9676)) - Bump `@metamask/config-registry-controller` from `^0.4.1` to `^1.0.0` ([#9706](MetaMask/core#9706)) ``` and `@metamask/config-registry-controller` to `^1.0.0` ```markdown ## [1.0.0] ### Added - Add `ConfigRegistryControllerStateChangedEvent` (`ConfigRegistryController:stateChanged`) to the controller's events ([#9595](MetaMask/core#9595)) - Add `ConfigRegistryController.getNetworkConfigByCaip2ChainId` method to retrieve a network config by its CAIP-2 chain ID ([#9597](MetaMask/core#9597), [#9606](MetaMask/core#9606)) - The method returns the network config if found, or `undefined` if not found. - The method is also accessible via the controller's messenger as `ConfigRegistryController:getNetworkConfigByCaip2ChainId`. ### Changed - **BREAKING:** `ConfigRegistryControllerState.configs.networks` is now a `Record<Caip2ChainId, RegistryNetworkConfig>` instead of a `Record<string, RegistryNetworkConfig>` ([#9606](MetaMask/core#9606)) - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](MetaMask/core#9074)) - Bump `@metamask/controller-utils` from `^12.1.1` to `^12.3.0` ([#9083](MetaMask/core#9083), [#9218](MetaMask/core#9218)) - Bump `@metamask/profile-sync-controller` from `^28.1.1` to `^28.3.0` ([#9119](MetaMask/core#9119), [#9463](MetaMask/core#9463)) - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](MetaMask/core#9129)) - Bump `@metamask/polling-controller` from `^16.0.6` to `^16.0.8` ([#9218](MetaMask/core#9218), [#9349](MetaMask/core#9349)) - Bump `@metamask/messenger` from `^1.2.0` to `^2.0.0` ([#9392](MetaMask/core#9392)) ### Removed - **BREAKING:** Removed `ConfigRegistryControllerStateChangeEvent` type in favor of `ConfigRegistryControllerStateChangedEvent` ([#9595](MetaMask/core#9595)) ``` ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Related: https://consensyssoftware.atlassian.net/browse/WPN-1710 ## **Manual testing steps** 1. Verify the network switching and asset polling work same as before ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Popular-network behavior now depends on config registry state at runtime; incorrect messenger wiring would break network enablement, but the change is limited to dependency versions and one delegate action. > > **Overview** > Bumps **`@metamask/network-enablement-controller`** to `^6.0.0` and **`@metamask/config-registry-controller`** to `^1.0.0`, with lockfile updates. > > Wires **`NetworkEnablementController`** to the config registry by delegating **`ConfigRegistryController:getState`** on its messenger so v6 can use registry data for popular-network classification. > > Config-registry selector tests now build mock registry entries with the **`RegistryNetworkConfig`** type instead of untyped inline objects, matching the v1 typed `configs.networks` shape. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1ddf8cd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
Bigshmow
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Aug 5, 2026
…er` (#44766) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ~~Using preview build from MetaMask/core#9611 Bumping `@metamask/network-enablement-controller` to `^6.0.0` ```markdown ## [6.0.0] ### Added - Expose missing public `NetworkEnablementController` method through its messenger ([#9660](MetaMask/core#9660)) - The following action is now available: - `NetworkEnablementController:restoreEnabledNetworkMap` - Corresponding action type (`NetworkEnablementControllerRestoreEnabledNetworkMapAction`) is available as well. ### Changed - **BREAKING:** Popular-network classification is now augmented by `ConfigRegistryController` ([#9611](MetaMask/core#9611)) - `NetworkEnablementControllerMessenger` now requires the `ConfigRegistryController:getState` action to be available. - Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.3.0` ([#9568](MetaMask/core#9568), [#9589](MetaMask/core#9589), [#9593](MetaMask/core#9593), [#9693](MetaMask/core#9693)) - Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](MetaMask/core#9676)) - Bump `@metamask/config-registry-controller` from `^0.4.1` to `^1.0.0` ([#9706](MetaMask/core#9706)) ``` and `@metamask/config-registry-controller` to `^1.0.0` ```markdown ## [1.0.0] ### Added - Add `ConfigRegistryControllerStateChangedEvent` (`ConfigRegistryController:stateChanged`) to the controller's events ([#9595](MetaMask/core#9595)) - Add `ConfigRegistryController.getNetworkConfigByCaip2ChainId` method to retrieve a network config by its CAIP-2 chain ID ([#9597](MetaMask/core#9597), [#9606](MetaMask/core#9606)) - The method returns the network config if found, or `undefined` if not found. - The method is also accessible via the controller's messenger as `ConfigRegistryController:getNetworkConfigByCaip2ChainId`. ### Changed - **BREAKING:** `ConfigRegistryControllerState.configs.networks` is now a `Record<Caip2ChainId, RegistryNetworkConfig>` instead of a `Record<string, RegistryNetworkConfig>` ([#9606](MetaMask/core#9606)) - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](MetaMask/core#9074)) - Bump `@metamask/controller-utils` from `^12.1.1` to `^12.3.0` ([#9083](MetaMask/core#9083), [#9218](MetaMask/core#9218)) - Bump `@metamask/profile-sync-controller` from `^28.1.1` to `^28.3.0` ([#9119](MetaMask/core#9119), [#9463](MetaMask/core#9463)) - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](MetaMask/core#9129)) - Bump `@metamask/polling-controller` from `^16.0.6` to `^16.0.8` ([#9218](MetaMask/core#9218), [#9349](MetaMask/core#9349)) - Bump `@metamask/messenger` from `^1.2.0` to `^2.0.0` ([#9392](MetaMask/core#9392)) ### Removed - **BREAKING:** Removed `ConfigRegistryControllerStateChangeEvent` type in favor of `ConfigRegistryControllerStateChangedEvent` ([#9595](MetaMask/core#9595)) ``` ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Related: https://consensyssoftware.atlassian.net/browse/WPN-1710 ## **Manual testing steps** 1. Verify the network switching and asset polling work same as before ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Popular-network behavior now depends on config registry state at runtime; incorrect messenger wiring would break network enablement, but the change is limited to dependency versions and one delegate action. > > **Overview** > Bumps **`@metamask/network-enablement-controller`** to `^6.0.0` and **`@metamask/config-registry-controller`** to `^1.0.0`, with lockfile updates. > > Wires **`NetworkEnablementController`** to the config registry by delegating **`ConfigRegistryController:getState`** on its messenger so v6 can use registry data for popular-network classification. > > Config-registry selector tests now build mock registry entries with the **`RegistryNetworkConfig`** type instead of untyped inline objects, matching the v1 typed `configs.networks` shape. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1ddf8cd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
n3ps
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Aug 6, 2026
…er` (#44766) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ~~Using preview build from MetaMask/core#9611 Bumping `@metamask/network-enablement-controller` to `^6.0.0` ```markdown ## [6.0.0] ### Added - Expose missing public `NetworkEnablementController` method through its messenger ([#9660](MetaMask/core#9660)) - The following action is now available: - `NetworkEnablementController:restoreEnabledNetworkMap` - Corresponding action type (`NetworkEnablementControllerRestoreEnabledNetworkMapAction`) is available as well. ### Changed - **BREAKING:** Popular-network classification is now augmented by `ConfigRegistryController` ([#9611](MetaMask/core#9611)) - `NetworkEnablementControllerMessenger` now requires the `ConfigRegistryController:getState` action to be available. - Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.3.0` ([#9568](MetaMask/core#9568), [#9589](MetaMask/core#9589), [#9593](MetaMask/core#9593), [#9693](MetaMask/core#9693)) - Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](MetaMask/core#9676)) - Bump `@metamask/config-registry-controller` from `^0.4.1` to `^1.0.0` ([#9706](MetaMask/core#9706)) ``` and `@metamask/config-registry-controller` to `^1.0.0` ```markdown ## [1.0.0] ### Added - Add `ConfigRegistryControllerStateChangedEvent` (`ConfigRegistryController:stateChanged`) to the controller's events ([#9595](MetaMask/core#9595)) - Add `ConfigRegistryController.getNetworkConfigByCaip2ChainId` method to retrieve a network config by its CAIP-2 chain ID ([#9597](MetaMask/core#9597), [#9606](MetaMask/core#9606)) - The method returns the network config if found, or `undefined` if not found. - The method is also accessible via the controller's messenger as `ConfigRegistryController:getNetworkConfigByCaip2ChainId`. ### Changed - **BREAKING:** `ConfigRegistryControllerState.configs.networks` is now a `Record<Caip2ChainId, RegistryNetworkConfig>` instead of a `Record<string, RegistryNetworkConfig>` ([#9606](MetaMask/core#9606)) - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](MetaMask/core#9074)) - Bump `@metamask/controller-utils` from `^12.1.1` to `^12.3.0` ([#9083](MetaMask/core#9083), [#9218](MetaMask/core#9218)) - Bump `@metamask/profile-sync-controller` from `^28.1.1` to `^28.3.0` ([#9119](MetaMask/core#9119), [#9463](MetaMask/core#9463)) - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](MetaMask/core#9129)) - Bump `@metamask/polling-controller` from `^16.0.6` to `^16.0.8` ([#9218](MetaMask/core#9218), [#9349](MetaMask/core#9349)) - Bump `@metamask/messenger` from `^1.2.0` to `^2.0.0` ([#9392](MetaMask/core#9392)) ### Removed - **BREAKING:** Removed `ConfigRegistryControllerStateChangeEvent` type in favor of `ConfigRegistryControllerStateChangedEvent` ([#9595](MetaMask/core#9595)) ``` ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Related: https://consensyssoftware.atlassian.net/browse/WPN-1710 ## **Manual testing steps** 1. Verify the network switching and asset polling work same as before ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Popular-network behavior now depends on config registry state at runtime; incorrect messenger wiring would break network enablement, but the change is limited to dependency versions and one delegate action. > > **Overview** > Bumps **`@metamask/network-enablement-controller`** to `^6.0.0` and **`@metamask/config-registry-controller`** to `^1.0.0`, with lockfile updates. > > Wires **`NetworkEnablementController`** to the config registry by delegating **`ConfigRegistryController:getState`** on its messenger so v6 can use registry data for popular-network classification. > > Config-registry selector tests now build mock registry entries with the **`RegistryNetworkConfig`** type instead of untyped inline objects, matching the v1 typed `configs.networks` shape. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1ddf8cd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Adding
ConfigRegistryController:getNetworkConfigByCaip2ChainIdto make it more ergonomic for other controllers to consume ConfigRegistryController's network configs.References
Checklist
Note
Low Risk
Read-only state lookup with no mutation, polling, or security-sensitive logic; additive API only.
Overview
Adds
getNetworkConfigByCaip2ChainIdso consumers can resolve a network config by CAIP-2 chain ID (e.g.eip155:1) without reading controller state directly. The method returns the matchingRegistryNetworkConfigorundefined.The method is registered in
MESSENGER_EXPOSED_METHODS, so other controllers can callConfigRegistryController:getNetworkConfigByCaip2ChainIdthrough the messenger. Auto-generated method action types and changelog are updated; unit tests cover a hit and a missing chain ID.Reviewed by Cursor Bugbot for commit 318ec0e. Bugbot is set up for automated code reviews on this repo. Configure here.