Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
Ignoring alerts on:
|
|
@SocketSecurity ignore npm/@metamask/gas-fee-controller@26.0.1 This is a MetaMask-owned package ( |
Builds ready [bafa023]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [464b89d]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
✨ Files requiring CODEOWNER review ✨🕵️ @MetaMask/extension-privacy-reviewers (1 files, +1 -0)
📜 @MetaMask/policy-reviewers (5 files, +179 -5)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🧪 @MetaMask/qa (1 files, +1 -0)
🔄 @MetaMask/swaps-engineers (1 files, +1 -0)
|
Builds ready [914ca1c]
UI Startup Metrics (1268 ± 122 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
) ## Explanation ### Current State The `NetworkEnablementController` tracks which networks are enabled/disabled but lacks information about the native asset identifier for each chain. This information is needed to properly identify native assets across different blockchain networks using a standardized format. Extension UI PR: MetaMask/metamask-extension#39234 ### Solution This PR adds a new state property `nativeAssetIdentifiers` to the `NetworkEnablementController` that maps CAIP-2 chain IDs to CAIP-19-like native asset identifiers. For example: - `eip155:1` → `eip155:1/slip44:60` (Ethereum uses ETH, SLIP-44 coin type 60) - `eip155:56` → `eip155:56/slip44:714` (BSC uses BNB, SLIP-44 coin type 714) - `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` → `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501` ### Implementation Details 1. **New `Slip44Service`**: A service that wraps the `@metamask/slip44` package to look up SLIP-44 coin types by symbol (e.g., `ETH` → `60`, `BTC` → `0`). 2. **State Updates**: The `nativeAssetIdentifiers` state is automatically updated when: - A network is added (`NetworkController:networkAdded`) - A network is removed (`NetworkController:networkRemoved`) - A network's native currency symbol is changed (`NetworkController:stateChange`) 3. **Default State**: Popular networks are pre-populated with their correct native asset identifiers based on their native currency symbols. 4. **Graceful Handling**: If a symbol has no SLIP-44 mapping, the entry is removed from the state rather than storing an invalid identifier. ### Dependency Addition Added `@metamask/slip44` package to dynamically look up SLIP-44 coin types instead of hardcoding them, ensuring accuracy and maintainability. ## References - [SLIP-44 Standard](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) - [CAIP-2 Chain ID Specification](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md) - [CAIP-19 Asset Identifier Specification](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md) - [@metamask/slip44 npm package](https://www.npmjs.com/package/@metamask/slip44) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduces native asset tracking and supporting utilities. > > - Adds `nativeAssetIdentifiers` mapping (CAIP-2 -> `.../slip44:<coinType>`) to `NetworkEnablementController` state and metadata > - New `Slip44Service` (uses `@metamask/slip44` and chainid.network) to resolve coin types by symbol/chainId; exports helpers > - Makes `init()` async and populates EVM identifiers; new `initNativeAssetIdentifiers(networks)` API for bulk initialization > - Updates network lifecycle: on add (async) computes and stores identifier; on remove deletes identifier > - Extends public exports (types, service) and adds `@metamask/slip44` dependency > - Updates/extends tests for controller, selectors, utils, and new service > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f8cdcfc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Description
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2026-01-13.at.15.32.37.mov
Pre-merge author checklist
Pre-merge reviewer checklist