Add address color dots and cached ENS reverse lookups
Some checks failed
check / check (push) Has been cancelled

Deterministic colored dots derived from address bytes (16-color palette)
displayed before every address. ENS reverse resolution for transaction
counterparties with 12-hour localStorage cache.
This commit is contained in:
2026-02-26 03:26:52 +07:00
parent fbff44ade6
commit d28d5a5a51
5 changed files with 155 additions and 11 deletions

View File

@@ -99,6 +99,35 @@ function balanceLinesForAddress(addr) {
return html;
}
const ADDRESS_COLORS = [
"#e6194b",
"#3cb44b",
"#4363d8",
"#f58231",
"#911eb4",
"#42d4f4",
"#f032e6",
"#bfef45",
"#fabed4",
"#469990",
"#dcbeff",
"#9a6324",
"#800000",
"#aaffc3",
"#808000",
"#000075",
];
function addressColor(address) {
const idx = parseInt(address.slice(2, 6), 16) % 16;
return ADDRESS_COLORS[idx];
}
function addressDotHtml(address) {
const color = addressColor(address);
return `<span style="width:8px;height:8px;border-radius:50%;display:inline-block;background:${color};margin-right:4px;vertical-align:middle;flex-shrink:0;"></span>`;
}
module.exports = {
$,
showError,
@@ -106,4 +135,6 @@ module.exports = {
showView,
showFlash,
balanceLinesForAddress,
addressColor,
addressDotHtml,
};