Compare commits

...

8 Commits

Author SHA1 Message Date
Jeremy Klein
d88739fe84
Merge 587be067ed into a1ca7a194b 2024-12-10 14:50:34 -08:00
Jon Staab
a1ca7a194b Change strategy for naming groups 2024-12-10 19:25:28 -03:00
Jeremy Klein
587be067ed Add back msats comment 2024-09-26 10:13:32 -07:00
Jeremy Klein
1a65d511da Remove explicit msats in names 2024-09-22 21:57:21 -07:00
Jeremy Klein
9dd2256a2a Switch to used budget instead of remaining 2024-09-22 21:32:42 -07:00
Jeremy Klein
1c96bc45cf Add renewal_period 2024-09-18 22:46:48 -07:00
Jeremy Klein
210966466b
Suggested comment clarification
Co-authored-by: Roland <33993199+rolznz@users.noreply.github.com>
2024-09-18 22:42:04 -07:00
Jeremy Klein
17cd5be192 [NWC] Add get_budget command for per-connection budget limits.
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.
2024-09-17 21:18:23 -07:00
3 changed files with 31 additions and 3 deletions

4
29.md
View File

@ -30,8 +30,6 @@ When encountering just the `<host>` without the `'<group-id>`, clients MAY infer
Events sent by users to groups (chat messages, text notes, moderation events etc) MUST have an `h` tag with the value set to the group _id_.
`h` tags MAY include the group's name as the second argument. This allows `unmanaged` groups to be assigned human-readable names without relay support.
## Timeline references
In order to not be used out of context, events sent to these groups may contain references to previous events seen from the same relay in the `previous` tag. The choice of which previous events to pick belongs to the clients. The references are to be made using the first 8 characters (4 bytes) of any event in the last 50 events seen by the user in the relay, excluding events by themselves. There can be any number of references (including zero), but it's recommended that clients include at least 3 and that relays enforce this.
@ -242,3 +240,5 @@ A definition for `kind:10009` was included in [NIP-51](51.md) that allows client
### Using `unmanaged` relays
To prevent event leakage, when using `unmanaged` relays, clients should include the [NIP-70](70.md) `-` tag, as just the `previous` tag won't be checked by other `unmanaged` relays.
Groups MAY be named without relay support by adding a `name` to the corresponding tag in a user's `kind 10009` group list.

28
47.md
View File

@ -402,6 +402,34 @@ 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": {
"used_budget": 10000, // used budget amount in msats
"total_budget": 100000, // total budget amount in msats
"renews_at": 1693876973, // timestamp in seconds since epoch, optional. If not provided, the budget does not renew.
"renewal_period": "monthly", // daily|weekly|monthly|yearly|never
}
}
```
### `get_info`
Request:

2
51.md
View File

@ -29,7 +29,7 @@ For example, _mute list_ can contain the public keys of spammers and bad actors
| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) |
| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) |
| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) |
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL), `"r"` for each relay in use |
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL + optional group name), `"r"` for each relay in use |
| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a"` (kind:30015 interest set) |
| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) |
| DM relays | 10050 | Where to receive [NIP-17](17.md) direct messages | `"relay"` (see [NIP-17](17.md)) |