feat(sirius-x): 🔓 Unlock my wallet in nav dropdown when a saved wallet exists
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).
This commit is contained in:
parent
bce4aa3529
commit
afeae356aa
9 changed files with 31 additions and 14 deletions
|
|
@ -301,6 +301,6 @@ $("mint-btn").addEventListener("click", async () => {
|
|||
});
|
||||
</script>
|
||||
<script defer src="../js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -219,6 +219,6 @@
|
|||
<footer id="site-footer"></footer>
|
||||
|
||||
<script defer src="../js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -425,6 +425,6 @@ process.exit(0);"</pre>
|
|||
<footer id="site-footer"></footer>
|
||||
|
||||
<script defer src="../js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -421,9 +421,9 @@ process.exit(0);"</pre>
|
|||
<script type="importmap">
|
||||
{ "imports": { "@bitauth/libauth": "https://silentmode.st/js/libauth.js" } }
|
||||
</script>
|
||||
<script type="module" src="./js/register-flow.js?v=20260908tld"></script>
|
||||
<script type="module" src="./js/register-flow.js?v=20260908unlock"></script>
|
||||
|
||||
<script defer src="./js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -75,15 +75,30 @@
|
|||
const dot = `<span class="wallet-dot" aria-hidden="true"></span>`;
|
||||
btn.innerHTML = `${dot}<span class="wallet-label">Wallet</span><span class="wallet-caret" aria-hidden="true">▾</span>`;
|
||||
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 ? `
|
||||
<a href="#" role="menuitem" data-action="unlock">
|
||||
<span class="mi-ic">🔓</span>
|
||||
<span class="mi-body"><b>Unlock my wallet</b><span class="mi-hint">one you already created on this device</span></span>
|
||||
</a>
|
||||
<hr>
|
||||
` : "";
|
||||
const headerHint = hasSaved
|
||||
? `<span class="profile-hint">Locked wallet on this device</span><span class="profile-sub">Unlock or add another</span>`
|
||||
: `<span class="profile-hint">No wallet yet</span><span class="profile-sub">Sign in to see your names</span>`;
|
||||
// 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 = `
|
||||
<div class="profile-header">
|
||||
<span class="profile-hint">No wallet yet</span>
|
||||
<span class="profile-sub">Sign in to see your names</span>
|
||||
</div>
|
||||
<div class="profile-header">${headerHint}</div>
|
||||
${unlockItem}
|
||||
<a href="#" role="menuitem" data-action="new">
|
||||
<span class="mi-ic">🆕</span>
|
||||
<span class="mi-body"><b>New wallet</b><span class="mi-hint">generate a fresh 12-word phrase</span></span>
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -812,6 +812,6 @@ $("tld-submit").addEventListener("click", async () => {
|
|||
updateTldPrice();
|
||||
</script>
|
||||
<script defer src="./js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -170,6 +170,6 @@ sha256sum <downloaded-file>.exe</pre>
|
|||
<footer id="site-footer"></footer>
|
||||
|
||||
<script defer src="../js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="../js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
4
tld.html
4
tld.html
|
|
@ -249,8 +249,8 @@
|
|||
})();
|
||||
</script>
|
||||
|
||||
<script type="module" src="./js/register-flow.js?v=20260908tld"></script>
|
||||
<script type="module" src="./js/register-flow.js?v=20260908unlock"></script>
|
||||
<script defer src="./js/site-footer.js?v=20260907rel"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260907inline"></script>
|
||||
<script defer src="./js/profile-menu.js?v=20260908unlock"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue