-
-
Notifications
You must be signed in to change notification settings - Fork 256
feat: support adding non-evm tokens #7016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
bergarces
reviewed
Oct 31, 2025
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
salimtb
reviewed
Oct 31, 2025
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
bergarces
previously approved these changes
Oct 31, 2025
bergarces
reviewed
Nov 3, 2025
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
bergarces
previously approved these changes
Nov 3, 2025
Prithpal-Sooriya
previously approved these changes
Nov 3, 2025
…e to case insensiteivity
…-EVM account creation (#7000) ## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References Related to [MUL-1222](https://consensyssoftware.atlassian.net/browse/MUL-1222), [MUL-1221](https://consensyssoftware.atlassian.net/browse/MUL-1221) ## 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 - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes [MUL-1222]: https://consensyssoftware.atlassian.net/browse/MUL-1222?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds per-provider concurrency limits for non-EVM account creation (Solana defaults to 3), refactors creation flow to optionally await/aggregate errors, and updates providers/tests accordingly. > > - **Core** > - Introduce `withMaxConcurrency` in `SnapAccountProvider` using a semaphore; add optional `maxConcurrency` to `SnapAccountProviderConfig`. > - Add `toRejectedErrorMessage` util and factor non‑EVM creation into `MultichainAccountWallet.#createNonEvmAccounts`, supporting await-all with aggregated errors and background mode logging. > - Forward optional `providerConfigs` safely (`?.`) and allow Solana-specific config (including `maxConcurrency`). > - **Providers** > - Update `SolAccountProvider`, `BtcAccountProvider`, and `TrxAccountProvider` to use `SnapAccountProviderConfig` and throttle `createAccounts` via `withMaxConcurrency`. > - Default Solana `maxConcurrency: 3`; others unthrottled by default. > - **Tests** > - Add concurrency tests for `SnapAccountProvider`. > - Update wallet tests to verify aggregated non‑EVM failures when awaiting all and provider config forwarding. > - **Docs** > - Update `CHANGELOG.md` with new throttling behavior and defaults. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6e21486. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [MUL-1221]: https://consensyssoftware.atlassian.net/browse/MUL-1221?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…in controller exports ## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Updates Subscription Controller exports. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] 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/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Exports `SubscriptionControllerSubmitSponsorshipIntentsAction` and `SubmitSponsorshipIntentsMethodParams`, and updates the changelog accordingly. > > - **Subscription Controller exports**: > - Add `SubscriptionControllerSubmitSponsorshipIntentsAction` to `src/index.ts`. > - Add `SubmitSponsorshipIntentsMethodParams` to `src/index.ts`. > - **Docs**: > - Update `CHANGELOG.md` to note the new `SubscriptionControllerSubmitSponsorshipIntentsAction` export. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e8e08ff. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Minor release of `@metamask/multichain-account-service`. Changelog: ```md ### Added - Add per-provider throttling for non-EVM account creation to improve performance on low-end devices ([#7000](#7000)) - Solana provider is now limited to 3 concurrent account creations by default when creating multichain account groups. - Other providers remain unthrottled by default. ``` Mobile test-drive PR: MetaMask/metamask-mobile#21905 (QA'd ✅ ) ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publish @metamask/multichain-account-service 2.1.0 adding per-provider throttling (Solana capped at 3 concurrent) and update dependents; bump monorepo to 657.0.0. > > - **multichain-account-service (`packages/multichain-account-service`)**: > - Release `2.1.0` with per-provider throttling for non-EVM account creation. > - Solana provider limited to 3 concurrent creations by default. > - Update `CHANGELOG.md` and version references. > - **Dependents**: > - Bump `@metamask/multichain-account-service` devDependency to `^2.1.0` in `packages/account-tree-controller` and `packages/assets-controllers`. > - **Repo**: > - Bump monorepo version to `657.0.0`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b4773ca. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> - Updates DeFiPositionsController to only update the selected EVM account - Adds timeout & retry mechanism - Fixes issue with DeFi polling starting before onboarding due to subscription to `KeyringController:unlocked` event Draft PR for extension: MetaMask/metamask-extension#37215 Draft PR for mobile: MetaMask/metamask-mobile#21657 <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Related to https://consensyssoftware.atlassian.net/browse/ASSETS-1238 - [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 - [X] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [X] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Updates DeFi positions to only refresh the selected EVM address, gates updates on relevant events, and adds an 8s timeout with a single retry to the API fetch. > > - **DeFiPositionsController** > - Refreshes DeFi positions for only the selected EVM account (`_executePoll`, `#updateAccountPositions`). > - Replaces AccountsController dependencies with `AccountTreeController:getAccountsFromSelectedAccountGroup` to derive selected EVM address. > - Event changes: > - Stops polling on `KeyringController:lock` (unchanged). > - Removes `KeyringController:unlock` and `AccountsController:accountAdded` listeners. > - Adds `AccountTreeController:selectedAccountGroupChange` to refresh selected address. > - `TransactionController:transactionConfirmed` now updates only if it matches the selected address. > - **Fetch behavior** > - `fetch-positions`: wraps API call with `timeoutWithRetry` (8s timeout, 1 retry). > - Adds `utils/timeout-with-retry` with unit tests. > - **Tests** > - Update unit tests to new selected-account-only behavior and new events. > - **Changelog** > - Documents breaking changes to events/behavior and new timeout+retry. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fe03293. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Currently, non-evm native assets were identified by a static list. With this change, they will be identified when using `slip44` as part of the asset namespace, instead of `token`. <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> - [ ] I've updated the test suite for new or updated code as appropriate - [ ] 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/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Infer `isNative` for non‑EVM assets from `slip44` namespace and export `AssetsByAccountGroup` type. > > - **Selectors** > - Update `selectAllMultichainAssets` in `selectors/token-selectors.ts` to set `isNative` when `caipAsset.assetNamespace === 'slip44'` (remove static `MULTICHAIN_NATIVE_ASSET_IDS`). > - **Exports** > - Export `AssetsByAccountGroup` from `selectors/token-selectors` via `src/index.ts`. > - **Docs** > - Update `CHANGELOG.md` for the new export and `isNative` detection change. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f2bf02b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
be8c8a0
Prithpal-Sooriya
approved these changes
Nov 3, 2025
This was referenced Nov 6, 2025
github-merge-queue bot
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Nov 7, 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 is crucial for improving user experience by allowing users to hide unwanted tokens, especially in light of spam and malicious token issues. The problem is that 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-EVM tokens to your wallet. In order to get this done the following PR has been merged into Core: - Support for adding non-evm tokens [here](MetaMask/core#7016) Furthermore, this PR improves the UI experience for importing tokens and aligns with the current implementation design on mobile **NOTE**: to keep this PR as small as possible the token hiding feature will be aded in [this](#37423) upcoming PR <!-- 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/37501?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 importing 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/9eb0a52e-1e20-433a-ae6d-2f52cec47866 ### **After** https://github.com/user-attachments/assets/da64d359-894d-4cd0-b781-7f7e89ca6f1a ## **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 non‑EVM token import support via multichain assets, revamps the Import Tokens modal, and updates tests and mocks accordingly. > > - **Multichain/Backend**: > - Add `multichainAddAssets(assetIds, accountId)` action and wire through `metamask-controller` to `multichainAssetsController.addAssets`. > - **Import Tokens UI/Logic**: > - Rework `ImportTokensModal` to support EVM and non‑EVM chains (network selection, loading/unsupported states, tab visibility, exchange rates fetch by selected network). > - Use `useTokensWithFiltering` for token search; pass explicit `chainId` to `TokenSearch`. > - Enable tokens link on non‑EVM account overview. > - **Token List**: > - Update `TokenList` to detect already‑added non‑EVM assets via `accountsAssets` and `toAssetId`; remove reliance on current-network badge logic. > - Update container to supply `accountsAssets` (instead of selected account address). > - **E2E/Unit Tests**: > - Add/adjust tests for non‑EVM flows, modal states, and token list; update page objects and mocks (Bridge API endpoints for multiple networks); minor wait stability tweaks. > - **Localization**: > - Remove deprecated warning/setting strings across locales (e.g., `customTokenWarningInNonTokenDetectionNetwork`, `inYourSettings`, `tokenScamSecurityRisk`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4b25aae. 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>
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>
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>
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 now available for NON-EVM assets but there is no way to bring the assets back. This task involves implementing a token import feature for non-EVM assets. This is crucial for improving user experience by allowing users to import. The implementation should be prioritized to align with upcoming Solana campaigns.
Also this PR solves an existing issue where ignored tokens cannot be added back through the "Custom" tokens flow:
Screen.Recording.2025-11-03.at.16.40.25.mov
References
https://consensyssoftware.atlassian.net/browse/ASSETS-1425
Checklist
Note
Adds
MultichainAssetsController.addAssetsfor non‑EVM assets, ensures balances default to 0 for newly added assets without snap balances, and fixes case-insensitive ignored token re-add; updates tests and changelog.addAssetsaction/method to add multiple non‑EVMCaipAssetTypeassets; validates same-chain, refreshes metadata, updatesstate.accountsAssets, removes fromallIgnoredAssets, and publishesaccountAssetListUpdated.MultichainAssetsController:addAssetshandler; updates action types.accountAssetListUpdated, sets balance to{ amount: '0', unit: '' }for newly added assets missing from snap response.allIgnoredTokenswhen re‑adding tokens even if address case differs; normalize withtoChecksumHexAddressfor dedupe/filtering inaddTokens.addAssetsAPI and the case-insensitive ignored token fix.Written by Cursor Bugbot for commit 6b72b0d. This will update automatically on new commits. Configure here.