From e8e5edf5f27bc8d6b19e3757ce4d5d5bff815e21 Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 26 Feb 2026 15:53:56 +0700 Subject: [PATCH] Make active address display copyable with etherscan link Click the active address above Send/Receive to copy it. A small box-arrow icon links to the address on etherscan. --- src/popup/views/home.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/popup/views/home.js b/src/popup/views/home.js index 3b98219..7e22d5b 100644 --- a/src/popup/views/home.js +++ b/src/popup/views/home.js @@ -4,6 +4,7 @@ const { showFlash, balanceLinesForAddress, addressDotHtml, + escapeHtml, } = require("./helpers"); const { state, saveState, currentAddress } = require("../../shared/state"); const { updateSendBalance, renderSendTokenSelect } = require("./send"); @@ -21,12 +22,27 @@ function renderTotalValue() { el.textContent = formatUsd(getTotalValueUsd(state.wallets)); } +const EXT_ICON = + `` + + `` + + `` + + `` + + ``; + function renderActiveAddress() { const el = $("active-address-display"); if (!el) return; if (state.activeAddress) { - const dot = addressDotHtml(state.activeAddress); - el.innerHTML = dot + state.activeAddress; + const addr = state.activeAddress; + const dot = addressDotHtml(addr); + const link = `https://etherscan.io/address/${addr}`; + el.innerHTML = + `${dot}${escapeHtml(addr)}` + + `${EXT_ICON}`; + $("active-addr-copy").addEventListener("click", () => { + navigator.clipboard.writeText(addr); + showFlash("Copied!"); + }); } else { el.textContent = ""; }