Cancel Order
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:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cancel",
"payload": null
}
},
"<index N signature of the sha256 hash of the serialized first element of content>"
]
Mostro response
Mostro will send a message with action cancel confirming the order was canceled, here an example of rumor's content of the message:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "canceled",
"payload": null
}
},
null
]
Mostro updates the addressable event with d tag <Order Id> to change the status to canceled:
[
"EVENT",
"RAND",
{
"id": "<Event id>",
"pubkey": "<Mostro's pubkey>",
"created_at": 1702549437,
"kind": 38383,
"tags": [
["d", "<Order Id>"],
["k", "sell"],
["f", "VES"],
["s", "canceled"],
["amt", "7851"],
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["network", "mainnet"],
["layer", "lightning"],
["expiration", "1719391096"],
["y", "mostro", "[Mostro instance name]"],
["z", "order"]
],
"content": "",
"sig": "<Mostro's signature>"
}
]
Bond race during take
A client that sent take-buy / take-sell and is waiting for pay-bond-invoice may receive Action::Canceled instead — meaning another user paid their bond first on the same order (whichever bond locks first wins; see pay bond invoice). Surface this clearly to the user, e.g. "Order was taken by another user before you locked the bond." Do not silently retry the take — the order may not be available anymore, and the supersede mechanism on the daemon side has already discarded the prior bond request.
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:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cancel",
"payload": null
}
},
null
]
Mostro will send this message to the seller:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cooperative-cancel-initiated-by-you",
"payload": null
}
},
null
]
And this message to the buyer:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cooperative-cancel-initiated-by-peer",
"payload": null
}
},
null
]
The buyer can accept the cooperative cancellation sending this message:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cancel",
"payload": null
}
},
null
]
And Mostro will send this message to both parties:
[
{
"order": {
"version": 1,
"id": "<Order Id>",
"action": "cooperative-cancel-accepted",
"payload": null
}
},
null
]
Mostro updates the addressable event with d tag <Order Id> to change the status to canceled:
[
"EVENT",
"RAND",
{
"id": "<Event id>",
"pubkey": "<Mostro's pubkey>",
"created_at": 1702549437,
"kind": 38383,
"tags": [
["d", "<Order Id>"],
["k", "sell"],
["f", "VES"],
["s", "canceled"],
["amt", "7851"],
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["network", "mainnet"],
["layer", "lightning"],
["expiration", "1719391096"],
["y", "mostro", "[Mostro instance name]"],
["z", "order"]
],
"content": "",
"sig": "<Mostro's signature>"
}
]