fix(frontend): Charts pair 24h Vol (USD) (#565) #1089

Merged
PlasticDigits merged 2 commits from fix/565-charts-pair-volume-usd into main 2026-08-19 02:12:11 +00:00
PlasticDigits commented 2026-08-19 01:02:55 +00:00 (Migrated from gitlab.com)

Summary

  • Charts pair 24h Stats no longer formatNums raw volume_base / volume_quote (the leftover from #540 / #544 AC4).
  • Primary box is Vol (USD) from GET /api/v1/pairs/{addr}/stats volume_usd via existing formatIndexedVolumeUsd ($ + compact; unpriced + trades → —; idle USD 0 → $0).
  • Secondary Vol ({symbol}) boxes use formatTokenAmount with that pair’s asset_0 / asset_1 decimals (factory order). Missing / out-of-range decimals → —. #524 invert does not swap legs or change the USD figure.
  • Integrator JSON stays raw for volume_base / volume_quote. No indexer schema change. Docs, invariants P565-1–P565-7, skill AGENTS_FRONTEND_CHARTS_PAIR_STATS.md, and make verify-issue-565.

Closes #565.

Test plan

  • RTL ChartsPage: UST1/cUSTC 847004054 / 157465643310 / volume_usd=763.35 → Vol (USD) matches /\$/ and strip does not match /847\.0M|157\.5B/
  • RTL: UST1/USTR 18-dec quote 19300000000000000000 → no /T$/ on the stats strip
  • RTL: volume_usd null/0/'' + trade_count > 0 → — (not $0, not raw fallback)
  • RTL: trade_count === 0 and USD 0 → $0
  • RTL: invalid USD (NaN, HTML, 1e309, 200-char, negative) → —; no <script> inject
  • RTL/unit: token secondary formatTokenAmount path; missing/out-of-range decimals → —; 6-dec vs 18-dec lie fails
  • RTL: invert pill does not change Vol (USD) or swap UST1/cUSTC labels
  • Grep: ChartsPage.tsx has no formatNum(stats.volume_base) / formatNum(stats.volume_quote)
  • make verify-issue-565 passed twice
  • Manual: https://dex.cl8y.com/charts UST1/cUSTC 24h Stats Vol (USD) ≈ curl volume_usd; token vols ≈ raw ÷ 10^6
  • Manual: UST1/USTR strip has no T
  • Manual: overview strip (#548) and tape Amount (#557) unchanged

Acceptance (issue)

  • V1. Primary volume is USD ($ + compact) from stats volume_usd
  • V2. UST1/USTR never compact-formats raw 18-dec quote as T
  • V3. Token Vol boxes are human + that leg’s decimals; missing decimals → —
  • V4. Unpriced USD + trade_count > 0 → —
  • V5. #524 invert does not change USD or swap base/quote decimals
  • V6. JSON volume_base / volume_quote remain raw (comment-only on indexer response)
  • V7. RTL + make verify-issue-565 + docs/skill cross-link
## Summary - Charts pair **24h Stats** no longer `formatNum`s raw `volume_base` / `volume_quote` (the leftover from #540 / #544 **AC4**). - Primary box is **Vol (USD)** from `GET /api/v1/pairs/{addr}/stats` `volume_usd` via existing `formatIndexedVolumeUsd` (`$` + compact; unpriced + trades → `—`; idle USD `0` → `$0`). - Secondary **Vol ({symbol})** boxes use `formatTokenAmount` with **that pair’s** `asset_0` / `asset_1` decimals (factory order). Missing / out-of-range decimals → `—`. #524 invert does not swap legs or change the USD figure. - Integrator JSON stays raw for `volume_base` / `volume_quote`. No indexer schema change. Docs, invariants **P565-1–P565-7**, skill `AGENTS_FRONTEND_CHARTS_PAIR_STATS.md`, and `make verify-issue-565`. Closes #565. ## Test plan - [x] RTL ChartsPage: UST1/cUSTC `847004054` / `157465643310` / `volume_usd=763.35` → Vol (USD) matches `/\$/` and strip does **not** match `/847\.0M|157\.5B/` - [x] RTL: UST1/USTR 18-dec quote `19300000000000000000` → no `/T$/` on the stats strip - [x] RTL: `volume_usd` null/`0`/`''` + `trade_count > 0` → `—` (not `$0`, not raw fallback) - [x] RTL: `trade_count === 0` and USD `0` → `$0` - [x] RTL: invalid USD (`NaN`, HTML, `1e309`, 200-char, negative) → `—`; no `<script>` inject - [x] RTL/unit: token secondary `formatTokenAmount` path; missing/out-of-range decimals → `—`; 6-dec vs 18-dec lie fails - [x] RTL: invert pill does not change Vol (USD) or swap UST1/cUSTC labels - [x] Grep: `ChartsPage.tsx` has no `formatNum(stats.volume_base)` / `formatNum(stats.volume_quote)` - [x] `make verify-issue-565` passed twice - [ ] Manual: `https://dex.cl8y.com/charts` UST1/cUSTC 24h Stats Vol (USD) ≈ curl `volume_usd`; token vols ≈ raw ÷ 10^6 - [ ] Manual: UST1/USTR strip has no `T` - [ ] Manual: overview strip (#548) and tape Amount (#557) unchanged ## Acceptance (issue) - [x] **V1.** Primary volume is USD (`$` + compact) from stats `volume_usd` - [x] **V2.** UST1/USTR never compact-formats raw 18-dec quote as `T` - [x] **V3.** Token Vol boxes are human + that leg’s decimals; missing decimals → `—` - [x] **V4.** Unpriced USD + `trade_count > 0` → `—` - [x] **V5.** #524 invert does not change USD or swap base/quote decimals - [x] **V6.** JSON `volume_base` / `volume_quote` remain raw (comment-only on indexer response) - [x] **V7.** RTL + `make verify-issue-565` + docs/skill cross-link
PlasticDigits commented 2026-08-19 02:12:07 +00:00 (Migrated from gitlab.com)

added 20 commits

  • e7bca66f...e9a62709 - 19 commits from branch main
  • 975e0620 - Merge origin/main into fix/565-charts-pair-volume-usd.

Compare with previous version

added 20 commits <ul><li>e7bca66f...e9a62709 - 19 commits from branch <code>main</code></li><li>975e0620 - Merge origin/main into fix/565-charts-pair-volume-usd.</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/371/diffs?diff_id=1969765551&start_sha=e7bca66f81fa61d0229430053537af79295ee3b5)
PlasticDigits commented 2026-08-19 02:12:11 +00:00 (Migrated from gitlab.com)

mentioned in commit 17790e7db4

mentioned in commit 17790e7db4c5ebac9b339f572b4b1fcce71ce301
PlasticDigits (Migrated from gitlab.com) merged commit 17790e7db4 into main 2026-08-19 02:12:11 +00:00
PlasticDigits commented 2026-08-19 02:16:49 +00:00 (Migrated from gitlab.com)

mentioned in issue #564

mentioned in issue #564
PlasticDigits commented 2026-08-19 02:16:56 +00:00 (Migrated from gitlab.com)

mentioned in issue #565

mentioned in issue #565
PlasticDigits commented 2026-08-19 02:28:46 +00:00 (Migrated from gitlab.com)

mentioned in issue #573

mentioned in issue #573
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1089
No description provided.