fix: make block number click-to-copy with etherscan link
All checks were successful
check / check (push) Successful in 9s
All checks were successful
check / check (push) Successful in 9s
Block number on success-tx view now has click-to-copy and an external
link to etherscan.io/block/{number}, consistent with how addresses and
transaction hashes are displayed.
Closes #99
This commit is contained in:
@@ -59,6 +59,16 @@ function txHashHtml(hash) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function blockNumberHtml(blockNumber) {
|
||||||
|
const num = String(blockNumber);
|
||||||
|
const link = `https://etherscan.io/block/${num}`;
|
||||||
|
const extLink = `<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
||||||
|
return (
|
||||||
|
`<span class="underline decoration-dashed cursor-pointer" data-copy="${escapeHtml(num)}">${escapeHtml(num)}</span>` +
|
||||||
|
extLink
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function attachCopyHandlers(viewId) {
|
function attachCopyHandlers(viewId) {
|
||||||
document
|
document
|
||||||
.getElementById(viewId)
|
.getElementById(viewId)
|
||||||
@@ -189,7 +199,7 @@ function renderSuccess() {
|
|||||||
$("success-tx-to").innerHTML = toAddressHtml(d.to);
|
$("success-tx-to").innerHTML = toAddressHtml(d.to);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("success-tx-block").textContent = String(d.blockNumber);
|
$("success-tx-block").innerHTML = blockNumberHtml(d.blockNumber);
|
||||||
$("success-tx-hash").innerHTML = txHashHtml(d.hash);
|
$("success-tx-hash").innerHTML = txHashHtml(d.hash);
|
||||||
|
|
||||||
// Show decoded calldata details if present
|
// Show decoded calldata details if present
|
||||||
|
|||||||
Reference in New Issue
Block a user