Make o and r tags variadic

This commit is contained in:
arthurfranca 2024-06-09 15:38:31 -03:00
parent 278601d085
commit 194d1d70a2

16
22.md
View File

@ -35,17 +35,21 @@ This way a client can request all comments related to the kind it supports, not
### Threads ### Threads
**There is always an `o` tag** pointing to the original post that started the thread. **There is always an `o` tag** pointing to the original post that started the thread.
Its value can be an event id (with an `"i:<event-kind>:<event-pubkey>:"` prefix), Its value can be an event id (with an `"e:"` prefix),
an event address (`"a:"` prefix) or others shown at below section. The second value 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. 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. This tag is useful to load all messages of a thread at once.
Note that if commenting on a replaceable event, one can choose to add both id and address references. Note that if commenting on a replaceable event, one can choose to add both id and address references.
After the first value, the `o` tag may have a variable number of `<key><space-separator><value>` fields
at any order. When the tag references an event id, both a a [NIP-65](65.md) pubkey hint and a relay hint
are recommended fields while for an event address, just the relay hint.
Examples: Examples:
- `["o", "i:<event-kind>:<event-pubkey>:<event-id>", "<relay-url, optional>"]` - `["o", "e:<event-id>", "p <event-pubkey, optional>", "r <relay-url, optional>"]`
- `["o", "a:<event-kind>:<event-pubkey>:<d-tag, optional>", "<relay-url, optional>"]` - `["o", "a:<event-kind>:<event-pubkey>:<d-tag, optional>", "r <relay-url, optional>"]`
Also, **there is always an `r` tag** pointing to the subject being directly commented on or replied to, using the 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. same structure of the `o` tag.
@ -75,7 +79,7 @@ the client supports the [NIP-65](65.md) relay usage spec,
// referencing the OP // referencing the OP
["o", "r:https://abc.com/articles/1/"], ["o", "r:https://abc.com/articles/1/"],
// replying to a parent kind:1111 comment // replying to a parent kind:1111 comment
["r", "i:1111:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://example.relay"], ["r", "e:5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "p f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca", "r wss://example.relay"],
// the OP "kind"; for an url, the kind is its domain // the OP "kind"; for an url, the kind is its domain
["K", "r:https://abc.com"] ["K", "r:https://abc.com"]
// the parent kind // the parent kind
@ -91,8 +95,8 @@ the client supports the [NIP-65](65.md) relay usage spec,
content: 'Great blog post! Check this out nostr:npub1sn0wdenkukak0d9dfczzeacvhkrgz92ak56egt7vdgzn8pv2wfqqhrjdv9.', content: 'Great blog post! Check this out nostr:npub1sn0wdenkukak0d9dfczzeacvhkrgz92ak56egt7vdgzn8pv2wfqqhrjdv9.',
tags: [ tags: [
// top-level comments have the same o and r tags // top-level comments have the same o and r tags
["o", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"], ["o", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "r wss://example.relay"],
["r", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"], ["r", "a:30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "r wss://example.relay"],
// the OP kind // the OP kind
["K", "n:30023"] ["K", "n:30023"]
// the parent kind // the parent kind