// List every registered BNS name and group by TLD, using our own indexer. import WebSocket from "ws"; import { buildIndex, CHIPNET_ELECTRUM } from "../../Argus/src/lib/resolver-web.js"; const OURS = CHIPNET_ELECTRUM[0]; const idx = await buildIndex({ WebSocket, electrum: [OURS], directIP: true }); const byTld = new Map(); for (const [name, entry] of idx) { const tld = name.split(".").pop(); if (!byTld.has(tld)) byTld.set(tld, []); byTld.get(tld).push({ name, records: Object.keys(entry.records) }); } console.log(`total names: ${idx.size}`); console.log(`distinct TLDs: ${byTld.size}\n`); for (const [tld, entries] of [...byTld.entries()].sort((a, b) => b[1].length - a[1].length)) { console.log(`.${tld} (${entries.length})`); for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) { console.log(` ${e.name.padEnd(28)} records: ${e.records.join(", ") || "—"}`); } }