fix non-evm token type detection#8811
Merged
Merged
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
| const MOCK_TRX_ASSET = 'tron:728126428/slip44:195' as Caip19AssetId; | ||
| const MOCK_SPL_ASSET = | ||
| 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/spl:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' as Caip19AssetId; | ||
| 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' as Caip19AssetId; |
Contributor
There was a problem hiding this comment.
Just making sure. There was an ADR around the naming standardisation for solana
https://github.com/MetaMask/decisions/pull/170/changes
Contributor
Author
There was a problem hiding this comment.
I don't know what the long term plan is, but our APIs are currently returning those assetIds with the token namespace, not spl.
When we determine the type, we assume erc20, and change it to native or spl depending on conditions. I just changed the conditions to make them work to what we currently receive from the API.
Prithpal-Sooriya
approved these changes
May 14, 2026
GeorgeGkas
approved these changes
May 14, 2026
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
Currently, all non-evm tokens are being stored as 'erc20', which is wrong. It is not causing any issues in the client, but needs to be corrected.
This fixes it.
References
Checklist
Note
Medium Risk
Adjusts asset-type classification logic used to populate
assetsInfo, which could affect downstream rendering/formatting for non-EVM assets if CAIP-19 parsing assumptions are wrong, but scope is limited and covered by updated unit tests.Overview
Fixes incorrect
assetsInfo.typeclassification for non-EVM assets by treating any CAIP-19*/slip44:*identifier asnative(noterc20), and by recognizing Solana SPL tokens assplwhen the chain namespace is Solana and the asset namespace istoken.Updates both the token-metadata transform (
TokenDataSource) and theaddCustomAssetpending-metadata path (AssetsController) to use the same namespace-aware rules, exports the sharedCaipAssetNamespaceenum, and refreshes docs/tests (including switching examples/fixtures fromsolana:.../spl:tosolana:.../token:).Reviewed by Cursor Bugbot for commit fe92f4b. Bugbot is set up for automated code reviews on this repo. Configure here.