fix: etherscan link on address-token page goes to token-specific URL (#136)
All checks were successful
check / check (push) Successful in 9s
All checks were successful
check / check (push) Successful in 9s
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. Closes #135 Co-authored-by: user <user@Mac.lan guest wan> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #136 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
This commit was merged in pull request #136.
This commit is contained in:
@@ -50,6 +50,10 @@ function etherscanAddressLink(address) {
|
|||||||
return `${currentNetwork().explorerUrl}/address/${address}`;
|
return `${currentNetwork().explorerUrl}/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");
|
||||||
@@ -156,7 +160,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