aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-07 22:34:18 -0700
committerAdam Soltys <[email protected]>2026-11-07 22:34:18 -0700
commitd6b9298e2dfde43542a516b3b0cac4770592a794 (patch)
tree047d5ec76ea1e659fa186f043f632a4f18a6ea7f /src/features
parenta1cb2db1907313530b50798dea0e37278cbbb0ef (diff)
downloadcoinosv3-d6b9298e2dfde43542a516b3b0cac4770592a794.tar.gz
coinosv3-d6b9298e2dfde43542a516b3b0cac4770592a794.zip
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 spendableHEADmaster
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6Ts5Tktega8VbLg31q
Diffstat (limited to 'src/features')
-rw-r--r--src/features/zaps.js10
1 files changed, 9 insertions, 1 deletions
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) {