Add multi_invoice_lookup to NWC / NIP47

This commit is contained in:
blackcoffeexbt 2024-07-24 11:15:59 +01:00 committed by GitHub
parent 0227a2cd97
commit cf6c21d410
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

63
47.md
View File

@ -305,6 +305,69 @@ Response:
Errors: Errors:
- `NOT_FOUND`: The invoice could not be found by the given parameters. - `NOT_FOUND`: The invoice could not be found by the given parameters.
### `multi_lookup_invoice`
Description: Requests information for multiple invoices simultaneously.
Request:
```jsonc
{
"method": "multi_lookup_invoice",
"params": {
"invoices": [
{"invoice": "lnbc1...", "payment_hash": "abc123..."}, // Optional payment hash
{"invoice": "lnbc20n1..."}
]
}
}
```
Response:
A single response is sent with data for each invoice in the requested invoices list
```jsonc
{
"result_type": "multi_lookup_invoice",
"results": [
{
"type": "incoming", // "incoming" for invoices, "outgoing" for payments
"invoice": "string", // encoded invoice, optional
"description": "string", // invoice's description, optional
"description_hash": "string", // invoice's description hash, optional
"preimage": "string", // payment's preimage, optional if unpaid
"payment_hash": "string", // Payment hash for the payment
"amount": 123, // value in msats
"fees_paid": 123, // value in msats
"created_at": unixtimestamp, // invoice/payment creation time
"expires_at": unixtimestamp, // invoice expiration time, optional if not applicable
"settled_at": unixtimestamp, // invoice/payment settlement time, optional if unpaid
"metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc.
},
{
"type": "outgoing",
"invoice": "lnbc20n1...",
"description": "Second invoice description",
"description_hash": "string",
"preimage": "string",
"payment_hash": "def456...",
"amount": 200,
"fees_paid": 20,
"created_at": 1592604483,
"expires_at": 1592608083,
"settled_at": 1592607583,
"metadata": {}
}
]
}
```
Errors:
- NOT_FOUND: One or more of the requested invoices could not be found by the given parameters.
- INVALID_REQUEST: The request format is incorrect or missing required fields.
-
### `list_transactions` ### `list_transactions`
Lists invoices and payments. If `type` is not specified, both invoices and payments are returned. Lists invoices and payments. If `type` is not specified, both invoices and payments are returned.