diff options
| author | Roland <33993199+rolznz@users.noreply.github.com> | 2025-09-15 23:42:07 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-15 09:42:07 -0700 |
| commit | 400d975da36955a11c22f682cbcd3776ecb09867 (patch) | |
| tree | 61f3abd45b4a4c4d42ceaf9659465894f92c8911 /47.md | |
| parent | e35a1bebbc7a5e10970d2dbc9d07a88ee876bfbf (diff) | |
feat: add metadata to NIP-47 make_invoice and payment commands (#2063)
Diffstat (limited to '47.md')
| -rw-r--r-- | 47.md | 38 |
1 files changed, 36 insertions, 2 deletions
| @@ -188,6 +188,7 @@ Request: | |||
| 188 | "params": { | 188 | "params": { |
| 189 | "invoice": "lnbc50n1...", // bolt11 invoice | 189 | "invoice": "lnbc50n1...", // bolt11 invoice |
| 190 | "amount": 123, // invoice amount in msats, optional | 190 | "amount": 123, // invoice amount in msats, optional |
| 191 | "metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc, optional | ||
| 191 | } | 192 | } |
| 192 | } | 193 | } |
| 193 | ``` | 194 | ``` |
| @@ -217,7 +218,7 @@ Request: | |||
| 217 | "params": { | 218 | "params": { |
| 218 | "invoices": [ | 219 | "invoices": [ |
| 219 | {"id":"4da52c32a1", "invoice": "lnbc1...", "amount": 123}, // bolt11 invoice and amount in msats, amount is optional | 220 | {"id":"4da52c32a1", "invoice": "lnbc1...", "amount": 123}, // bolt11 invoice and amount in msats, amount is optional |
| 220 | {"id":"3da52c32a1", "invoice": "lnbc50n1..."}, | 221 | {"id":"3da52c32a1", "invoice": "lnbc50n1...", "metadata": {} }, // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc, optional |
| 221 | ], | 222 | ], |
| 222 | } | 223 | } |
| 223 | } | 224 | } |
| @@ -324,7 +325,8 @@ Request: | |||
| 324 | "amount": 123, // value in msats | 325 | "amount": 123, // value in msats |
| 325 | "description": "string", // invoice's description, optional | 326 | "description": "string", // invoice's description, optional |
| 326 | "description_hash": "string", // invoice's description hash, optional | 327 | "description_hash": "string", // invoice's description hash, optional |
| 327 | "expiry": 213 // expiry in seconds from time invoice is created, optional | 328 | "expiry": 213, // expiry in seconds from time invoice is created, optional |
| 329 | "metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc, optional | ||
| 328 | } | 330 | } |
| 329 | } | 331 | } |
| 330 | ``` | 332 | ``` |
| @@ -612,6 +614,38 @@ The **client** should check the `encryption` tag in the `info` event to determin | |||
| 612 | ## Using a dedicated relay | 614 | ## Using a dedicated relay |
| 613 | This NIP does not specify any requirements on the type of relays used. However, if the user is using a custodial service it might make sense to use a relay that is hosted by the custodial service. The relay may then enforce authentication to prevent metadata leaks. Not depending on a 3rd party relay would also improve reliability in this case. | 615 | This NIP does not specify any requirements on the type of relays used. However, if the user is using a custodial service it might make sense to use a relay that is hosted by the custodial service. The relay may then enforce authentication to prevent metadata leaks. Not depending on a 3rd party relay would also improve reliability in this case. |
| 614 | 616 | ||
| 617 | ## Metadata | ||
| 618 | Metadata MAY be stored by the **wallet service** alongside invoices and payments. The metadata MUST be no more than 4096 characters, otherwise MUST be dropped. This is to ensure transactions do not get too large to be relayed. | ||
| 619 | |||
| 620 | NWC relays SHOULD allow at least a payload size of 64KB and **clients** SHOULD fetch small page sizes (maximum of 20 transactions per page) otherwise there is risk of `list_transactions` responses being rejected. | ||
| 621 | |||
| 622 | Here are some properties that are recognized by some NWC clients: | ||
| 623 | |||
| 624 | ```jsonc | ||
| 625 | { | ||
| 626 | "comment": "string", // LUD-12 comment | ||
| 627 | "payer_data": { | ||
| 628 | "email": "string", | ||
| 629 | "name": "string", | ||
| 630 | "pubkey": "string", | ||
| 631 | }, // LUD-18 payer data | ||
| 632 | "recipient_data": { | ||
| 633 | "identifier": "string" | ||
| 634 | }, // similar to LUD-18 payer data, but to record recipient data e.g. the lightning address of the recipient | ||
| 635 | "nostr": { | ||
| 636 | "pubkey": "string", | ||
| 637 | "tags": [], | ||
| 638 | // ... | ||
| 639 | }, // NIP-57 (Nostr Zaps) | ||
| 640 | "tlv_records": [ // tlv records, optional | ||
| 641 | { | ||
| 642 | "type": 5482373484, // tlv type | ||
| 643 | "value": "0123456789abcdef" // hex encoded tlv value | ||
| 644 | } | ||
| 645 | ] // keysend TLV records (e.g. for podcasting 2.0 boostagrams) | ||
| 646 | } & Record<string, unknown>; | ||
| 647 | ``` | ||
| 648 | |||
| 615 | ## Appendix | 649 | ## Appendix |
| 616 | 650 | ||
| 617 | ### Example NIP-47 info event | 651 | ### Example NIP-47 info event |