Skip to content

fix(explorer): use max instead of sum for transaction value display#712

Open
decofe wants to merge 1 commit intomainfrom
jev/fix-swap-double-count-value
Open

fix(explorer): use max instead of sum for transaction value display#712
decofe wants to merge 1 commit intomainfrom
jev/fix-swap-double-count-value

Conversation

@decofe
Copy link
Member

@decofe decofe commented Mar 13, 2026

Summary

DEX swap transactions show double the actual value (e.g. $10 swap displays as $20).

Motivation

A stablecoin DEX swap of $10 AlphaUSD → BetaUSD produces two token transfer events — one in, one out. The explorer sums all amount parts: $10 + $10 = $20 displayed.

Changes

  • apps/explorer/src/comps/TxTransactionRow.tsx — use max instead of sum for amountParts reduce
  • apps/explorer/src/routes/_layout/address/$address.tsx — same fix in TransactionTotalCell

For a simple send (1 amount part), behavior is unchanged. For swaps (2 amount parts), the max correctly shows the value of one side.

Testing

  • pnpm --filter explorer check passes (lint + types)

Prompted by: jev

DEX swaps contain two token transfer events (input + output). The
previous logic summed all amount parts, causing a $10 swap to display
as $20. Using max of individual amounts correctly shows $10.

Co-authored-by: kazanins <3875832+kazanins@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019ce654-42a6-7421-a473-bd1b8205fa84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants