Conversation
209e095 to
c5f25f9
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
e3cddf0 to
212d43f
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…ient for token detection
- TokenDetector now fetches token lists directly from the Tokens API
(/v3/chains/{chain}/assets) via TokensApiClient instead of reading
from TokenListController:getState
- Remove TokenDetectorMessenger type; constructor now takes TokensApiClient
as second argument
- RpcDataSource creates a TokensApiClient instance and passes it to
TokenDetector; removes the tokenDetectorMessenger adapter
- Remove #getTokenMetadataFromTokenList from RpcDataSource — unknown
ERC-20 metadata is omitted until TokenDataSource enriches it downstream
- Remove GetTokenListState from RpcDataSourceAllowedActions and
AssetsControllerAllowedActions; TokenListController:getState is no
longer called anywhere in RpcDataSource
- Update all tests to mock TokensApiClient instead of messenger state
212d43f to
2de4fb1
Compare
packages/assets-controller/src/data-sources/evm-rpc-services/services/TokenDetector.ts
Show resolved
Hide resolved
packages/assets-controller/src/data-sources/evm-rpc-services/services/TokenDetector.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 06272c1. Configure here.
packages/assets-controller/src/data-sources/evm-rpc-services/clients/TokensApiClient.ts
Show resolved
Hide resolved
| const TOKENS_API_BASE_URL = 'https://tokens.api.cx.metamask.io/v3/chains'; | ||
|
|
||
| /** How many tokens to request from the API per chain. */ | ||
| const TOKENS_API_FIRST = 25; |
There was a problem hiding this comment.
we now auto-detect only the top 25 assets when using the RPC fetcher, which significantly reduces latency in the RPC token detection process.
| TokenDetectionOptions, | ||
| TokenDetectionResult, | ||
| TokenListEntry, | ||
| TokenListState, |
There was a problem hiding this comment.
TokenList has been replaced by 1 single time fecth to token api top assets

Explanation
References
Checklist
Note
Medium Risk
Changes token detection and RPC metadata behavior by replacing
TokenListController:getStatewith live Tokens API fetches (with caching/fallback), which can affect detected tokens and metadata availability when the API is slow or unavailable.Overview
Token detection now pulls its token list from the Tokens API instead of
TokenListController.TokenDetectortakes a newTokensApiClient, fetches/v3/chains/{chain}/assets, caches results per chain, and falls back to stale cache on API errors (logging failures).RpcDataSourceandAssetsControllerdropTokenListController:getStatefrom allowed actions and remove token-list-based ERC-20 metadata fallbacks; unknown ERC-20s are omitted fromassetsInfountil downstream enrichment. Tests/fixtures are updated accordingly, and a newTokensApiClient(plus unit tests) is added and exported.Reviewed by Cursor Bugbot for commit 9baa7da. Bugbot is set up for automated code reviews on this repo. Configure here.