Parallelize address scanning and unify address display formatting
Some checks failed
check / check (push) Has been cancelled

Scanning: check all gap-limit addresses in parallel per batch instead
of sequentially. For a wallet with 1 used address this reduces from
12 sequential RPC round-trips to 1 parallel batch + 1 small follow-up.

Display: add shared formatAddressHtml(address, ensName, maxLen) and
escapeHtml() to helpers.js. Use them in confirm-tx (was missing color
dot entirely) and approval view. Remove duplicate escapeHtml from
addressDetail.js.
This commit is contained in:
2026-02-26 03:46:25 +07:00
parent 1dfc006cb9
commit 0d543288b2
5 changed files with 84 additions and 47 deletions

View File

@@ -3,7 +3,13 @@
// password modal, decrypts secret, signs and broadcasts.
const { parseEther } = require("ethers");
const { $, showError, hideError, showView } = require("./helpers");
const {
$,
showError,
hideError,
showView,
formatAddressHtml,
} = require("./helpers");
const { state } = require("../../shared/state");
const { getSignerForAddress } = require("../../shared/wallet");
const { decryptWithPassword } = require("../../shared/vault");
@@ -16,16 +22,15 @@ let pendingTx = null;
function show(txInfo) {
pendingTx = txInfo;
$("confirm-from").textContent = txInfo.from;
$("confirm-to").textContent = txInfo.to;
$("confirm-from").innerHTML = formatAddressHtml(txInfo.from, null, null);
$("confirm-to").innerHTML = formatAddressHtml(
txInfo.to,
txInfo.ensName,
null,
);
const ensEl = $("confirm-to-ens");
if (txInfo.ensName) {
ensEl.textContent = "(" + txInfo.ensName + ")";
ensEl.classList.remove("hidden");
} else {
ensEl.classList.add("hidden");
}
// Hide the separate ENS element — it's now inline in the address display
$("confirm-to-ens").classList.add("hidden");
$("confirm-amount").textContent = txInfo.amount + " " + txInfo.token;