From 0f03ba7cd837999e16a2701bd9e2a61de92c5d6f Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 26 Feb 2026 03:29:42 +0700 Subject: [PATCH] Link tx hash, from, and to addresses to Etherscan in transaction detail view --- src/popup/views/addressDetail.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/popup/views/addressDetail.js b/src/popup/views/addressDetail.js index 3910025..82cb1d9 100644 --- a/src/popup/views/addressDetail.js +++ b/src/popup/views/addressDetail.js @@ -152,21 +152,35 @@ function renderTransactions(txs) { }); } +function etherscanAddressLink(address) { + return `https://etherscan.io/address/${address}`; +} + +function etherscanTxLink(hash) { + return `https://etherscan.io/tx/${hash}`; +} + function txDetailAddressHtml(address) { const ensName = ensNameMap.get(address) || null; const dot = addressDotHtml(address); + const link = etherscanAddressLink(address); if (ensName) { return ( dot + - escapeHtml(ensName) + - `
${escapeHtml(address)}
` + `${escapeHtml(ensName)}` + + `
${escapeHtml(address)}
` ); } - return dot + escapeHtml(address); + return ( + dot + + `${escapeHtml(address)}` + ); } function showTxDetail(tx) { - $("tx-detail-hash").textContent = tx.hash; + const txLink = etherscanTxLink(tx.hash); + $("tx-detail-hash").innerHTML = + `${escapeHtml(tx.hash)}`; $("tx-detail-from").innerHTML = txDetailAddressHtml(tx.from); $("tx-detail-to").innerHTML = txDetailAddressHtml(tx.to); $("tx-detail-value").textContent = tx.value + " " + tx.symbol;