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;