argus/src/web/register-entry.js
Local Dev 53428a605f bns: one network table instead of chipnet constants copied into fifteen places
Every client hard-coded the chipnet beacons, address prefix and electrum
servers on its own: resolver, registrar config, wallets, gateway, indexer,
mirror scripts, the browser bundle and the mobile Java. A mainnet launch would
have meant finding all of them and hoping none was missed.

The table now lives in resolver-web.js, the one file every client already
shares, so it stays a single-file drop-in. BNS_NETWORK selects the record;
unset means chipnet, so nothing changes today: the live index resolves the
same 60 names and 20 TLDs, the 67 offline tests pass, and the dashboard,
market and studio load the same values through BNS.NETWORK.

The mainnet record carries the verified public servers, the prefix and its
own Sia bucket, but its beacons, start height and operator address are
deliberately null: requireBeacons() refuses to scan until they are pinned in
the order ROADMAP-MAINNET.md §6 requires. Bns.java reads a generated
BnsNetwork.java so the phone cannot drift from the desktop clients.
NETWORK-CONFIG.md records what reads the table and what a launch still pins.
2026-09-27 21:18:37 +02:00

59 lines
2.6 KiB
JavaScript

// Browser entry point for the registration flow. Everything the register page
// needs, and nothing that touches the filesystem or a private key we hold.
//
// Bundled by build-web.mjs to site/js/bns-register.js as a plain ES module:
// <script type="module"> import * as BNS from './js/bns-register.js' </script>
export { BuiltInWallet, CHIPNET_PREFIX, MAINNET_PREFIX, DEFAULT_PREFIX } from "../lib/wallet-web.js";
export {
connect,
checkAvailability,
quoteRegistration,
registerWithBuiltInWallet,
registerWithExternalWallet,
registerTldWithBuiltInWallet,
registerTldWithExternalWallet,
findTldOwnerAddress,
splitServiceFee,
setRecordsWithBuiltInWallet,
setRecordsWithExternalWallet,
setTldRecordsWithBuiltInWallet,
signRecordsManifest,
findCertificateUtxo,
getBalance,
} from "../lib/registrar.js";
export { REGISTRAR, priceSummary } from "../registrar-config.js";
export {
buildRegistrationTx,
buildTldRegistrationTx,
buildUpdateTx,
buildPrepTx,
hasGenesisInput,
toWcTransactionObject,
normalizeName,
normalizeTld,
displayName,
payloadBudget,
TLD_BEACON,
NoGenesisInputError,
InsufficientFundsError,
} from "../lib/register-tx.js";
export { signTransaction, txidOf, txidOfHex } from "../lib/sign-tx.js";
export { buildListing, completeSale, verifyListing, signInputs, sourceOutputToJson, sourceOutputFromJson } from "../lib/market-tx.js";
export { findTldCertificateUtxo, buildCosignRequest, signCosignRequest } from "../lib/registrar.js";
export { usdListingRedeem, usdListingAddress, payoutSats, parseOracleMessage, verifyOracleMessage, buildUsdListingTx, buildUsdBuyTx, buildUsdCancelTx, verifyUsdListing, DEFAULT_MAX_AGE_SECS } from "../lib/market-usd.js";
export { toTokenAddress, addressToLockingBytecode, addressToScripthash, getUtxos, getUtxosForAddresses, broadcast } from "../lib/chain.js";
export { resolveName, buildIndex, NETWORK, NETWORKS, getNetwork, requireBeacons, DEFAULT_NETWORK_ID } from "../lib/resolver-web.js";
export {
describeGenesisRequirement,
pubkeyToAddress,
pubkeyToLockingBytecode,
} from "../lib/connect/wallet-session.js";
export { binToHex, hexToBin } from "@bitauth/libauth";
export { stringify } from "@bitauth/libauth";
// NOT re-exported here on purpose: the WizardConnect and WalletConnect adapters.
// They are separate bundles (site/js/wizardconnect.js, site/js/walletconnect2.js)
// that the page dynamic-imports only when the buyer picks that option.
// - WizardConnect: LGPL-3.0-or-later, must stay separate + unminified (§4d1).
// - WalletConnect: ~590 kB nobody using the built-in wallet should download.