fix: etherscan link on address-token page goes to token-specific URL
All checks were successful
check / check (push) Successful in 13s
All checks were successful
check / check (push) Successful in 13s
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/<contract>?a=<address>) instead of the plain address page.
This commit is contained in:
@@ -45,6 +45,10 @@ function etherscanAddressLink(address) {
|
|||||||
return `https://etherscan.io/address/${address}`;
|
return `https://etherscan.io/address/${address}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function etherscanTokenLink(tokenContract, holderAddress) {
|
||||||
|
return `https://etherscan.io/token/${tokenContract}?a=${holderAddress}`;
|
||||||
|
}
|
||||||
|
|
||||||
function isoDate(timestamp) {
|
function isoDate(timestamp) {
|
||||||
const d = new Date(timestamp * 1000);
|
const d = new Date(timestamp * 1000);
|
||||||
const pad = (n) => String(n).padStart(2, "0");
|
const pad = (n) => String(n).padStart(2, "0");
|
||||||
@@ -151,7 +155,10 @@ function show() {
|
|||||||
$("address-token-dot").innerHTML = addressDotHtml(addr.address);
|
$("address-token-dot").innerHTML = addressDotHtml(addr.address);
|
||||||
$("address-token-full").dataset.full = addr.address;
|
$("address-token-full").dataset.full = addr.address;
|
||||||
$("address-token-full").textContent = 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 =
|
$("address-token-etherscan-link").innerHTML =
|
||||||
`<a href="${addrLink}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
`<a href="${addrLink}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user