From 2c9a34aff65b2433501c5e7240157f70eb6ba8dd Mon Sep 17 00:00:00 2001 From: user Date: Sat, 28 Feb 2026 08:57:16 -0800 Subject: [PATCH] fix: show own labelled address for swap transactions in tx lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For swap transactions in the transaction history list views (home and addressDetail), display the user's own labelled wallet address instead of the contract/counterparty address. The contract address is not useful in the list view — users need to see which of their addresses performed the swap. Closes #55 --- src/popup/views/addressDetail.js | 10 +++++++--- src/popup/views/home.js | 11 ++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/popup/views/addressDetail.js b/src/popup/views/addressDetail.js index 8e6f7ee..90d9c21 100644 --- a/src/popup/views/addressDetail.js +++ b/src/popup/views/addressDetail.js @@ -186,10 +186,14 @@ function renderTransactions(txs) { let html = ""; let i = 0; for (const tx of txs) { + // For swap transactions, show the user's own labelled wallet + // address instead of the contract address (see issue #55). const counterparty = - tx.direction === "sent" || tx.direction === "contract" - ? tx.to - : tx.from; + tx.direction === "contract" && tx.directionLabel === "Swap" + ? tx.from + : tx.direction === "sent" || tx.direction === "contract" + ? tx.to + : tx.from; const ensName = ensNameMap.get(counterparty) || null; const title = addressTitle(counterparty, state.wallets); const dirLabel = tx.directionLabel; diff --git a/src/popup/views/home.js b/src/popup/views/home.js index cb7cd24..1b24d13 100644 --- a/src/popup/views/home.js +++ b/src/popup/views/home.js @@ -103,10 +103,15 @@ function renderHomeTxList(ctx) { let html = ""; let i = 0; for (const tx of homeTxs) { + // For swap transactions, show the user's own labelled wallet + // address (the one that initiated the swap) instead of the + // contract address which is not useful in the list view. const counterparty = - tx.direction === "sent" || tx.direction === "contract" - ? tx.to - : tx.from; + tx.direction === "contract" && tx.directionLabel === "Swap" + ? tx.from + : tx.direction === "sent" || tx.direction === "contract" + ? tx.to + : tx.from; const dirLabel = tx.directionLabel; const amountStr = tx.value ? escapeHtml(tx.value + " " + tx.symbol)