From afeae356aaef6a7ba1e56548987b0c11e57f08ac Mon Sep 17 00:00:00 2001 From: Local Dev Date: Tue, 8 Sep 2026 00:24:54 +0200 Subject: [PATCH] =?UTF-8?q?feat(sirius-x):=20=F0=9F=94=93=20Unlock=20my=20?= =?UTF-8?q?wallet=20in=20nav=20dropdown=20when=20a=20saved=20wallet=20exis?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the only way to unlock a wallet that had been saved in this browser was to click Register (name or TLD), open the modal, and pick 'Unlock my browser wallet' from the wallet-choice step. From the nav dropdown you could only start onboarding fresh (New / Import / WC). profile-menu.js now checks localStorage for the BuiltInWallet's storage key (bns.wallet.v1) at every render, and when a saved wallet is present inserts a '🔓 Unlock my wallet' item at the top of the not-signed-in dropdown — with a divider below it, so it reads as the primary action and the Onboarding options stay available for adding a different wallet. The dropdown click handler already lazy-loads register-flow.js and calls window.siriusSignInWallet(action); register-flow.js's startSignIn grew an 'unlock' mode that opens the modal directly at stepUnlock (the password prompt). Same success path as every other sign-in: on unlock success, siriusProfile is written and the modal closes with '✓ Signed in' — the nav pill flips to the address without a reload. Verified end-to-end on landing: saved wallet detected -> dropdown shows Unlock as first item -> click -> password -> '✓ Signed in' -> pill becomes 'qqyx49…zx8x seed ▾' with no reload. TLD mint from tld.html also verified end-to-end: search 'e2etldtest' -> Register -> modal -> Unlock -> password -> Fund -> Confirm (fee 1,250,000 sat + beacon dust ~1,300 sat) -> Register -> checking-availability -> loading-coins -> 'wallet is empty' (expected without chipnet funds; downstream code is the same registerTldWithBuiltInWallet path the CLI uses). --- admin/index.html | 2 +- brand/index.html | 2 +- docs/index.html | 2 +- index.html | 4 ++-- js/profile-menu.js | 25 ++++++++++++++++++++----- js/register-flow.js | 2 ++ portal.html | 2 +- theseus/index.html | 2 +- tld.html | 4 ++-- 9 files changed, 31 insertions(+), 14 deletions(-) diff --git a/admin/index.html b/admin/index.html index e49d384..d4db60c 100644 --- a/admin/index.html +++ b/admin/index.html @@ -301,6 +301,6 @@ $("mint-btn").addEventListener("click", async () => { }); - + diff --git a/brand/index.html b/brand/index.html index 152fc19..3f59ed6 100644 --- a/brand/index.html +++ b/brand/index.html @@ -219,6 +219,6 @@ - + diff --git a/docs/index.html b/docs/index.html index 02e007b..aa198fd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -425,6 +425,6 @@ process.exit(0);" - + diff --git a/index.html b/index.html index a9705cd..5db7490 100644 --- a/index.html +++ b/index.html @@ -421,9 +421,9 @@ process.exit(0);" - + - + diff --git a/js/profile-menu.js b/js/profile-menu.js index a0129f5..0ab378f 100644 --- a/js/profile-menu.js +++ b/js/profile-menu.js @@ -75,15 +75,30 @@ const dot = ``; btn.innerHTML = `${dot}Wallet`; btn.setAttribute("aria-label", "Wallet — not signed in"); + // If a saved encrypted wallet already exists in this browser (created + // in a previous session), surface an Unlock option as the first item so + // users can sign back into the same wallet the mint flow would use — + // instead of hunting for it inside the Register modal's wallet-choice. + const hasSaved = (() => { + try { return !!localStorage.getItem("bns.wallet.v1"); } catch { return false; } + })(); + const unlockItem = hasSaved ? ` + + 🔓 + Unlock my walletone you already created on this device + +
+ ` : ""; + const headerHint = hasSaved + ? `Locked wallet on this deviceUnlock or add another` + : `No wallet yetSign in to see your names`; // Each item opens the shared mint modal (js/register-flow.js) at the // matching wallet step, in sign-in-only mode. No navigation, no separate // portal page — everything happens inline on whatever page the user is // on. profile-menu.js loads register-flow.js on demand. menu.innerHTML = ` -
- No wallet yet - Sign in to see your names -
+
${headerHint}
+ ${unlockItem} 🆕 New walletgenerate a fresh 12-word phrase @@ -145,7 +160,7 @@ location.reload(); return; } - if (["new", "import", "wc"].includes(action)) { + if (["new", "import", "wc", "unlock"].includes(action)) { close(); const savedLabel = btn.querySelector(".wallet-label")?.textContent; const walletLabel = btn.querySelector(".wallet-label"); diff --git a/js/register-flow.js b/js/register-flow.js index 7888eb0..1e7170e 100644 --- a/js/register-flow.js +++ b/js/register-flow.js @@ -193,11 +193,13 @@ function startTldFlow(label, opts = {}) { // and closes — no name context, no Fund/Confirm. function startSignIn(mode) { state.name = null; + state.tld = null; state.signInOnly = true; open(); if (mode === "new") stepCreate(); else if (mode === "import") stepImport(); else if (mode === "wc") stepExternal(); + else if (mode === "unlock") stepUnlock(); else stepWallet(); } diff --git a/portal.html b/portal.html index 9825947..6779501 100644 --- a/portal.html +++ b/portal.html @@ -812,6 +812,6 @@ $("tld-submit").addEventListener("click", async () => { updateTldPrice(); - + diff --git a/theseus/index.html b/theseus/index.html index e6fbbfd..79422b0 100644 --- a/theseus/index.html +++ b/theseus/index.html @@ -170,6 +170,6 @@ sha256sum <downloaded-file>.exe
- + diff --git a/tld.html b/tld.html index 5737272..d182bae 100644 --- a/tld.html +++ b/tld.html @@ -249,8 +249,8 @@ })(); - + - +