mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-09-29 16:31:12 +00:00
Add other prefixes
This commit is contained in:
parent
6af79cbf93
commit
278601d085
25
22.md
25
22.md
@ -20,13 +20,13 @@ A comment is an event of `kind:1111` with plaintext `.content`
|
||||
(no HTML, no Markdown nor other formatting).
|
||||
|
||||
**It must have a `k` tag** pointing to the kind of the subject being commented on.
|
||||
It has a prefix: `"n:"` for nostr subjects and `"r:"` for url ones.
|
||||
Its value has a prefix: `"n:"` for nostr subjects and other prefixes (listed in a section ahead)
|
||||
for things that aren't nostr events.
|
||||
|
||||
For example, when commenting on a `kind:30023`, the `k` tag is set to "n:30023".
|
||||
When replying to another `kind:1111`, the `k` tag is set to "n:1111".
|
||||
If commenting on an `https://abc.com/articles/1` article the `k` tag is set to "r:https://abc.com" (its domain).
|
||||
|
||||
The `k` tag is useful to fetch top-level comments about events of specific kinds (or domains), for example,
|
||||
The `k` tag is useful to fetch top-level comments about events of specific types, for example,
|
||||
by filtering with `{ "#k": ["n:30023"], "kinds": [1111] }`.
|
||||
|
||||
**An uppercase `K` tag must also be present.** The difference is that it is set to the original post (the one starting the thread) kind.
|
||||
@ -35,8 +35,8 @@ This way a client can request all comments related to the kind it supports, not
|
||||
### Threads
|
||||
|
||||
**There is always an `o` tag** pointing to the original post that started the thread.
|
||||
It can be an event id (with an `"i:<event-kind>:<event-pubkey>:"` prefix),
|
||||
an event address (`"a:"` prefix) or an url (`"r:"` prefix). The second value
|
||||
Its value can be an event id (with an `"i:<event-kind>:<event-pubkey>:"` prefix),
|
||||
an event address (`"a:"` prefix) or others shown at below section. The second value
|
||||
is the optional recommended relay url where the referenced event may be found.
|
||||
This tag is useful to load all messages of a thread at once.
|
||||
|
||||
@ -46,12 +46,19 @@ Examples:
|
||||
|
||||
- `["o", "i:<event-kind>:<event-pubkey>:<event-id>", "<relay-url, optional>"]`
|
||||
- `["o", "a:<event-kind>:<event-pubkey>:<d-tag, optional>", "<relay-url, optional>"]`
|
||||
- `["o", "r:https://abc.com/articles/1/"]`
|
||||
|
||||
Also, **there is always an `r` tag** pointing to the subject being directly commented on or replied to, using the
|
||||
same structure of the `o` tag.
|
||||
This tag is useful to lazily load a thread.
|
||||
|
||||
### Other possible `o`/`r` tag values and their corresponding `K/k` tag values
|
||||
|
||||
| `o`/`r` tag | corresponding `K/k` tag |
|
||||
| - | - |
|
||||
| "r:`<url>`" | "r:`<domain>`" |
|
||||
| "t:`<topic>`" | "#:t" |
|
||||
| "g:`<geohash>`" | "#:g" |
|
||||
|
||||
#### Thread Relays
|
||||
|
||||
If the original post being commented on is a nostr event and
|
||||
@ -68,7 +75,7 @@ the client supports the [NIP-65](65.md) relay usage spec,
|
||||
// referencing the OP
|
||||
["o", "r:https://abc.com/articles/1/"],
|
||||
// replying to a parent kind:1111 comment
|
||||
["r", "i:1111:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"],
|
||||
["r", "i:1111:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://example.relay"],
|
||||
// the OP "kind"; for an url, the kind is its domain
|
||||
["K", "r:https://abc.com"]
|
||||
// the parent kind
|
||||
@ -84,8 +91,8 @@ the client supports the [NIP-65](65.md) relay usage spec,
|
||||
content: 'Great blog post! Check this out nostr:npub1sn0wdenkukak0d9dfczzeacvhkrgz92ak56egt7vdgzn8pv2wfqqhrjdv9.',
|
||||
tags: [
|
||||
// top-level comments have the same o and r tags
|
||||
["o", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7"],
|
||||
["r", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7"],
|
||||
["o", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
|
||||
["r", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
|
||||
// the OP kind
|
||||
["K", "n:30023"]
|
||||
// the parent kind
|
||||
|
Loading…
Reference in New Issue
Block a user