Repository navigation
Show the balance in fiat again, priced from the 1Click listing - #692
Conversation
QTC's USD price is the one 1Click lists it with, read every five minutes with a conditional GET: the client remembers each GET's ETag, so an unchanged listing answers 304 with no body. Reading the listed QTC no longer costs the CoinGecko ranking, which only the swap token list needs. The exchange rate service carries the price as nullable and refuses to convert without one, so the fiat line under the balance only appears once a real price is known, and the hide toggle masks it too.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Request changes
Reviewed head ed168eddfa1b56c98d537f7d02209446cc29321e against base a67f13b230f79b2c46f331debc55a8c703e4e686.
- [P2] Remove the unused import so CI can reach the tests — mobile-app/test/unit/balance_fiat_line_test.dart:2. The new
package:flutter/material.dartimport is unused. The current CI run fails its Analyze step on this exactunused_importwarning and skips all three package test stages. Remove the import and rerun CI.
No other blocking findings in the price lookup, ETag handling, fiat conversion, transaction display, or hide-balance behavior.
Validation in a detached worktree:
- SDK:
flutter test --no-pub test/services/swap_service_test.dart test/services/one_click_service_test.dart— 46 passed. - Wallet:
flutter test --no-pubwith balance_fiat_line, exchange_rate_service, amount_input_logic, input_amount_max, send_amount_layout, review_send_screen, home_intent_gating, swap_flow, and transaction_detail_sheet tests — 87 passed. git diff --checkanddart format --output=none --set-exit-if-changed --line-length=120on all nine changed Dart files — passed.- SDK analysis passed. Local wallet analysis was terminated at the required 10-second cap, so it is incomplete; the linked CI log confirms the new warning.
|
Removed the unused |
The swap list no longer asks CoinGecko for a market-cap ranking or for token logos. It is 1Click's own listing, one asset per symbol, with QTC moved to the top and USDC right after it; every other token keeps its place. QTC now appears in the token picker, and picking it for the other side moves QTC there. Token icons are the monograms the picker already fell back to.
Order swap tokens as 1Click lists them, QTC first and USDC second
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Approve
Reviewed head df3a68b860beb801e93f134b6dde40a1ea29d063 against base b8de5e97a04dc549ec8ebd6be46e4a7ad4ae80fe, including the merged swap-token ordering changes. No blocking findings. The unused import from the previous review is removed.
The balance waits for a listed QTC price, uses the selected fiat currency, and masks both amounts when hidden. Transaction amounts remain QTC-only. The shared listing cache and ETag revalidation preserve token identification and avoid CoinGecko requests; the swap screen selects a foreign token initially and handles QTC selection on either side consistently.
Validation in a detached worktree:
- SDK:
flutter test --no-pub test/services/swap_service_test.dart test/services/one_click_service_test.dart— 45 passed. - Wallet:
flutter test --no-pubacross balance_fiat_line, exchange_rate_service, amount_input_logic, input_amount_max, send_amount_layout, review_send_screen, home_intent_gating, swap_flow, transaction_detail_sheet, and swap_math tests — 89 passed. git diff --checkanddart format --output=none --set-exit-if-changed --line-length=120on all 12 changed Dart files — passed.- Root Melos analysis was terminated at the required 10-second cap after cold-wallet and miner analysis passed; SDK/wallet analysis is incomplete. GitHub CI is still running, and dependency cooldown passed.
What
The fiat line under the QTC balance on the home screen is back, driven by a real price instead of the 1:1 placeholder it was removed with.
GET /v0/tokens) lists QTC with a USD price (166.66 at the time of writing). A newtokenUsdPriceProviderreads it on start and every 5 minutes.OneClickServicenow remembers each GET's ETag and sendsIf-None-Match, so an unchanged listing answers 304 with no body. The first fetch is ~10 KB gzipped, refreshes cost nothing until a price changes. Verified against the live API.SwapServicenow caches the raw listing separately from the ranked swap list, sogetListedQuantusTokennever triggers the CoinGecko ranking. Only the swap screen's token list does.ExchangeRateService.tokenToUsdRateis nullable and converting without a price throws.CurrencyDisplayState.secondaryAmountis null until a price is known, so nothing shows rather than a wrong number. Transaction amounts stay QTC-only; only the balance carries the fiat line. The hide-balance toggle masks it.Tests
$3.00for 1.5 QTC at $2, transaction amounts carry none, the widget shows and hides the line.