Skip to content

Commit

Permalink
commands: include missing amount in response
Browse files Browse the repository at this point in the history
The GUI uses the InsufficientFunds error to get the missing
amount when the user is creating a new spend.

It is not straightforward to extract this information in a
general way from the RPC error. Instead, this missing amount
will be included in the command response.

These changes are based on suggestions from darosior
and edouardparis.
  • Loading branch information
jp1ac4 committed Jan 17, 2024
1 parent 7ca6cc8 commit 8cd021d
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 127 deletions.
7 changes: 7 additions & 0 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,18 @@ This command will refuse to create any output worth less than 5k sats.

#### Response

If the spend is created successfully, the following response will be received:

| Field | Type | Description |
| -------------- | ----------------- | ---------------------------------------------------- |
| `psbt` | string | PSBT of the spending transaction, encoded as base64. |
| `warnings` | list of string | Warnings, if any, generated during spend creation. |

If there are insufficient funds to create the required spend, then the following response will be received:

| Field | Type | Description |
| -------------- | ----------------- | ---------------------------------------------------- |
| `missing` | integer | Additional sats required to create the spend. |

### `updatespend`

Expand Down
Loading

0 comments on commit 8cd021d

Please sign in to comment.