diff options
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/names.js | 8 | ||||
| -rw-r--r-- | src/features/zaps.js | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/features/names.js b/src/features/names.js index 8f37b36..7e51c8c 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -923,6 +923,14 @@ export function namesFeature(ctx) { render: (seg) => namePane(seg), }]; }, + // Is a typed name real yet? (the send form asks once typing pauses, and + // only moves on when something answers — never on a half-typed domain) + async probeLnAddress(text) { + const parsed = parsePaymentName(text); + if (!parsed) return false; + if (OUR_DOMAINS.includes(parsed.domain)) return !!(await registrarLookup(parsed.name, parsed.domain).catch(() => null)); + return !!(await resolveBip353(parsed.name, parsed.domain).catch(() => null)); + }, // BEFORE zaps in the registry: a pasted user@domain tries DNS first. matchSendText(text, typed) { if (typed) return false; // don't yank the form away mid-keystroke diff --git a/src/features/zaps.js b/src/features/zaps.js index a99de94..f0b655a 100644 --- a/src/features/zaps.js +++ b/src/features/zaps.js @@ -414,6 +414,12 @@ export function zapsFeature(ctx) { begin(target, zapDisplay(target, text), tap); return true; }, + // A lightning address is real when its server answers as a pay endpoint. + async probeLnAddress(text) { + const target = parseZapTarget(text); + if (!target || target.kind !== 'lnaddr') return false; + return fetchPayParams(target.url).then(() => true, () => false); + }, // The typed-lightning-address affordance on the send form. sendFormNote(a) { if (!canPay() || !ui.send || ui.send.recipients.length !== 1) return null; |
