Add address-token detail view for per-token transaction filtering
All checks were successful
check / check (push) Successful in 17s

Clicking a token balance on the address detail view navigates to a
focused view showing only that token's transactions. Send pre-selects
and locks the token dropdown, Receive shows an ERC-20 warning for
non-ETH tokens, and all back buttons return to the correct parent view.
This commit is contained in:
2026-02-27 11:26:59 +07:00
parent a5b2470dba
commit 21fe854fa4
9 changed files with 503 additions and 9 deletions

View File

@@ -20,6 +20,8 @@ const { log } = require("../../shared/log");
const QRCode = require("qrcode");
const makeBlockie = require("ethereum-blockies-base64");
let ctx;
const EXT_ICON =
`<span style="display:inline-block;width:10px;height:10px;margin-left:4px;vertical-align:middle">` +
`<svg viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5">` +
@@ -36,6 +38,7 @@ function etherscanTxLink(hash) {
}
function show() {
state.selectedToken = null;
const wallet = state.wallets[state.selectedWallet];
const addr = wallet.addresses[state.selectedAddress];
const wi = state.selectedWallet;
@@ -71,6 +74,14 @@ function show() {
state.trackedTokens,
state.showZeroBalanceTokens,
);
$("address-balances")
.querySelectorAll(".balance-row")
.forEach((row) => {
row.addEventListener("click", () => {
state.selectedToken = row.dataset.token;
ctx.showAddressToken();
});
});
renderSendTokenSelect(addr);
$("tx-list").innerHTML =
'<div class="text-muted text-xs py-1">Loading...</div>';
@@ -272,7 +283,8 @@ function showTxDetail(tx) {
});
}
function init(ctx) {
function init(_ctx) {
ctx = _ctx;
$("address-full").addEventListener("click", () => {
const addr = $("address-full").dataset.full;
if (addr) {
@@ -297,6 +309,7 @@ function init(ctx) {
}
$("send-to").value = "";
$("send-amount").value = "";
$("send-token").disabled = false;
updateSendBalance();
showView("send");
});
@@ -318,7 +331,11 @@ function init(ctx) {
$("btn-add-token").addEventListener("click", ctx.showAddTokenView);
$("btn-tx-back").addEventListener("click", () => {
show();
if (state.selectedToken) {
ctx.showAddressToken();
} else {
show();
}
});
}