dgb-wallet/packages/bns/scripts/resolve-demo.ts
Digibyte.X d50286a9a5 DigiByte.X Wallet — recovery-first web wallet monorepo
Packages: core (BIP39/32/44/49/84/86 derivation, WIF), keystore (PBKDF2 +
AES-GCM), psbt, p2p (BIP157/158 SPV daemon, Dandelion++ broadcast with
relay-echo verification), blockbook, rpc, electrum, net, bns, web-ui
(React/Vite), mobile (Expo). ops/ holds the nginx vhost, systemd unit and
push.sh deploy script for digibyte.x/web.
2026-09-20 20:16:52 +02:00

31 lines
1.1 KiB
TypeScript

// Resolve a BNS name against real chipnet electrum servers.
// Default: resolve tlds.bch (the well-known root TLD certificate) and
// print the activated TLD list. Pass any name as an arg to resolve it.
import { resolveName, DEFAULT_ELECTRUM } from '../src/index.js';
const name = process.argv[2] ?? 'tlds.bch';
console.log(`\nBNS resolve: ${name}`);
console.log(`Electrum pool (${DEFAULT_ELECTRUM.length}):`);
for (const s of DEFAULT_ELECTRUM) console.log(` ${s.url}${s.ip ? ' (ip ' + s.ip + ')' : ''}`);
console.log();
const t0 = performance.now();
const entry = await resolveName(name);
const ms = (performance.now() - t0).toFixed(0);
if (!entry) {
console.log(` ${name} — not registered (index built in ${ms} ms)`);
process.exit(1);
}
console.log(` ${entry.name} (index built in ${ms} ms)`);
if (entry.height) console.log(` height: ${entry.height}`);
if (entry.txid) console.log(` txid: ${entry.txid}`);
console.log(` records:`);
for (const [k, v] of Object.entries(entry.records)) {
if (v == null) continue;
const shown = v.length > 200 ? v.slice(0, 200) + '...' : v;
console.log(` ${k}: ${shown}`);
}