Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 193 additions & 2 deletions 47.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,34 @@ pubkey should be used.
Errors:
- `PAYMENT_FAILED`: The payment failed. This may be due to a timeout, exhausting all routes, insufficient capacity or similar.

### `pay_chain`

Description: Requests payment to one or more chain addresses.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should happen if the backend is not able to pay all adresses but only some (e.g. too few funds)?
Might add a line saying something alike: All given addresses have to be paid in a single transaction or the request gets failed.
This should give the client the explicit guarantee that the transaction will happen as requested.

Request:
```jsonc
{
"method": "pay_chain",
"params": {
"recipients": [
["bc1q...", 123], // [address, amount in sats]
["bc1p...", 456] // can send to multiple addresses
],
"feerate": 10 // optional feerate in sat/vByte
}
}
```

Response:
```jsonc
{
"result_type": "pay_chain",
"result": {
"txid": "0123456789abcdef...",
}
}
```

### `make_invoice`

Request:
Expand Down Expand Up @@ -346,6 +374,29 @@ Response:
Errors:
- `NOT_FOUND`: The invoice could not be found by the given parameters.

### `make_chain_address`

Request:
```jsonc
{
"method": "make_chain_address",
"params": {
"type": "p2tr", // optional - (p2tr, p2wpkh etc)
}
}
```

Response:
```jsonc
{
"result_type": "make_chain_address",
"result": {
"address": "bc1q...", // chain address
"type": "p2tr", // (p2tr, p2wpkh etc)
}
}
```

### `list_transactions`

Lists invoices and payments. If `type` is not specified, both invoices and payments are returned.
Expand Down Expand Up @@ -393,6 +444,102 @@ Response:
}
```

### `list_chain_transactions`

Request:
```jsonc
{
"method": "list_chain_transactions",
"params": {
"from": unixtimestamp, // optional
"until": unixtimestamp, // optional
"limit": 10, // maximum number of transactions to return, optional
"offset": 0, // offset of the first transaction to return, optional
}
}
```

Response:
```jsonc
{
"result_type": "list_chain_transactions",
"result": {
"transactions": [
{
"txid": "0123456789abcdef...",
"spentUtxos": [ // UTXOs that belonged to the wallet and were spent in this transaction
{
"txid": "abcdef0123456789...",
"vout": 0,
"address": "bc1q...",
"amount": 150000 // value in sats
}
],
"receivedUtxos": [ // new UTXOs the wallet received from this transaction
{
"txid": "0123456789abcdef...",
"vout": 0,
"address": "bc1p...",
"amount": 49900 // value in sats (change output)
},
{
"txid": "0123456789abcdef...",
"vout": 2,
"address": "bc1q...",
"amount": 25000 // value in sats (received payment)
}
],
"confirmations": 1,
"metadata": {} // generic metadata
},
{
"txid": "fedcba9876543210...",
"spentUtxos": [], // empty - wallet didn't spend any UTXOs in this transaction
"receivedUtxos": [ // wallet received a payment
{
"txid": "fedcba9876543210...",
"vout": 1,
"address": "bc1q...",
"amount": 100000 // value in sats (pure incoming payment)
}
],
"confirmations": 6,
"metadata": {} // generic metadata
}
],
}
}
```

### `list_utxos`

Request:
```jsonc
{
"method": "list_utxos",
"params": {
"min_confirmations": 1, // minimum number of confirmations, optional
}
}
```

Response:
```jsonc
{
"result_type": "list_utxos",
"result": {
"utxos": [
{
"txid": "0123456789abcdef...",
"vout": 0,
"amount": 123, // value in sats
"confirmations": 1,
}
],
}
}
```

### `get_balance`

Request:
Expand All @@ -413,6 +560,27 @@ Response:
}
```

### `get_chain_balance`

Request:
```jsonc
{
"method": "get_chain_balance",
"params": {}
}
```

Response:
```jsonc
{
"result_type": "get_chain_balance",
"result": {
"confirmed_balance": 100000, // user's balance in sats
"unconfirmed_balance": 100000, // user's unconfirmed balance in sats
}
}
```

### `get_info`

Request:
Expand Down Expand Up @@ -440,6 +608,29 @@ Response:
}
```

### `sign_psbt`

Request:
```jsonc
{
"method": "sign_psbt",
"params": {
"psbt": "cHNidP8BAHICAAAAA...", // base64 encoded psbt
"input_index": 0, // index of the input to sign, optional
}
}
```

Response:
```jsonc
{
"result_type": "sign_psbt",
"result": {
"psbt": "cHNidP8BAHIC...", // base64 encoded signed psbt
}
}
```

## Notifications

### `payment_received`
Expand Down Expand Up @@ -518,7 +709,7 @@ This NIP does not specify any requirements on the type of relays used. However,
"payment_received payment_sent"
]
],
"content": "pay_invoice pay_keysend get_balance get_info make_invoice lookup_invoice list_transactions multi_pay_invoice multi_pay_keysend sign_message notifications",
"content": "pay_invoice pay_keysend get_balance get_info make_invoice lookup_invoice list_transactions multi_pay_invoice multi_pay_keysend pay_chain sign_message notifications",
"sig": "31f57b369459b5306a5353aa9e03be7fbde169bc881c3233625605dd12f53548179def16b9fe1137e6465d7e4d5bb27ce81fd6e75908c46b06269f4233c845d8"
}
```
```