Repository navigation
List each swap token once per chain with its chain's logo - #699
Conversation
The picker showed one listing per symbol. It now lists every priced 1Click listing, one per symbol and chain: each symbol's main listing first, by market cap as before, then its listings on other chains by market cap and chain (Ethereum, Bitcoin, Solana, Tron, BNB Chain, NEAR, Base, Arbitrum, Polygon, Optimism, Avalanche, then the rest). Deprecated listings and a second listing of a symbol on the same chain are left out. Each row shows the token's logo with its chain's logo in the corner and the chain's name under the symbol, and search matches the chain too. Chain logos come from CoinGecko's asset platforms, kept on the device for a week, or for a coin's own chain from the coin; SwapToken names all 36 chains 1Click lists on. A chain without a logo keeps its letter.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Approve
Reviewed head b56a75ef34dd87f64de85b072f8d6539eec7aa53 against base 572e6a5ea76ea9fbb4785debac3c28dcffe5a745.
No blocking findings. The per-chain listings retain their individual asset IDs through selection and quoting, saved addresses remain scoped by network, and the cache schema change avoids reading the old markets payload. The picker search and chain badges reuse the existing swap flow and image cache.
Validation:
- SDK:
flutter test --no-pub test/services/swap_service_test.dart test/services/coin_gecko_service_test.dart test/services/swap_token_icon_service_test.dart— 57 passed. - Mobile:
flutter test --no-pub test/screens/swap_flow_test.dart test/unit/token_icon_test.dart— 35 passed. - A temporary probe using the live CoinGecko platform response confirmed the Bitcoin Cash coin-logo fallback — passed.
- Read-only 1Click listing and CoinGecko platform checks matched the supported chain mappings and duplicate-listing behavior.
- Changed Dart files: formatting passed (15 files, zero changes);
git diff --checkpassed.
Workspace analysis was stopped at the required 10-second limit: cold-wallet and miner analysis completed cleanly, but SDK/mobile analysis remains incomplete. GitHub's Analyze check is still in progress.
|
The chain badge is now half the token icon's diameter on every TokenIcon (picker, swap form, summary, progress), matching Vizor's picker. The badge size is derived from the icon size instead of being passed per call site. |
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Approve
Reviewed head e94d1ad385f9570b81bfd75f943d1946d6de743b against base 572e6a5ea76ea9fbb4785debac3c28dcffe5a745, including both badge-sizing commits.
No blocking findings. Listings remain distinct by asset ID through picker selection and quote requests, and saved addresses remain scoped by network. The main/secondary listing order, duplicate and deprecated filtering, cache schema migration, and shared image cache are consistent with the intended behavior. All TokenIcon callers use the new proportional badge size.
Validation:
- SDK:
flutter test --no-pub --reporter expanded test/services/swap_service_test.dart test/services/coin_gecko_service_test.dart test/services/swap_token_icon_service_test.dart— 57 passed. - Mobile:
flutter test --no-pub --reporter expanded test/screens/swap_flow_test.dart test/unit/token_icon_test.dart— 35 passed again at the latest head, including per-chain search and the parallel CoinGecko timeout behavior. - Changed Dart files:
dart format --output=none --set-exit-if-changed --line-length=120— 18 files checked, zero changes.git diff --checkpassed. - Read-only checks of the 1Click token listing and CoinGecko asset platforms confirmed the supported chain mappings and the USDC/Hypercore duplicate pair.
Workspace analysis via dart run melos exec --concurrency=1 -- "flutter analyze . --fatal-infos" was stopped at the required 10-second limit. Cold-wallet and miner analysis completed cleanly; SDK/mobile analysis is incomplete. GitHub's Analyze check remains in progress, so CI is not yet confirmed green.
Problem
The swap picker showed one listing per symbol, so USDC could only be swapped on Ethereum. 1Click lists about 195 priced listings across 36 chains: USDC on 17 chains, USDT on 12, ETH on 9. Rows also showed only a chain code ("ETH") with a letter badge, while other wallets show the token logo with the chain's logo in the corner.
Changes
SwapServicekeeps every priced listing, one per symbol and chain.(DEPRECATED), such asUSDT0(DEPRECATED).SwapTokennames all 36 chains 1Click lists on. Each entry gives the name shown and the CoinGecko id for its logo.CoinGeckoService.platformLogosreads/asset_platformsand keeps the 50 px logo for each mapped chain. It's cached for a week, alongside markets, and both caches share one helper.AppConstants.coingeckoEndpointis now the API base.TokenIconshows the chain's logo in the corner, downloaded once and kept on disk throughSwapTokenIconService.imageAt, the same cache as token logos. The letter shows until it loads.Tests
swap_service_test: per-chain rows in two tiers, the chain order for USDT across six chains, deprecated and repeated listings left out, and chain logo addresses from a platform or from a coin.coin_gecko_service_test: chain logos cached across restarts and refetched for a chain not yet seen, plus the existing markets cache tests on the new storage keys.token_icon_test: the chain badge shows the letter until the logo is there, then the logo.swap_flow_test: the picker lists USDC on Ethereum and on Solana, and filters by "usdc" and by "solana".melos run analyzeis clean.Notes
coingecko_marketstocoingecko_coin_markets, because cached entries now store their payload underdata. The old entry from build 154 is no longer read.