mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-23 00:45:53 -05:00
Create 41.md
This commit is contained in:
parent
8c3c421715
commit
afe487db43
46
41.md
Normal file
46
41.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
NIP-41
|
||||||
|
======
|
||||||
|
|
||||||
|
### Poll & Vote Event
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
`draft` `optional` `author:0xtlt`
|
||||||
|
|
||||||
|
An event with kind `1` that wants to contain a poll can do so by adding poll tags and its content as follows:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
...
|
||||||
|
"kind": 1,
|
||||||
|
"tags": [
|
||||||
|
...
|
||||||
|
["poll", "Choice 1"],
|
||||||
|
["poll", "Choice 2"],
|
||||||
|
["poll", "Choice 3"]
|
||||||
|
...
|
||||||
|
],
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then the client should display voting options if more than **1 choice** is present in the poll.
|
||||||
|
|
||||||
|
The client can then submit the vote by sending an event with kind `8` and its content which will be the index (start at `0`) of the chosen choice.
|
||||||
|
|
||||||
|
It should also contain an `e` tag with the id of the poll event only.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
...
|
||||||
|
"kind": 8,
|
||||||
|
"tags": [
|
||||||
|
...
|
||||||
|
["e", "<event-id>"]
|
||||||
|
...
|
||||||
|
],
|
||||||
|
"content": "1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Warning
|
||||||
|
|
||||||
|
Keep in mind that all votes are public and accessible to everyone.
|
Loading…
Reference in New Issue
Block a user