From 71ef08fe8543ae71a9fbb4863247493ac85757a7 Mon Sep 17 00:00:00 2001 From: clawbot Date: Sat, 28 Feb 2026 10:41:14 -0800 Subject: [PATCH] fix: address all 3 violations from #59 1. Protocol name now has Etherscan link (was appearing clickable but wasn't) 2. Token contract addresses: symbol shown separately, then color dot + full address + Etherscan link (symbol no longer interposed) 3. Raw data section moved after transaction hash (no longer pushes useful info off screen) --- src/popup/index.html | 14 +++++------ src/popup/views/transactionDetail.js | 36 ++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/popup/index.html b/src/popup/index.html index 74dfb69..2118551 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -999,18 +999,18 @@ class="text-xs" > -
Transaction hash
+ diff --git a/src/popup/views/transactionDetail.js b/src/popup/views/transactionDetail.js index 08dfc60..67679a9 100644 --- a/src/popup/views/transactionDetail.js +++ b/src/popup/views/transactionDetail.js @@ -149,9 +149,11 @@ function render() { if (headingEl) headingEl.textContent = "Transaction"; } - // Hide calldata section; re-fetch if this is a contract call + // Hide calldata and raw data sections; re-fetch if this is a contract call const calldataSection = $("tx-detail-calldata-section"); if (calldataSection) calldataSection.classList.add("hidden"); + const rawDataSection = $("tx-detail-rawdata-section"); + if (rawDataSection) rawDataSection.classList.add("hidden"); if (tx.isContractCall || tx.direction === "contract") { loadCalldata(tx.hash, tx.to); @@ -202,9 +204,20 @@ async function loadCalldata(txHash, toAddress) { for (const d of decoded.details || []) { detailsHtml += `
`; detailsHtml += `
${escapeHtml(d.label)}
`; - if (d.address) { + if (d.address && d.isToken) { + // Token entry: show symbol on its own line, then dot + address + Etherscan link const dot = addressDotHtml(d.address); - detailsHtml += `
${dot}${copyableHtml(d.value, "break-all")}
`; + const tokenSymbol = d.value.match(/^(\S+)\s*\(/)?.[1]; + if (tokenSymbol) { + detailsHtml += `
${escapeHtml(tokenSymbol)}
`; + } + const etherscanUrl = `https://etherscan.io/token/${d.address}`; + detailsHtml += `
${dot}${copyableHtml(d.address, "break-all")}${etherscanLinkHtml(etherscanUrl)}
`; + } else if (d.address) { + // Protocol/contract entry: show name + Etherscan link + const dot = addressDotHtml(d.address); + const etherscanUrl = `https://etherscan.io/address/${d.address}`; + detailsHtml += `
${dot}${copyableHtml(d.value, "break-all")}${etherscanLinkHtml(etherscanUrl)}
`; } else { detailsHtml += `
${escapeHtml(d.value)}
`; } @@ -228,13 +241,16 @@ async function loadCalldata(txHash, toAddress) { section.classList.remove("hidden"); - // Bind copy handlers for new elements - section.querySelectorAll("[data-copy]").forEach((el) => { - el.onclick = () => { - navigator.clipboard.writeText(el.dataset.copy); - showFlash("Copied!"); - }; - }); + // Bind copy handlers for new elements (including raw data now outside section) + const copyTargets = [section, rawSection].filter(Boolean); + for (const container of copyTargets) { + container.querySelectorAll("[data-copy]").forEach((el) => { + el.onclick = () => { + navigator.clipboard.writeText(el.dataset.copy); + showFlash("Copied!"); + }; + }); + } } catch (e) { log.errorf("loadCalldata failed:", e.message); }