…llet 21 (MetaMask#47744)
## **Description**
`@metamask/wallet` 21.0.0 now constructs `NetworkEnablementController`
(NEC) itself, together with its messenger. This PR bumps
`@metamask/wallet` to `^21.0.0` and
`@metamask/network-enablement-controller` to `^7.1.0`, and switches the
extension to use the wallet-owned instance (ASSETS-4169).
- Removes the legacy `messenger-client-init` NEC init and its messenger
factory.
- `metamask-controller.js` now gets the controller through
`this.wallet.getInstance('NetworkEnablementController')`. Persistence is
unchanged because the instance is already in the explicit store maps.
- Adds `app/scripts/wallet-init/network-enablement-controller.ts`
(`setupNetworkEnablementController`). It holds the client-side behaviour
that was previously in the init:
- Re-runs `init()` once `MultichainNetworkController` is registered. The
`init()` call made by `Wallet.init()` cannot read it yet, and that error
is swallowed.
- On a fresh install with no persisted `enabledNetworkMap`, enables all
popular networks, or localhost when `IN_TEST` is set.
- When a Config Registry auto-enabled network is added, restores the
previous enabled-network map so the user's selection doesn't change.
- Keeps the existing Solana account-change and account-group-change
handlers.
- Adds a dedicated init messenger in `wallet-init/messengers` that
delegates only the actions and events the setup needs.
Note: on a fresh install the NEC map now starts from NEC's default keys
(for example Sei and Monad) rather than only the configured networks.
After `enableAllPopularNetworks()` the enabled set is the same as
before.
Related work:
- MetaMask#47487 (Sentinel API service). Wallet 21 also delegates
`SentinelApiService:simulateTransactions` to `TransactionController`.
That has no effect here because `TransactionController` stays pinned to
72.3.0, so Sentinel adoption is left to that PR.
- MetaMask#47269 (AssetsController via wallet) touches the same wallet-init
area.
- Mobile counterpart: MetaMask/metamask-mobile#39132.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
[ASSETS-4169](https://consensyssoftware.atlassian.net/browse/ASSETS-4169)
## **Manual testing steps**
1. Build and load the extension, then create a new wallet.
2. Open the network filter on the home page and verify that all popular
networks are enabled.
3. Select a single network in the filter, then lock and reload the
extension. Verify the single-network selection is kept.
4. Add a network that the Config Registry auto-enables (for example from
the network list). Verify the network filter selection does not change.
5. Upgrade an existing profile from `main` to this build. Verify its
previous network selection is kept.
<!--
## **Screenshots/Recordings**
### **Before**
### **After**
-->
## **Pre-merge author checklist**
- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] 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.
[ASSETS-4169]:
https://consensyssoftware.atlassian.net/browse/ASSETS-4169?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes wallet initialization order and default network-filter
behavior on fresh installs and during auto-enabled network adds;
regressions would affect which networks users see across the extension.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5a1c852. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## **Description**
`@metamask/wallet` 21.0.0 now constructs `NetworkEnablementController`
(NEC) itself, together with its messenger. This PR bumps
`@metamask/wallet` to `^21.0.0` and
`@metamask/network-enablement-controller` to `^7.1.0`, and switches the
extension to use the wallet-owned instance (ASSETS-4169).
- Removes the legacy `messenger-client-init` NEC init and its messenger
factory.
- `metamask-controller.js` now gets the controller through
`this.wallet.getInstance('NetworkEnablementController')`. Persistence is
unchanged because the instance is already in the explicit store maps.
- Adds `app/scripts/wallet-init/network-enablement-controller.ts`
(`setupNetworkEnablementController`). It holds the client-side behaviour
that was previously in the init:
- Re-runs `init()` once `MultichainNetworkController` is registered. The
`init()` call made by `Wallet.init()` cannot read it yet, and that error
is swallowed.
- On a fresh install with no persisted `enabledNetworkMap`, enables all
popular networks, or localhost when `IN_TEST` is set.
- When a Config Registry auto-enabled network is added, restores the
previous enabled-network map so the user's selection doesn't change.
- Keeps the existing Solana account-change and account-group-change
handlers.
- Adds a dedicated init messenger in `wallet-init/messengers` that
delegates only the actions and events the setup needs.
Note: on a fresh install the NEC map now starts from NEC's default keys
(for example Sei and Monad) rather than only the configured networks.
After `enableAllPopularNetworks()` the enabled set is the same as
before.
LavaMoat webpack policies are intentionally unchanged. Regenerating them
for wallet 21 and network-enablement-controller 7.1 (`@metamaskbot
update-policies` or `yarn lavamoat:auto`) is left out of this PR, so the
LavaMoat policy checks are expected to fail until that follow-up.
Related work:
- MetaMask#47487 (Sentinel API service). Wallet 21 also delegates
`SentinelApiService:simulateTransactions` to `TransactionController`.
That has no effect here because `TransactionController` stays pinned to
72.3.0, so Sentinel adoption is left to that PR.
- MetaMask#47269 (AssetsController via wallet) touches the same wallet-init
area.
- Mobile counterpart: MetaMask/metamask-mobile#39132.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
[ASSETS-4169](https://consensyssoftware.atlassian.net/browse/ASSETS-4169)
## **Manual testing steps**
1. Build and load the extension, then create a new wallet.
2. Open the network filter on the home page and verify that all popular
networks are enabled.
3. Select a single network in the filter, then lock and reload the
extension. Verify the single-network selection is kept.
4. Add a network that the Config Registry auto-enables (for example from
the network list). Verify the network filter selection does not change.
5. Upgrade an existing profile from `main` to this build. Verify its
previous network selection is kept.
<!--
## **Screenshots/Recordings**
### **Before**
### **After**
-->
## **Pre-merge author checklist**
- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
[ASSETS-4169]:
https://consensyssoftware.atlassian.net/browse/ASSETS-4169?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_AGENT_PR_BODY_END -->
<div><a
href="https://cursor.com/agents/bc-fc07b32c-7a00-448e-8948-e163799bd337?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a
href="https://cursor.com/background-agent?bcId=bc-fc07b32c-7a00-448e-8948-e163799bd337&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
Co-authored-by: Xiaoming Wang <dawnseeker8@users.noreply.github.com>
Description
Adopts MetaMask/core#9476. With it,
TransactionControllersends all Sentinel simulation requests through theSentinelApiService:simulateTransactionsmessenger action.@metamask/transaction-controllerfrom72.3.0to^73.1.2.@metamask/wallet@21.0.0already delegatesSentinelApiService:simulateTransactionsto theTransactionControllermessenger.getSimulationConfignow returns only{ newUrl }.SentinelApiServiceadds the bearer token itself viaAuthenticationController:getBearerToken.SentinelApiServiceis already registered on the root messenger, so no further wiring is needed.Changelog
CHANGELOG entry: null
Related issues
Refs: MetaMask/core#9476
Manual testing steps
Authorizationheader.Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes transaction simulation wiring and Shield gateway config shape during signing; dependency bump affects a core controller path.
Overview
Upgrades
@metamask/transaction-controllerto ^73.1.2 so Sentinel simulation runs throughSentinelApiService:simulateTransactionsinstead of the controller callingfetchdirectly.getSimulationConfigin wallet init now returns only{ newUrl }from Shield gateway resolution; bearer tokens are no longer passed through this hook because the new service obtains them viaAuthenticationController:getBearerToken. A unit test asserts that behavior.LavaMoat policies are updated for the new dependency graph (
@metamask/sentinel-api-service, tighteruuidcrypto globals, nofetchon@metamask/transaction-controller). E2E simulation mocks use request id1instead of0to match the updated simulation RPC flow.Reviewed by Cursor Bugbot for commit 6eead18. Bugbot is set up for automated code reviews on this repo. Configure here.