-
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.
* Dispute docs * Cancel docs
- Loading branch information
Showing
2 changed files
with
148 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,93 @@ | ||
# Cancel Order | ||
|
||
## 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](https://github.com/nostr-protocol/nips/blob/master/04.md), the `content` field of the event should be a base64-encoded, aes-256-cbc encrypted 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) | ||
|
||
## Cancel a pending order | ||
|
||
A use can cancel an Order created by himself and with status `Pending` sending action `Cancel`, the message will look like this: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj", | ||
"action": "Cancel", | ||
"content": null | ||
} | ||
``` | ||
|
||
## Mostro response | ||
|
||
Mostro will send a message with action `Cancel` confirming the order was canceled, here an example of the message: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "Cancel", | ||
"content": null | ||
} | ||
``` | ||
|
||
## Cancel cooperatively | ||
|
||
A user can cancel an `Active` order, but will need the counterparty to agree, let's look at an example where the seller initiates a cooperative cancellation: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "Cancel", | ||
"content": null | ||
} | ||
``` | ||
|
||
Mostro will send this message to the seller: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "CooperativeCancelInitiatedByYou", | ||
"content": null | ||
} | ||
``` | ||
|
||
And this message to the buyer: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "CooperativeCancelInitiatedByPeer", | ||
"content": null | ||
} | ||
``` | ||
|
||
The buyer can accept the cooperative cancellation sending this message: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "Cancel", | ||
"content": null | ||
} | ||
``` |
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,55 @@ | ||
# Disputes | ||
|
||
## 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](https://github.com/nostr-protocol/nips/blob/master/04.md), the `content` field of the event should be a base64-encoded, aes-256-cbc encrypted 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) | ||
|
||
## Start a dispute | ||
|
||
A use can start a dispute in an order with status `Pending` or `FiatSent` sending action `Dispute`, here is an example where the seller initiates a dispute: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj", | ||
"action": "Dispute", | ||
"content": null | ||
} | ||
``` | ||
|
||
## Mostro response | ||
|
||
Mostro will send this message to the seller: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "DisputeInitiatedByYou,", | ||
"content": null | ||
} | ||
``` | ||
|
||
And here is the message to the buyer: | ||
|
||
```json | ||
{ | ||
"version": "0", | ||
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", | ||
"pubkey": null, | ||
"action": "DisputeInitiatedByPeer", | ||
"content": null | ||
} | ||
``` |