Skip to content

Commit

Permalink
Add user rating markdown doc
Browse files Browse the repository at this point in the history
  • Loading branch information
grunch committed Nov 1, 2023
1 parent 06d3f67 commit b472448
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/user_rating.md
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
}
}
```

0 comments on commit b472448

Please sign in to comment.