-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# User rating | ||
|
||
## Overview | ||
|
||
All mostro messages are [Parameterized Replaceable Events](https://github.com/nostr-protocol/nips/blob/master/01.md#kinds) and use `30078` as event `kind`, a list of standard event kinds can be found [here](https://github.com/nostr-protocol/nips#event-kinds) | ||
|
||
## Communication between users and Mostro | ||
|
||
All messages from/to Mostro should be a Nostr event kind 4, the content of the event should be a JSON-serialized string (with no white space or line breaks) of the following structure: | ||
|
||
- `version` | ||
- `order_id` (optional) | ||
- `pubkey` (optional) | ||
- `action` (https://docs.rs/mostro-core/latest/mostro_core/enum.Action.html) | ||
- `content` (optional https://docs.rs/mostro-core/latest/mostro_core/enum.Content.html) | ||
|
||
After a successful trade Mostro send a nip04 event to both parties to let them know they can rate each other, here an example how the message look like: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3", | ||
"pubkey": null, | ||
"action": "RateUser", | ||
"content": null | ||
} | ||
``` | ||
|
||
After a Mostro client receive this message, the user can rate the other party, the rating is a number between 1 and 5, to rate the client must receive user's input and create a new nip04 event to send to Mostro with this content: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3", | ||
"pubkey": null, | ||
"action": "RateUser", | ||
"content": { | ||
"RatingUser": 5 // User input | ||
} | ||
} | ||
``` |