Repository navigation
feat: support ignoring non-evm tokens - #6981
Merged
Merged
Conversation
juanmigdr
marked this pull request as ready for review
October 29, 2025 15:55
juanmigdr
enabled auto-merge (squash)
October 29, 2025 16:39
bergarces
approved these changes
Oct 29, 2025
This was referenced Nov 6, 2025
github-merge-queue Bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Nov 10, 2025
<!-- 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** The feature to hide tokens is available for EVM assets but not for non-EVM assets. This task involves implementing a similar token hiding feature for non-EVM assets. This is crucial for improving user experience by allowing users to hide unwanted tokens, especially in light of spam and malicious token issues. The implementation should be prioritized to align with upcoming Solana campaigns. Furthermore, having the possibility of hiding tokens is not great if you cannot add tokens back. Therefore I have implemented the whole logic to add non-VEVM tokens to your wallet and remove them from ignored tokens list. In order to get this done the following PRs have been merged into Core: - Support for adding non-evm tokens [here](MetaMask/core#7016) - Support for ignoring non-evm tokens [here](MetaMask/core#6981) Furthermore this PR solves a couple of bugs: - Flashy behavior on the import token header when opening import token screen - Already added tokens could be re-added which was incorrect, they have been disabled now <!-- 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? --> ## **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: support importing and ignoring non-evm tokens ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1425 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/77de0410-53b3-43cc-a6e4-2951db6b2b32 ### **After** https://github.com/user-attachments/assets/629c34bd-e0a9-4eef-bf3c-ec03be874b1a ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/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] > Enables importing and hiding non‑EVM tokens, updates Add Asset/search UI to work across EVM/non‑EVM networks, and improves token removal, explorer links, and already‑added token handling. > > - **Non‑EVM token support**: > - Add tokens via `MultichainAssetsController.addAssets` in `SearchTokenAutocomplete`; retain EVM via `TokensController.addTokens`. > - New `removeNonEvmToken` util to hide non‑EVM tokens; integrate in `Tokens` and `AssetOptions`. > - Disable re‑adding already‑added tokens (EVM via `selectTokensByChainIdAndAddress`, non‑EVM via `selectMultichainAssets`). > - **Add Asset flow**: > - Use `useTopTokens` to source token lists; show loading state; only fetch token list for EVM. > - Render custom Token/NFT tabs only on EVM networks; support non‑EVM search/import. > - Network selector filters to EVM when not adding tokens. > - **Search and lists**: > - Refactor `AssetSearch` to `useTokenSearch` with `allTokens` prop and debounced updates. > - `MultiAssetListItems` switches to `FlashList`, shows network badges, and disables already‑added tokens. > - **Navigation/UI**: > - Update Import screens to use `getImportTokenNavbarOptions` (BottomSheetHeader). > - Enable "Add token" button on non‑EVM networks in `TokenListControlBar`. > - **Asset details**: > - `AssetOptions` handles CAIP addresses for explorers, hides "Remove token" for native/wSOL, and supports non‑EVM removal with notifications/metrics. > - `ConfirmAddAsset` balances support non‑EVM addresses (hexified), and header updated. > - **Tests**: > - Extensive unit/snapshot updates for new behaviors across search, add, list, confirm, tokens, and asset options. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f43d635. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Kylan Hurt <6249205+smilingkylan@users.noreply.github.com> Co-authored-by: Luis Taniça <matallui@gmail.com> Co-authored-by: Caainã Jeronimo <caainaje@gmail.com> Co-authored-by: Kevin Bluer <kevin@bluer.com>
7 tasks
github-merge-queue Bot
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Nov 10, 2025
<!-- 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** The feature to hide tokens is available for EVM assets but not for non-EVM assets. This task involves implementing a similar token hiding feature for non-EVM assets. This is crucial for improving user experience by allowing users to hide unwanted tokens, especially in light of spam and malicious token issues. The implementation should be prioritized to align with upcoming Solana campaigns. In order to get this done the following PRs have been merged: - Support for ignoring non-evm tokens in core [here](MetaMask/core#6981) - Support for importing non-evm tokens in Extension [here](#37501) <!-- 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? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/37423?quickstart=1) ## **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: support ignoring non-evm tokens ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1425 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/acdaf634-dee2-418a-bf8f-23c5832b9d53 ### **After** https://github.com/user-attachments/assets/512bcae8-d326-4987-8345-577207c69375 <!-- [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] > Adds support to hide/ignore non‑EVM assets via multichain API, passes chainId for EVM token hides, removes isEvm prop from asset options, and bumps assets controller. > > - **Multichain/Background**: > - Add `getApi()` method `multichainIgnoreAssets(assetIds, accountId)` delegating to `MultichainAssetsController.ignoreAssets`. > - **UI**: > - Update `HideTokenConfirmationModal` to: > - Detect non‑EVM chains and dispatch `multichainIgnoreAssets([address], accountId)`. > - For EVM, dispatch `ignoreTokens` with `networkClientId` and `chainId`. > - Use selector `getInternalAccountBySelectedAccountGroupAndCaip` to resolve account for non‑EVM. > - Simplify `AssetOptions`: > - Remove `isEvm` prop and logic; show Hide option whenever `!isNativeAsset`. > - Adjust `native-asset.tsx` and `token-asset.tsx` to stop passing `isEvm` to `AssetOptions`. > - **Store/Actions**: > - Add thunk `multichainIgnoreAssets(assetIds, accountId)`; keep `ignoreTokens` flow for EVM, now provided `chainId` from UI. > - **Tests**: > - Update `hide-token-confirmation-modal` tests to assert `chainId` passed to `ignoreTokens` and existing flows. > - **Dependencies**: > - Bump `@metamask/assets-controllers` to `^87.1.1`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 731f870. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Bernardo Garces Chapero <bernardo.chapero@consensys.net>
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
The feature to hide tokens is available for EVM assets but not for non-EVM assets. This task involves implementing a similar token hiding feature for non-EVM assets. This is crucial for improving user experience by allowing users to hide unwanted tokens, especially in light of spam and malicious token issues. The implementation should be prioritized to align with upcoming Solana campaigns.
NOTE:
References
https://consensyssoftware.atlassian.net/browse/ASSETS-1425
Checklist
Note
Introduce
allIgnoredAssetsandignoreAssetsin MultichainAssetsController and filter ignored non-EVM assets in selectors and balance calculations.allIgnoredAssetsto state and default metadata; clean up on account removal.ignoreAssets(accountId, assets); register handler and expose via messenger.accountAssetListUpdatedhandling.#isAssetIgnoredand related tests.src/balances.ts):MultichainAssetsControllerStatein calculators; excludeallIgnoredAssetsfrom non‑EVM balance totals and change calculations.selectors/token-selectors.ts):AssetListStatewithallIgnoredAssets; omit ignored multichain assets inselectAllMultichainAssets.ignoreAssetsfor non‑EVM chains.Written by Cursor Bugbot for commit 0846036. This will update automatically on new commits. Configure here.