Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/kdf/active swaps v2 #374

Merged
merged 9 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/get_data_lint_files_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ jobs:
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-

- name: Generate configs
- name: Generate API methods table
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
shell: bash
run: ${GITHUB_WORKSPACE}/utils/gen_api_methods_table.py

Expand Down
10 changes: 10 additions & 0 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,16 @@
"response-success-6",
"withdraw-qrc-20-with-gas-limit"
],
"src/pages/komodo-defi-framework/api/v20/active_swaps/index.mdx": [
"active-swaps",
"arguments",
"response",
"examples",
"command-without-include-status",
"response-uuids-only",
"command-include-status-true",
"response-statuses-included"
],
"src/pages/komodo-defi-framework/api/v20/add_delegation/index.mdx": [
"add-delegation",
"arguments",
Expand Down
4 changes: 4 additions & 0 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@
{
"title": "Swaps",
"links": [
{
"title": "active_swaps",
"href": "/komodo-defi-framework/api/v20/active_swaps/"
},
{
"title": "recreate_swap_data",
"href": "/komodo-defi-framework/api/v20/recreate_swap_data/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ The `RawTxInfo` object includes the following items:

The `InputTxns` object includes the following items:

| Parameter | Type | Description |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tx\_hash | string | The transaction id of an unspent transaction from the same wallet output. |
| index | integer | The \[output index([https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for](https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for))] of this unspent transaction output. |
| script\_pub\_key | string | The [scriptpubkey](https://learnmeabitcoin.com/technical/scriptPubKey) of this unspent transaction output. |
| amount | decimal | The value of this unspent transaction output. |
| Parameter | Type | Description |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| tx\_hash | string | The transaction id of an unspent transaction from the same wallet output. |
| index | integer | The [output index](https://bitcoin.stackexchange.com/questions/100765/what-does-the-index-of-an-utxo-stand-for) of this unspent transaction output. |
| script\_pub\_key | string | The [scriptpubkey](https://learnmeabitcoin.com/technical/scriptPubKey) of this unspent transaction output. |
| amount | float | The value of this unspent transaction output. |
| amount | | |

<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
```json
Expand Down
2 changes: 1 addition & 1 deletion src/pages/komodo-defi-framework/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods:

| Legacy | v2.0 (release) | v2.0 (dev) |
| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [active\_swaps](/komodo-defi-framework/api/legacy/active_swaps/#active-swaps) | | |
| [active\_swaps](/komodo-defi-framework/api/legacy/active_swaps/#active-swaps) | [active\_swaps](/komodo-defi-framework/api/v20/active_swaps/#active-swaps) | |
| | [add\_delegation](/komodo-defi-framework/api/v20/add_delegation/#add-delegation) | |
| | [add\_node\_to\_version\_stat](/komodo-defi-framework/api/v20/add_node_to_version_stat/#add-node-to-version-stat) | |
| [all\_swaps\_uuids\_by\_filter](/komodo-defi-framework/api/legacy/all_swaps_uuids_by_filter/#all-swaps-uuids-by-filter) | | |
Expand Down
219 changes: 102 additions & 117 deletions src/pages/komodo-defi-framework/api/legacy/active_swaps/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export const description =

# active\_swaps

**active\_swaps (include\_status)**

The `active_swaps` method returns all the swaps that are currently running on the Komodo DeFi Framework API node.

<Note>
This method has been deprecated in favor of [active\_swaps v2](/komodo-defi-framework/api/v20/active_swaps/). The legacy version does not include v2 (Trading Protocol Upgrade) swap statuses in responses (it only returns uuids for these).
</Note>

## Arguments

| Structure | Type | Description |
Expand Down Expand Up @@ -45,7 +47,8 @@ The `active_swaps` method returns all the swaps that are currently running on th
"7592a07a-2805-4050-8ab8-984480e812f0",
"82cbad96-ea9f-40fb-9225-07496323e35d",
"177f7fa5-c9f3-4673-a2fa-28451a123e61"
]
],
"statuses": null
}
}
```
Expand All @@ -68,122 +71,104 @@ The `active_swaps` method returns all the swaps that are currently running on th

```json
{
"uuids": ["5d02843e-d1b4-488d-aad0-114d82020453"],
"statuses": {
"5d02843e-d1b4-488d-aad0-114d82020453": {
"type": "Taker",
"uuid": "5d02843e-d1b4-488d-aad0-114d82020453",
"events": [
{
"timestamp": 1612780908698,
"event": {
"type": "Started",
"data": {
"taker_coin": "MARTY",
"maker_coin": "DOC",
"maker": "7310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5",
"my_persistent_pub": "03ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36fa",
"lock_duration": 7800,
"maker_amount": "1",
"taker_amount": "1",
"maker_payment_confirmations": 1,
"maker_payment_requires_nota": false,
"taker_payment_confirmations": 1,
"taker_payment_requires_nota": false,
"taker_payment_lock": 1612788708,
"uuid": "5d02843e-d1b4-488d-aad0-114d82020453",
"started_at": 1612780908,
"maker_payment_wait": 1612784028,
"maker_coin_start_block": 793472,
"taker_coin_start_block": 797356,
"fee_to_send_taker_fee": {
"coin": "MARTY",
"amount": "0.00001"
},
"taker_payment_trade_fee": {
"coin": "MARTY",
"amount": "0.00001"
},
"maker_payment_spend_trade_fee": {
"coin": "DOC",
"amount": "0"
}
}
}
},
{
"timestamp": 1612780924704,
"event": {
"type": "Negotiated",
"data": {
"maker_payment_locktime": 1612796508,
"maker_pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5",
"secret_hash": "026bebc2e19c243d0940dd583c9573bf10377afd"
}
}
},
{
"timestamp": 1612780924962,
"event": {
"type": "TakerFeeSent",
"data": {
"tx_hex": "0400008085202f8901f425fbefe21f33ccb7b487df251191b27dfa7b639b04f60e5493c7ea41dbf149000000006b483045022100d5ec3e542175479bd4bd011e19b76a75e99f19cc49867e5bca9541950322c33a02207a4d1ffd674fb9760de79bb4929af44d66344b5e182de3c377186deebf6bf376012103ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36faffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac5ce6f305000000001976a914d55f0df6cb82630ad21a4e6049522a6f2b6c9d4588ac7c152160000000000000000000000000000000",
"tx_hash": "75323ab7acd64bd35242611fabaec560d9acf2e1f9ca28d3a4aba47a79fb49c4"
}
}
},
{
"timestamp": 1612780935966,
"event": {
"type": "MakerPaymentReceived",
"data": {
"tx_hex": "0400008085202f89028bef955e42107c562e4e02421f25c455723a701573f86c17b4d82e35a7d8f9f7020000006b483045022100b12fc9d95acca76bf5fd8d5c6acc288b454032ba4561b1c2b1f5f33b2cf2926d022017e561bc2cd93308848674b47b2e8ebd8f074ea78e32454d5fea6f08c0b1f1e40121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff5dfd0b24c0f7c3cf235868cf9a26ec49574764d135796fc4e7d20e95d55a8653000000006a47304402207c752d14601d1c99892f9d6c88c8ff2f93211640a65b2ee69172a16b908b21e402206f0b66684158445888271a849ab46258ad722496ee64fde055a6f44e36ed2ccc0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff0300e1f5050000000017a9141b85c1a277f44f7d77d52b78e2ba70a0becc2ff9870000000000000000166a14026bebc2e19c243d0940dd583c9573bf10377afda7d26301000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888ac87152160000000000000000000000000000000",
"tx_hash": "27dafe553246553d54f909fbbded80e6d490fdb95ca7b6807d73eca45f0d7a22"
}
}
},
{
"timestamp": 1612780935967,
"event": {
"type": "MakerPaymentWaitConfirmStarted"
}
"uuids": [
"44798382-8c63-4047-b5d8-70a60fa2546b"
],
"statuses": {
"44798382-8c63-4047-b5d8-70a60fa2546b": {
"type": "Taker",
"uuid": "44798382-8c63-4047-b5d8-70a60fa2546b",
"my_order_uuid": "44798382-8c63-4047-b5d8-70a60fa2546b",
"events": [
{
"timestamp": 1730634185287,
"event": {
"type": "Started",
"data": {
"taker_coin": "MARTY",
"maker_coin": "DOC",
"maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732",
"my_persistent_pub": "034cbf74541c1d3436bc7638a2738f64df4fee22d4443cdf11d54cea7d7f55f256",
"lock_duration": 7800,
"maker_amount": "2.4",
"taker_amount": "2.4",
"maker_payment_confirmations": 1,
"maker_payment_requires_nota": false,
"taker_payment_confirmations": 1,
"taker_payment_requires_nota": false,
"taker_payment_lock": 1730641984,
"uuid": "44798382-8c63-4047-b5d8-70a60fa2546b",
"started_at": 1730634184,
"maker_payment_wait": 1730637304,
"maker_coin_start_block": 803893,
"taker_coin_start_block": 818506,
"fee_to_send_taker_fee": {
"coin": "MARTY",
"amount": "0.00001",
"paid_from_trading_vol": false
},
"taker_payment_trade_fee": {
"coin": "MARTY",
"amount": "0.00001",
"paid_from_trading_vol": false
},
"maker_payment_spend_trade_fee": {
"coin": "DOC",
"amount": "0.00001",
"paid_from_trading_vol": true
},
"maker_coin_htlc_pubkey": "034cbf74541c1d3436bc7638a2738f64df4fee22d4443cdf11d54cea7d7f55f256",
"taker_coin_htlc_pubkey": "034cbf74541c1d3436bc7638a2738f64df4fee22d4443cdf11d54cea7d7f55f256",
"p2p_privkey": null
}
}
}
],
"maker_amount": "2.4",
"maker_coin": "DOC",
"maker_coin_usd_price": null,
"taker_amount": "2.4",
"taker_coin": "MARTY",
"taker_coin_usd_price": null,
"gui": "mm2_777",
"mm_version": "2.2.0-beta_caf803b",
"success_events": [
"Started",
"Negotiated",
"TakerFeeSent",
"TakerPaymentInstructionsReceived",
"MakerPaymentReceived",
"MakerPaymentWaitConfirmStarted",
"MakerPaymentValidatedAndConfirmed",
"TakerPaymentSent",
"WatcherMessageSent",
"TakerPaymentSpent",
"MakerPaymentSpent",
"MakerPaymentSpentByWatcher",
"MakerPaymentSpendConfirmed",
"Finished"
],
"error_events": [
"StartFailed",
"NegotiateFailed",
"TakerFeeSendFailed",
"MakerPaymentValidateFailed",
"MakerPaymentWaitConfirmFailed",
"TakerPaymentTransactionFailed",
"TakerPaymentWaitConfirmFailed",
"TakerPaymentDataSendFailed",
"TakerPaymentWaitForSpendFailed",
"MakerPaymentSpendFailed",
"MakerPaymentSpendConfirmFailed",
"TakerPaymentWaitRefundStarted",
"TakerPaymentRefundStarted",
"TakerPaymentRefunded",
"TakerPaymentRefundedByWatcher",
"TakerPaymentRefundFailed",
"TakerPaymentRefundFinished"
]
}
],
"maker_amount": "1",
"maker_coin": "DOC",
"taker_amount": "1",
"taker_coin": "MARTY",
"gui": null,
"mm_version": "23c89ced5",
"success_events": [
"Started",
"Negotiated",
"TakerFeeSent",
"MakerPaymentReceived",
"MakerPaymentWaitConfirmStarted",
"MakerPaymentValidatedAndConfirmed",
"TakerPaymentSent",
"TakerPaymentSpent",
"MakerPaymentSpent",
"Finished"
],
"error_events": [
"StartFailed",
"NegotiateFailed",
"TakerFeeSendFailed",
"MakerPaymentValidateFailed",
"MakerPaymentWaitConfirmFailed",
"TakerPaymentTransactionFailed",
"TakerPaymentWaitConfirmFailed",
"TakerPaymentDataSendFailed",
"TakerPaymentWaitForSpendFailed",
"MakerPaymentSpendFailed",
"TakerPaymentWaitRefundStarted",
"TakerPaymentRefunded",
"TakerPaymentRefundFailed"
]
}
}
}
```
</CollapsibleSection>
Loading
Loading