Skip to content

Commit af821ea

Browse files
authored
Merge pull request #14 from MostroP2P/differentiation-of-rumor-content-elements
Differentiation of rumor's content elements
2 parents cc3e93e + 59c793e commit af821ea

15 files changed

+479
-397
lines changed

src/cancel.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,35 @@
33
A user can cancel an order created by himself and with status `pending` sending action `cancel`, the rumor's content of the message will look like this:
44

55
```json
6-
{
7-
"order": {
8-
"version": 1,
9-
"id": "<Order Id>",
10-
"action": "cancel",
11-
"payload": null
12-
}
13-
}
6+
[
7+
{
8+
"order": {
9+
"version": 1,
10+
"id": "<Order Id>",
11+
"action": "cancel",
12+
"payload": null
13+
}
14+
},
15+
"<index N signature of the sha256 hash of the serialized first element of content>"
16+
]
1417
```
1518

1619
## Mostro response
1720

1821
Mostro will send a message with action `cancel` confirming the order was canceled, here an example of rumor's content of the message:
1922

2023
```json
21-
{
22-
"order": {
23-
"version": 1,
24-
"id": "<Order Id>",
25-
"action": "canceled",
26-
"payload": null
27-
}
28-
}
24+
[
25+
{
26+
"order": {
27+
"version": 1,
28+
"id": "<Order Id>",
29+
"action": "canceled",
30+
"payload": null
31+
}
32+
},
33+
null
34+
]
2935
```
3036

3137
Mostro updates the parameterized replaceable event with `d` tag `<Order Id>` to change the status to `canceled`:

src/dispute.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,55 @@
33
A use can start a dispute in an order with status `active` or `fiat-sent` sending action `dispute`, here is an example where the seller initiates a dispute:
44

55
```json
6-
{
7-
"order": {
8-
"version": 1,
9-
"id": "<Order Id>",
10-
"action": "dispute",
11-
"payload": null
12-
}
13-
}
6+
[
7+
{
8+
"order": {
9+
"version": 1,
10+
"id": "<Order Id>",
11+
"action": "dispute",
12+
"payload": null
13+
}
14+
},
15+
"<index N signature of the sha256 hash of the serialized first element of content>"
16+
]
1417
```
1518

1619
## Mostro response
1720

1821
Mostro will send this message to the seller:
1922

2023
```json
21-
{
22-
"order": {
23-
"version": 1,
24-
"id": "<Order Id>",
25-
"action": "dispute-initiated-by-you",
26-
"payload": {
27-
"dispute": "<Dispute Id>"
24+
[
25+
{
26+
"order": {
27+
"version": 1,
28+
"id": "<Order Id>",
29+
"action": "dispute-initiated-by-you",
30+
"payload": {
31+
"dispute": "<Dispute Id>"
32+
}
2833
}
29-
}
30-
}
34+
},
35+
null
36+
]
3137
```
3238

3339
And here is the message to the buyer:
3440

3541
```json
36-
{
37-
"order": {
38-
"version": 1,
39-
"id": "<Order Id>",
40-
"action": "dispute-initiated-by-peer",
41-
"payload": {
42-
"dispute": "<Dispute Id>"
42+
[
43+
{
44+
"order": {
45+
"version": 1,
46+
"id": "<Order Id>",
47+
"action": "dispute-initiated-by-peer",
48+
"payload": {
49+
"dispute": "<Dispute Id>"
50+
}
4351
}
44-
}
45-
}
52+
},
53+
null
54+
]
4655
```
4756

4857
Mostro will not update the addressable event with `d` tag `<Order Id>` to change the status to `dispute`, this is because the order is still active, the dispute is just a way to let the admins and the other party know that there is a problem with the order.

src/new_buy_order.md

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@
33
To create a new buy order the user should send a Gift wrap Nostr event to Mostro with the following rumor's content:
44

55
```json
6-
{
7-
"order": {
8-
"version": 1,
9-
"action": "new-order",
10-
"trade_index": 1,
11-
"payload": {
12-
"order": {
13-
"kind": "buy",
14-
"status": "pending",
15-
"amount": 0,
16-
"fiat_code": "VES",
17-
"fiat_amount": 100,
18-
"payment_method": "face to face",
19-
"premium": 1,
20-
"created_at": 0
6+
[
7+
{
8+
"order": {
9+
"version": 1,
10+
"action": "new-order",
11+
"trade_index": 1,
12+
"payload": {
13+
"order": {
14+
"kind": "buy",
15+
"status": "pending",
16+
"amount": 0,
17+
"fiat_code": "VES",
18+
"fiat_amount": 100,
19+
"payment_method": "face to face",
20+
"premium": 1,
21+
"created_at": 0
22+
}
2123
}
2224
}
23-
}
24-
}
25+
},
26+
"<index N signature of the sha256 hash of the serialized first element of content>"
27+
]
2528
```
2629

2730
The nostr event will look like this:
@@ -40,32 +43,35 @@ The nostr event will look like this:
4043

4144
## Confirmation message
4245

43-
Mostro will send back a nip59 event as a confirmation message to the user like the following:
46+
Mostro will send back a nip59 event as a confirmation message, the content of the rumor looks like the following:
4447

4548
```json
46-
{
47-
"order": {
48-
"version": 1,
49-
"id": "<Order id>",
50-
"action": "new-order",
51-
"payload": {
52-
"order": {
53-
"id": "<Order id>",
54-
"kind": "buy",
55-
"status": "pending",
56-
"amount": 0,
57-
"fiat_code": "VES",
58-
"fiat_amount": 100,
59-
"payment_method": "face to face",
60-
"premium": 1,
61-
"master_buyer_pubkey": null,
62-
"master_seller_pubkey": null,
63-
"buyer_invoice": null,
64-
"created_at": 1698870173
49+
[
50+
{
51+
"order": {
52+
"version": 1,
53+
"id": "<Order id>",
54+
"action": "new-order",
55+
"payload": {
56+
"order": {
57+
"id": "<Order id>",
58+
"kind": "buy",
59+
"status": "pending",
60+
"amount": 0,
61+
"fiat_code": "VES",
62+
"fiat_amount": 100,
63+
"payment_method": "face to face",
64+
"premium": 1,
65+
"master_buyer_pubkey": null,
66+
"master_seller_pubkey": null,
67+
"buyer_invoice": null,
68+
"created_at": 1698870173
69+
}
6570
}
6671
}
67-
}
68-
}
72+
},
73+
null
74+
]
6975
```
7076

7177
Mostro publishes this order as an event kind `38383` with status `pending`:

src/new_buy_order_ln_address.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,29 @@
33
Creating buy order with a [lightning address](https://github.com/andrerfneves/lightning-address) would make the process way faster and easy going, to acomplish the buyer should send a Gift wrap Nostr event to Mostro with the following rumor's content:
44

55
```json
6-
{
7-
"order": {
8-
"version": 1,
9-
"action": "new-order",
10-
"trade_index": 1,
11-
"payload": {
12-
"order": {
13-
"kind": "buy",
14-
"status": "pending",
15-
"amount": 0,
16-
"fiat_code": "VES",
17-
"fiat_amount": 100,
18-
"payment_method": "face to face",
19-
"premium": 1,
20-
"buyer_invoice": "mostro_p2p@ln.tips",
21-
"created_at": 0
6+
[
7+
{
8+
"order": {
9+
"version": 1,
10+
"action": "new-order",
11+
"trade_index": 1,
12+
"payload": {
13+
"order": {
14+
"kind": "buy",
15+
"status": "pending",
16+
"amount": 0,
17+
"fiat_code": "VES",
18+
"fiat_amount": 100,
19+
"payment_method": "face to face",
20+
"premium": 1,
21+
"buyer_invoice": "mostro_p2p@ln.tips",
22+
"created_at": 0
23+
}
2224
}
2325
}
24-
}
25-
}
26+
},
27+
"<index N signature of the sha256 hash of the serialized first element of content>"
28+
]
2629
```
2730

2831
The nostr event will look like this:

src/new_sell_order.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,37 @@
33
To create a new sell order the user should send a Gift wrap Nostr event to Mostro, the rumor event should have the following rumor's content:
44

55
```json
6-
{
7-
"order": {
8-
"version": 1,
9-
"action": "new-order",
10-
"trade_index": 1,
11-
"payload": {
12-
"order": {
13-
"kind": "sell",
14-
"status": "pending",
15-
"amount": 0,
16-
"fiat_code": "VES",
17-
"min_amount": null,
18-
"max_amount": null,
19-
"fiat_amount": 100,
20-
"payment_method": "face to face",
21-
"premium": 1,
22-
"created_at": 0
6+
[
7+
{
8+
"order": {
9+
"version": 1,
10+
"action": "new-order",
11+
"trade_index": 1,
12+
"payload": {
13+
"order": {
14+
"kind": "sell",
15+
"status": "pending",
16+
"amount": 0,
17+
"fiat_code": "VES",
18+
"min_amount": null,
19+
"max_amount": null,
20+
"fiat_amount": 100,
21+
"payment_method": "face to face",
22+
"premium": 1,
23+
"created_at": 0
24+
}
2325
}
2426
}
25-
}
26-
}
27+
},
28+
null
29+
]
2730
```
2831

2932
Let's explain some of the fields:
3033

3134
- kind: `sell` or `buy`
3235
- status: Is always `pending` when creating a new order
33-
- amount: 0 for when we want to sell with at market price, otherwise the amount in satoshis
36+
- amount: `0` for when we want to sell with at market price, otherwise the amount in satoshis
3437
- created_at: No need to send the correct unix timestamp, Mostro will replace it with the current time
3538

3639
The event to send to Mostro would look like this:
@@ -52,26 +55,29 @@ The event to send to Mostro would look like this:
5255
Mostro will send back a nip59 event as a confirmation message to the user like the following (unencrypted rumor's content example):
5356

5457
```json
55-
{
56-
"order": {
57-
"version": 1,
58-
"id": "<Order id>",
59-
"action": "new-order",
60-
"payload": {
61-
"order": {
62-
"id": "<Order id>",
63-
"kind": "sell",
64-
"status": "pending",
65-
"amount": 0,
66-
"fiat_code": "VES",
67-
"fiat_amount": 100,
68-
"payment_method": "face to face",
69-
"premium": 1,
70-
"created_at": 1698870173
58+
[
59+
{
60+
"order": {
61+
"version": 1,
62+
"id": "<Order id>",
63+
"action": "new-order",
64+
"payload": {
65+
"order": {
66+
"id": "<Order id>",
67+
"kind": "sell",
68+
"status": "pending",
69+
"amount": 0,
70+
"fiat_code": "VES",
71+
"fiat_amount": 100,
72+
"payment_method": "face to face",
73+
"premium": 1,
74+
"created_at": 1698870173
75+
}
7176
}
7277
}
73-
}
74-
}
78+
},
79+
null
80+
]
7581
```
7682

7783
Mostro publishes this order as an event kind `38383` with status `pending`:

0 commit comments

Comments
 (0)