From bc2aedaab69b7ee6981c39a65163cbb456ba8a16 Mon Sep 17 00:00:00 2001 From: clawbot Date: Sun, 1 Mar 2026 20:13:55 +0100 Subject: [PATCH] fix: etherscan link on address-token page goes to token-specific URL (#136) When viewing the address-token page for our own address with an ERC-20 token, the etherscan link now navigates to the token-specific page (`etherscan.io/token/?a=
`) instead of the plain address page. Closes #135 Co-authored-by: user Co-authored-by: Jeffrey Paul Reviewed-on: https://git.eeqj.de/sneak/AutistMask/pulls/136 Co-authored-by: clawbot Co-committed-by: clawbot --- src/popup/views/addressToken.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/popup/views/addressToken.js b/src/popup/views/addressToken.js index 8b31b60..bb9a4e2 100644 --- a/src/popup/views/addressToken.js +++ b/src/popup/views/addressToken.js @@ -50,6 +50,10 @@ function etherscanAddressLink(address) { return `${currentNetwork().explorerUrl}/address/${address}`; } +function etherscanTokenLink(tokenContract, holderAddress) { + return `https://etherscan.io/token/${tokenContract}?a=${holderAddress}`; +} + function isoDate(timestamp) { const d = new Date(timestamp * 1000); const pad = (n) => String(n).padStart(2, "0"); @@ -156,7 +160,10 @@ function show() { $("address-token-dot").innerHTML = addressDotHtml(addr.address); $("address-token-full").dataset.full = addr.address; $("address-token-full").textContent = addr.address; - const addrLink = etherscanAddressLink(addr.address); + const addrLink = + tokenId !== "ETH" + ? etherscanTokenLink(tokenId, addr.address) + : etherscanAddressLink(addr.address); $("address-token-etherscan-link").innerHTML = `${EXT_ICON}`;