From 7064a5b282f1c8e8d6d3e5fa614013c32921454f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 28 Aug 2026 08:23:20 -0700 Subject: The address is fetched while the key still turns in the lock: sign-in races a registrar lookup against the seed work and seeds the name before first paint, so the Receive pane opens straight onto its QR instead of "setting up your payment address" Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi --- src/features/names.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/features/names.js') diff --git a/src/features/names.js b/src/features/names.js index 235b834..5b2f856 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -650,6 +650,21 @@ export function namesFeature(ctx) { namesAdoptIdentity(signer, npub) { return adoptIdentity(signer, npub); }, // the claimed payment address, for anyone prefilling a lightning address namesAddress() { const st = load(); return st.name ? `${st.name}@${st.domain || DOMAIN()}` : null; }, + // Sign-in races this lookup against the seed work: by the time the + // wallet opens, the answer is usually already in hand… + namesLookupByPk(pk) { + if (!pk) return null; + return fetch(`${REGISTRAR}/pubkey/${pk}?domain=${encodeURIComponent(DOMAIN())}`) + .then((x) => x.json()).catch(() => null); + }, + // …and this seeds it into state just before the first paint, so the + // Receive pane opens with the QR instead of "setting up your address". + namesSeed(rec) { + if (!rec || !rec.name) return null; + const st = load(); + if (!st.name) save({ name: rec.name, domain: rec.domain || DOMAIN(), uri: rec.uri }); + return true; + }, // 'pending' while the restore/claim pass is still running — the wallet // screen holds spending-setup prompts until the name question is settled. namesSettled() { return checked ? 'yes' : 'pending'; }, -- cgit v1.2.3