From b135815a34b1f8dc2c7114205c118f638e2e2499 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Thu, 19 Feb 2026 00:22:09 -0500 Subject: [PATCH] fix(explorer): exclude approval events from Total column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ERC20 Approval events were being counted as value transfers in the Total column, inflating the displayed amount. For example, a tx with approve(1 USDC) + deposit(1 USDC) showed $2 instead of $1. Approvals grant spending permission — no tokens are moved — so they should not contribute to the total value sum. --- apps/explorer/src/comps/TxTransactionRow.tsx | 14 ++++++++------ .../src/routes/_layout/address/$address.tsx | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/explorer/src/comps/TxTransactionRow.tsx b/apps/explorer/src/comps/TxTransactionRow.tsx index 66679d0c..ae271c3b 100644 --- a/apps/explorer/src/comps/TxTransactionRow.tsx +++ b/apps/explorer/src/comps/TxTransactionRow.tsx @@ -127,12 +127,14 @@ export function TransactionTotal(props: { transaction: Transaction }) { const amountParts = React.useMemo(() => { if (!batchData) return - return batchData.knownEvents.flatMap((event) => - event.parts.filter( - (part): part is Extract => - part.type === 'amount', - ), - ) + return batchData.knownEvents + .filter((event) => event.type !== 'approval') + .flatMap((event) => + event.parts.filter( + (part): part is Extract => + part.type === 'amount', + ), + ) }, [batchData]) const infiniteLabel = diff --git a/apps/explorer/src/routes/_layout/address/$address.tsx b/apps/explorer/src/routes/_layout/address/$address.tsx index dc43270f..85dbbcce 100644 --- a/apps/explorer/src/routes/_layout/address/$address.tsx +++ b/apps/explorer/src/routes/_layout/address/$address.tsx @@ -1391,12 +1391,14 @@ function TransactionTotalCell(props: { transaction: EnrichedTransaction }) { const { transaction } = props const amountParts = React.useMemo(() => { - return transaction.knownEvents.flatMap((event) => - event.parts.filter( - (part): part is Extract => - part.type === 'amount', - ), - ) + return transaction.knownEvents + .filter((event) => event.type !== 'approval') + .flatMap((event) => + event.parts.filter( + (part): part is Extract => + part.type === 'amount', + ), + ) }, [transaction.knownEvents]) const infiniteLabel =