fix: add reverse ENS lookups for all displayed addresses (closes #22)
All checks were successful
check / check (push) Successful in 22s
All checks were successful
check / check (push) Successful in 22s
Previously, ENS reverse lookups were only performed for the single counterparty address (from or to depending on direction). This meant contract interaction targets and the non-counterparty side of transactions never got ENS names resolved. Now both from and to addresses are collected for ENS resolution, ensuring all displayed addresses show their ENS names when available.
This commit is contained in:
@@ -150,11 +150,11 @@ async function loadTransactions(address) {
|
||||
|
||||
loadedTxs = txs;
|
||||
|
||||
// Collect unique counterparty addresses for ENS resolution.
|
||||
// Collect ALL unique addresses (from + to) for ENS resolution so
|
||||
// that reverse lookups work for every displayed address, not just
|
||||
// the ones that were originally entered as ENS names.
|
||||
const counterparties = [
|
||||
...new Set(
|
||||
txs.map((tx) => (tx.direction === "sent" ? tx.to : tx.from)),
|
||||
),
|
||||
...new Set(txs.flatMap((tx) => [tx.from, tx.to].filter(Boolean))),
|
||||
];
|
||||
if (counterparties.length > 0) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user