Expand description
Zapping a note (NIP-57): asking its author’s Lightning address for an invoice that, once paid, their wallet service announces as a zap.
It takes two requests over https (LNURL-pay, LUD-06 and LUD-16). The
first asks the address what it accepts: how little, how much, and
whether it knows about zaps. The second asks for an invoice of an amount,
and carries a signed zap request naming the note and the relays the
receipt should go to. Paying the invoice is left to a wallet: the invoice
is all this client produces.
Everything the address answers is somebody else’s word. The invoice is only shown if it asks for the amount that was chosen.
Structs§
- Invoice
- An invoice to pay.
- PayInfo
- What a Lightning address accepts.
- ZapOrder
- A zap to ask an invoice for.
Enums§
Constants§
- MAX_
ANSWER_ 🔒BYTES - How long what a Lightning address answers may be. Real answers are a few hundred bytes, and an invoice a few hundred more.
Functions§
- invoice_
millisats 🔒 - What a Lightning invoice asks for, in millisats, read from the amount
in its human-readable part:
lnbc2500u1…is 2500 micro-bitcoin.Nonefor an invoice that names no amount, or isn’t one. - invoice_
url 🔒 - Where an invoice for
millisatsis asked for:pay_info’s callback, with the amount and, for a zap, the signed request. A plain payment carries the comment instead, if the address takes one that long. - parse_
answer 🔒 - The JSON object in
answer, unless it is LNURL’s way of saying no:{"status": "ERROR", "reason": "…"}. - parse_
invoice 🔒 - The invoice in the answer to the second request, if it is one for
millisats. - parse_
pay_ 🔒info - What a Lightning address accepts, by its answer to the first request.
- pay_
info_ 🔒url - Where the Lightning address
name@domainis asked what it accepts (LUD-16).Noneif it isn’t an address. - request_
invoice - Ask a Lightning address for the invoice of
order, withsignersigning for an account that zaps. - zap_
request 🔒 - The zap request for
millisatsto the author ofnote, yet to be signed: what the wallet service copies into its receipt, which is to go torelays. - zapper_
key - The key the wallet service behind the Lightning address
addresssigns its zap receipts with, as it says itself: none, of one that doesn’t do zaps. A receipt for a zap to that address counts when this key signed it (NIP-57).