From d6b9298e2dfde43542a516b3b0cac4770592a794 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Nov 2026 22:34:18 -0700 Subject: A scanned LNURL opens as what it is even while Spending is still connecting. "I refreshed and scanned it again and it put the lnurl in the recipient field and gave me a zap button" (Adam, 2026-11-08): zaps' matchSendText turned everything down until canLnPay, which is false for the first moments after a refresh, so his own withdraw link fell through to the send form's "Zap LNURL…" affordance. A withdraw pays us and needs nothing spendable, and only the GET says which kind an lnurl is, so a scanned or pasted lnurl is taken first and resolved; a pay one meets the pay checks where it's paid. lnurl-withdraw-test covers the scan with nothing spendable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6Ts5Tktega8VbLg31q --- src/features/zaps.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/features/zaps.js b/src/features/zaps.js index 8ac78fb..8e29409 100644 --- a/src/features/zaps.js +++ b/src/features/zaps.js @@ -533,7 +533,15 @@ export function zapsFeature(ctx) { // a login challenge needs no balance, only the wallet's key const auth = parseLnurlAuth(text); if (auth) { beginLogin(auth); return true; } - if (!canPay() || !ui.send || ui.send.recipients.length !== 1) return false; + if (!ui.send || ui.send.recipients.length !== 1) return false; + // An LNURL may be a withdraw — it pays US, so it needs no spendable + // balance, and right after a refresh (Spending still connecting) the + // check below turned a scanned withdraw link into a "Zap LNURL…" + // recipient (Adam, 2026-11-08). Only the GET can tell: take it now, + // and a pay one meets the pay checks where it's paid. + const early = parseZapTarget(text); + if (early && early.kind === 'lnurl' && !typed) { begin(early, zapDisplay(early, text), true); return true; } + if (!canPay()) return false; const tap = !typed; // scanned/pasted (a tap), not a keystroke const nof = maybeNoffer(text); if (nof) { -- cgit v1.2.3