Swap Common Structures
swaps_common_structures
SwapEvent
There are a variety if swap events which may occur during a trade. See Maker Events and Taker Events for more info.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | ✓ | See Maker Events and Taker Events for more info. |
| data | varies | ✓ | The data field may contain contextual information (e.g. txids) releated to a swap event. In some cases, it will be null. |
Show Example
Example
{
"type": "TakerFeeSent",
"data": {
"tx_hex": "0400008085202f89014b9e44ba75ed80361776ac385feee7bba13b6c2d3147a3d9b5d71362a4624219000000006b483045022100a45de07b5d211c62e8ecf90cd5bee5076f6b6f20715f5618d7d0d93a6209ad870220596ca01682d2dbd4efeba3a0e90a373fd61b619471747df26afc2e2bb167de4c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acf4979600000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88acaf73d363000000000000000000000000000000",
"tx_hash": "b2ee0e692523c5ca081f62e36325d09a629004850be8b86df149fc979e9e3e87"
}
} SwapEvents
For each step of a trade, a SwapEvent will be created, alongside the timestamp of the event. See Maker Events and Taker Events for more info.
| Parameter | Type | Required | Description |
|---|---|---|---|
| timestamp | integer | ✓ | Timestamp for the SwapEvent in UNIX format. |
| event | object | ✓ | A standard SwapEvent object. |
Show Example
Example
{
"event": {
"type": "MakerPaymentWaitConfirmStarted"
},
"timestamp": 1564050588178
} SwapStatus
Each swap status will be nested under its associated UUID.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | ✓ | Maker or Taker. Indicates if the user created the order (maker), or matched with an existing order (taker). | |
| uuid | string | ✓ | A unique identifier for the swap. | |
| events | list | ✓ | A list of swap events. The structure of each event varies depending on its type, as detailed in the SwapEvents section. | |
| maker_coin | string | ✓ | The coin being sent by the maker and received by the taker. | |
| taker_coin | string | ✓ | The coin being sent by the taker and received by the maker. | |
| maker_amount | numeric string | ✓ | The amount of maker_coin being traded. | |
| taker_amount | numeric string | ✓ | The amount of taker_coin being traded. | |
| gui | string | – | null | An identifier for the GUI used to initiate the swap, as defined in your MM2.json file. |
| mm_version | string | ✓ | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | |
| success_events | list | ✓ | A list of possible swap event types for a successful swap, for makers and takers. | |
| error_events | list | ✓ | A list of possible swap event types which may appear in a failed swap, for makers and takers. |
Show Example
Example
{
"type": "Taker",
"uuid": "5d02843e-d1b4-488d-aad0-114d82020453",
"events": [
...
],
"maker_amount": "1",
"maker_coin": "DOC",
"taker_amount": "1",
"taker_coin": "MARTY",
"gui": null,
"mm_version": "23c89ced5",
"success_events": [
...
],
"error_events": [
...
]
}{
"FromId": 4
}