| ${esc(l.label)}${l.note ? `${esc(l.note)}` : ""} |
@@ -479,6 +498,10 @@ async function stepConfirm() {
render(`Preparing…
Building your registration transaction.
`);
try {
const c = await client();
+ // TLD flow skips the name-availability check and the per-name quote —
+ // registerTldWith*Wallet builds the tx internally and checks the on-chain
+ // TLD registry itself. Just show a simple confirm screen with the fee.
+ if (state.tld) return stepConfirmTld();
const avail = await BNS.checkAvailability(c, state.name);
if (!avail.available) throw new Error(`"${avail.name}" was just registered by someone else`);
const quote = await BNS.quoteRegistration(c, {
@@ -509,6 +532,73 @@ async function stepConfirm() {
}
}
+// ---------- TLD confirm ----------
+async function stepConfirmTld() {
+ const feeSats = state.tld.serviceFeeSats;
+ const owner = state.wallet ? state.wallet.address : (state.session ? (await state.session.getAddresses())[0] : "your address");
+ render(`
+ Confirm ${esc(state.name)}
+ One transaction. It mints the TLD certificate to your token address; you become
+ the registry operator for every second-level name under it.
+
+ | Service fee${feeSats === 0n ? " (none on chipnet)" : ""} |
+ ${sats(feeSats)} sat |
+ | Beacon dust + chain fee (covered by wallet) |
+ ~1,300 sat |
+
+ Minted to ${esc(owner)}.
+ That wallet becomes the operator for this TLD.
+
+
+ `);
+ $("back").onclick = stepFund;
+ $("go").onclick = stepRegisterTld;
+}
+
+async function stepRegisterTld() {
+ render(`Registering ${esc(state.name)}
+ Signing in your browser and broadcasting to the chain. Do not close this tab.
+ `);
+ const log = $("log");
+ const say = (s) => { const d = document.createElement("div"); d.textContent = s; log.appendChild(d); log.scrollTop = log.scrollHeight; };
+ const serviceFee = { address: BNS.REGISTRAR?.serviceFee?.address ?? null, sats: state.tld.serviceFeeSats };
+ try {
+ const res = state.session
+ ? await BNS.registerTldWithExternalWallet(await client(), {
+ session: state.session, tld: state.tld.label, records: {},
+ serviceFee, tldListUrl: "https://navigate.st/api/tlds", onProgress: say,
+ })
+ : await BNS.registerTldWithBuiltInWallet(await client(), {
+ wallet: state.wallet, tld: state.tld.label, records: {},
+ serviceFee, tldListUrl: "https://navigate.st/api/tlds", onProgress: say,
+ });
+ state.result = res;
+ stepDoneTld();
+ } catch (e) {
+ err(e);
+ const row = document.createElement("div"); row.className = "row end";
+ row.innerHTML = ``;
+ sheet.appendChild(row);
+ $("back").onclick = stepConfirmTld;
+ }
+}
+
+function stepDoneTld() {
+ const r = state.result;
+ render(`
+ ✓ .${esc(r.tld)} is yours
+ The TLD certificate is on the chain, held by your key. Second-level names under
+ .${esc(r.tld)} now live in your registry.
+
+ | Transaction | ${esc(r.txid.slice(0,20))}… |
+ | Certificate ID | ${esc(r.category.slice(0,20))}… |
+ | Operator | ${esc(r.ownerAddress.slice(0,22))}… |
+
+
+ `);
+ $("fin").onclick = close;
+}
+
// ---------- register ----------
async function stepRegister() {
render(`Registering ${esc(state.name)}
diff --git a/js/site-footer.js b/js/site-footer.js
index 4d41eaa..267b972 100644
--- a/js/site-footer.js
+++ b/js/site-footer.js
@@ -31,7 +31,7 @@
Product
- - 🪪 Register a name
+ - ✏️ Register a name
- 🌐 Register a TLD
- 🔑 My names portal
- 🧭 Theseus browser
diff --git a/portal.html b/portal.html
index 681c096..9825947 100644
--- a/portal.html
+++ b/portal.html
@@ -114,7 +114,7 @@