// Portable BNS resolver — the shared keystone for all clients (browser // extension, mobile webview, Electron). ZERO dependencies: only a WebSocket // (native in browsers; inject Node's `ws`). Reads names straight from the // Bitcoin Cash chain via a chipnet electrum (Fulcrum) server, using verbose // transactions so CashToken data arrives as plain JSON — no tx-decoding lib. // // Contract (identical semantics to Argus/src/lib/bns.js): // buildIndex() -> Map // resolveName("x.bch") -> Entry | null // normalizeName(input) -> string (throws on invalid) export const BEACON = "bchtest:qp8njaa9a3ahg7259s5qajnce526n0rttsq8qwx4jl"; // electrum scripthash of BEACON (sha256(lockingBytecode) reversed, hex). // Constant — the beacon never changes. export const BEACON_SCRIPTHASH = "e1cdbba719436f49acb4bf245b44df875c6d6b405eda46a9d3e736d138102f3b"; export const PREFIX = "BNS1"; export const TLD = ".bch"; export const DEFAULT_TLD = "bch"; const LABEL_RE = /^[a-z0-9-]{1,32}$/; // the registered label const TLD_RE = /^[a-z0-9-]{1,16}$/; // the TLD suffix // an on-chain name: "