Skip to content

Commit

Permalink
sync dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharang committed Oct 31, 2024
2 parents 333f5c9 + 20a038d commit 52b79cd
Show file tree
Hide file tree
Showing 8 changed files with 961 additions and 212 deletions.
27 changes: 18 additions & 9 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,7 @@
"response-success-2",
"qtum-qrc-20-coin-activation",
"response-success-3",
"response-error-mm2-is-not-set",
"error-responses",
"enable-method",
"arguments-2",
"response-2",
Expand Down Expand Up @@ -2814,6 +2814,14 @@
"token-protocol-parse-error-error",
"unexpected-token-protocol-error"
],
"src/pages/komodo-defi-framework/api/v20/get_current_mtp/index.mdx": [
"get-current-mtp",
"arguments",
"response",
"examples",
"command",
"response-success"
],
"src/pages/komodo-defi-framework/api/v20/get_public_key/index.mdx": [
"get-public-key",
"arguments",
Expand Down Expand Up @@ -2968,6 +2976,15 @@
"command",
"response-2"
],
"src/pages/komodo-defi-framework/api/v20/peer_connection_healthcheck/index.mdx": [
"peer-connection-healthcheck",
"arguments",
"response",
"examples",
"command",
"response-peer-found",
"response-peer-not-found"
],
"src/pages/komodo-defi-framework/api/v20/recreate_swap_data/index.mdx": [
"recreate-swap-data",
"arguments",
Expand Down Expand Up @@ -3109,14 +3126,6 @@
"invalid-request-wrong-parameter-type",
"invalid-fee-policy-attempt-to-use-eth-gas-for-utxo-coin"
],
"src/pages/komodo-defi-framework/api/v20-dev/get_current_mtp/index.mdx": [
"get-current-mtp",
"arguments",
"response",
"examples",
"command",
"response-success"
],
"src/pages/komodo-defi-framework/api/v20-dev/get_locked_amount/index.mdx": [
"get-locked-amount",
"arguments",
Expand Down
730 changes: 695 additions & 35 deletions postman/collections/komodo_defi.postman_collection.json

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,19 @@
"href": "/komodo-defi-framework/api/v20/withdraw/"
}
]
},
{
"title": "Utility",
"links": [
{
"title": "peer_connection_healthcheck",
"href": "/komodo-defi-framework/api/v20/peer_connection_healthcheck/"
},
{
"title": "get_current_mtp",
"href": "/komodo-defi-framework/api/v20/get_current_mtp/"
}
]
}
]
},
Expand All @@ -510,15 +523,6 @@
"titleLink": "/komodo-defi-framework/api/v20-dev/",
"links": []
},
{
"title": "Utility",
"links": [
{
"title": "get_current_mtp",
"href": "/komodo-defi-framework/api/v20-dev/get_current_mtp/"
}
]
},
{
"title": "HD Wallet Tasks",
"links": [
Expand Down
251 changes: 126 additions & 125 deletions src/pages/komodo-defi-framework/api/index.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,18 @@ Komodo DeFi Framework is a true cross chain, cross protocol Decentralized Exchan

#### Arguments

| Structure | Type | Description |
| ---------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| coin | string | Ticker of coin to activate |
| servers | array of objects | List of \[Electrum servers] ([https://github.com/KomodoPlatform/coins/tree/master/electrums](https://github.com/KomodoPlatform/coins/tree/master/electrums)) |
| servers.url | string | Electrum server URL |
| servers.protocol | string (optional, defaults to `TCP`) | Transport protocol used by Komodo DeFi Framework API to connect to the electrum server (`TCP` or `SSL`) |
| servers.disable\_cert\_verification | bool (optional, defaults to `false`.) | If `true`, this disables server SSL/TLS certificate verification (e.g. to use self-signed certificate). <b>Use at your own risk</b> |
| mm2 | integer | Required if not set in `coins` file. Informs the Komodo DeFi Framework API whether or not the coin is expected to function. Accepted values are `0` or `1` |
| tx\_history | bool | If `true` the Komodo DeFi Framework API will preload trasaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/komodo-defi-framework/api/legacy/my_tx_history/#my-tx-history) method |
| required\_confirmations | integer (optional, defaults to `3`) | Number of confirmations for the Komodo DeFi Framework API to wait during the transaction steps of an atomic swap. |
| requires\_notarization | boolean (optional, defaults to `false`) | If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. |
| swap\_contract\_address | string (required for QRC20 only) | address of etomic swap smart contract |
| fallback\_swap\_contract | string (required for QRC20 only) | address of backup etomic swap smart contract |
| utxo\_merge\_params | object (optional) | If set, will consolidate excessive UTXOs (e.g. from mining) |
| utxo\_merge\_params.merge\_at | integer | Number of UTXOs in wallet required before merging |
| utxo\_merge\_params.check\_every | integer | How often to check the UTXO count, in seconds. Ideally should be at least 3x the coins block time. |
| utxo\_merge\_params.max\_merge\_at\_once | integer | Maximum number of UTXOs to merge in each consolidation transaction. Should be less that `merge_at` value, but will fail if so high the transaction becomes too large. Suggested maximum is 250. |
| Structure | Type | Description | |
| ------------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| coin | string | Ticker of coin to activate | |
| servers | list of objects | A list of standard [ActivationServers](/komodo-defi-framework/api/common_structures/activation/#activation-servers) objects. | |
| mm2 | integer | Required if not set in `coins` file. Informs the Komodo DeFi Framework API whether or not the coin is expected to function. Accepted values are `0` or `1` | |
| min\_connected | integer | Optional, defaults to `1`. Minimum number of electrum servers to maintain an active connection to. | |
| max\_connected | integer | Optional. Maximum number of electrum servers to maintain an active connection to. If not set, defaults to all servers in activation request. | |
| required\_confirmations | integer | Optional, defaults to `3`. Number of confirmations for the Komodo DeFi Framework API to wait during the transaction steps of an atomic swap. | |
| requires\_notarization | boolean | Optional, defaults to `false`. If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. | |
| swap\_contract\_address | string | QRC20 only. Address of etomic swap smart contract | |
| fallback\_swap\_contract | string | QRC20 only. Address of backup etomic swap smart contract | |
| utxo\_merge\_params | object | A standard [UtxoMergeParams](/komodo-defi-framework/api/common_structures/activation/#utxo-merge-params) object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses. | |

#### Response

Expand All @@ -105,15 +100,22 @@ Komodo DeFi Framework is a true cross chain, cross protocol Decentralized Exchan
"method": "electrum",
"servers": [
{
"url": "electrum1.cipig.net:10063"
"url": "electrum1.cipig.net:10063",
"protocol": "TCP"
},
{
"url": "electrum2.cipig.net:10063"
"url": "electrum2.cipig.net:20063",
"protocol": "SSL",
"disable_cert_verification": true
},
{
"url": "electrum3.cipig.net:10063"
"url": "electrum3.cipig.net:20063",
"protocol": "SSL",
"ws_url": "electrum3.cipig.net:30063"
}
],
"min_connected": 1,
"max_connected": 2,
"userpass": "RPC_UserP@SSW0RD"
}
```
Expand Down Expand Up @@ -218,17 +220,33 @@ Komodo DeFi Framework is a true cross chain, cross protocol Decentralized Exchan
"result": "success"
}
```
</CollapsibleSection>

#### Response (Error, `mm2` is not set)
#### Error responses

If mm2 is not set in either the command or your `coins` file, you will see the following error:
If mm2 is not set in either the command or your `coins` file, you will see the following error:

```json
{
"error": "lp_coins:943] lp_coins:693] mm2 param is not set neither in coins config nor enable request, assuming that coin is not supported"
}
```
</CollapsibleSection>
```json
{
"error": "lp_coins:943] lp_coins:693] mm2 param is not set neither in coins config nor enable request, assuming that coin is not supported"
}
```

If min\_connected is \< 1, you will see the following error:

```json
{
"error":"rpc:184] dispatcher_legacy:141] lp_commands_legacy:141] lp_coins:4462] utxo_standard:73] utxo_coin_builder:616] Internal error: manager:129] min_connected should be greater than 0"
}
```

If max\_connected is \< min\_connected, you will see the following error:

```json
{
"error": "rpc:184] dispatcher_legacy:141] lp_commands_legacy:141] lp_coins:4462] utxo_standard:73] utxo_coin_builder:616] Internal error: manager:132] min_connected (2) must be <= max_connected (1)"
}
```

## Enable Method

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export const title = "Komodo DeFi Framework Method: Peer Connection Healthcheck";
export const description = "The peer_connection_healthcheck method checks if a peer is connected to the KDF network.";

# peer\_connection\_healthcheck

The `peer_connection_healthcheck` method checks if a peer is connected to the KDF network using the [currently configured](/komodo-defi-framework/setup/configure-mm2-json/) `netid`.

## Arguments

| Structure | Type | Description |
| --------- | ---- | ----------- |
| (none) | | |

#### Response

| Structure | Type | Description |
| --------- | ------- | --------------------------------------- |
| result | boolean | True if peer found connected to network |

#### 📌 Examples

#### Command

<CodeGroup title="" tag="POST" label="peer_connection_healthcheck" mm2MethodDecorate="true">
```json
{
"userpass": "RPC_UserP@SSW0RD",
"method": "peer_connection_healthcheck",
"mmrpc": "2.0",
"params": {
"peer_address": "12D3KooWCcjBQ3kG3BzjVwuZqGDL2YxXik6SCDv2YAHj4E54NiAy"
}
}
```
</CodeGroup>

<CollapsibleSection expandedText="Hide Response" collapsedText="Show Response">
#### Response (peer found)

```json
{
"mmrpc": "2.0",
"result": true,
"id": null
}
```

#### Response (peer not found)

```json
{
"mmrpc": "2.0",
"result": false,
"id": null
}
```
</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ When running the Komodo DeFi API via commandline with the `mm2` binary, some bas

#### Example for HD Wallets:

If you are using HD wallets, you will need to add the `hd_account_id` value to your `MM2.json` file. This value will be used in the derivation path for all coins, and will take the place of the `COIN_ID` value in the following path: `m/44'/COIN_ID'/<hd_account_id>'/CHAIN/ADDRESS_ID`.
If you are using HD wallets, you will need to set `enable_hd` to `true` in to your `MM2.json` file.

<Note>
Using the same seed phrase with / without setting the `hd_account_id` value
Using the same seed phrase with / without setting `enable_hd` to `true`
will result in different addresses being generated. For example, when using
the seed phrase `february soldier message acid member jump shadow walk novel impose puppy tornado`: - If the `hd_account_id` value is set to `0` in
the seed phrase `february soldier message acid member jump shadow walk novel impose puppy tornado`: - If `enable_hd` is `true` in your
MM2.json, the first address in the wallet returns the address
`0x26cE5D1cD4CC673a1b0b980371C7c862B9503452` for ETH - If the `hd_account_id`
value is not set, the wallet will return the address
`0x26cE5D1cD4CC673a1b0b980371C7c862B9503452` for ETH - If the `enable_hd`
is `false` (or not set), the wallet will return the address
`0x8c40a6E127c7a13e26ce95deA88354C3fb134580` for ETH
</Note>

Expand All @@ -98,7 +98,7 @@ If you are using HD wallets, you will need to add the `hd_account_id` value to y
"passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU",
"allow_weak_password": false,
"dbdir": "/path/to/DB/folder",
"hd_account_id": 0
"enable_hd": true
}
```

Expand Down

0 comments on commit 52b79cd

Please sign in to comment.