diff options
| author | Adam Soltys <[email protected]> | 2026-08-28 08:23:20 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-28 08:23:20 -0700 |
| commit | 7064a5b282f1c8e8d6d3e5fa614013c32921454f (patch) | |
| tree | d7897b08e26339f2d67156425cb014473ab67922 /src/features/names.js | |
| parent | 274130edd7d11a0643d9b1f7469022207e5f5563 (diff) | |
| download | coinosv3-7064a5b282f1c8e8d6d3e5fa614013c32921454f.tar.gz coinosv3-7064a5b282f1c8e8d6d3e5fa614013c32921454f.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
Diffstat (limited to 'src/features/names.js')
| -rw-r--r-- | src/features/names.js | 15 |
1 files changed, 15 insertions, 0 deletions
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'; }, |
