Skip to content

Commit

Permalink
[NWC] Add get_budget command for per-connection budget limits.
Browse files Browse the repository at this point in the history
This separates the notion of budget from `get_balance` so that permissions
can be more appropriately controlled by the wallet. Budgets can be configured
by users like how Alby supports, and client apps can query their remaining
budget and when it will renew next.

Breaking out a separate command for this purpose means that a user can let
a client app see their own remaining budget without giving the app access
to see their entire wallet balance.
  • Loading branch information
jklein24 committed Sep 18, 2024
1 parent 8c47577 commit 17cd5be
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 47.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,33 @@ Response:
}
```

### `get_budget`

Budgets can be used to limit the amount of funds that can be spent by a connection in a given time period.
Budgets are optional and can be set by the user if their wallet supports it. Support for this command indicates
that the wallet supports user-configured budgets. The budget will be reset at the `renews_at` timestamp.

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

Response:
```jsonc
{
"result_type": "get_budget",
"result": {
"remaining_budget_msats": 10000,
"total_budget_msats": 100000,
"renews_at": 1693876973, // timestamp in seconds since epoch
}
}
```

### `get_info`

Request:
Expand Down

0 comments on commit 17cd5be

Please sign in to comment.