fix(frontend): Your History (this pair) missing amounts + CSV download fails silently #479
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#479
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
User report (mobile QA, Keplr connected): Your history (this pair) shows Time / Side / Price (Fee / Tx when scrolled) but no amount columns, and Download CSV appears to do nothing. Investigation shows both are real gaps in the same panel — not Keplr signing related.
Related: #163 (history feature), #352 (mobile horizontal scroll only), #432 (CSV formula injection — keep intact), skill
skills/AGENTS_FRONTEND_ORDER_HISTORY.md.Current codebase
Panel & mounts
WalletIndexerHistoryPanel.tsx/limitsLimitOrdersPage.tsx)/tradeTradePage.tsx)fetchTraderHistoryCsv,downloadTextAsFiletext_csv.rs— swaps CSV already includesoffer_amount,return_amount; fills includetoken0_amount,token1_amountTradesTable.tsxalready shows Amount in / Amount out — wallet pair history does not reuse itSwaps table columns (UI)
Time | Side | Price | Fee | Tx— Side is{offer_asset} → {ask_asset}(symbols only).offer_amount/return_amountare never rendered even thoughIndexerTradeandGET /api/v1/traders/{addr}/tradesreturn them.Limit fills table columns (UI)
Time | Order | Side | Price | Commission | Tx—token0_amount/token1_amountnot rendered though present onIndexerLimitFill.CSV download path
HistoryBlock.onCsv→downloadCsv→fetchTraderHistoryCsv(...?format=csv&pair=...)→downloadTextAsFile(blob +<a download>).catchinonCsv— failures become unhandled rejections; no toast / inline error.disabled={pending}— not gated on Keplr beyond panel visibility (walletAddress+terra1pair).wallet-history-163.spec.tsasserts the button is visible, never clicks it or asserts a download.fetchTraderHistoryCsvhas no retry (unlikefetchJson); client requestslimit: 500while server caps at 200.Mobile note
Tables use
overflow-x-auto+min-w-[28rem](#352). Narrow viewports clip left columns; users may only see Price / Fee / Tx unless they scroll — which can make the missing-amount gap feel worse, but amounts were never present.Why a new implementation is needed
TradesTableshows amount columns; wallet pair history should not be a weaker surface for the user’s own trades.Constraints / guardrails
offer_amount/return_amount(swaps) andtoken0_amount/token1_amount(fills). Prefer frontend-only for the amount columns.csv_escape_cell/ SEC-F12 (#432) behavior; do not weaken escaping when touching export.pair=query). Do not expand to global wallet history in this issue.formatTokenAmount/ pair decimals when available). If aligning withTradesTable’sformatNum(raw)for short-term parity, document the choice; do not invent a third format.#352horizontal scroll /data-testid="wallet-history-table-scroll"behavior; do not hide Amount behind a breakpoint without an accessible alternative.VITE_INDEXER_URL— if table JSON loads, CSV uses the same origin; do not “fix” CSV by changing CORS unless a real cross-origin bug is reproduced. Prefer UX error surfacing + download path hardening first.limit: 500vs server max 200 — either align the client to 200 or document clamp; do not silently imply 500 rows were exported.Relevant files
frontend-dapp/src/components/trade/WalletIndexerHistoryPanel.tsxfrontend-dapp/src/components/trade/__tests__/WalletIndexerHistoryPanel.test.tsxfrontend-dapp/src/services/indexer/client.ts(fetchTraderHistoryCsv,downloadTextAsFile)frontend-dapp/src/types/index.ts(IndexerTrade,IndexerLimitFill)frontend-dapp/src/components/ui/TradesTable.tsx(amount column precedent)frontend-dapp/src/utils/formatAmount.tsfrontend-dapp/e2e/wallet-history-163.spec.tsindexer/src/api/text_csv.rs,indexer/src/api/traders.rs(verify only unless export bug is server-side)skills/AGENTS_FRONTEND_ORDER_HISTORY.md,docs/frontend.md(wallet history section)Recommended direction
A. Amount columns (UI)
offer_amount/return_amount.token0_amount/token1_amount(label clearly vs base/quote).TradesTable(columns + formatting) or shared cell helpers to avoid drift.formatTokenAmountwhen symbols/decimals are known.B. CSV download reliability (same panel)
HistoryBlock.onCsvand surface inline error or toast (same patterns asRetryError/ existing alerts).limitwith server max (200) or show that export is capped.fetchJson).<a download>fails in QA (e.g. fallback open/showSaveFilePickeronly where supported — keep simple).format=csvsuccess (and/or download event) when indexer is up — not visibility-only.Acceptance criteria
token0_amount/token1_amount.tx_hash/ row id (spot-check vs JSON or CSV)..csvfile (or equivalent download) for swaps/fills/cancels as applicable.Test plan (all paths)
Unit / component
WalletIndexerHistoryPanelrenders Amount in/out (or chosen labels) when swap rows includeoffer_amount/return_amount.token0_amount/token1_amountpresent.downloadTextAsFilewith expected filename prefix (swaps-/limit-fills-/limit-cancellations-).pendingso the button is re-enabled.nullwhen wallet or pair address invalid.Integration / indexer (regression)
GET /api/v1/traders/{addr}/trades?format=csv&pair=…returns header includingoffer_amount,return_amount.token0_amount,token1_amount.text_csvstill pass.E2E / manual
/limits+ connected wallet + selected pair with known swaps: amounts visible; CSV download works (desktop Chrome)./tradeswaps-only history: amounts + CSV after expanding disclosure if collapsed.VITE_INDEXER_URL: table and/or CSV show failure messaging.Cross-browser smoke
Test plan (attack / hack / abuse vectors)
=,+,-,@remain neutralized by server escaping (#432); do not strip escaping on the client.replace(/[^a-zA-Z0-9]/g, '')).limitmax (200); client must not request unbounded rows; rapid repeated CSV clicks should not wedge UI (pending/ disable).getExplorerTxUrl+rel="noopener noreferrer".credentials: 'include'unless already required elsewhere.text/csv;charset=utf-8blob type; do not execute CSV as script in-page.Verification criteria
offer_amount/return_amountmatch the UI (modulo formatting) for the same txs.format=csvrequest; no unhandled rejection left unexplained.make test-frontend(or targeted Vitest) and existing trader CSV indexer tests pass; E2E history spec covers CSV click when chain/indexer available.mentioned in commit
49b0195034mentioned in merge request !1016
mentioned in commit
4c97620dc5mentioned in issue #557