From ba54f412d2f5044204624b26875585ee446f48ba Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 26 Feb 2026 15:56:09 +0700 Subject: [PATCH] Show active address ETH balance and USD value in headline The headline now shows the active address's balance as "x.yyyy ETH ($z.aa USD)" instead of the sum across all wallets. --- src/popup/views/home.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/popup/views/home.js b/src/popup/views/home.js index 7e22d5b..c456832 100644 --- a/src/popup/views/home.js +++ b/src/popup/views/home.js @@ -12,14 +12,32 @@ const QRCode = require("qrcode"); const { deriveAddressFromXpub } = require("../../shared/wallet"); const { formatUsd, + getPrice, getAddressValueUsd, - getTotalValueUsd, } = require("../../shared/prices"); +function findActiveAddr() { + for (const w of state.wallets) { + for (const a of w.addresses) { + if (a.address === state.activeAddress) return a; + } + } + return null; +} + function renderTotalValue() { const el = $("total-value"); if (!el) return; - el.textContent = formatUsd(getTotalValueUsd(state.wallets)); + const addr = findActiveAddr(); + if (!addr) { + el.textContent = ""; + return; + } + const ethBal = parseFloat(addr.balance || "0"); + const ethStr = ethBal.toFixed(4) + " ETH"; + const usd = getAddressValueUsd(addr); + const usdStr = usd !== null ? " (" + formatUsd(usd) + " USD)" : ""; + el.textContent = ethStr + usdStr; } const EXT_ICON =