Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 41acf1e. Configure here.
| // Check map of validated tokens (cache keys are lowercase) | ||
| const tokenData = | ||
| this.#tokensChainsCache[chainId]?.data?.[lowercaseTokenAddress]; | ||
|
|
There was a problem hiding this comment.
Raw v3 API data missing icon proxy and aggregator formatting
Medium Severity
The old code read token data from tokensChainsCache, where iconUrl had been replaced by formatIconUrlWithProxy (producing a proxy URL like https://static.cx.metamask.io/api/v1/tokenIcons/{chainId}/{address}.png) and aggregators had been run through formatAggregatorNames. The new fetchVerifiedTokensByAddresses call returns raw v3 API data with neither transformation applied. This means the image field on detected tokens will contain whatever raw URL the v3 API returns instead of the expected proxy URL, and aggregators will contain raw API keys instead of formatted display names.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 41acf1e. Configure here.


Explanation
References
Checklist
Note
Medium Risk
Changes token detection/enrichment data sources and caching behavior, which can affect which tokens are auto-added and when metadata appears; also introduces new external API calls and filtering logic that could impact detection rates if the v3 endpoint/threshold behaves unexpectedly.
Overview
Token detection via WS/polling now fetches ERC-20 metadata directly from the v3 Tokens API (
tokens-api-v3.ts) instead of relying onTokenListController’stokensChainsCache, and filters out unverified tokens using an occurrences threshold (spam prevention).TokenListControllerstops persisting/loadingtokensChainsCachefor Accounts API v4-supported chains (including purging any stale persisted entries), publishes a newTokenListController:tokenListFetchedevent with the processed token list, and always treats the cache as invalid for those chains.TokensControllerswitches from enriching token state onTokenListController:stateChangeto enriching only whentokenListFetchedfires, via a dedicated#enrichTokensFromTokenListhelper.Reviewed by Cursor Bugbot for commit 41acf1e. Bugbot is set up for automated code reviews on this repo. Configure here.