From 31034a07a37ae84fc90ecb6448e749344534ab0d Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:03:20 +0800 Subject: [PATCH 01/85] add WithdrawFee object to common structures --- src/pages/atomicdex/api/v20/index.mdx | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index c5d310b7..fd9e1fc9 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -248,4 +248,68 @@ The `TokensRequest` object includes the following items for a given coin or toke +### WithdrawFee + +The `WithdrawFee` object varies epending on the coin or token type. Refer to the examples to view the object structure for each type. + + +| Parameter | Type | Description | +| ------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------| +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total_gas_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + + +### Example of Eth type + +```json +{ + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" +} +``` + +### Example of Qrc20 type + +```json +{ + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" +} +``` + +### Example of Tendermint type + +```json +{ + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 +} +``` + +### Example of Utxo type + +```json +{ + "type": "Utxo", + "amount": "0.00001" +} +``` From bb19ab51a1c172fed96df0cc526936ae0a5595a6 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:03:46 +0800 Subject: [PATCH 02/85] update temlate for atomicdex methods --- templates/atomicdex_method.mdx | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/templates/atomicdex_method.mdx b/templates/atomicdex_method.mdx index 13c9535a..8065b81e 100644 --- a/templates/atomicdex_method.mdx +++ b/templates/atomicdex_method.mdx @@ -17,24 +17,8 @@ The `METHOD_NAME` method has a description about what it is used for and it will | optionalParam | boolean | Optional, defaults to `something`. What difference does it make? | -### Response Parameters - -| Parameter | Type | Description | -| --------------| ---------------- | ----------------------------------------------------------------------------------------------- | -| someText | string | This text string has a purpose and here it is. | -| numberText | string (numeric) | This text string has a purpose and here it is. | -| wholeNumber | integer | What is the reason for this number? | -| decimalNumber | float | What is the reason for this number? | -| someObject | object | There should be a link here to a separate table for this object | -| listOfObjects | array of objects | There should be a link here to a separate table for an instance of the object within this array | -| isOrIsNot | boolean | What does this turn on or off? | -| optionalParam | boolean | Optional, defaults to `something`. What difference does it make? | - - #### 📌 Example(s) -#### Command - ```json {{ mm2MethodDecorate : true }} { @@ -57,6 +41,20 @@ The `METHOD_NAME` method has a description about what it is used for and it will +### Response Parameters + +| Parameter | Type | Description | +| --------------| ---------------- | ----------------------------------------------------------------------------------------------- | +| someText | string | This text string has a purpose and here it is. | +| numberText | string (numeric) | This text string has a purpose and here it is. | +| wholeNumber | integer | What is the reason for this number? | +| decimalNumber | float | What is the reason for this number? | +| someObject | object | There should be a link here to a separate table for this object | +| listOfObjects | array of objects | There should be a link here to a separate table for an instance of the object within this array | +| isOrIsNot | boolean | What does this turn on or off? | +| optionalParam | boolean | Optional, defaults to `something`. What difference does it make? | + + #### Response @@ -66,7 +64,6 @@ The `METHOD_NAME` method has a description about what it is used for and it will "key": "value", } ``` - @@ -108,3 +105,7 @@ This and other errors all sit within the same `CollapsibleSection` tags. ``` + + +View the source code at: https://github.com/KomodoPlatform/repo/blob/branch/folder/file.ext + \ No newline at end of file From 813bb2c0179c7fae3dfa4fe8c3f8be129fe0c0f7 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:04:37 +0800 Subject: [PATCH 03/85] fix typo in withdraw doc --- src/pages/atomicdex/api/legacy/withdraw/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/legacy/withdraw/index.mdx b/src/pages/atomicdex/api/legacy/withdraw/index.mdx index bf54682e..bc1b3e86 100644 --- a/src/pages/atomicdex/api/legacy/withdraw/index.mdx +++ b/src/pages/atomicdex/api/legacy/withdraw/index.mdx @@ -29,7 +29,7 @@ This method generates a raw transaction which should then be broadcast using [se | received_by_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | | spent_by_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | | total_amount | string (numeric) | the total amount of coins transferred | -| fee_details | object | the fee dsetails of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | +| fee_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | | tx_hash | string | the hash of the generated transaction | | tx_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | | coin | string | the name of the coin the user wants to withdraw | From 6aab7c4d4647226cb5d6c2a90bd8e7d80a8c62a2 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:09:44 +0800 Subject: [PATCH 04/85] add token withdraw objects to common structures --- src/pages/atomicdex/api/v20/index.mdx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index fd9e1fc9..e05d10e2 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -313,3 +313,27 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` +### WithdrawType + +The `WithdrawType` object is used for NFT withdrawals. It includes the following items for a given coin or token: + + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | +| withdraw_data | object | A standard [WithdrawData](/atomicdex/api/v20#withdraw-data) object. | + + +### WithdrawData + +The `WithdrawData` object is used for NFT withdrawals. It includes the following items for a given coin or token: + + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| to | string | Destination address to withdraw the token to. | +| token_address | string | Token address. | +| token_id | string | Token ID. | +| fee | string | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | + From d5099cfab2d65401fd3ac8d0ff14c406496bb0d5 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:31:44 +0800 Subject: [PATCH 05/85] Update WithdrawData object params --- src/pages/atomicdex/api/v20/index.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index e05d10e2..b43b0750 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -321,7 +321,7 @@ The `WithdrawType` object is used for NFT withdrawals. It includes the following | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| | type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw_data | object | A standard [WithdrawData](/atomicdex/api/v20#withdraw-data) object. | +| withdraw_data | object | A standard [WithdrawData](/atomicdex/api/v20#withdraw-data) object. | ### WithdrawData @@ -335,5 +335,7 @@ The `WithdrawData` object is used for NFT withdrawals. It includes the following | to | string | Destination address to withdraw the token to. | | token_address | string | Token address. | | token_id | string | Token ID. | -| fee | string | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| amount | string | Optional, defaults to `1`. When sending more than one NFT, use the `withdraw_erc1155` withdraw type. Amount of NFTs to withdraw. | +| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with the `token_id` will be sent. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | From 7579cf3ae9e38adcd306fc7b1c006fc79ff078e7 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 02:36:25 +0800 Subject: [PATCH 06/85] add draft NFT docs --- .../api/v20-dev/non_fungible_tokens/index.mdx | 577 ++++++++++++++++++ src/pages/atomicdex/api/v20/index.mdx | 2 +- 2 files changed, 578 insertions(+), 1 deletion(-) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx new file mode 100644 index 00000000..46e13cd0 --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -0,0 +1,577 @@ +# Non Fungible Tokens (NFTs) + +The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + + +## NFT Information Methods + +- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-list) +- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-transfers) +- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-metadata) + + +## NFT Transaction Methods + +- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc721) +- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc1155) + + +## Get NFT List + + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chains | array | List of chains to scan for NFTs. Chains must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | + + +#### 📌 Example(s) + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth" + } +} +``` + + + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | +| amount | string | Amount of tokens. | +| block_number_minted | integer | Block height when the token was minted. | +| block_number | integer | Current block height. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection_name | string | Collection name. May be `null`. | +| contract_type | string | Contract type. `ERC721` or `ERC1155`. | +| owner_of | string | Address of the token owner. | +| token_address | string | Token address. | +| token_id | string | Token ID. | +| token_hash | string | Token hash. | +| symbol | string | Token symbol. | +| token_uri | string | Token URI. | +| metadata | string | Token metadata. | +| last_token_uri_sync | string | Last time the token URI was synced. | +| last_metadata_sync | string | Last time the token metadata was synced. | +| minter_address | string | Minter address. | +| possible_spam | boolean | Possible spam. | +| uri_meta | object | A Standard [TokenMetadata](LINK TO COMMON STRUCTURE) object. | + + + +```json +{ + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "token_name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "token_name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null + } + } + ] + }, + "id": null +} +``` + + + +# Get NFT Transfers + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chains | array | List of chains to scan for NFTs. Chains must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | + + +#### 📌 Example(s) + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth" + } +} +``` + + + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | +| amount | string | Amount of tokens transferred. | +| block_hash | string | Hash of block in which transfer occurred. | +| block_number | integer | Height of block in which transfer occurred. | +| block_timestamp | string | Block date/time string. CONFIRM: SHOULD THIS NOT BE AN EPOCH TIMESTAMP? | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection_name | string | May be `null`. Name of collection which token belongs to. | +| contract_type | string | Contract type. `ERC721` or `ERC1155`. | +| token_address | string | Address of token transferred. | +| token_id | string | Token ID. | +| possible_spam | boolean | Possible spam. MORE INFO? | +| transaction_hash | string | Transaction ID of the transfer. | +| transaction_index | string | Transaction index of the transfer. | +| log_index | string | Log index of the transfer. | +| value | string | Tranfer value. | +| transaction_type | string | Transation type. `Single` or `WHAT IS THE OTHER TYPE?`. | +| from_address | string | Address of previous owner which sent the token(s). | +| to_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. WHAT ARE THE POSSIBLE VALUES? | +| verified | integer | I HAVE NO IDEA WHAT THIS MEANS | +| operator | string | I HAVE NO IDEA WHAT THIS MEANS | + + + +```json +{ + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": "2023-03-08T10:11:36.000Z", + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "collection_name": null, + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false + }, + { + "chain": "POLYGON", + "block_number": 40059494, + "block_timestamp": "2023-03-07T05:59:40.000Z", + "block_hash": "0x74ed1956f9ddd850639086985eda441dd984b6cdd657608be19e42e66bd911af", + "transaction_hash": "0x03653c73b8540d166e94382345cb1e028c08c3c9d4fd809e8c1cf307407f91e8", + "transaction_index": 51, + "log_index": 232, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "collection_name": null, + "from_address": "0x32c5a026cb212cf18de790400763df8b64b4d028", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "status": "Receive", + "amount": "2", + "verified": 1, + "operator": "0x32c5a026cb212cf18de790400763df8b64b4d028", + "possible_spam": false + } + ] + }, + "id": null +} +``` + + + +# Get NFT Metadata + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| token_address | string | The token address. | +| token_id | string | Token ID. | +| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | + + +#### 📌 Example(s) + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC", + "url": "https://moralis-proxy.komodo.earth" + } +} +``` + + + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | +| amount | string | Amount of tokens. | +| block_number_minted | integer | Block height when the token was minted. | +| block_number | integer | Current block height. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection_name | string | Collection name. May be `null`. | +| contract_type | string | Contract type. `ERC721` or `ERC1155`. | +| owner_of | string | Address of the token owner. | +| token_address | string | Token address. | +| token_id | string | Token ID. | +| token_hash | string | Token hash. | +| symbol | string | Token symbol. | +| token_uri | string | Token URI. | +| metadata | string | Token metadata. | +| last_token_uri_sync | string | Last time the token URI was synced. | +| last_metadata_sync | string | Last time the token metadata was synced. | +| minter_address | string | Minter address. | +| possible_spam | boolean | Possible spam. | +| uri_meta | object | A Standard [TokenMetadata](LINK TO COMMON STRUCTURE) object. | + + + +```json +{ + "mmrpc": "2.0", + "result": { + "chain": "BSC", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "125f8f4e952e107c257960000b4b250e", + "block_number_minted": 25810308, + "block_number": 28056721, + "contract_type": "ERC721", + "collection_name": "Binance NFT Mystery Box-Back to Blockchain Future", + "symbol": "BMBBBF", + "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", + "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", + "last_token_uri_sync": "2023-02-19T19:12:09.471Z", + "last_metadata_sync": "2023-02-19T19:12:18.080Z", + "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", + "possible_spam": false, + "uri_meta": { + "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", + "token_name": "Nebula Nodes", + "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", + "attributes": null, + "animation_url": null + } + }, + "id": null +} +``` + + + +## Withdraw NFTs + + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | +| withdraw_type | object | A standard [WithdrawType](/atomicdex/api/v20#withdraw-type) object. | + + +#### 📌 ERC721 Withdraw Example + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "BSC", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + } + } + } +} +``` + + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | +| amount | string | Amount of tokens to withdraw. | +| tx_hex | string | Raw transaction hex of the withdrawl. | +| tx_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract_type | string | Contract type. `ERC721` or `ERC1155`. | +| token_address | string | Token address. | +| token_id | string | Token ID. | +| fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. CONFIRM: EVERYWHERE ELSE THIS PARAM IS `chain`. | +| block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | +| internal_id | integer | I HAVE NO IDEA WHAT THIS MEANS. | +| transaction_type | string | This will always be `NftTransfer`. CONFIRM | + + + +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", + "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC721", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + }, + "coin": "BNB", + "block_height": 0, + "timestamp": 1684239228, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null +} +``` + + + +#### 📌 ERC1155 Withdraw Example + +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2" + } + } + } +} +``` + + + +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", + "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000154089437979", + "total_fee": "0.01048116357133158" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241604, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null +} +``` + + + +#### 📌 ERC1155 Withdraw Max Example + +If you would like to withdraw all NFTs from a token_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "max": true + } + } + } +} +``` + + + +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", + "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000137182923005", + "total_fee": "0.0093311824228001" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241781, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null +} +``` + + + +View the source code at: https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs + diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index b43b0750..fd49b9a9 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -336,6 +336,6 @@ The `WithdrawData` object is used for NFT withdrawals. It includes the following | token_address | string | Token address. | | token_id | string | Token ID. | | amount | string | Optional, defaults to `1`. When sending more than one NFT, use the `withdraw_erc1155` withdraw type. Amount of NFTs to withdraw. | -| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with the `token_id` will be sent. | +| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with the `token_address` will be sent. | | fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | From 3312117a750f7b814e0617dea7ac55099f442a59 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 14:42:01 +0800 Subject: [PATCH 07/85] update sidebar --- src/data/sidebar.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/data/sidebar.ts b/src/data/sidebar.ts index 104f79f8..8b1efdb1 100644 --- a/src/data/sidebar.ts +++ b/src/data/sidebar.ts @@ -393,6 +393,31 @@ const atomicdexApi_20_Dev_PageNavigation: NavigationRouteType = { } ] }, + { + "title": "Non-Fungible Tokens", + "links": [ + { + "title": "Overview", + "href": "/atomicdex/api/v20-dev/non-fungible-tokens" + }, + { + "title": "Get a list of NFTs", + "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-list" + }, + { + "title": "Get a list of NFT transfers", + "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-transfers" + }, + { + "title": "Get NFT metadata", + "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-metadata" + }, + { + "title": "Withdraw NFTs", + "href": "/atomicdex/api/v20-dev/non-fungible-tokens#withdraw-nft" + } + ] + }, { "title": "Coin Activation Tasks", "titleLink": "/atomicdex/api/v20-dev/coin_activation_tasks/", From 59aee219678daaa9786488bc39a7d15291e6a57b Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 14:45:59 +0800 Subject: [PATCH 08/85] fix sidebar path --- src/data/sidebar.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/data/sidebar.ts b/src/data/sidebar.ts index 8b1efdb1..5f4dd454 100644 --- a/src/data/sidebar.ts +++ b/src/data/sidebar.ts @@ -398,23 +398,23 @@ const atomicdexApi_20_Dev_PageNavigation: NavigationRouteType = { "links": [ { "title": "Overview", - "href": "/atomicdex/api/v20-dev/non-fungible-tokens" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens" }, { "title": "Get a list of NFTs", - "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-list" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-list" }, { "title": "Get a list of NFT transfers", - "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-transfers" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-transfers" }, { "title": "Get NFT metadata", - "href": "/atomicdex/api/v20-dev/non-fungible-tokens#get-nft-metadata" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-metadata" }, { "title": "Withdraw NFTs", - "href": "/atomicdex/api/v20-dev/non-fungible-tokens#withdraw-nft" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#withdraw-nft" } ] }, From 1f30451f99eb4376016ca536ef8f61bc3b73bcd4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 14:51:29 +0800 Subject: [PATCH 09/85] test heading tags --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 46e13cd0..ce87967d 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -17,7 +17,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 - Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc1155) -## Get NFT List +## Get NFT List {{label : 'get_nft_list', tag : 'API-v2'}} ### Request Parameters From b480c89daef39df72bc717888a33e8d996e06265 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 14:56:12 +0800 Subject: [PATCH 10/85] add heading tags for NFT docs --- .../atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index ce87967d..cf21ce9b 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -17,7 +17,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 - Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc1155) -## Get NFT List {{label : 'get_nft_list', tag : 'API-v2'}} +## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} ### Request Parameters @@ -152,7 +152,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 -# Get NFT Transfers +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} ### Request Parameters @@ -265,7 +265,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 -# Get NFT Metadata +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters @@ -356,7 +356,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 -## Withdraw NFTs +## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} ### Request Parameters From 8bdb582eb13861a61aff2a292dc7daa7c9b1ce67 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 14:59:27 +0800 Subject: [PATCH 11/85] fix links --- src/data/sidebar.ts | 4 ++-- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/sidebar.ts b/src/data/sidebar.ts index 5f4dd454..ca7a58f7 100644 --- a/src/data/sidebar.ts +++ b/src/data/sidebar.ts @@ -402,11 +402,11 @@ const atomicdexApi_20_Dev_PageNavigation: NavigationRouteType = { }, { "title": "Get a list of NFTs", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-list" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-a-list-of-nfts" }, { "title": "Get a list of NFT transfers", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-transfers" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-a-list-of-nft-transfers" }, { "title": "Get NFT metadata", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index cf21ce9b..5776b0ab 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -152,7 +152,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 -# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} +## Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} ### Request Parameters @@ -265,7 +265,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 -# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} +## Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters From 46e58723bd4acdbdc52e1f31226985441c083472 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 17 May 2023 15:00:57 +0800 Subject: [PATCH 12/85] fix link --- src/data/sidebar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/sidebar.ts b/src/data/sidebar.ts index ca7a58f7..e53d2d9a 100644 --- a/src/data/sidebar.ts +++ b/src/data/sidebar.ts @@ -414,7 +414,7 @@ const atomicdexApi_20_Dev_PageNavigation: NavigationRouteType = { }, { "title": "Withdraw NFTs", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#withdraw-nft" + "href": "/atomicdex/api/v20-dev/non_fungible_tokens#withdraw-nfts" } ] }, From 8cf91394707585c1f341696bcf9ba53f8ae42e71 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 25 May 2023 16:52:08 +0800 Subject: [PATCH 13/85] updated NFT response descritions from review feedback --- .../api/v20-dev/non_fungible_tokens/index.mdx | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 5776b0ab..051af352 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -24,9 +24,12 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to scan for NFTs. Chains must be [activated](/atomicdex/api/legacy/coin_activation) first. | -| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | +| chains | array | List of chains to scan for NFTs. | +| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | + +In future, users will be able to also define their own Moralis API key. + #### 📌 Example(s) @@ -52,24 +55,24 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 | Parameter | Type | Description | | ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | Amount of tokens. | -| block_number_minted | integer | Block height when the token was minted. | -| block_number | integer | Current block height. | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block_number_minted | integer | The block height when the NFT was minted. | +| block_number | integer | The block height when the amount or owner changed. | | chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection_name | string | Collection name. May be `null`. | -| contract_type | string | Contract type. `ERC721` or `ERC1155`. | -| owner_of | string | Address of the token owner. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| token_hash | string | Token hash. | -| symbol | string | Token symbol. | -| token_uri | string | Token URI. | -| metadata | string | Token metadata. | -| last_token_uri_sync | string | Last time the token URI was synced. | -| last_metadata_sync | string | Last time the token metadata was synced. | +| collection_name | string | May be `null`. An NFT collection name. | +| contract_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last_token_uri_sync | string | When the token_uri was last updated. | +| last_metadata_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. | | minter_address | string | Minter address. | -| possible_spam | boolean | Possible spam. | -| uri_meta | object | A Standard [TokenMetadata](LINK TO COMMON STRUCTURE) object. | +| owner_of | string | The wallet address of the owner of the NFT. | +| possible_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | +| symbol | string | The symbol of the NFT contract. | +| token_address | string | The address of the NFT contract. | +| token_id | string | The token ID of the NFT. | +| token_hash | string | The token hash. | +| token_uri | string | The URI to the metadata of the token. | +| uri_meta | object | A TokenMetadata object. The contents of this object varies, but may include values for `image`, `token_name`, `description`, `attributes` or `animation_url`. | @@ -194,7 +197,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 | contract_type | string | Contract type. `ERC721` or `ERC1155`. | | token_address | string | Address of token transferred. | | token_id | string | Token ID. | -| possible_spam | boolean | Possible spam. MORE INFO? | +| possible_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | | transaction_hash | string | Transaction ID of the transfer. | | transaction_index | string | Transaction index of the transfer. | | log_index | string | Log index of the transfer. | @@ -202,9 +205,9 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 | transaction_type | string | Transation type. `Single` or `WHAT IS THE OTHER TYPE?`. | | from_address | string | Address of previous owner which sent the token(s). | | to_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. WHAT ARE THE POSSIBLE VALUES? | +| status | string | Transfer status. Will be either `Send` or `Receive`. | | verified | integer | I HAVE NO IDEA WHAT THIS MEANS | -| operator | string | I HAVE NO IDEA WHAT THIS MEANS | +| operator | string | May be `null`. | @@ -404,10 +407,10 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 | token_address | string | Token address. | | token_id | string | Token ID. | | fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. CONFIRM: EVERYWHERE ELSE THIS PARAM IS `chain`. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. CONFIRM: EVERYWHERE ELSE THIS PARAM IS `chain`. | | block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | | timestamp | integer | Timestamp of the block containing the withdrawl transaction. | -| internal_id | integer | I HAVE NO IDEA WHAT THIS MEANS. | +| internal_id | integer | Defaults to `0`, but may be used in future for backend referencing to identify a transaction in local database data. | | transaction_type | string | This will always be `NftTransfer`. CONFIRM | From 2fd9d09eb07350bd2abf0df0c4504750530df1c4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 25 May 2023 17:02:38 +0800 Subject: [PATCH 14/85] add some DevComments for items needing clarification --- .../api/v20-dev/non_fungible_tokens/index.mdx | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 051af352..0c1e7930 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -67,14 +67,18 @@ In future, users will be able to also define their own Moralis API key. | minter_address | string | Minter address. | | owner_of | string | The wallet address of the owner of the NFT. | | possible_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | -| symbol | string | The symbol of the NFT contract. | +| symbol | string | May be `null`. The symbol of the NFT contract. | | token_address | string | The address of the NFT contract. | | token_id | string | The token ID of the NFT. | | token_hash | string | The token hash. | | token_uri | string | The URI to the metadata of the token. | -| uri_meta | object | A TokenMetadata object. The contents of this object varies, but may include values for `image`, `token_name`, `description`, `attributes` or `animation_url`. | +| uri_meta | object | A TokenMetadata object. The contents of this object varies, but will include values for `image`, `token_name`, `description`, `attributes` or `animation_url` (which might be `null`). | + +For uri_meta, I think only the values under the `attributes` key are variable. The other keys are always present, but may be `null`. This should link to a standard object. + + ```json { @@ -191,7 +195,7 @@ In future, users will be able to also define their own Moralis API key. | amount | string | Amount of tokens transferred. | | block_hash | string | Hash of block in which transfer occurred. | | block_number | integer | Height of block in which transfer occurred. | -| block_timestamp | string | Block date/time string. CONFIRM: SHOULD THIS NOT BE AN EPOCH TIMESTAMP? | +| block_timestamp | string | Block date/time string. | | chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | collection_name | string | May be `null`. Name of collection which token belongs to. | | contract_type | string | Contract type. `ERC721` or `ERC1155`. | @@ -202,13 +206,19 @@ In future, users will be able to also define their own Moralis API key. | transaction_index | string | Transaction index of the transfer. | | log_index | string | Log index of the transfer. | | value | string | Tranfer value. | -| transaction_type | string | Transation type. `Single` or `WHAT IS THE OTHER TYPE?`. | +| transaction_type | string | Transation type. Possible values are `Single`. | | from_address | string | Address of previous owner which sent the token(s). | | to_address | string | Address of new owner which received the token(s). | | status | string | Transfer status. Will be either `Send` or `Receive`. | -| verified | integer | I HAVE NO IDEA WHAT THIS MEANS | -| operator | string | May be `null`. | +| verified | integer | | +| operator | string | May be `null`. | + + +`block timestamp` is a date time string, though I would expect a unix timestamp +`verified` has no description. +What are the other possible values for `transaction_type`? + ```json @@ -320,7 +330,8 @@ In future, users will be able to also define their own Moralis API key. | last_metadata_sync | string | Last time the token metadata was synced. | | minter_address | string | Minter address. | | possible_spam | boolean | Possible spam. | -| uri_meta | object | A Standard [TokenMetadata](LINK TO COMMON STRUCTURE) object. | +| uri_meta | object | A TokenMetadata object. The contents of this object varies, but will include values for `image`, `token_name`, `description`, `attributes` or `animation_url` (which might be `null`). | + @@ -407,12 +418,15 @@ In future, users will be able to also define their own Moralis API key. | token_address | string | Token address. | | token_id | string | Token ID. | | fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. CONFIRM: EVERYWHERE ELSE THIS PARAM IS `chain`. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | | timestamp | integer | Timestamp of the block containing the withdrawl transaction. | | internal_id | integer | Defaults to `0`, but may be used in future for backend referencing to identify a transaction in local database data. | -| transaction_type | string | This will always be `NftTransfer`. CONFIRM | +| transaction_type | string | This will always be `NftTransfer`. | + +Is `transaction_type` always `NftTransfer`? + ```json From 6892872400a02b84636e9b65aa6d6d1ad18cea8b Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 26 May 2023 17:13:38 +0800 Subject: [PATCH 15/85] add coin activation note for nft withdraw --- .../atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 0c1e7930..b58a2d75 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -165,7 +165,7 @@ For uri_meta, I think only the values under the `attributes` key are variable. T | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to scan for NFTs. Chains must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| chains | array | List of chains to scan for NFTs. | | url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | @@ -284,7 +284,7 @@ What are the other possible values for `transaction_type`? | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| chain | string | The token chain. | | token_address | string | The token address. | | token_id | string | Token ID. | | url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | @@ -372,6 +372,9 @@ What are the other possible values for `transaction_type`? ## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + +To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation) which holds the NFTs first. + ### Request Parameters From 0b825480d395bd07418a3304765d8380ed61217f Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 26 May 2023 17:44:30 +0800 Subject: [PATCH 16/85] review fixed for NFT docs --- .../api/v20-dev/non_fungible_tokens/index.mdx | 21 +++++++++--- src/pages/atomicdex/api/v20/index.mdx | 33 +++++++++++++++---- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index b58a2d75..a22f3bbe 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -206,10 +206,10 @@ For uri_meta, I think only the values under the `attributes` key are variable. T | transaction_index | string | Transaction index of the transfer. | | log_index | string | Log index of the transfer. | | value | string | Tranfer value. | -| transaction_type | string | Transation type. Possible values are `Single`. | +| transaction_type | string | Transation type. Possible values are `Single`. | | from_address | string | Address of previous owner which sent the token(s). | | to_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | | verified | integer | | | operator | string | May be `null`. | @@ -217,7 +217,8 @@ For uri_meta, I think only the values under the `attributes` key are variable. T `block timestamp` is a date time string, though I would expect a unix timestamp `verified` has no description. What are the other possible values for `transaction_type`? - +What is `operator`? +What does `verified` mean? @@ -381,7 +382,13 @@ To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activa | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| | url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | -| withdraw_type | object | A standard [WithdrawType](/atomicdex/api/v20#withdraw-type) object. | +| withdraw_type | object | A standard [WithdrawNftType](/atomicdex/api/v20#withdraw-nft-type) object. | + + +When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). +When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). +Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. + #### 📌 ERC721 Withdraw Example @@ -408,6 +415,11 @@ To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activa ``` + +May change in future. See https://github.com/KomodoPlatform/komodo-docs-mdx/pull/42#discussion_r1197745312 +Right now `internal_id` is always zero and actually I dont save TransactionNftDetails in db as we use info from moralis (NftTransferHistory), but may be in the future. I will need it... + + ### Response Parameters | Parameter | Type | Description | @@ -427,6 +439,7 @@ To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activa | internal_id | integer | Defaults to `0`, but may be used in future for backend referencing to identify a transaction in local database data. | | transaction_type | string | This will always be `NftTransfer`. | + Is `transaction_type` always `NftTransfer`? diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 2d52ef1a..090beb4d 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -316,20 +316,39 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` -### WithdrawType +### WithdrawNftType -The `WithdrawType` object is used for NFT withdrawals. It includes the following items for a given coin or token: +The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| | type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw_data | object | A standard [WithdrawData](/atomicdex/api/v20#withdraw-data) object. | +| withdraw_data | object | A standard [WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155) object. | -### WithdrawData + +When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). +When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). +Due to this difference, the `amount` and `max` fields are only used the when `type` value in `WithdrawType` is `withdraw_erc1155`. + + +### WithdrawDataErc721 + +The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contracts. It includes the following items for a given coin or token: + + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| to | string | Destination address to withdraw the token to. | +| token_address | string | Token address. | +| token_id | string | Token ID. | + + +### WithdrawDataErc1155 -The `WithdrawData` object is used for NFT withdrawals. It includes the following items for a given coin or token: +The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 contracts. It includes the following items for a given coin or token: | Parameter | Type | Description | @@ -338,7 +357,7 @@ The `WithdrawData` object is used for NFT withdrawals. It includes the following | to | string | Destination address to withdraw the token to. | | token_address | string | Token address. | | token_id | string | Token ID. | -| amount | string | Optional, defaults to `1`. When sending more than one NFT, use the `withdraw_erc1155` withdraw type. Amount of NFTs to withdraw. | -| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with the `token_address` will be sent. | +| amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is `true. | +| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | | fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | From 86857d5e10f5e580e73894e4ca40bd27ada9795d Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 31 May 2023 16:38:22 +0800 Subject: [PATCH 17/85] Add token metadata object --- .../api/v20-dev/non_fungible_tokens/index.mdx | 4 +- src/pages/atomicdex/api/v20/index.mdx | 78 +++++++++++++++++-- 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index a22f3bbe..7fa84494 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -72,7 +72,7 @@ In future, users will be able to also define their own Moralis API key. | token_id | string | The token ID of the NFT. | | token_hash | string | The token hash. | | token_uri | string | The URI to the metadata of the token. | -| uri_meta | object | A TokenMetadata object. The contents of this object varies, but will include values for `image`, `token_name`, `description`, `attributes` or `animation_url` (which might be `null`). | +| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | @@ -331,7 +331,7 @@ What does `verified` mean? | last_metadata_sync | string | Last time the token metadata was synced. | | minter_address | string | Minter address. | | possible_spam | boolean | Possible spam. | -| uri_meta | object | A TokenMetadata object. The contents of this object varies, but will include values for `image`, `token_name`, `description`, `attributes` or `animation_url` (which might be `null`). | +| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 73b00fdd..ced0c1df 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -451,6 +451,71 @@ The `TokensRequest` object includes the following items for a given coin or toke +### TokenMetadata + +The `TokenMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------| +| image | string | Optional. Url to the NFT's image. | +| token_name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation_url | string | Optional. Url to an animationto be displaye instead of a static image. | + + + +```json +[ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } +] +``` + + + ### WithdrawFee The `WithdrawFee` object varies epending on the coin or token type. Refer to the examples to view the object structure for each type. @@ -471,7 +536,7 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the -### Example of Eth type +#### Example of Eth type ```json { @@ -483,7 +548,7 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` -### Example of Qrc20 type +#### Example of Qrc20 type ```json { @@ -496,7 +561,7 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` -### Example of Tendermint type +#### Example of Tendermint type ```json { @@ -507,7 +572,7 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` -### Example of Utxo type +#### Example of Utxo type ```json { @@ -516,6 +581,7 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the } ``` + ### WithdrawNftType The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: @@ -533,6 +599,7 @@ When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it Due to this difference, the `amount` and `max` fields are only used the when `type` value in `WithdrawType` is `withdraw_erc1155`. + ### WithdrawDataErc721 The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contracts. It includes the following items for a given coin or token: @@ -544,6 +611,7 @@ The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contra | to | string | Destination address to withdraw the token to. | | token_address | string | Token address. | | token_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | ### WithdrawDataErc1155 @@ -559,5 +627,5 @@ The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 cont | token_id | string | Token ID. | | amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is `true. | | max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | From f5b42883f0b569f8bcf69c0a798b9f623aaff5a9 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 31 May 2023 17:02:15 +0800 Subject: [PATCH 18/85] nft docs review fixes --- .../atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 7fa84494..10b1a04a 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -206,7 +206,7 @@ For uri_meta, I think only the values under the `attributes` key are variable. T | transaction_index | string | Transaction index of the transfer. | | log_index | string | Log index of the transfer. | | value | string | Tranfer value. | -| transaction_type | string | Transation type. Possible values are `Single`. | +| transaction_type | string | Transaction type. Possible values are `Single`. | | from_address | string | Address of previous owner which sent the token(s). | | to_address | string | Address of new owner which received the token(s). | | status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | @@ -214,8 +214,7 @@ For uri_meta, I think only the values under the `attributes` key are variable. T | operator | string | May be `null`. | -`block timestamp` is a date time string, though I would expect a unix timestamp -`verified` has no description. +`verified` has no description. Related to https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. What are the other possible values for `transaction_type`? What is `operator`? What does `verified` mean? @@ -440,10 +439,6 @@ Right now `internal_id` is always zero and actually I dont save TransactionNftDe | transaction_type | string | This will always be `NftTransfer`. | - -Is `transaction_type` always `NftTransfer`? - - ```json { From 3c3b5b9dbd3b08b90386ecd839cbc724f80f6dd6 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 31 May 2023 18:38:45 +0800 Subject: [PATCH 19/85] adds TokensRequest and TokenFilter objects --- src/pages/atomicdex/api/v20/index.mdx | 34 ++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index ced0c1df..751f9291 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -431,14 +431,16 @@ For requests which return many results, pagination offsets may be applied. ** Us -### TokensRequest +### TokenFilter -The `TokensRequest` object includes the following items for a given coin or token: +The `TokenFilter` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ---------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of the token to be enabled | -| required_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------| +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers after this date are included in the response. | +| to_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers before this date are included in the response. | @@ -516,6 +518,26 @@ The `TokenMetadata` object includes the following items for a given coin or toke +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ---------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the token to be enabled | +| required_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + +```json +{ + "ticker": "MINDS-ERC20", + "required_confirmations": 4 +} +``` + + + ### WithdrawFee The `WithdrawFee` object varies epending on the coin or token type. Refer to the examples to view the object structure for each type. From 3d9d0c6badd3f4630d3010f5a706f43ce3a84720 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 31 May 2023 18:40:47 +0800 Subject: [PATCH 20/85] update nft req/resp for examples with filter params --- .../api/v20-dev/non_fungible_tokens/index.mdx | 283 ++++++++++-------- 1 file changed, 166 insertions(+), 117 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 10b1a04a..c49d9680 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -19,36 +19,16 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 ## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. ### Request Parameters | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| | chains | array | List of chains to scan for NFTs. | -| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | - - -In future, users will be able to also define their own Moralis API key. - - -#### 📌 Example(s) - - -```json {{ mm2MethodDecorate : true }} -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "url": "https://moralis-proxy.komodo.earth" - } -} -``` - +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page_number | integer | Optional, defaults to `0`. The page offset for items in response. | ### Response Parameters @@ -75,9 +55,24 @@ In future, users will be able to also define their own Moralis API key. | uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | - -For uri_meta, I think only the values under the `attributes` key are variable. The other keys are always present, but may be `null`. This should link to a standard object. - +#### 📌 Example with no optional params + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ] + } +} +``` + + ```json @@ -151,7 +146,9 @@ For uri_meta, I think only the values under the `attributes` key are variable. T "animation_url": null } } - ] + ], + "skipped": 0, + "total": 2 }, "id": null } @@ -159,33 +156,92 @@ For uri_meta, I think only the values under the `attributes` key are variable. T -## Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} - -### Request Parameters - -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to scan for NFTs. | -| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | +#### 📌 Example with no optional params + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } +} +``` + -#### 📌 Example(s) - -```json {{ mm2MethodDecorate : true }} + +```json { - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_transfers", "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "token_name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null + } + } ], - "url": "https://moralis-proxy.komodo.earth" - } + "skipped": 1, + "total": 1 + }, + "id": null } ``` - + + + +## Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page_number | integer | Optional, defaults to `0`. The page offset for items in response. | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20#token-filter) object. | ### Response Parameters @@ -220,6 +276,29 @@ What is `operator`? What does `verified` mean? +#### 📌 Example with date and `send` filters + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": "2023-03-08" + } + } +} +``` + + + ```json { @@ -247,30 +326,10 @@ What does `verified` mean? "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", "possible_spam": false - }, - { - "chain": "POLYGON", - "block_number": 40059494, - "block_timestamp": "2023-03-07T05:59:40.000Z", - "block_hash": "0x74ed1956f9ddd850639086985eda441dd984b6cdd657608be19e42e66bd911af", - "transaction_hash": "0x03653c73b8540d166e94382345cb1e028c08c3c9d4fd809e8c1cf307407f91e8", - "transaction_index": 51, - "log_index": 232, - "value": "0", - "contract_type": "ERC1155", - "transaction_type": "Single", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "collection_name": null, - "from_address": "0x32c5a026cb212cf18de790400763df8b64b4d028", - "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "status": "Receive", - "amount": "2", - "verified": 1, - "operator": "0x32c5a026cb212cf18de790400763df8b64b4d028", - "possible_spam": false } - ] + ], + "skipped": 1, + "total": 2 }, "id": null } @@ -287,26 +346,6 @@ What does `verified` mean? | chain | string | The token chain. | | token_address | string | The token address. | | token_id | string | Token ID. | -| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | - - -#### 📌 Example(s) - - -```json {{ mm2MethodDecorate : true }} -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_metadata", - "mmrpc": "2.0", - "params": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "chain": "BSC", - "url": "https://moralis-proxy.komodo.earth" - } -} -``` - ### Response Parameters @@ -333,6 +372,23 @@ What does `verified` mean? | uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | +#### 📌 Example + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC", + } +} +``` + + ```json @@ -380,16 +436,34 @@ To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activa | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| url | string | URL link to [Moralis API](https://docs.moralis.io/) (or proxy). | | withdraw_type | object | A standard [WithdrawNftType](/atomicdex/api/v20#withdraw-nft-type) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | +| amount | string | Amount of tokens to withdraw. | +| tx_hex | string | Raw hex of signed transaction. Use this with the [send_raw_transaction](/atomicdex/api/legacy/send_raw_transaction) RPC to broadcast the transaction. | +| tx_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract_type | string | Contract type. `ERC721` or `ERC1155`. | +| token_address | string | Token address. | +| token_id | string | Token ID. | +| fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | +| internal_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction_type | string | This will always be `NftTransfer`. | + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. - #### 📌 ERC721 Withdraw Example @@ -414,31 +488,6 @@ Due to this difference, the `amount` and `max` fields are only used the `type` v ``` - -May change in future. See https://github.com/KomodoPlatform/komodo-docs-mdx/pull/42#discussion_r1197745312 -Right now `internal_id` is always zero and actually I dont save TransactionNftDetails in db as we use info from moralis (NftTransferHistory), but may be in the future. I will need it... - - -### Response Parameters - -| Parameter | Type | Description | -| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | Amount of tokens to withdraw. | -| tx_hex | string | Raw transaction hex of the withdrawl. | -| tx_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract_type | string | Contract type. `ERC721` or `ERC1155`. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | -| internal_id | integer | Defaults to `0`, but may be used in future for backend referencing to identify a transaction in local database data. | -| transaction_type | string | This will always be `NftTransfer`. | - - ```json { From 5e86b5d9e57774c57d04520b22a78620d70b87b1 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 31 May 2023 21:47:44 +0800 Subject: [PATCH 21/85] add `refresh_nft_metadata` and `update_nft` --- .../api/v20-dev/non_fungible_tokens/index.mdx | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index c49d9680..49d3044c 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -426,6 +426,114 @@ What does `verified` mean? +## Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will query the provided url to update the information stored in the local database. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chains | array | List of chains to update NFTs for. | +| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | + + + +If there are no errors, this request will return an empty response. + + +#### 📌 Example + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "'$USERPASS'", + "method": "update_nft", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth" + } +} +``` + + + + + +```json +{ + "mmrpc": "2.0", + "result": null, + "id": null +} +``` + + + +Need to add some error responses here. + + + +## Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token_address and token_id. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | +| token_address | string | Token address. | +| token_id | string | Token ID. | + + + +If there are no errors, this request will return an empty response. + + +#### 📌 Example + + +```json {{ mm2MethodDecorate : true }} +{ + "userpass": "'$USERPASS'", + "method": "refresh_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth" + } +} +``` + + + + + +If there are no errors, this request will return an empty response. + + +```json +{ + "mmrpc": "2.0", + "result": null, + "id": null +} +``` + + + +Need to add some error responses here. + + + ## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} From a4219169a9d4825ff98a689325de4be9069a7fa8 Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:16:03 +0800 Subject: [PATCH 22/85] rm comma --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 49d3044c..d1745fd2 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -383,7 +383,7 @@ What does `verified` mean? "params": { "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", "token_id": "214300044414", - "chain": "BSC", + "chain": "BSC" } } ``` From d26ec28fbadeb3a135a0e3266668433d42d2fb3b Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:20:42 +0800 Subject: [PATCH 23/85] Update index.mdx --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index d1745fd2..141114f4 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -291,7 +291,7 @@ What does `verified` mean? "max": true, "filters": { "send": true, - "from_date": "2023-03-08" + "from_date": 1676636291 } } } From 8497f453189411c618e0f175bdc3253e4676f861 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sat, 9 Sep 2023 22:40:06 +0800 Subject: [PATCH 24/85] add codegroup tags --- .../api/v20-dev/non_fungible_tokens/index.mdx | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 141114f4..a0f1bd66 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -57,8 +57,8 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` #### 📌 Example with no optional params - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "get_nft_list", @@ -158,8 +158,8 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` #### 📌 Example with no optional params - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "get_nft_list", @@ -278,8 +278,8 @@ What does `verified` mean? #### 📌 Example with date and `send` filters - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "get_nft_transfers", @@ -374,8 +374,8 @@ What does `verified` mean? #### 📌 Example - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "get_nft_metadata", @@ -444,8 +444,8 @@ If there are no errors, this request will return an empty response. #### 📌 Example - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "'$USERPASS'", "method": "update_nft", @@ -498,8 +498,8 @@ If there are no errors, this request will return an empty response. #### 📌 Example - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "'$USERPASS'", "method": "refresh_nft_metadata", @@ -574,8 +574,9 @@ Due to this difference, the `amount` and `max` fields are only used the `type` v #### 📌 ERC721 Withdraw Example - -```json {{ mm2MethodDecorate : true }} + + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "withdraw_nft", @@ -636,8 +637,8 @@ Due to this difference, the `amount` and `max` fields are only used the `type` v If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "withdraw_nft", @@ -699,8 +700,8 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw If you would like to withdraw all NFTs from a token_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - -```json {{ mm2MethodDecorate : true }} + +```json { "userpass": "MM2_RPC_PASSWORD", "method": "withdraw_nft", From 6d43eb4f6c79f00bd9908e7edb86d55d8360b07e Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sat, 9 Sep 2023 20:16:21 +0530 Subject: [PATCH 25/85] removes sidebar.ts --- src/data/sidebar.ts | 1050 ------------------------------------------- 1 file changed, 1050 deletions(-) delete mode 100644 src/data/sidebar.ts diff --git a/src/data/sidebar.ts b/src/data/sidebar.ts deleted file mode 100644 index 1fb86986..00000000 --- a/src/data/sidebar.ts +++ /dev/null @@ -1,1050 +0,0 @@ -import { NavigationRouteType } from "@/store/navigation/types"; - -const startHerePageNavigation: NavigationRouteType = { - "/start-here/": [ - { - "title": "About Komodo Platform", - "links": [ - { - "title": "Platform overview", - "href": "/start-here/about-komodo-platform//" - }, - { - "title": "Product introductions", - "href": "/start-here/about-komodo-platform/product-introductions/" - }, - { - "title": "Doc orientation", - "href": "/start-here/about-komodo-platform/orientation/" - }, - { - "title": "Simple Installations", - "href": "/start-here/about-komodo-platform/simple-installations/" - } - ] - }, - { - "title": "Learning launchpad", - "links": [ - { - "title": "Learning path outline", - "href": "/start-here/learning-launchpad/learning-path-outline/" - }, - { - "title": "Common technologies and concepts", - "href": "/start-here/learning-launchpad/common-terminology-and-concepts/" - } - ] - }, - { - "title": "Core technology discussions", - "links": [ - { - "title": "Introduction", - "href": "/start-here/core-technology-discussions/introduction/" - }, - { - "title": "Delayed Proof of Work", - "href": "/start-here/core-technology-discussions/delayed-proof-of-work/" - }, - { - "title": "Initial DEX Offering (IDO)", - "href": "/start-here/core-technology-discussions/initial-dex-offering/" - }, - { - "title": "The Antara Framework", - "href": "/start-here/core-technology-discussions/antara/" - }, - { - "title": "AtomicDEX and Atomic Swaps", - "href": "/start-here/core-technology-discussions/atomicdex/" - }, - { - "title": "Miscellaneous", - "href": "/start-here/core-technology-discussions/miscellaneous/" - }, - { - "title": "References", - "href": "/start-here/core-technology-discussions/references/" - } - ] - } - ] -}; - -const atomicdexPageNavigation: NavigationRouteType = { - "/atomicdex/": [ - { - "title": "AtomicDEX", - "links": [ - { - "title": "Introduction to AtomicDEX Documentation", - "href": "/atomicdex/" - }, - { - "title": "RPC Methods for AtomicDEX", - "href": "/atomicdex/api/" - } - ] - }, - { - "title": "Setup", - "links": [ - { - "title": "Installing AtomicDEX-API", - "href": "/atomicdex/setup/" - }, - { - "title": "Configuring AtomicDEX-API", - "href": "/atomicdex/setup/configure-mm2-json/" - } - ] - }, - { - "title": "Tutorials", - "links": [ - { - "title": "AtomicDEX Introduction", - "href": "/atomicdex/tutorials/" - }, - { - "title": "AtomicDEX Walkthrough", - "href": "/atomicdex/tutorials/atomicdex-walkthrough/" - }, - { - "title": "DEX Metrics", - "href": "/atomicdex/tutorials/atomicdex-metrics/" - }, - { - "title": "Adding a new coin to the AtomicDEX-API", - "href": "/atomicdex/tutorials/listing-a-coin-on-atomicdex/" - }, - { - "title": "How to Become a Liquidity Provider", - "href": "/atomicdex/tutorials/how-to-become-a-liquidity-provider/" - }, - { - "title": "How to Query the MM2 SQLite Database", - "href": "/atomicdex/tutorials/query-the-mm2-database/" - }, - { - "title": "How to Setup and Use AtomicDEX-API on a AWS EC2 Instance", - "href": "/atomicdex/tutorials/setup-atomicdex-aws/" - }, - { - "title": "How to Update your Coins File", - "href": "/atomicdex/tutorials/coins-file-update/" - }, - { - "title": "More Information About AtomicDEX", - "href": "/atomicdex/tutorials/additional-information-about-atomicdex/" - } - ] - }, - { - "title": "User Guides (Mobile) ", - "links": [ - { - "title": "Create a New Wallet Using AtomicDEX Mobile", - "href": "/atomicdex/mobile/" - }, - { - "title": "Restore Wallet Using AtomicDEX Mobile", - "href": "/atomicdex/mobile/restore-wallet-using-atomicdex-mobile/" - }, - { - "title": "Add and Activate Coins on AtomicDEX Mobile", - "href": "/atomicdex/mobile/add-and-activate-coins-on-atomicdex-mobile/" - }, - { - "title": "View Your Receiving Address to Send Funds for Trading", - "href": "/atomicdex/mobile/view-your-receiving-address-to-send-funds-for-trading/" - }, - { - "title": "Withdraw or Send Funds Using AtomicDEX Mobile", - "href": "/atomicdex/mobile/withdraw-or-send-funds-using-atomicdex-mobile/" - }, - { - "title": "Perform Cross-Chain Atomic Swaps Using AtomicDEX Mobile", - "href": "/atomicdex/mobile/perform-cross-chain-atomic-swaps-using-atomicdex-mobile/" - }, - { - "title": "View Ongoing Orders and Swap History on AtomicDEX Mobile", - "href": "/atomicdex/mobile/view-ongoing-orders-and-swap-history-on-atomicdex-mobile/" - }, - { - "title": "Recover Seed on AtomicDEX Mobile", - "href": "/atomicdex/mobile/recover-seed-on-atomicdex-mobile/" - }, - { - "title": "Delete Seed (Wallet) on AtomicDEX Mobile", - "href": "/atomicdex/mobile/delete-seed-from-atomicdex-mobile/" - } - ] - }, - { - "title": "Change Logs", - "links": [ - { - "title": "changelog", - "href": "/atomicdex/changelog/" - } - ] - } - ] -}; - -const atomicdexApi20MasterPageNavigation: NavigationRouteType = { - "/atomicdex/api/v20": [ - { - "title": "AtomicDEX API 2.0 (Master)", - "links": [ - { - "title": "AtomicDEX-API RPC Protocol v2.0 (Master)", - "href": "/atomicdex/api/v20/" - } - ] - }, - { - "title": "Coin Activation", - "links": [ - { - "title": "enable_bch_with_slp_tokens", - "href": "/atomicdex/api/v20/enable_bch_with_tokens/" - }, - { - "title": "enable_slp", - "href": "/atomicdex/api/v20/enable_slp/" - }, - { - "title": "enable_tendermint_with_assets", - "href": "/atomicdex/api/v20/enable_tendermint_with_assets/" - }, - { - "title": "enable_tendermint_token", - "href": "/atomicdex/api/v20/enable_tendermint_token/" - }, - { - "title": "enable_eth_with_tokens", - "href": "/atomicdex/api/v20/enable_eth_with_tokens/" - }, - { - "title": "enable_erc20", - "href": "/atomicdex/api/v20/enable_erc20/" - } - ] - }, - { - "title": "Market Maker Bot", - "links": [ - { - "title": "start_simple_market_maker_bot", - "href": "/atomicdex/api/v20/start_simple_market_maker_bot/" - }, - { - "title": "stop_simple_market_maker_bot", - "href": "/atomicdex/api/v20/stop_simple_market_maker_bot/" - }, - { - "title": "telegram_alerts", - "href": "/atomicdex/api/v20/telegram_alerts/" - } - ] - }, - { - "title": "Message Signing", - "links": [ - { - "title": "Signing and verifying messages", - "href": "/atomicdex/api/v20/message_signing/" - } - ] - }, - { - "title": "Orders", - "links": [ - { - "title": "best_orders", - "href": "/atomicdex/api/v20/best_orders/" - } - ] - }, - { - "title": "Seednode Version Stats ", - "links": [ - { - "title": "add_node_to_version_stat", - "href": "/atomicdex/api/v20/add_node_to_version_stat/" - }, - { - "title": "remove_node_from_version_stat", - "href": "/atomicdex/api/v20/remove_node_from_version_stat/" - }, - { - "title": "start_version_stat_collection", - "href": "/atomicdex/api/v20/start_version_stat_collection/" - }, - { - "title": "stop_version_stat_collection", - "href": "/atomicdex/api/v20/stop_version_stat_collection/" - }, - { - "title": "update_version_stat_collection", - "href": "/atomicdex/api/v20/update_version_stat_collection/" - } - ] - }, - { - "title": "Staking", - "links": [ - { - "title": "add_delegation", - "href": "/atomicdex/api/v20/add_delegation/" - }, - { - "title": "get_staking_infos", - "href": "/atomicdex/api/v20/get_staking_infos/" - }, - { - "title": "remove_delegation", - "href": "/atomicdex/api/v20/remove_delegation/" - } - ] - }, - { - "title": "Swaps", - "links": [ - { - "title": "recreate_swap_data", - "href": "/atomicdex/api/v20/recreate_swap_data/" - }, - { - "title": "trade_preimage", - "href": "/atomicdex/api/v20/trade_preimage/" - } - ] - }, - { - "title": "Wallet", - "links": [ - { - "title": "get_public_key", - "href": "/atomicdex/api/v20/get_public_key/" - }, - { - "title": "get_public_key_hash", - "href": "/atomicdex/api/v20/get_public_key_hash/" - }, - { - "title": "get_raw_transaction", - "href": "/atomicdex/api/v20/get_raw_transaction/" - }, - { - "title": "my_tx_history", - "href": "/atomicdex/api/v20/my_tx_history/" - }, - { - "title": "withdraw", - "href": "/atomicdex/api/v20/withdraw/" - } - ] - } - ] -}; - -const atomicdexApi_20_Dev_PageNavigation: NavigationRouteType = { - "/atomicdex/api/v20-dev": [ - { - "title": "AtomicDEX API 2.0 (Dev)", - "links": [ - { - "title": "AtomicDEX-API RPC Protocol v2.0 (Dev)", - "href": "/atomicdex/api/v20-dev/" - } - ] - }, - { - "title": "Utility", - "links": [ - { - "title": "get_current_mtp", - "href": "/atomicdex/api/v20-dev/get_current_mtp/" - } - ] - }, - { - "title": "HD Wallet Tasks", - "links": [ - { - "title": "Overview", - "href": "/atomicdex/api/v20-dev/hd_wallets_overview/" - }, - { - "title": "Trezor Initialization", - "href": "/atomicdex/api/v20-dev/trezor_initialisation/" - }, - { - "title": "Address Management", - "href": "/atomicdex/api/v20-dev/hd_address_management/" - }, - { - "title": "Account Balance Tasks", - "href": "/atomicdex/api/v20-dev/account_balance_tasks/" - } - ] - }, - { - "title": "Non-Fungible Tokens", - "links": [ - { - "title": "Overview", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens" - }, - { - "title": "Get a list of NFTs", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-a-list-of-nfts" - }, - { - "title": "Get a list of NFT transfers", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-a-list-of-nft-transfers" - }, - { - "title": "Get NFT metadata", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#get-nft-metadata" - }, - { - "title": "Withdraw NFTs", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens#withdraw-nfts" - } - ] - }, - { - "title": "Lightning Network", - "links": [ - { - "title": "Overview", - "href": "/atomicdex/api/v20-dev/lightning/" - }, - { - "title": "Lightning Initialization", - "href": "/atomicdex/api/v20-dev/lightning/activation" - }, - { - "title": "Lightning Nodes", - "href": "/atomicdex/api/v20-dev/lightning/nodes" - }, - { - "title": "Lightning Channels", - "href": "/atomicdex/api/v20-dev/lightning/channels" - }, - { - "title": "Lightning Payments", - "href": "/atomicdex/api/v20-dev/lightning/payments" - } - ] - }, - { - "title": "Coin Activation Tasks", - "titleLink": "/atomicdex/api/v20-dev/coin_activation_tasks/", - "links": [] - }, - { - "title": "get_locked_amount", - "titleLink": "/atomicdex/api/v20-dev/get_locked_amount/", - "links": [] - }, - { - "title": "max_maker_vol", - "titleLink": "/atomicdex/api/v20-dev/max_maker_vol/", - "links": [] - }, - { - "title": "Withdraw Tasks", - "titleLink": "/atomicdex/api/v20-dev/withdraw_tasks/", - "links": [] - }, - { - "title": "ZHTLC Coins", - "titleLink": "/atomicdex/api/v20-dev/zhtlc_coins/", - "links": [] - } - ] -}; - -const atomicdexApiLegacyPageNavigation: NavigationRouteType = { - "/atomicdex-api-legacy": [ - { - "title": "AtomicDEX API (Legacy)", - "links": [ - { - "title": "batch_requests", - "href": "/atomicdex/api/legacy/batch_requests/" - } - ] - }, - { - "title": "Note about rational number type", - "titleLink": "/atomicdex/api/legacy/rational_number_note/", - "links": [] - }, - { - "title": "Coin Activation ", - "links": [ - { - "title": "Activation Methods", - "href": "/atomicdex/api/legacy/coin_activation/" - }, - { - "title": "coins_needed_for_kick_start", - "href": "/atomicdex/api/legacy/coins_needed_for_kick_start/" - }, - { - "title": "disable_coin", - "href": "/atomicdex/api/legacy/disable_coin/" - }, - { - "title": "get_enabled_coins", - "href": "/atomicdex/api/legacy/get_enabled_coins/" - }, - { - "title": "set_required_confirmations", - "href": "/atomicdex/api/legacy/set_required_confirmations/" - }, - { - "title": "set_requires_notarization", - "href": "/atomicdex/api/legacy/set_requires_notarization/" - } - ] - }, - { - "title": "Network", - "links": [ - { - "title": "get_gossip_mesh", - "href": "/atomicdex/api/legacy/get_gossip_mesh/" - }, - { - "title": "get_gossip_peer_topics", - "href": "/atomicdex/api/legacy/get_gossip_peer_topics/" - }, - { - "title": "get_gossip_topic_peers", - "href": "/atomicdex/api/legacy/get_gossip_topic_peers/" - }, - { - "title": "get_my_peer_id", - "href": "/atomicdex/api/legacy/get_my_peer_id/" - }, - { - "title": "get_peers_info", - "href": "/atomicdex/api/legacy/get_peers_info/" - }, - { - "title": "get_relay_mesh", - "href": "/atomicdex/api/legacy/get_relay_mesh/" - } - ] - }, - { - "title": "Orders", - "links": [ - { - "title": "best_orders", - "href": "/atomicdex/api/legacy/best_orders/" - }, - { - "title": "buy", - "href": "/atomicdex/api/legacy/buy/" - }, - { - "title": "cancel_all_orders", - "href": "/atomicdex/api/legacy/cancel_all_orders/" - }, - { - "title": "cancel_order", - "href": "/atomicdex/api/legacy/cancel_order/" - }, - { - "title": "my_orders", - "href": "/atomicdex/api/legacy/my_orders/" - }, - { - "title": "orderbook", - "href": "/atomicdex/api/legacy/orderbook/" - }, - { - "title": "orderbook_depth", - "href": "/atomicdex/api/legacy/orderbook_depth/" - }, - { - "title": "orders_history_by_filter", - "href": "/atomicdex/api/legacy/orders_history_by_filter/" - }, - { - "title": "order_status", - "href": "/atomicdex/api/legacy/order_status/" - }, - { - "title": "recover_funds_of_swap", - "href": "/atomicdex/api/legacy/recover_funds_of_swap/" - }, - { - "title": "sell", - "href": "/atomicdex/api/legacy/sell/" - }, - { - "title": "setprice", - "href": "/atomicdex/api/legacy/setprice/" - }, - { - "title": "update_maker_order", - "href": "/atomicdex/api/legacy/update_maker_order/" - } - ] - }, - { - "title": "Swaps", - "links": [ - { - "title": "active_swaps", - "href": "/atomicdex/api/legacy/active_swaps/" - }, - { - "title": "all_swaps_uuids_by_filter", - "href": "/atomicdex/api/legacy/all_swaps_uuids_by_filter/" - }, - { - "title": "get_trade_fee", - "href": "/atomicdex/api/legacy/get_trade_fee/" - }, - { - "title": "import_swaps", - "href": "/atomicdex/api/legacy/import_swaps/" - }, - { - "title": "min_trading_vol", - "href": "/atomicdex/api/legacy/min_trading_vol/" - }, - { - "title": "max_taker_vol", - "href": "/atomicdex/api/legacy/max_taker_vol/" - }, - { - "title": "my_recent_swaps", - "href": "/atomicdex/api/legacy/my_recent_swaps/" - }, - { - "title": "my_swap_status", - "href": "/atomicdex/api/legacy/my_swap_status/" - }, - { - "title": "trade_preimag", - "href": "/atomicdex/api/legacy/trade_preimage/" - } - ] - }, - { - "title": "Utility", - "links": [ - { - "title": "ban_pubkey", - "href": "/atomicdex/api/legacy/ban_pubkey/" - }, - { - "title": "help", - "href": "/atomicdex/api/legacy/help/" - }, - { - "title": "list_banned_pubkeys", - "href": "/atomicdex/api/legacy/list_banned_pubkeys/" - }, - { - "title": "stop", - "href": "/atomicdex/api/legacy/stop/" - }, - { - "title": "unban_pubkeys", - "href": "/atomicdex/api/legacy/unban_pubkeys/" - }, - { - "title": "version", - "href": "/atomicdex/api/legacy/version/" - } - ] - }, - { - "title": "Wallet", - "links": [ - { - "title": "convertaddress", - "href": "/atomicdex/api/legacy/convertaddress/" - }, - { - "title": "convert_utxo_address", - "href": "/atomicdex/api/legacy/convert_utxo_address/" - }, - { - "title": "kmd_rewards_info", - "href": "/atomicdex/api/legacy/kmd_rewards_info/" - }, - { - "title": "my_balance", - "href": "/atomicdex/api/legacy/my_balance/" - }, - { - "title": "my_tx_history", - "href": "/atomicdex/api/legacy/my_tx_history/" - }, - { - "title": "send_raw_transaction", - "href": "/atomicdex/api/legacy/send_raw_transaction/" - }, - { - "title": "show_priv_key", - "href": "/atomicdex/api/legacy/show_priv_key/" - }, - { - "title": "validateaddress", - "href": "/atomicdex/api/legacy/validateaddress/" - }, - { - "title": "withdraw", - "href": "/atomicdex/api/legacy/withdraw/" - } - ] - } - ] -}; - -const antaraFrameworkPageNavigation: NavigationRouteType = { - "/antara": [ - { - "title": "Introduction to Antara Documentation", - "titleLink": "/antara/", - "links": [] - }, - { - "title": "Antara Customizations", - "titleLink": "/antara/setup/antara-customizations/", - "links": [] - }, - { - "title": "Antara Tutorials", - "links": [ - { - "title": "Introduction to Antara Tutorials", - "href": "/antara/tutorials/introduction-to-antara-tutorials/" - }, - { - "title": "Understanding Antara Addresses", - "href": "/antara/tutorials/understanding-antara-addresses/" - }, - { - "title": "Overview of Antara Modules — Part I", - "href": "/antara/tutorials/overview-of-antara-modules-part-i/" - }, - { - "title": "Overview of Antara Modules — Part II", - "href": "/antara/tutorials/overview-of-antara-modules-part-ii/" - }, - { - "title": "Beginner Series — Preparation", - "href": "/antara/tutorials/beginner-series-part-0/" - }, - { - "title": "Beginner Series — Create a Blockchain", - "href": "/antara/tutorials/beginner-series-part-1/" - }, - { - "title": "Beginner Series — Using a Faucet", - "href": "/antara/tutorials/beginner-series-part-2/" - }, - { - "title": "Beginner Series — Connecting to Another Programming Environment", - "href": "/antara/tutorials/beginner-series-part-3/" - }, - { - "title": "Beginner Series — Understanding Tokens", - "href": "/antara/tutorials/beginner-series-part-4/" - }, - { - "title": "Advanced Series — Introduction", - "href": "/antara/tutorials/advanced-series-0/" - }, - { - "title": "Advanced Series — Smart Chain Development Basics", - "href": "/antara/tutorials/advanced-series-1/" - }, - { - "title": "Advanced Series — Antara Module Development Basics", - "href": "/antara/tutorials/advanced-series-2/" - }, - { - "title": "Advanced Series — Preparing for Heir Development", - "href": "/antara/tutorials/advanced-series-3/" - }, - { - "title": "Advanced Series — Final Conceptual Discussion", - "href": "/antara/tutorials/advanced-series-4/" - }, - { - "title": "Advanced Series — Developing the Heir Module Prototype", - "href": "/antara/tutorials/advanced-series-5/" - }, - { - "title": "Advanced Series — Miscellaneous", - "href": "/antara/tutorials/advanced-series-6/" - }, - { - "title": "Module Tutorial — Dilithium", - "href": "/antara/tutorials/dilithium-module-tutorial/" - }, - { - "title": "Module Tutorial — Gateways", - "href": "/antara/tutorials/gateways-module-tutorial/" - }, - { - "title": "Module Tutorial — Musig", - "href": "/antara/tutorials/musig-module-tutorial/" - }, - { - "title": "Module Tutorial — Rogue", - "href": "/antara/tutorials/rogue-module-tutorial/" - }, - { - "title": "Module Tutorial — Pegs | User", - "href": "/antara/tutorials/pegs-module-user-tutorial/" - }, - { - "title": "Module Tutorial — Pegs | Creator", - "href": "/antara/tutorials/pegs-module-creator-tutorial/" - } - ] - }, - { - "title": "Antara Modules", - "links": [ - { - "title": "Assets", - "href": "/antara/api/assets/" - }, - { - "title": "Channels", - "href": "/antara/api/channels/" - }, - { - "title": "Custom", - "href": "/antara/api/custom/" - }, - { - "title": "Dice", - "href": "/antara/api/dice/" - }, - { - "title": "Dilithium", - "href": "/antara/api/dilithium/" - }, - { - "title": "Faucet", - "href": "/antara/api/faucet/" - }, - { - "title": "Gaming", - "href": "/antara/api/gaming/" - }, - { - "title": "Gateways", - "href": "/antara/api/gateways/" - }, - { - "title": "Heir", - "href": "/antara/api/heir/" - }, - { - "title": "MuSig", - "href": "/antara/api/musig/" - }, - { - "title": "Oracles", - "href": "/antara/api/oracles/" - }, - { - "title": "Payments", - "href": "/antara/api/payments/" - }, - { - "title": "Pegs", - "href": "/antara/api/pegs/" - }, - { - "title": "Prices", - "href": "/antara/api/prices/" - }, - { - "title": "Rewards", - "href": "/antara/api/rewards/" - }, - { - "title": "Rogue", - "href": "/antara/api/rogue/" - }, - { - "title": "Sudoku", - "href": "/antara/api/sudoku/" - }, - { - "title": "Tokens", - "href": "/antara/api/tokens/" - } - ] - } - ] -}; - -const smartChainPageNavigation: NavigationRouteType = { - "/smart-chains": [ - { - "title": "Introduction to Smart Chain Documentation", - "titleLink": "/smart-chains/", - "links": [] - }, - { - "title": "Komodo Changelog", - "titleLink": "/smart-chains/changelog/", - "links": [] - }, - { - "title": "Smart Chain Setup", - "links": [ - { - "title": "Installing Smart Chain Software From Source Code", - "href": "/smart-chains/setup/installing-from-source/" - }, - { - "title": "Updating Smart Chain Software From Source Code", - "href": "/smart-chains/setup/updating-from-source/" - }, - { - "title": "Interacting with Smart Chains", - "href": "/smart-chains/setup/interacting-with-smart-chains/" - }, - { - "title": "Ecosystem Smart Chain Launch Commands", - "href": "/smart-chains/setup/ecosystem-launch-parameters/" - }, - { - "title": "Smart Chain Maintenance", - "href": "/smart-chains/setup/smart-chain-maintenance/" - }, - { - "title": "Common Runtime Parameters", - "href": "/smart-chains/setup/common-runtime-parameters/" - }, - { - "title": "nSPV (Enhanced Lite Mode)", - "href": "/smart-chains/setup/nspv/" - } - ] - }, - { - "title": "Smart Chain Tutorials", - "links": [ - { - "title": "Introduction to Smart Chain Tutorials", - "href": "/smart-chains/tutorials/introduction-to-smart-chain-tutorials/" - }, - { - "title": "Basic Environment Setup for Linux VPS", - "href": "/smart-chains/tutorials/basic-environment-setup-for-linux-vps/" - }, - { - "title": "Create a Default Smart Chain", - "href": "/smart-chains/tutorials/create-a-default-smart-chain/" - }, - { - "title": "Creating a Smart Chain on a Single Node", - "href": "/smart-chains/tutorials/creating-a-smart-chain-on-a-single-node/" - }, - { - "title": "Running Komodo Software in Debug Mode", - "href": "/smart-chains/tutorials/running-komodo-software-in-debug-mode/" - }, - { - "title": "Multisignature Transaction Creation and Walkthrough", - "href": "/smart-chains/tutorials/multisignature-transaction-creation-and-walkthrough/" - }, - { - "title": "Smart Chain API Basics", - "href": "/smart-chains/tutorials/smart-chain-api-basics/" - } - ] - }, - { - "title": "Smart Chain API", - "links": [ - { - "title": "Address", - "href": "/smart-chains/api/address/" - }, - { - "title": "Blockchain", - "href": "/smart-chains/api/blockchain/" - }, - { - "title": "CC Lib", - "href": "/smart-chains/api/cclib/" - }, - { - "title": "Control", - "href": "/smart-chains/api/control/" - }, - { - "title": "Cross-Chain API", - "href": "/smart-chains/api/crosschain/" - }, - { - "title": "Disclosure", - "href": "/smart-chains/api/disclosure/" - }, - { - "title": "Generate", - "href": "/smart-chains/api/generate/" - }, - { - "title": "Mining", - "href": "/smart-chains/api/mining/" - }, - { - "title": "Jumblr", - "href": "/smart-chains/api/jumblr/" - }, - { - "title": "Network", - "href": "/smart-chains/api/network/" - }, - { - "title": "Raw Transactions", - "href": "/smart-chains/api/rawtransactions/" - }, - { - "title": "Util", - "href": "/smart-chains/api/util/" - }, - { - "title": "Wallet", - "href": "/smart-chains/api/wallet/" - } - ] - } - ] -}; - -export const sidebarNavData: NavigationRouteType[] = [ - startHerePageNavigation, - atomicdexPageNavigation, - atomicdexApi20MasterPageNavigation, - atomicdexApi_20_Dev_PageNavigation, - atomicdexApiLegacyPageNavigation, - antaraFrameworkPageNavigation, - smartChainPageNavigation, -]; From 451dda8234fa70ec0730c75c708842024540c698 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sat, 9 Sep 2023 20:20:59 +0530 Subject: [PATCH 26/85] updates sidebar --- src/data/sidebar.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/data/sidebar.json b/src/data/sidebar.json index 6b06b47f..ad83fb5c 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -395,6 +395,11 @@ } ] }, + { + "title": "Non-Fungible Tokens", + "titleLink": "/atomicdex/api/v20-dev/non_fungible_tokens/", + "links": [] + }, { "title": "Lightning Network", "links": [ From c8c7e96a04bac86797a5ca18b2d7a5d351a1e135 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:15:28 +0530 Subject: [PATCH 27/85] fix internal link --- .../api/v20-dev/non_fungible_tokens/index.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index a0f1bd66..083e9eef 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -6,15 +6,15 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 ## NFT Information Methods -- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-list) -- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-transfers) -- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non-fungible-tokens/get-nft-metadata) +- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-list) +- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-transfers) +- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-metadata) ## NFT Transaction Methods -- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc721) -- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non-fungible-tokens/withdraw-nft#erc1155) +- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw-nft#erc721) +- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw-nft#erc1155) ## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} From 197751ea0da8f5a84e5f975c9440aa01e7255fab Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:24:03 +0530 Subject: [PATCH 28/85] fix internal link --- .../api/v20-dev/non_fungible_tokens/index.mdx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 083e9eef..8269bf8c 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -6,15 +6,15 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 ## NFT Information Methods -- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-list) -- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-transfers) -- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get-nft-metadata) +- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) +- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) +- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) ## NFT Transaction Methods -- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw-nft#erc721) -- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw-nft#erc1155) +- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-721-withdraw-example) +- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example) ## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} @@ -369,7 +369,7 @@ What does `verified` mean? | last_metadata_sync | string | Last time the token metadata was synced. | | minter_address | string | Minter address. | | possible_spam | boolean | Possible spam. | -| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | +| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#tokenmetadata) object. | #### 📌 Example @@ -435,7 +435,7 @@ This method will query the provided url to update the information stored in the | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| | chains | array | List of chains to update NFTs for. | -| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | @@ -537,14 +537,14 @@ Need to add some error responses here. ## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} -To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation) which holds the NFTs first. +To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. ### Request Parameters | Parameter | Type | Description | | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| withdraw_type | object | A standard [WithdrawNftType](/atomicdex/api/v20#withdraw-nft-type) object. | +| withdraw_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdrawnfttype) object. | ### Response Parameters From 71d114e750734f605607571727f701c9a404479a Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:25:46 +0530 Subject: [PATCH 29/85] linter wip --- .../js/validate_update_internal_links_userpass.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 5630945b..8f73d58c 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -10,15 +10,19 @@ import path from 'path' (async function () { try { await walkDir("./src/pages", async (filePath) => { - //console.log("Processing: " + filePath) + if (!filePath.endsWith("/index.mdx")) { throw new Error("File path doesn't end with '/index.mdx': " + filePath) } - const markdown = await fs.readFile(filePath, 'utf-8'); + if (!filePath.includes("non_fungible_token")) { + return + } + console.log("Processing: " + filePath) + const file = await remark() .use(remarkGfm) .use(remarkMdx) - .use(() => (tree) => { + .use(() => async (tree) => { visit(tree, 'link', async (node) => { //Process the link node.url = await processLink(node.url, filePath); @@ -57,7 +61,7 @@ import path from 'path' }); }) - .process(markdown); + .process(await fs.readFile(filePath, 'utf-8')); if (file) { await fs.writeFile(filePath, String(file)); } @@ -73,7 +77,7 @@ async function processLink(link, currFilePath) { return link } const isExternalURL = /^https?:\/\//; - if (isExternalURL.test(link)) return; + if (isExternalURL.test(link)) return link; let filePath = "src/pages"; let strippedPath = link.split("#")[0]; // strips hash if (strippedPath.endsWith("/")) { From f496a0b9267a602334e2ea4206dfa14759107edd Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 00:25:21 +0530 Subject: [PATCH 30/85] linting wip --- STYLE_GUIDE.md | 16 + .../api/v20-dev/non_fungible_tokens/index.mdx | 1157 ++++++++--------- src/pages/atomicdex/api/v20/index.mdx | 303 +++-- ...validate_update_internal_links_userpass.js | 159 ++- 4 files changed, 820 insertions(+), 815 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 4c78bbf1..a21b4f44 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -87,6 +87,22 @@ Titles and descriptions are mandatory on every documentation page and must be ad We've got a few **MDX** components we use across the Docs. Below is a walkthrough of how to start writing and using the components that make up the Docs. +IMPORTANT: Alwats use double quotes inside mdx tags. + +Example: + +Correct: + +``` + +``` + +Wrong: + +``` + +``` + MDX supports standard markdown by default [CommonMark](https://commonmark.org/). However, this project also has [GFM](https://github.github.com/gfm/) installed. > Many of the components mentioned here are simplified and possibly do more than **explicitly pointed out**. diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 8269bf8c..fda28f36 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -2,20 +2,16 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. - - ## NFT Information Methods -- Get a list of your tokens with [get_nft_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) -- Get a list of token transfers with [get_nft_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) -- Get token metadata with [get_nft_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) - +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) ## NFT Transaction Methods -- Withdraw ERC721 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-721-withdraw-example) -- Withdraw ERC1155 tokens with [withdraw_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example) - +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example) ## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} @@ -23,741 +19,716 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page_number | integer | Optional, defaults to `0`. The page offset for items in response. | - +| Parameter | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `0`. The page offset for items in response. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block_number_minted | integer | The block height when the NFT was minted. | -| block_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection_name | string | May be `null`. An NFT collection name. | -| contract_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last_token_uri_sync | string | When the token_uri was last updated. | -| last_metadata_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. | -| minter_address | string | Minter address. | -| owner_of | string | The wallet address of the owner of the NFT. | -| possible_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token_address | string | The address of the NFT contract. | -| token_id | string | The token ID of the NFT. | -| token_hash | string | The token hash. | -| token_uri | string | The URI to the metadata of the token. | -| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | - +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection\_name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. | +| minter\_address | string | Minter address. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. | +| token\_uri | string | The URI to the metadata of the token. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | #### 📌 Example with no optional params -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ] + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ] + } } -} -``` + ``` - - -```json -{ - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "BSC", - "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", - "token_id": "0", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "b34ddf294013d20a6d70691027625839", - "block_number_minted": 25465916, - "block_number": 25919780, - "contract_type": "ERC1155", - "collection_name": null, - "symbol": null, - "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", - "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", - "last_token_uri_sync": "2023-02-07T17:10:08.402Z", - "last_metadata_sync": "2023-02-07T17:10:16.858Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "uri_meta": { - "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "token_name": "Tiki box", - "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", - "attributes": [ - { - "trait_type": "Crypto Logo", - "value": "TIKI NFT CRYPTOLOGO SCAR" - } - ], - "animation_url": null - } - }, - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "collection_name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "token_name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "token_name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "token_name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null + } } - } - ], - "skipped": 0, - "total": 2 - }, - "id": null -} -``` + ], + "skipped": 0, + "total": 2 + }, + "id": null + } + ``` - #### 📌 Example with no optional params -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "limit": 1, - "page_number": 2 - } -} -``` + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } + } + ``` - - -```json -{ - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "collection_name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "token_name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "collection_name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "token_name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null + } } - } - ], - "skipped": 1, - "total": 1 - }, - "id": null -} -``` + ], + "skipped": 1, + "total": 1 + }, + "id": null + } + ``` - ## Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. - ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page_number | integer | Optional, defaults to `0`. The page offset for items in response. | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20#token-filter) object. | - +| Parameter | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `0`. The page offset for items in response. | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | Amount of tokens transferred. | -| block_hash | string | Hash of block in which transfer occurred. | -| block_number | integer | Height of block in which transfer occurred. | -| block_timestamp | string | Block date/time string. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection_name | string | May be `null`. Name of collection which token belongs to. | -| contract_type | string | Contract type. `ERC721` or `ERC1155`. | -| token_address | string | Address of token transferred. | -| token_id | string | Token ID. | -| possible_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | -| transaction_hash | string | Transaction ID of the transfer. | -| transaction_index | string | Transaction index of the transfer. | -| log_index | string | Log index of the transfer. | -| value | string | Tranfer value. | -| transaction_type | string | Transaction type. Possible values are `Single`. | -| from_address | string | Address of previous owner which sent the token(s). | -| to_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | | -| operator | string | May be `null`. | +| Parameter | Type | Description | +| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | string | Block date/time string. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | Tranfer value. | +| transaction\_type | string | Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | | +| operator | string | May be `null`. | -`verified` has no description. Related to https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. -What are the other possible values for `transaction_type`? -What is `operator`? -What does `verified` mean? + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? #### 📌 Example with date and `send` filters -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_transfers", - "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" - ], - "max": true, - "filters": { - "send": true, - "from_date": 1676636291 - } - } -} -``` + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } + } + ``` - - -```json -{ - "mmrpc": "2.0", - "result": { - "transfer_history": [ - { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": "2023-03-08T10:11:36.000Z", - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, - "value": "0", - "contract_type": "ERC1155", - "transaction_type": "Single", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "collection_name": null, - "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", - "verified": 1, - "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "possible_spam": false - } - ], - "skipped": 1, - "total": 2 - }, - "id": null -} -``` + + ```json + { + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": "2023-03-08T10:11:36.000Z", + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "collection_name": null, + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null + } + ``` - ## Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chain | string | The token chain. | -| token_address | string | The token address. | -| token_id | string | Token ID. | - +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | Amount of tokens. | -| block_number_minted | integer | Block height when the token was minted. | -| block_number | integer | Current block height. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection_name | string | Collection name. May be `null`. | -| contract_type | string | Contract type. `ERC721` or `ERC1155`. | -| owner_of | string | Address of the token owner. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| token_hash | string | Token hash. | -| symbol | string | Token symbol. | -| token_uri | string | Token URI. | -| metadata | string | Token metadata. | -| last_token_uri_sync | string | Last time the token URI was synced. | -| last_metadata_sync | string | Last time the token metadata was synced. | -| minter_address | string | Minter address. | -| possible_spam | boolean | Possible spam. | -| uri_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#tokenmetadata) object. | - +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------- | +| amount | string | Amount of tokens. | +| block\_number\_minted | integer | Block height when the token was minted. | +| block\_number | integer | Current block height. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection\_name | string | Collection name. May be `null`. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| owner\_of | string | Address of the token owner. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| token\_hash | string | Token hash. | +| symbol | string | Token symbol. | +| token\_uri | string | Token URI. | +| metadata | string | Token metadata. | +| last\_token\_uri\_sync | string | Last time the token URI was synced. | +| last\_metadata\_sync | string | Last time the token metadata was synced. | +| minter\_address | string | Minter address. | +| possible\_spam | boolean | Possible spam. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#tokenmetadata) object. | #### 📌 Example -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_metadata", - "mmrpc": "2.0", - "params": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "chain": "BSC" + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "get_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } } -} -``` + ``` - - -```json -{ - "mmrpc": "2.0", - "result": { - "chain": "BSC", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "125f8f4e952e107c257960000b4b250e", - "block_number_minted": 25810308, - "block_number": 28056721, - "contract_type": "ERC721", - "collection_name": "Binance NFT Mystery Box-Back to Blockchain Future", - "symbol": "BMBBBF", - "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", - "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", - "last_token_uri_sync": "2023-02-19T19:12:09.471Z", - "last_metadata_sync": "2023-02-19T19:12:18.080Z", - "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", - "possible_spam": false, - "uri_meta": { - "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "token_name": "Nebula Nodes", - "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", - "attributes": null, - "animation_url": null - } - }, - "id": null -} -``` + + ```json + { + "mmrpc": "2.0", + "result": { + "chain": "BSC", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "125f8f4e952e107c257960000b4b250e", + "block_number_minted": 25810308, + "block_number": 28056721, + "contract_type": "ERC721", + "collection_name": "Binance NFT Mystery Box-Back to Blockchain Future", + "symbol": "BMBBBF", + "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", + "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", + "last_token_uri_sync": "2023-02-19T19:12:09.471Z", + "last_metadata_sync": "2023-02-19T19:12:18.080Z", + "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", + "possible_spam": false, + "uri_meta": { + "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", + "token_name": "Nebula Nodes", + "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", + "attributes": null, + "animation_url": null + } + }, + "id": null + } + ``` - ## Update NFT {{label : 'update_nft', tag : 'API-v2'}} This method will query the provided url to update the information stored in the local database. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | array | List of chains to update NFTs for. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | - +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------- | +| chains | array | List of chains to update NFTs for. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -If there are no errors, this request will return an empty response. + If there are no errors, this request will return an empty response. #### 📌 Example -```json -{ - "userpass": "'$USERPASS'", - "method": "update_nft", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "url": "https://moralis-proxy.komodo.earth" + ```json + { + "userpass": "'$USERPASS'", + "method": "update_nft", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth" + } } -} -``` + ``` - - - -```json -{ - "mmrpc": "2.0", - "result": null, - "id": null -} -``` + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` -Need to add some error responses here. + Need to add some error responses here. - ## Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} -This method refreshes metadata of one NFT and metadata of related transactions with the same token_address and token_id. +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chains | string | Chains which holds the NFT you would like to updated metadata for. | -| url | string | URL link to the Moralis API proxy base url (https://moralis-proxy.komodo.earth) or equivalent. | -| token_address | string | Token address. | -| token_id | string | Token ID. | - +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | -If there are no errors, this request will return an empty response. + If there are no errors, this request will return an empty response. #### 📌 Example -```json -{ - "userpass": "'$USERPASS'", - "method": "refresh_nft_metadata", - "mmrpc": "2.0", - "params": { - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "chain": "POLYGON", - "url": "https://moralis-proxy.komodo.earth" + ```json + { + "userpass": "'$USERPASS'", + "method": "refresh_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth" + } } -} -``` + ``` + + + If there are no errors, this request will return an empty response. + - - -If there are no errors, this request will return an empty response. - - -```json -{ - "mmrpc": "2.0", - "result": null, - "id": null -} -``` + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` -Need to add some error responses here. + Need to add some error responses here. - ## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} -To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| withdraw_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdrawnfttype) object. | - +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------- | +| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdrawnfttype) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------| ---------------- | ------------------------------------------------------------------------------------------------ | -| amount | string | Amount of tokens to withdraw. | -| tx_hex | string | Raw hex of signed transaction. Use this with the [send_raw_transaction](/atomicdex/api/legacy/send_raw_transaction) RPC to broadcast the transaction. | -| tx_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract_type | string | Contract type. `ERC721` or `ERC1155`. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| fee_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | -| internal_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction_type | string | This will always be `NftTransfer`. | +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | -When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). -When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). -Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). + When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. #### 📌 ERC721 Withdraw Example - -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "url": "https://moralis-proxy.komodo.earth", - "withdraw_type": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "BSC", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "BSC", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + } } } } -} -``` + ``` - -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", - "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC721", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "fee_details": { - "type": "Eth", + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", + "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC721", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + }, "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" + "block_height": 0, + "timestamp": 1684239228, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "coin": "BNB", - "block_height": 0, - "timestamp": 1684239228, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null -} -``` + "id": null + } + ``` - #### 📌 ERC1155 Withdraw Example If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "url": "https://moralis-proxy.komodo.earth", - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2" + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2" + } } } } -} -``` + ``` - -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", - "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", + "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000154089437979", + "total_fee": "0.01048116357133158" + }, "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000154089437979", - "total_fee": "0.01048116357133158" + "block_height": 0, + "timestamp": 1684241604, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241604, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null -} -``` + "id": null + } + ``` - #### 📌 ERC1155 Withdraw Max Example -If you would like to withdraw all NFTs from a token_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. -```json -{ - "userpass": "MM2_RPC_PASSWORD", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "url": "https://moralis-proxy.komodo.earth", - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "max": true + ```json + { + "userpass": "MM2_RPC_PASSWORD", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "url": "https://moralis-proxy.komodo.earth", + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "max": true + } } } } -} -``` + ``` - -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", - "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", + "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000137182923005", + "total_fee": "0.0093311824228001" + }, "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000137182923005", - "total_fee": "0.0093311824228001" + "block_height": 0, + "timestamp": 1684241781, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241781, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null -} -``` + "id": null + } + ``` -View the source code at: https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs + View the source code at: [https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 3bf10432..2cefae78 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -1,5 +1,6 @@ export const title = "AtomicDEX API RPC Protocol v2.0"; -export const description = "Starting with version beta-2.1.3434, the AtomicDEX API supports the standardized protocol format called mmrpc 2.0."; +export const description = + "Starting with version beta-2.1.3434, the AtomicDEX API supports the standardized protocol format called mmrpc 2.0."; # AtomicDEX API RPC Protocol v2.0 @@ -173,7 +174,9 @@ The `DerivationMethod` object includes the following items for a given coin or t | type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | - Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. + Using the same seed or private key to generate keypairs using different + derivation methods will result in a different address and private key for each + method. Where the value indicates: @@ -276,8 +279,13 @@ It is used for estimating the transaction fee rate (`feerate`) for different tra ### LightningChannelConfig - The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. - If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels#open_channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels#update_channel) methods, the values in this object will default to the values set in the `coins` configuration file. + The values in this object are only used if the channel is being opened by the + user. If the channel is being opened by the counterparty, the values in this + object are ignored. If not specified when using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels#open_channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels#update_channel) + methods, the values in this object will default to the values set in the + `coins` configuration file. | Parameter | Type | Description | @@ -292,7 +300,9 @@ It is used for estimating the transaction fee rate (`feerate`) for different tra | their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | - For GUIs and wallet apps, it is recommended to set `announced_channel` to `false` (the default value), as the node is not expected to be reliably online. + For GUIs and wallet apps, it is recommended to set `announced_channel` to + `false` (the default value), as the node is not expected to be reliably + online. ### LightningChannelOptions @@ -379,8 +389,8 @@ It is used for estimating the transaction fee rate (`feerate`) for different tra | destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | - Response may change in future. - See [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + Response may change in future. See + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) ### Pagination @@ -397,104 +407,99 @@ For requests which return many results, pagination offsets may be applied. \*\* ```json { - "PageNumber": 1 + "PageNumber": 1 } ``` ```json { - "FromId": 4 + "FromId": 4 } ``` - ### TokenFilter The `TokenFilter` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------| -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers after this date are included in the response. | -| to_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers before this date are included in the response. | - - - -```json -{ - "ticker": "MINDS-ERC20", - "required_confirmations": 4 -} -``` - +| Parameter | Type | Description | +| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers after this date are included in the response. | +| to\_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers before this date are included in the response. | + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + ### TokenMetadata The `TokenMetadata` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------| -| image | string | Optional. Url to the NFT's image. | -| token_name | string | Optional. Name of the token. | -| description | string | Optional. Description of the token. | -| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | -| animation_url | string | Optional. Url to an animationto be displaye instead of a static image. | - - - -```json -[ - { - "trait_type": "Specialization", - "value": "Thief" - }, - { - "trait_type": "Skin Tone", - "value": "#0013b0" - }, - { - "trait_type": "Weapon", - "value": "Crossbow" - }, - { - "trait_type": "Species", - "value": "Dark Elf" - }, - { - "trait_type": "Gender", - "value": "Female" - }, - { - "trait_type": "Strength", - "value": "8" - }, - { - "trait_type": "Dexterity", - "value": "12" - }, - { - "trait_type": "Intelligence", - "value": "10" - }, - { - "trait_type": "Perks", - "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] - }, - { - "trait_type": "Weakness", - "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] - }, - { - "trait_type": "Personality", - "value": "Aggressive" - } -] -``` - +| Parameter | Type | Description | +| -------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Url to the NFT's image. | +| token\_name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animationto be displaye instead of a static image. | + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + ### TokensRequest @@ -514,117 +519,111 @@ The `TokensRequest` object includes the following items for a given coin or toke ``` - ### WithdrawFee The `WithdrawFee` object varies epending on the coin or token type. Refer to the examples to view the object structure for each type. +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | -| Parameter | Type | Description | -| ------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------| -| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | -| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | -| coin | string | The coin which will be used to pay the transaction fee. | -| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | -| gas_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | -| gas_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | -| miner_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | -| total_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | -| total_gas_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | - - - - -#### Example of Eth type + + #### Example of Eth type -```json -{ + ```json + { "type": "Eth", "coin": "BNB", "gas": 109739, "gas_price": "0.000000003", "total_fee": "0.000329217" -} -``` + } + ``` -#### Example of Qrc20 type + #### Example of Qrc20 type -```json -{ + ```json + { "type": "Qrc20", "coin": "tQTUM", "miner_fee": "0.00000447", "gas_limit": 100000, "gas_price": 40, "total_gas_fee": "0.04" -} -``` + } + ``` -#### Example of Tendermint type + #### Example of Tendermint type -```json -{ + ```json + { "type": "Tendermint", "coin": "IRIS", "amount": "0.038553", "gas_limit": 100000 -} -``` + } + ``` -#### Example of Utxo type + #### Example of Utxo type -```json -{ + ```json + { "type": "Utxo", "amount": "0.00001" -} -``` - + } + ``` + ### WithdrawNftType The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw_data | object | A standard [WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155) object. | - +| Parameter | Type | Description | +| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | +| withdraw\_data | object | A standard [WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155) object. | -When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). -When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). -Due to this difference, the `amount` and `max` fields are only used the when `type` value in `WithdrawType` is `withdraw_erc1155`. + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT + is absolutely unique - it has only 1 owner and the owner can own only 1 NFT + which has this `token_id` in its `token_address` (also referred to as contract + address). When the `type` value in `WithdrawType` is `withdraw_erc1155`, it + means that it is possible for more than 1 user to own one or more of the same + NFT (with an identical `token_id`). Due to this difference, the `amount` and + `max` fields are only used the when `type` value in `WithdrawType` is + `withdraw_erc1155`. - ### WithdrawDataErc721 The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | -| to | string | Destination address to withdraw the token to. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | - +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | ### WithdrawDataErc1155 The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------| -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | -| to | string | Destination address to withdraw the token to. | -| token_address | string | Token address. | -| token_id | string | Token ID. | -| amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is `true. | -| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | - +| Parameter | Type | Description | +| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 8f73d58c..380dabb3 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -1,6 +1,6 @@ import { visit, SKIP } from 'unist-util-visit' import { is } from "unist-util-is"; -import { promises as fs } from 'fs'; +import fs from 'fs'; import { constants } from "fs" import { remark } from 'remark' import remarkMdx from 'remark-mdx' @@ -9,70 +9,75 @@ import path from 'path' (async function () { try { - await walkDir("./src/pages", async (filePath) => { - - if (!filePath.endsWith("/index.mdx")) { - throw new Error("File path doesn't end with '/index.mdx': " + filePath) - } - if (!filePath.includes("non_fungible_token")) { - return - } - console.log("Processing: " + filePath) - - const file = await remark() - .use(remarkGfm) - .use(remarkMdx) - .use(() => async (tree) => { - visit(tree, 'link', async (node) => { - //Process the link - node.url = await processLink(node.url, filePath); - }); - }) - .use(() => (tree) => { - visit(tree, (node, nodeIndex, parentNode) => { - if (!filePath.includes("src/pages/atomicdex")) { - return SKIP; - } - // if ( - // is(node, { name: "CodeGroup" })) { - // console.log(node) - // } - try { - if ( - is(node, { name: "CodeGroup" }) && - node.attributes.some(attr => attr.type === 'mdxJsxAttribute' && attr.name === "mm2MethodDecorate" && attr.value === "true") - ) { - // console.log(node) - const originalChild = node.children[0]; - if (node.children.length !== 1 || originalChild.lang !== "json") { - throw new Error(`unexpected code block in file ${filePath} : ` + JSON.stringify()) - } - const clonedChild = JSON.parse(JSON.stringify(originalChild)); - let methodObj = JSON.parse(clonedChild.value) - methodObj.userpass = "testpsw" - clonedChild.value = JSON.stringify(methodObj, null, 2) - //console.log(clonedChild) - node.children = [clonedChild]; - return SKIP; - } - } catch (error) { - throw new Error(error) - } - - }); - }) - .process(await fs.readFile(filePath, 'utf-8')); - if (file) { - await fs.writeFile(filePath, String(file)); - } - }); + let filepaths = [] + walkDir("./src/pages", filepath => filepaths.push(filepath)); + for (let index = 0; index < filepaths.length; index++) { + const filePath = filepaths[index]; + await processFile(filePath) + } } catch (error) { if (error) throw error; } })() +async function processFile(filePath) { + if (!filePath.endsWith("/index.mdx")) { + throw new Error("File path doesn't end with '/index.mdx': " + filePath) + } + // if (!filePath.includes("/setup/ecosystem-launch-parameters/")) { + // return + // } + // console.log("Processing: " + filePath) + const file = await remark() + .use(remarkGfm) + .use(remarkMdx) + .use(() => (tree) => { + console.log("Processing: " + filePath) + visit(tree, 'link', (node) => { + //Process the link + node.url = processLink(node.url, filePath); + }); + }) + .use(() => (tree) => { + visit(tree, (node, nodeIndex, parentNode) => { + if (!filePath.includes("src/pages/atomicdex")) { + return SKIP; + } + // if ( + // is(node, { name: "CodeGroup" })) { + // console.log(node) + // } + try { + if ( + is(node, { name: "CodeGroup" }) && + node.attributes.some(attr => attr.type === 'mdxJsxAttribute' && attr.name === "mm2MethodDecorate" && attr.value === "true") + ) { + // console.log(node) + const originalChild = node.children[0]; + if (node.children.length !== 1 || originalChild.lang !== "json") { + throw new Error(`unexpected code block in file ${filePath} : ` + JSON.stringify()) + } + const clonedChild = JSON.parse(JSON.stringify(originalChild)); + let methodObj = JSON.parse(clonedChild.value) + methodObj.userpass = "testpsw" + clonedChild.value = JSON.stringify(methodObj, null, 2) + //console.log(clonedChild) + node.children = [clonedChild]; + return SKIP; + } + } catch (error) { + throw new Error(error) + } + + }); + }) + .process(fs.readFileSync(filePath, 'utf-8')); + if (file) { + fs.writeFileSync(filePath, String(file)); + } +} // Function to process a link -async function processLink(link, currFilePath) { +function processLink(link, currFilePath) { if (link.startsWith("mailto:")) { return link } @@ -124,7 +129,7 @@ async function processLink(link, currFilePath) { const internalLinkFile = path.join(filePath, correctUrl.split("#")[0] + "index.mdx") try { - await fs.access(internalLinkFile, constants.F_OK) + fs.accessSync(internalLinkFile, constants.F_OK) } catch (err) { console.log("currNormalisedDir:" + currNormalisedDir) console.log(currFilePath) @@ -141,15 +146,29 @@ async function processLink(link, currFilePath) { return correctUrl; } -async function walkDir(dir, callback) { - let files = await fs.readdir(dir); - await Promise.all(files.map(async (file) => { - const filePath = path.join(dir, file); - const stats = await fs.stat(filePath); - if (stats.isDirectory()) { - await walkDir(filePath, callback); - } else if (stats.isFile()) { - await callback(filePath); +// needs import { promises as fs } from 'fs'; +// async function asyncWalkDir(dir, callback) { +// let files = await fs.readdir(dir); +// await Promise.all(files.map(async (file) => { +// const filePath = path.join(dir, file); +// const stats = await fs.stat(filePath); +// if (stats.isDirectory()) { +// await walkDir(filePath, callback); +// } else if (stats.isFile()) { +// await callback(filePath); +// } +// })); +// } + +export function walkDir(dirPath, callback) { + fs.readdirSync(dirPath).forEach((file) => { + const filePath = path.join(dirPath, file); + const stat = fs.statSync(filePath); + if (stat.isDirectory()) { + walkDir(filePath, callback); + + } else { + callback(filePath); } - })); + }); } From 6fb177a18ab4fafa4125f4cd8690b4c94c185a25 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 02:40:51 +0530 Subject: [PATCH 31/85] adds title and desc --- .../api/v20-dev/non_fungible_tokens/index.mdx | 4 ++ utils/js/package-lock.json | 33 +++++++++++++ utils/js/package.json | 2 + ...validate_update_internal_links_userpass.js | 49 ++++++++++++++++++- 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index fda28f36..0d1dbb99 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -1,3 +1,7 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; + # Non Fungible Tokens (NFTs) The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. diff --git a/utils/js/package-lock.json b/utils/js/package-lock.json index 8736c558..d8215fbd 100644 --- a/utils/js/package-lock.json +++ b/utils/js/package-lock.json @@ -9,6 +9,8 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { + "@sindresorhus/slugify": "^2.2.1", + "acorn": "^8.10.0", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", @@ -16,6 +18,37 @@ "unist-util-visit": "^5.0.0" } }, + "node_modules/@sindresorhus/slugify": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz", + "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==", + "dev": true, + "dependencies": { + "@sindresorhus/transliterate": "^1.0.0", + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@sindresorhus/transliterate": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-1.6.0.tgz", + "integrity": "sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", diff --git a/utils/js/package.json b/utils/js/package.json index 081c655b..cff348ff 100644 --- a/utils/js/package.json +++ b/utils/js/package.json @@ -11,6 +11,8 @@ "license": "ISC", "type": "module", "devDependencies": { + "@sindresorhus/slugify": "^2.2.1", + "acorn": "^8.10.0", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 380dabb3..5da23c9e 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -6,6 +6,8 @@ import { remark } from 'remark' import remarkMdx from 'remark-mdx' import remarkGfm from 'remark-gfm' import path from 'path' +import { slugifyWithCounter } from "@sindresorhus/slugify"; +import * as acorn from "acorn" (async function () { try { @@ -32,7 +34,13 @@ async function processFile(filePath) { .use(remarkGfm) .use(remarkMdx) .use(() => (tree) => { - console.log("Processing: " + filePath) + //console.log("Processing: " + filePath) + const hasTitleAndDesc = tree.children.some(node => node.type === 'mdxjsEsm' && isValidTitleDescExports(node.value)) + if (!hasTitleAndDesc) { + throw new Error("File doesn't have title/description: " + filePath) + } + }) + .use(() => (tree) => { visit(tree, 'link', (node) => { //Process the link node.url = processLink(node.url, filePath); @@ -128,6 +136,7 @@ function processLink(link, currFilePath) { // console.log("--------------------------------") const internalLinkFile = path.join(filePath, correctUrl.split("#")[0] + "index.mdx") + const slug = correctUrl.split("#")[1] try { fs.accessSync(internalLinkFile, constants.F_OK) } catch (err) { @@ -139,7 +148,7 @@ function processLink(link, currFilePath) { console.log(link) console.log(correctUrl) - console.error("Internal link doesn't exist: " + internalLinkFile); + console.error("Internal link file doesn't exist: " + internalLinkFile); throw new Error(err) } @@ -172,3 +181,39 @@ export function walkDir(dirPath, callback) { } }); } + +function isValidTitleDescExports(str) { + try { + const parsed = acorn.parse(str, { + sourceType: 'module', + }); + + let titleExported = false; + let descriptionExported = false; + for (const node of parsed.body) { + if (node.type === 'ExportNamedDeclaration') { + if (node.declaration && node.declaration.declarations) { + for (const declaration of node.declaration.declarations) { + if ( + declaration.id.name === 'title' && + declaration.init.type === 'Literal' + ) { + titleExported = true; + } + if ( + declaration.id.name === 'description' && + declaration.init.type === 'Literal' + ) { + descriptionExported = true; + } + } + } + } + } + + return titleExported && descriptionExported; + } catch (e) { + //console.log(e) + return false; // Parsing error means the string is not valid JS + } +} From 0c0a6a9b999a68797df6d56fce81fd6a5ea7b1e9 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 02:42:29 +0530 Subject: [PATCH 32/85] edit --- utils/js/validate_update_internal_links_userpass.js | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 5da23c9e..0bc1ad7a 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -186,6 +186,7 @@ function isValidTitleDescExports(str) { try { const parsed = acorn.parse(str, { sourceType: 'module', + ecmaVersion: 2020 }); let titleExported = false; From 44138e23d72f0a40e1b1b3adb39a1484cb81db7f Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 03:21:04 +0530 Subject: [PATCH 33/85] slugs extracted --- utils/js/package-lock.json | 44 +++++++++++++++++-- utils/js/package.json | 1 + ...validate_update_internal_links_userpass.js | 30 ++++++++++--- 3 files changed, 66 insertions(+), 9 deletions(-) diff --git a/utils/js/package-lock.json b/utils/js/package-lock.json index d8215fbd..73a3e98f 100644 --- a/utils/js/package-lock.json +++ b/utils/js/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@sindresorhus/slugify": "^2.2.1", "acorn": "^8.10.0", + "mdast-util-to-string": "^4.0.0", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", @@ -468,6 +469,19 @@ "integrity": "sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==", "dev": true }, + "node_modules/mdast-util-from-markdown/node_modules/mdast-util-to-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", + "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-gfm": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-2.0.2.tgz", @@ -702,6 +716,19 @@ "integrity": "sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==", "dev": true }, + "node_modules/mdast-util-to-markdown/node_modules/mdast-util-to-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", + "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-to-markdown/node_modules/unist-util-is": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", @@ -745,18 +772,27 @@ } }, "node_modules/mdast-util-to-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", - "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", "dev": true, "dependencies": { - "@types/mdast": "^3.0.0" + "@types/mdast": "^4.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-to-string/node_modules/@types/mdast": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.0.tgz", + "integrity": "sha512-YLeG8CujC9adtj/kuDzq1N4tCDYKoZ5l/bnjq8d74+t/3q/tHquJOJKUQXJrLCflOHpKjXgcI/a929gpmLOEng==", + "dev": true, + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/micromark": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", diff --git a/utils/js/package.json b/utils/js/package.json index cff348ff..0845f353 100644 --- a/utils/js/package.json +++ b/utils/js/package.json @@ -13,6 +13,7 @@ "devDependencies": { "@sindresorhus/slugify": "^2.2.1", "acorn": "^8.10.0", + "mdast-util-to-string": "^4.0.0", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 0bc1ad7a..9f1ecc5e 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -6,23 +6,43 @@ import { remark } from 'remark' import remarkMdx from 'remark-mdx' import remarkGfm from 'remark-gfm' import path from 'path' +import { toString } from "mdast-util-to-string"; + import { slugifyWithCounter } from "@sindresorhus/slugify"; import * as acorn from "acorn" (async function () { try { let filepaths = [] + const filepathSlugs = {} walkDir("./src/pages", filepath => filepaths.push(filepath)); + console.log(filepaths.length) + for (let index = 0; index < filepaths.length; index++) { + const filePath = filepaths[index]; + await remark().use(() => (tree) => { + const slugs = []; + + let slugify = slugifyWithCounter(); + // Visit all heading nodes and collect their values + visit(tree, 'heading', (node) => { + const slug = slugify(toString(node)); + slugs.push(slug); + }); + filepathSlugs[filePath] = slugs + // console.log(slugs); + }).process(fs.readFileSync(filePath, 'utf-8')); + } + console.log(Object.keys(filepathSlugs).length) for (let index = 0; index < filepaths.length; index++) { const filePath = filepaths[index]; - await processFile(filePath) + await processFile(filePath, filepathSlugs) } } catch (error) { if (error) throw error; } })() -async function processFile(filePath) { +async function processFile(filePath, filepathSlugs) { if (!filePath.endsWith("/index.mdx")) { throw new Error("File path doesn't end with '/index.mdx': " + filePath) } @@ -43,7 +63,7 @@ async function processFile(filePath) { .use(() => (tree) => { visit(tree, 'link', (node) => { //Process the link - node.url = processLink(node.url, filePath); + node.url = processLink(node.url, filePath, filepathSlugs); }); }) .use(() => (tree) => { @@ -85,7 +105,7 @@ async function processFile(filePath) { } } // Function to process a link -function processLink(link, currFilePath) { +function processLink(link, currFilePath, filepathSlugs) { if (link.startsWith("mailto:")) { return link } @@ -186,7 +206,7 @@ function isValidTitleDescExports(str) { try { const parsed = acorn.parse(str, { sourceType: 'module', - ecmaVersion: 2020 + ecmaVersion: 2020 }); let titleExported = false; From ddf9ff81613aac74c202717f90fe3f5844d3bbb4 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 03:24:43 +0530 Subject: [PATCH 34/85] slugs extracted --- utils/js/validate_update_internal_links_userpass.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 9f1ecc5e..87b89eaf 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -16,7 +16,6 @@ import * as acorn from "acorn" let filepaths = [] const filepathSlugs = {} walkDir("./src/pages", filepath => filepaths.push(filepath)); - console.log(filepaths.length) for (let index = 0; index < filepaths.length; index++) { const filePath = filepaths[index]; await remark().use(() => (tree) => { @@ -32,7 +31,6 @@ import * as acorn from "acorn" // console.log(slugs); }).process(fs.readFileSync(filePath, 'utf-8')); } - console.log(Object.keys(filepathSlugs).length) for (let index = 0; index < filepaths.length; index++) { const filePath = filepaths[index]; await processFile(filePath, filepathSlugs) @@ -157,6 +155,9 @@ function processLink(link, currFilePath, filepathSlugs) { const internalLinkFile = path.join(filePath, correctUrl.split("#")[0] + "index.mdx") const slug = correctUrl.split("#")[1] + if (!filepathSlugs[internalLinkFile].some(slugO => slug === slugO)) { + throw new Error(`Processing file: ${filePath}, slug: ${slug} not present in file: ${internalLinkFile}`) + } try { fs.accessSync(internalLinkFile, constants.F_OK) } catch (err) { From f9f3202b51545f3dae9d8502fe479fd3bb9eb956 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Sun, 10 Sep 2023 03:26:24 +0530 Subject: [PATCH 35/85] slugs linter online --- src/pages/antara/api/channels/index.mdx | 2 +- utils/js/validate_update_internal_links_userpass.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/antara/api/channels/index.mdx b/src/pages/antara/api/channels/index.mdx index eba2f735..67e1c639 100644 --- a/src/pages/antara/api/channels/index.mdx +++ b/src/pages/antara/api/channels/index.mdx @@ -43,7 +43,7 @@ The `channelsaddress` method displays the various addresses and their balances f Under normal circumstances, for the `pubkey` the user provides the destination address of the intended channel. -The global addresses are not used in the Channels Antara module. For more information about unique Antara addresses, see [this linked explanation.](/antara/tutorials/understanding-antara-addresses) +The global addresses are not used in the Channels Antara module. For more information about unique Antara addresses, see [this linked explanation.](/antara/tutorials/understanding-antara-addresses/) ### Arguments diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 87b89eaf..fd068f24 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -155,8 +155,8 @@ function processLink(link, currFilePath, filepathSlugs) { const internalLinkFile = path.join(filePath, correctUrl.split("#")[0] + "index.mdx") const slug = correctUrl.split("#")[1] - if (!filepathSlugs[internalLinkFile].some(slugO => slug === slugO)) { - throw new Error(`Processing file: ${filePath}, slug: ${slug} not present in file: ${internalLinkFile}`) + if (slug && !filepathSlugs[internalLinkFile].some(slugO => slug === slugO)) { + throw new Error(`Processing file: ${currFilePath}, slug: ${slug} not present in file: ${internalLinkFile}`) } try { fs.accessSync(internalLinkFile, constants.F_OK) From d37620c3762a1e51602b1313cc62dda6f6239587 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:38:57 +0530 Subject: [PATCH 36/85] fixing slugs wip --- .gitignore | 3 + .../api/v20-dev/non_fungible_tokens/index.mdx | 4 +- utils/js/package-lock.json | 94 ++++++++++++++++--- utils/js/package.json | 1 + ...validate_update_internal_links_userpass.js | 15 ++- 5 files changed, 96 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index aa94b398..2cd13023 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ Thumbs.db *.out *.pid *.sublime-* + +# custom +filepathSlugs.json diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 0d1dbb99..6a6cf76f 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -51,7 +51,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` | token\_id | string | The token ID of the NFT. | | token\_hash | string | The token hash. | | token\_uri | string | The URI to the metadata of the token. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20#token-metadata) object. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example with no optional params @@ -358,7 +358,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | last\_metadata\_sync | string | Last time the token metadata was synced. | | minter\_address | string | Minter address. | | possible\_spam | boolean | Possible spam. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#tokenmetadata) object. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example diff --git a/utils/js/package-lock.json b/utils/js/package-lock.json index 73a3e98f..ed5ced64 100644 --- a/utils/js/package-lock.json +++ b/utils/js/package-lock.json @@ -12,6 +12,7 @@ "@sindresorhus/slugify": "^2.2.1", "acorn": "^8.10.0", "mdast-util-to-string": "^4.0.0", + "mdx-annotations": "^0.1.3", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", @@ -276,6 +277,26 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/estree-util-visit": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-1.2.1.tgz", + "integrity": "sha512-xbgqcrkIVbIG+lI/gzbvd9SGTJL4zqJKBFttUl5pP27KhAjtMKbX/mQXJ7qgyXpMgVy/zvpm0xoQQaGL8OloOw==", + "dev": true, + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-visit/node_modules/@types/unist": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.8.tgz", + "integrity": "sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==", + "dev": true + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -793,6 +814,65 @@ "@types/unist": "*" } }, + "node_modules/mdx-annotations": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/mdx-annotations/-/mdx-annotations-0.1.3.tgz", + "integrity": "sha512-2XrOlQeBDUa8GirNHy/Y7BR1h/P+vzk+1G2rzAfqJ+lg6JcEOKMCqsVkpVFSw0hdzpVuj9BnoNeA+aU1XPTkoA==", + "dev": true, + "dependencies": { + "acorn": "^8.8.1", + "estree-util-visit": "^1.2.0", + "unist-util-visit": "^4.1.1" + } + }, + "node_modules/mdx-annotations/node_modules/@types/unist": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.8.tgz", + "integrity": "sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==", + "dev": true + }, + "node_modules/mdx-annotations/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdx-annotations/node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdx-annotations/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/micromark": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", @@ -1387,20 +1467,6 @@ "integrity": "sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==", "dev": true }, - "node_modules/micromark-util-events-to-acorn/node_modules/estree-util-visit": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-1.2.1.tgz", - "integrity": "sha512-xbgqcrkIVbIG+lI/gzbvd9SGTJL4zqJKBFttUl5pP27KhAjtMKbX/mQXJ7qgyXpMgVy/zvpm0xoQQaGL8OloOw==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/micromark-util-html-tag-name": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz", diff --git a/utils/js/package.json b/utils/js/package.json index 0845f353..d439f0cc 100644 --- a/utils/js/package.json +++ b/utils/js/package.json @@ -14,6 +14,7 @@ "@sindresorhus/slugify": "^2.2.1", "acorn": "^8.10.0", "mdast-util-to-string": "^4.0.0", + "mdx-annotations": "^0.1.3", "remark": "^14.0.3", "remark-gfm": "^3.0.1", "remark-mdx": "^2.3.0", diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index fd068f24..8f8ddf97 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -5,6 +5,7 @@ import { constants } from "fs" import { remark } from 'remark' import remarkMdx from 'remark-mdx' import remarkGfm from 'remark-gfm' +import { mdxAnnotations } from 'mdx-annotations' import path from 'path' import { toString } from "mdast-util-to-string"; @@ -18,19 +19,23 @@ import * as acorn from "acorn" walkDir("./src/pages", filepath => filepaths.push(filepath)); for (let index = 0; index < filepaths.length; index++) { const filePath = filepaths[index]; - await remark().use(() => (tree) => { + await remark().use(mdxAnnotations.remark).use(remarkMdx).use(() => (tree) => { const slugs = []; let slugify = slugifyWithCounter(); // Visit all heading nodes and collect their values visit(tree, 'heading', (node) => { const slug = slugify(toString(node)); + if (slug.includes("label")) { + console.log(node) + } slugs.push(slug); }); filepathSlugs[filePath] = slugs // console.log(slugs); }).process(fs.readFileSync(filePath, 'utf-8')); } + fs.writeFileSync("filepathSlugs.json", JSON.stringify(filepathSlugs, null, 2)) for (let index = 0; index < filepaths.length; index++) { const filePath = filepaths[index]; await processFile(filePath, filepathSlugs) @@ -44,10 +49,10 @@ async function processFile(filePath, filepathSlugs) { if (!filePath.endsWith("/index.mdx")) { throw new Error("File path doesn't end with '/index.mdx': " + filePath) } - // if (!filePath.includes("/setup/ecosystem-launch-parameters/")) { - // return - // } - // console.log("Processing: " + filePath) + if (!filePath.includes("/non_fungible_token")) { + return + } + console.log("Processing: " + filePath) const file = await remark() .use(remarkGfm) .use(remarkMdx) From fcc5cc3cd565989dd18092fbc02e853af1e05957 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:41:46 +0530 Subject: [PATCH 37/85] fixing slugs wip --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- utils/js/validate_update_internal_links_userpass.js | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 6a6cf76f..bd83efed 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -523,7 +523,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------- | -| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdrawnfttype) object. | +| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | ### Response Parameters diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 8f8ddf97..455a83dd 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -26,9 +26,6 @@ import * as acorn from "acorn" // Visit all heading nodes and collect their values visit(tree, 'heading', (node) => { const slug = slugify(toString(node)); - if (slug.includes("label")) { - console.log(node) - } slugs.push(slug); }); filepathSlugs[filePath] = slugs From 4c0626a3334680400cbc8e5790688b9ffb19549f Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:44:45 +0530 Subject: [PATCH 38/85] slugs fixed --- .../api/v20-dev/non_fungible_tokens/index.mdx | 138 +++++++++--------- ...validate_update_internal_links_userpass.js | 6 +- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index bd83efed..0ffe3c53 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -51,14 +51,14 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` | token\_id | string | The token ID of the NFT. | | token\_hash | string | The token hash. | | token\_uri | string | The URI to the metadata of the token. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example with no optional params ```json { - "userpass": "MM2_RPC_PASSWORD", + "userpass": "testpsw", "method": "get_nft_list", "mmrpc": "2.0", "params": { @@ -157,17 +157,17 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ```json { - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "limit": 1, - "page_number": 2 - } + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } } ``` @@ -234,7 +234,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | | limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | | page\_number | integer | Optional, defaults to `0`. The page offset for items in response. | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20#token-filter) object. | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters @@ -273,19 +273,19 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ```json { - "userpass": "MM2_RPC_PASSWORD", - "method": "get_nft_transfers", - "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" - ], - "max": true, - "filters": { - "send": true, - "from_date": 1676636291 - } + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 } + } } ``` @@ -339,25 +339,25 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------- | -| amount | string | Amount of tokens. | -| block\_number\_minted | integer | Block height when the token was minted. | -| block\_number | integer | Current block height. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection\_name | string | Collection name. May be `null`. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| owner\_of | string | Address of the token owner. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| token\_hash | string | Token hash. | -| symbol | string | Token symbol. | -| token\_uri | string | Token URI. | -| metadata | string | Token metadata. | -| last\_token\_uri\_sync | string | Last time the token URI was synced. | -| last\_metadata\_sync | string | Last time the token metadata was synced. | -| minter\_address | string | Minter address. | -| possible\_spam | boolean | Possible spam. | +| Parameter | Type | Description | +| ---------------------- | ------- | ---------------------------------------------------------------------- | +| amount | string | Amount of tokens. | +| block\_number\_minted | integer | Block height when the token was minted. | +| block\_number | integer | Current block height. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| collection\_name | string | Collection name. May be `null`. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| owner\_of | string | Address of the token owner. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| token\_hash | string | Token hash. | +| symbol | string | Token symbol. | +| token\_uri | string | Token URI. | +| metadata | string | Token metadata. | +| last\_token\_uri\_sync | string | Last time the token URI was synced. | +| last\_metadata\_sync | string | Last time the token metadata was synced. | +| minter\_address | string | Minter address. | +| possible\_spam | boolean | Possible spam. | | uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example @@ -365,7 +365,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ```json { - "userpass": "MM2_RPC_PASSWORD", + "userpass": "testpsw", "method": "get_nft_metadata", "mmrpc": "2.0", "params": { @@ -432,7 +432,7 @@ This method will query the provided url to update the information stored in the ```json { - "userpass": "'$USERPASS'", + "userpass": "testpsw", "method": "update_nft", "mmrpc": "2.0", "params": { @@ -482,7 +482,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w ```json { - "userpass": "'$USERPASS'", + "userpass": "testpsw", "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { @@ -521,28 +521,28 @@ This method refreshes metadata of one NFT and metadata of related transactions w ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------- | +| Parameter | Type | Description | +| -------------- | ------ | --------------------------------------------------------------------------- | | withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | ### Response Parameters -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens to withdraw. | -| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction) RPC to broadcast the transaction. | -| tx\_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | -| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction\_type | string | This will always be `NftTransfer`. | +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). @@ -555,7 +555,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w ```json { - "userpass": "MM2_RPC_PASSWORD", + "userpass": "testpsw", "method": "withdraw_nft", "mmrpc": "2.0", "params": { @@ -616,7 +616,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw ```json { - "userpass": "MM2_RPC_PASSWORD", + "userpass": "testpsw", "method": "withdraw_nft", "mmrpc": "2.0", "params": { @@ -678,7 +678,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` ```json { - "userpass": "MM2_RPC_PASSWORD", + "userpass": "testpsw", "method": "withdraw_nft", "mmrpc": "2.0", "params": { diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 455a83dd..d3484e1e 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -46,9 +46,9 @@ async function processFile(filePath, filepathSlugs) { if (!filePath.endsWith("/index.mdx")) { throw new Error("File path doesn't end with '/index.mdx': " + filePath) } - if (!filePath.includes("/non_fungible_token")) { - return - } + // if (!filePath.includes("/non_fungible_token")) { + // return + // } console.log("Processing: " + filePath) const file = await remark() .use(remarkGfm) From e3907ef3ebf9d63741d318f7fd6c4d4e8a929203 Mon Sep 17 00:00:00 2001 From: laruh Date: Thu, 28 Sep 2023 19:41:47 +0700 Subject: [PATCH 39/85] add params to `TokenFilter` --- src/pages/atomicdex/api/v20/index.mdx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index b9cec7eb..43c9a77d 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -534,12 +534,14 @@ For requests which return many results, pagination offsets may be applied. \*\* The `TokenFilter` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers after this date are included in the response. | -| to\_date | string | Optional. A UTC date string in the format `YYYY-MM-DD HH:MM:SS.SSS`. Only transfers before this date are included in the response. | +| Parameter | Type | Description | +| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A UNIX timestamp. Only transfers after this date are included in the response. | +| to\_date | integer | Optional. A UNIX timestamp. Only transfers before this date are included in the response. | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | ```json From 2b02e8e0bb231505a989fc1ec57bbff1021bb16a Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:49:18 +0530 Subject: [PATCH 40/85] updates to pass linter, added TODO --- filepathSlugs.json | 42 ++++++++++++++++- src/pages/atomicdex/api/index.mdx | 6 +++ .../api/v20-dev/non_fungible_tokens/index.mdx | 18 +++---- src/pages/atomicdex/api/v20/index.mdx | 47 ++++++++++--------- 4 files changed, 82 insertions(+), 31 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index f632208b..c114c541 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2345,7 +2345,17 @@ "lightning-payment-type", "pagination", "example", - "tokens-request" + "token-filter", + "token-metadata", + "tokens-request", + "withdraw-fee", + "example-of-eth-type", + "example-of-qrc20-type", + "example-of-tendermint-type", + "example-of-utxo-type", + "withdraw-nft-type", + "withdraw-data-erc721", + "withdraw-data-erc1155" ], "src/pages/atomicdex/api/v20/message_signing/index.mdx": [ "signing-and-verifying-messages", @@ -2733,6 +2743,36 @@ "response-balance-too-low", "response-transport-error" ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx": [ + "non-fungible-tokens-nfts", + "nft-information-methods", + "nft-transaction-methods", + "get-a-list-of-nfts", + "request-parameters", + "response-parameters", + "example-with-no-optional-params", + "example-with-no-optional-params-2", + "get-a-list-of-nft-transfers", + "request-parameters-2", + "response-parameters-2", + "example-with-date-and-send-filters", + "get-nft-metadata", + "request-parameters-3", + "response-parameters-3", + "example", + "update-nft", + "request-parameters-4", + "example-2", + "refresh-nft-metadata", + "request-parameters-5", + "example-3", + "withdraw-nfts", + "request-parameters-6", + "response-parameters-4", + "erc-721-withdraw-example", + "erc-1155-withdraw-example", + "erc-1155-withdraw-max-example" + ], "src/pages/atomicdex/api/v20-dev/task_account_balance/index.mdx": [ "account-balance-tasks", "init", diff --git a/src/pages/atomicdex/api/index.mdx b/src/pages/atomicdex/api/index.mdx index a7090c5a..73a53c29 100644 --- a/src/pages/atomicdex/api/index.mdx +++ b/src/pages/atomicdex/api/index.mdx @@ -45,6 +45,9 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | +| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) | +| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) | +| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -81,6 +84,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | +| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -120,9 +124,11 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | +| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | +| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 0ffe3c53..c1948d9b 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -55,7 +55,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` #### 📌 Example with no optional params - + ```json { "userpass": "testpsw", @@ -154,7 +154,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` #### 📌 Example with no optional params - + ```json { "userpass": "testpsw", @@ -270,7 +270,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde #### 📌 Example with date and `send` filters - + ```json { "userpass": "testpsw", @@ -362,7 +362,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde #### 📌 Example - + ```json { "userpass": "testpsw", @@ -429,7 +429,7 @@ This method will query the provided url to update the information stored in the #### 📌 Example - + ```json { "userpass": "testpsw", @@ -479,7 +479,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w #### 📌 Example - + ```json { "userpass": "testpsw", @@ -552,7 +552,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w #### 📌 ERC721 Withdraw Example - + ```json { "userpass": "testpsw", @@ -613,7 +613,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. - + ```json { "userpass": "testpsw", @@ -675,7 +675,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - + ```json { "userpass": "testpsw", diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 47899310..057c7fc6 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -545,14 +545,14 @@ For requests which return many results, pagination offsets may be applied. \*\* The `TokenFilter` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A UNIX timestamp. Only transfers after this date are included in the response. | -| to\_date | integer | Optional. A UNIX timestamp. Only transfers before this date are included in the response. | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | +| Parameter | Type | Description | +| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A UNIX timestamp. Only transfers after this date are included in the response. | +| to\_date | integer | Optional. A UNIX timestamp. Only transfers before this date are included in the response. | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | ```json @@ -711,10 +711,15 @@ The `WithdrawFee` object varies epending on the coin or token type. Refer to the The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: -| Parameter | Type | Description | -| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw\_data | object | A standard [WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155) object. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------- | +| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | +| withdraw\_data | object | A standard WithdrawDataErc721 or WithdrawDataErc1155 object. | + + + TODO: + sections pointed by the slugs don't exist: `[WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155)` + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT @@ -731,13 +736,13 @@ The `WithdrawNftType` object is used for NFT withdrawals. It includes the follow The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contracts. It includes the following items for a given coin or token: -| Parameter | Type | Description | -| -------------- | ------ | ---------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| Parameter | Type | Description | +| -------------- | ------ | ----------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | ### WithdrawDataErc1155 @@ -745,10 +750,10 @@ The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 cont | Parameter | Type | Description | | -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation) first. | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | | amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | | max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20#withdraw-fee) object. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | From 84fe379436147e2f585820a33be6080b1653978e Mon Sep 17 00:00:00 2001 From: gcharang Date: Fri, 29 Sep 2023 05:20:32 +0000 Subject: [PATCH 41/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- utils/_fileData.json | 85 ++++++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/utils/_fileData.json b/utils/_fileData.json index 71e805d9..06b3df0c 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -21,7 +21,7 @@ } }, "/antara/api/channels": { - "dateModified": "2023-09-11T05:33:19.000Z", + "dateModified": "2023-09-09T21:56:24.000Z", "contributors": [ { "name": "\"gcharang\"", @@ -1065,8 +1065,12 @@ } }, "/atomicdex/api": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-09-29T05:19:18.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -1075,18 +1079,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/legacy/active_swaps": { @@ -1594,7 +1594,7 @@ } }, "/atomicdex/api/legacy/get_trade_fee": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2237,7 +2237,7 @@ } }, "/atomicdex/api/legacy/trade_preimage": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2712,19 +2712,23 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-09-29T05:19:18.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" }, { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" }, { "name": "\"gcharang\"", @@ -2732,8 +2736,8 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20/message_signing": { @@ -3200,16 +3204,16 @@ } }, "/atomicdex/api/v20-dev/lightning/activation": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-29T04:59:01.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3220,12 +3224,12 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/lightning/channels": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3345,8 +3349,29 @@ "email": "21151592+gcharang@users.noreply.github.com" } }, + "/atomicdex/api/v20-dev/non_fungible_tokens": { + "dateModified": "2023-09-29T05:19:18.000Z", + "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, + { + "name": "\"smk762\"", + "email": "35845239+smk762@users.noreply.github.com" + } + ], + "lastContributor": { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + } + }, "/atomicdex/api/v20-dev/task_account_balance": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3359,7 +3384,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_qtum": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3372,7 +3397,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_utxo": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3398,7 +3423,7 @@ } }, "/atomicdex/api/v20-dev/task_init_trezor": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3411,7 +3436,7 @@ } }, "/atomicdex/api/v20-dev/task_withdraw": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", From b55adc66393340f1292728366eb7eeada993c243 Mon Sep 17 00:00:00 2001 From: laruh Date: Sun, 1 Oct 2023 19:39:35 +0700 Subject: [PATCH 42/85] fix some review notes for `get_nft_list`,`get_nft_transfers`, get_nft_metadata --- filepathSlugs.json | 1 + .../api/v20-dev/non_fungible_tokens/index.mdx | 232 +++++++++++------- src/pages/atomicdex/api/v20/index.mdx | 33 ++- 3 files changed, 166 insertions(+), 100 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index c114c541..8e54027a 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2345,6 +2345,7 @@ "lightning-payment-type", "pagination", "example", + "token-transfer-filter", "token-filter", "token-metadata", "tokens-request", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index c1948d9b..1aa911d2 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -23,35 +23,39 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `0`. The page offset for items in response. | +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection\_name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. | -| minter\_address | string | Minter address. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. | -| token\_uri | string | The URI to the metadata of the token. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example with no optional params @@ -87,17 +91,21 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "block_number_minted": 25465916, "block_number": 25919780, "contract_type": "ERC1155", - "collection_name": null, + "name": null, "symbol": null, "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", "last_token_uri_sync": "2023-02-07T17:10:08.402Z", "last_metadata_sync": "2023-02-07T17:10:16.858Z", "minter_address": "ERC1155 tokens don't have a single minter", "possible_spam": false, + "possible_phishing": false, "uri_meta": { "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "token_name": "Tiki box", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", "attributes": [ { @@ -105,7 +113,11 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "value": "TIKI NFT CRYPTOLOGO SCAR" } ], - "animation_url": null + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null } }, { @@ -117,18 +129,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "token_hash": "28f970585fd743b056859a6e41f50a8e", "block_number_minted": 36781490, "block_number": 42491885, - "contract_type": "ERC1155", - "collection_name": null, + "type": "ERC1155", + "name": null, "symbol": null, "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", "last_token_uri_sync": "2022-12-13T13:12:50.840Z", "last_metadata_sync": "2023-05-15T07:30:04.882Z", "minter_address": "ERC1155 tokens don't have a single minter", "possible_spam": false, + "possible_phishing": false, "uri_meta": { "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "token_name": "Forest Mushrooms", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", "attributes": [ { @@ -140,7 +156,11 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "value": "COMMON" } ], - "animation_url": null + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null } } ], @@ -188,17 +208,21 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "block_number_minted": 36781490, "block_number": 42491885, "contract_type": "ERC1155", - "collection_name": null, + "name": null, "symbol": null, "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", "last_token_uri_sync": "2022-12-13T13:12:50.840Z", "last_metadata_sync": "2023-05-15T07:30:04.882Z", "minter_address": "ERC1155 tokens don't have a single minter", "possible_spam": false, + "possible_phishing": false, "uri_meta": { "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "token_name": "Forest Mushrooms", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", "attributes": [ { @@ -210,7 +234,11 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "value": "COMMON" } ], - "animation_url": null + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null } } ], @@ -228,38 +256,45 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Request Parameters -| Parameter | Type | Description | -| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `0`. The page offset for items in response. | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | string | Block date/time string. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | May be `null`. If `true`, the contract address is has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam, phishing attempts, or suspicious activities. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | Tranfer value. | -| transaction\_type | string | Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | | -| operator | string | May be `null`. | +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. | +| operator | string | May be `null`. | `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. @@ -299,7 +334,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde { "chain": "POLYGON", "block_number": 40103927, - "block_timestamp": "2023-03-08T10:11:36.000Z", + "block_timestamp": 1678270296, "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", "transaction_index": 114, @@ -309,14 +344,20 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5", - "collection_name": null, "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", "status": "Send", "amount": "1", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "possible_spam": false + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false } ], "skipped": 1, @@ -339,26 +380,28 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | ---------------------------------------------------------------------- | -| amount | string | Amount of tokens. | -| block\_number\_minted | integer | Block height when the token was minted. | -| block\_number | integer | Current block height. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| collection\_name | string | Collection name. May be `null`. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| owner\_of | string | Address of the token owner. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| token\_hash | string | Token hash. | -| symbol | string | Token symbol. | -| token\_uri | string | Token URI. | -| metadata | string | Token metadata. | -| last\_token\_uri\_sync | string | Last time the token URI was synced. | -| last\_metadata\_sync | string | Last time the token metadata was synced. | -| minter\_address | string | Minter address. | -| possible\_spam | boolean | Possible spam. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example @@ -391,20 +434,27 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "block_number_minted": 25810308, "block_number": 28056721, "contract_type": "ERC721", - "collection_name": "Binance NFT Mystery Box-Back to Blockchain Future", + "name": "Binance NFT Mystery Box-Back to Blockchain Future", "symbol": "BMBBBF", "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", + "token_domain": "public.nftstatic.com", "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", "last_token_uri_sync": "2023-02-19T19:12:09.471Z", "last_metadata_sync": "2023-02-19T19:12:18.080Z", "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", "possible_spam": false, + "possible_phishing": false, "uri_meta": { "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "token_name": "Nebula Nodes", + "image_url": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", + "name": "Nebula Nodes", "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", "attributes": null, - "animation_url": null + "animation_url": null, + "animation_domain": null, + "external_url": null, + "external_domain": null, + "image_details": null } }, "id": null diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 057c7fc6..bdc6ac8b 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -545,12 +545,21 @@ For requests which return many results, pagination offsets may be applied. \*\* The `TokenFilter` object includes the following items for a given coin or token: +| Parameter | Type | Description | +| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + | Parameter | Type | Description | | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | | receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | | send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A UNIX timestamp. Only transfers after this date are included in the response. | -| to\_date | integer | Optional. A UNIX timestamp. Only transfers before this date are included in the response. | +| from\_date | integer | Optional. A UNIX timestamp. If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A UNIX timestamp. If `true`, filter includes transfers up to this date (inclusive). | | exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | | exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | @@ -567,13 +576,19 @@ The `TokenFilter` object includes the following items for a given coin or token: The `TokenMetadata` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| -------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------- | -| image | string | Optional. Url to the NFT's image. | -| token\_name | string | Optional. Name of the token. | -| description | string | Optional. Description of the token. | -| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | -| animation\_url | string | Optional. Url to an animationto be displaye instead of a static image. | +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | ```json From d65310daf2d87f9de0b772c1ab8175ca5044fc2d Mon Sep 17 00:00:00 2001 From: laruh Date: Sun, 1 Oct 2023 12:40:48 +0000 Subject: [PATCH 43/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- filepathSlugs.json | 2 +- .../api/v20-dev/non_fungible_tokens/index.mdx | 90 +++++++++---------- src/pages/atomicdex/api/v20/index.mdx | 10 +-- utils/_fileData.json | 24 ++--- 4 files changed, 65 insertions(+), 61 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 8e54027a..2c5ac49a 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2345,8 +2345,8 @@ "lightning-payment-type", "pagination", "example", - "token-transfer-filter", "token-filter", + "token-transfer-filter", "token-metadata", "tokens-request", "withdraw-fee", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 1aa911d2..7cca6493 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -34,28 +34,28 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example with no optional params @@ -256,7 +256,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Request Parameters -| Parameter | Type | Description | +| Parameter | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | chains | array | List of chains to scan for NFTs. | | max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | @@ -380,28 +380,28 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index bdc6ac8b..cf4df004 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -545,10 +545,10 @@ For requests which return many results, pagination offsets may be applied. \*\* The `TokenFilter` object includes the following items for a given coin or token: -| Parameter | Type | Description | -| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | ### TokenTransferFilter @@ -580,7 +580,7 @@ The `TokenMetadata` object includes the following items for a given coin or toke | ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | image | string | Optional. Direct URL to the NFT's image. | | image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | -| image\_domain | string | Optional. Extracted domain from the 'image_url', if valid. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | | name | string | Optional. Name of the token. | | description | string | Optional. Description of the token. | | attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | diff --git a/utils/_fileData.json b/utils/_fileData.json index 06b3df0c..f0fdd70e 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -2712,8 +2712,12 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-09-29T05:19:18.000Z", + "dateModified": "2023-10-01T12:39:35.000Z", "contributors": [ + { + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2722,10 +2726,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -2736,8 +2736,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" } }, "/atomicdex/api/v20/message_signing": { @@ -3350,8 +3350,12 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens": { - "dateModified": "2023-09-29T05:19:18.000Z", + "dateModified": "2023-10-01T12:39:35.000Z", "contributors": [ + { + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3366,8 +3370,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" } }, "/atomicdex/api/v20-dev/task_account_balance": { From 0e74d8b2e61dfa43e7db9136a05ece3b73ad6748 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 3 Oct 2023 17:43:47 +0800 Subject: [PATCH 44/85] add note for block height changes when transferring nfts --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 7cca6493..ba189979 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -11,6 +11,8 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 * Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) * Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) * Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata) ## NFT Transaction Methods @@ -19,7 +21,7 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 ## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} -Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. ### Request Parameters From 946516722b33931f5de0348390017bd6cff33787 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 3 Oct 2023 18:02:32 +0800 Subject: [PATCH 45/85] add link for unix epoch timestamps --- .../api/v20-dev/non_fungible_tokens/index.mdx | 4 ++-- src/pages/atomicdex/api/v20/index.mdx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index ba189979..52e9f4e7 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -274,7 +274,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | amount | string | Amount of tokens transferred. | | block\_hash | string | May be `null`. Hash of block in which transfer occurred. | | block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | | chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | token\_uri | string | May be `null`. The URI to the metadata of the token. | | token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | @@ -592,7 +592,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | | coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | | internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | | transaction\_type | string | This will always be `NftTransfer`. | diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 23a977d7..cebbfa3b 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -153,7 +153,7 @@ Contains information about electrum & lightwallet\_d servers for coins being use | light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | | electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | | electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a unix timestamp). | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | ### ActivationServers @@ -501,8 +501,8 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | | from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | | to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_timestamp | string | Optional. Minimum timestamp (in milliseconds) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp (in milliseconds) of payment results to return. | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | ### LightningPaymentType @@ -558,8 +558,8 @@ The `TokenTransferFilter` object includes the following items for a transfer of | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | | receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | | send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A UNIX timestamp. If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A UNIX timestamp. If `true`, filter includes transfers up to this date (inclusive). | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | | exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | | exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | From 0ee610bc3ef7f241fc19818600d8bfbf98967ff2 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 3 Oct 2023 18:11:40 +0800 Subject: [PATCH 46/85] add missing word --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 52e9f4e7..6888e97e 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -261,7 +261,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | Parameter | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | | limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | | page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | | protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | From de88450b9d52f7222697c7113cf6cd19e8d1efa5 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 3 Oct 2023 20:10:07 +0800 Subject: [PATCH 47/85] fix lint errors --- src/pages/atomicdex/api/index.mdx | 2 +- .../api/v20-dev/non_fungible_tokens/index.mdx | 20 +- src/pages/atomicdex/api/v20/index.mdx | 30 +- utils/_fileData.json | 686 +++++++++--------- ...validate_update_internal_links_userpass.js | 7 +- 5 files changed, 383 insertions(+), 362 deletions(-) diff --git a/src/pages/atomicdex/api/index.mdx b/src/pages/atomicdex/api/index.mdx index 73a53c29..320afc23 100644 --- a/src/pages/atomicdex/api/index.mdx +++ b/src/pages/atomicdex/api/index.mdx @@ -6,7 +6,7 @@ export const description = "This document lists all available RPC methods of the Legacy methods are in the process of a migration to AtomicDEX API v2.0 (and will also remain backwards compatible). During development, some newer AtomicDEX API methods are not available in the latest release. -To test the methods in v2.0 (Dev), you will need to [build the AtomicDEX API](/atomicdex/setup/) from the `dev` branch. +To test the methods in v2.0 (Dev), you will need to [build the AtomicDEX API](../atomicdex/setup/) from the `dev` branch. Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 6888e97e..71011f9d 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -258,14 +258,14 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | | max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | ### Response Parameters @@ -274,7 +274,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | amount | string | Amount of tokens transferred. | | block\_hash | string | May be `null`. Hash of block in which transfer occurred. | | block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | | chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | token\_uri | string | May be `null`. The URI to the metadata of the token. | | token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | @@ -592,7 +592,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | | coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | | internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | | transaction\_type | string | This will always be `NftTransfer`. | @@ -786,5 +786,5 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` - View the source code at: [https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/atomicDEX-API/blob/add-nft-cache-support/mm2src/coins/nft.rs) + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index cebbfa3b..e4837dfe 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -148,11 +148,11 @@ Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. -| Parameter | Type | Description | -| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| Parameter | Type | Description | +| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | | sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | ### ActivationServers @@ -501,8 +501,8 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | | from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | | to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | ### LightningPaymentType @@ -554,14 +554,14 @@ The `TokenFilter` object includes the following items for a given coin or token: The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: -| Parameter | Type | Description | -| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | ```json diff --git a/utils/_fileData.json b/utils/_fileData.json index f0fdd70e..e02549f1 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -214,8 +214,12 @@ } }, "/antara/api/musig": { - "dateModified": "2023-09-27T13:42:56.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -224,18 +228,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/oracles": { @@ -264,8 +264,12 @@ } }, "/antara/api/payments": { - "dateModified": "2023-09-28T07:39:39.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -277,15 +281,11 @@ { "name": "\"smk762\"", "email": "smk762@iinet.net.au" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/pegs": { @@ -364,8 +364,12 @@ } }, "/antara/api/rogue": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -374,18 +378,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/sudoku": { @@ -464,8 +464,12 @@ } }, "/antara/setup/antara-customizations": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -477,15 +481,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/setup": { @@ -506,8 +506,12 @@ } }, "/antara/tutorials/advanced-series-0": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -519,20 +523,20 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-1": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -544,20 +548,20 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-2": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -566,18 +570,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-3": { @@ -631,8 +631,12 @@ } }, "/antara/tutorials/advanced-series-5": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -644,15 +648,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-6": { @@ -915,8 +915,12 @@ } }, "/antara/tutorials/overview-of-antara-modules-part-i": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -925,23 +929,23 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/overview-of-antara-modules-part-ii": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -950,18 +954,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/pegs-module-creator-tutorial": { @@ -1015,8 +1015,12 @@ } }, "/antara/tutorials/rogue-module-tutorial": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -1028,15 +1032,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/understanding-antara-addresses": { @@ -1290,8 +1290,12 @@ } }, "/atomicdex/api/legacy/coin_activation": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -1307,15 +1311,11 @@ { "name": "\"Samuel Onoja\"", "email": "samiodev@icloud.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/legacy/coins_needed_for_kick_start": { @@ -2387,8 +2387,12 @@ } }, "/atomicdex/api/v20/add_delegation": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2400,15 +2404,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/add_node_to_version_stat": { @@ -2512,8 +2512,12 @@ } }, "/atomicdex/api/v20/enable_eth_with_tokens": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2525,15 +2529,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/enable_slp": { @@ -2687,8 +2687,12 @@ } }, "/atomicdex/api/v20/get_staking_infos": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2700,28 +2704,16 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20": { - "dateModified": "2023-10-01T12:39:35.000Z", + "dateModified": "2023-10-03T10:02:32.000Z", "contributors": [ - { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" - }, - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2730,19 +2722,35 @@ "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"laruh\"", + "email": "laruh@users.noreply.github.com" + }, + { + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" + }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/message_signing": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2754,15 +2762,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/my_tx_history": { @@ -2804,8 +2808,12 @@ } }, "/atomicdex/api/v20/recreate_swap_data": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2814,23 +2822,23 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/remove_delegation": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2842,15 +2850,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/remove_node_from_version_stat": { @@ -2879,10 +2883,14 @@ } }, "/atomicdex/api/v20/start_simple_market_maker_bot": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ { - "name": "\"gcharang\"", + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, + { + "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, { @@ -2892,15 +2900,11 @@ { "name": "\"smk762\"", "email": "smk762@iinet.net.au" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/start_version_stat_collection": { @@ -3179,8 +3183,12 @@ } }, "/atomicdex/api/v20-dev": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3192,15 +3200,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20-dev/lightning/activation": { @@ -3350,8 +3354,16 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens": { - "dateModified": "2023-10-01T12:39:35.000Z", + "dateModified": "2023-10-03T10:11:40.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, + { + "name": "\"laruh\"", + "email": "laruh@users.noreply.github.com" + }, { "name": "\"laruh\"", "email": "oblomoff616@gmail.com" @@ -3360,18 +3372,14 @@ "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"smk762\"", "email": "35845239+smk762@users.noreply.github.com" } ], "lastContributor": { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/task_account_balance": { @@ -3684,8 +3692,12 @@ } }, "/atomicdex/setup/configure-mm2-json": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3697,36 +3709,32 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/setup": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/additional-information-about-atomicdex": { @@ -3776,8 +3784,12 @@ } }, "/atomicdex/tutorials/atomicdex-walkthrough": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3789,15 +3801,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/coins-file-update": { @@ -3822,8 +3830,12 @@ } }, "/atomicdex/tutorials/how-to-become-a-liquidity-provider": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3835,40 +3847,36 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/how-to-compile-mm2-from-source": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials": { - "dateModified": "2023-05-31T18:19:46.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ { "name": "\"gaeacodes\"", @@ -3885,8 +3893,12 @@ } }, "/atomicdex/tutorials/listing-a-coin-on-atomicdex": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3894,15 +3906,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/query-the-mm2-database": { @@ -3931,8 +3939,12 @@ } }, "/atomicdex/tutorials/setup-atomicdex-aws": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3941,18 +3953,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter00": { @@ -3973,45 +3981,45 @@ } }, "/historical/cc-jl/chapter01": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter02": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter03": { @@ -4032,24 +4040,24 @@ } }, "/historical/cc-jl/chapter04": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter05": { @@ -4070,8 +4078,12 @@ } }, "/historical/cc-jl/chapter06": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -4079,19 +4091,15 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter07": { - "dateModified": "2023-05-24T13:18:47.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ { "name": "\"gaeacodes\"", @@ -4252,37 +4260,41 @@ } }, "/historical/cc-jl/faq": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl": { - "dateModified": "2023-06-14T19:22:24.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical": { @@ -4324,29 +4336,33 @@ } }, "/historical/whitepaper/chapter2": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/whitepaper/chapter3": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4355,18 +4371,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/whitepaper/chapter4": { @@ -4500,24 +4512,24 @@ } }, "/historical/whitepaper/references": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/": { @@ -4638,8 +4650,12 @@ } }, "/smart-chains/api/crosschain": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4651,15 +4667,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/api/disclosure": { @@ -4776,8 +4788,12 @@ } }, "/smart-chains/api/network": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4786,18 +4802,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/api/rawtransactions": { @@ -4922,8 +4934,12 @@ } }, "/smart-chains/setup/common-runtime-parameters": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4935,15 +4951,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/setup/ecosystem-launch-parameters": { @@ -4981,8 +4993,12 @@ } }, "/smart-chains/setup/installing-from-source": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4991,18 +5007,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/setup/interacting-with-smart-chains": { @@ -5090,24 +5102,24 @@ } }, "/smart-chains/tutorials/basic-environment-setup-for-linux-vps": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/tutorials/create-a-default-smart-chain": { @@ -5333,8 +5345,12 @@ } }, "/start-here/about-komodo-platform/simple-installations": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5342,15 +5358,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions/antara": { @@ -5396,8 +5408,12 @@ } }, "/start-here/core-technology-discussions/delayed-proof-of-work": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -5405,15 +5421,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions": { @@ -5434,8 +5446,12 @@ } }, "/start-here/core-technology-discussions/initial-dex-offering": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5447,15 +5463,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions/miscellaneous": { @@ -5484,24 +5496,24 @@ } }, "/start-here/core-technology-discussions/references": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here": { @@ -5547,8 +5559,12 @@ } }, "/start-here/learning-launchpad": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5563,8 +5579,8 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } } } \ No newline at end of file diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 737ad64f..210698d9 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -373,6 +373,9 @@ function checkUrlStatusCode(url) { } async function processExternalLink(link, currFilePath) { + let IgnoreURLs = [ + "https://moralis-proxy.komodo.earth" + ] if ( link.startsWith("http://127.0.0.1") || link.startsWith("https://127.0.0.1") || @@ -409,9 +412,11 @@ async function processExternalLink(link, currFilePath) { ); } else if (statusCode === 403 || statusCode === 405 || statusCode === 500) { console.log( - `Check this link manually: ${link}.It responds with statuscode: ${statusCode} ` + `Check this link manually: [${link}] It responds with statuscode: ${statusCode} ` ); fs.appendFileSync(manualLinkFile, link + "\n"); + } else if (IgnoreURLs.includes(link)) { + fs.appendFileSync(manualLinkFile, link + "\n"); } else { throw new Error( `The URL ${link} in the file ${currFilePath} returned a statuscode: ${statusCode}` From eaf8912b1846481007f8c1e3a1cd4640e02888df Mon Sep 17 00:00:00 2001 From: laruh Date: Wed, 4 Oct 2023 15:51:46 +0700 Subject: [PATCH 48/85] fix typo and use "contract_type" --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 71011f9d..2fa06120 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -131,7 +131,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "token_hash": "28f970585fd743b056859a6e41f50a8e", "block_number_minted": 36781490, "block_number": 42491885, - "type": "ERC1155", + "contract_type": "ERC1155", "name": null, "symbol": null, "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", From 881ea66c8bc3c441b5691c27f9abe3dd511ab85b Mon Sep 17 00:00:00 2001 From: laruh Date: Wed, 4 Oct 2023 17:06:46 +0700 Subject: [PATCH 49/85] add url\_antispam into `update_nft`, `refresh_nft_metadata` --- .../api/v20-dev/non_fungible_tokens/index.mdx | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 2fa06120..33180cad 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -470,10 +470,11 @@ This method will query the provided url to update the information stored in the ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------------------------------------------------------------- | -| chains | array | List of chains to update NFTs for. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| Parameter | Type | Description | +| ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to update NFTs for. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | If there are no errors, this request will return an empty response. @@ -492,7 +493,8 @@ This method will query the provided url to update the information stored in the "BSC", "POLYGON" ], - "url": "https://moralis-proxy.komodo.earth" + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" } } ``` @@ -518,12 +520,13 @@ This method refreshes metadata of one NFT and metadata of related transactions w ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | -| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | If there are no errors, this request will return an empty response. @@ -541,7 +544,8 @@ This method refreshes metadata of one NFT and metadata of related transactions w "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5", "chain": "POLYGON", - "url": "https://moralis-proxy.komodo.earth" + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" } } ``` From 4aeec661071ff94cac7af487ce6ab7c355bc7651 Mon Sep 17 00:00:00 2001 From: laruh Date: Wed, 4 Oct 2023 17:49:03 +0700 Subject: [PATCH 50/85] remove "url" from `withdraw_nft` req --- src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 33180cad..5a626051 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -615,7 +615,6 @@ This method refreshes metadata of one NFT and metadata of related transactions w "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "url": "https://moralis-proxy.komodo.earth", "withdraw_type": { "type": "withdraw_erc721", "withdraw_data": { @@ -676,7 +675,6 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "url": "https://moralis-proxy.komodo.earth", "withdraw_type": { "type": "withdraw_erc1155", "withdraw_data": { @@ -738,7 +736,6 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "url": "https://moralis-proxy.komodo.earth", "withdraw_type": { "type": "withdraw_erc1155", "withdraw_data": { From fed436700c490604c28c81834d5ae7017a3345a9 Mon Sep 17 00:00:00 2001 From: laruh Date: Wed, 4 Oct 2023 18:27:20 +0700 Subject: [PATCH 51/85] fix typo --- src/pages/atomicdex/api/v20/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index e4837dfe..fdf518c3 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -661,7 +661,7 @@ The `TokensRequest` object includes the following items for a given coin or toke ### WithdrawFee -The `WithdrawFee` object varies epending on the coin or token type. Refer to the examples to view the object structure for each type. +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. | Parameter | Type | Description | | --------------- | -------------- | --------------------------------------------------------------------------------- | From 5b5fc7577dab6e15194a4236f38e1e739d6d1392 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 20:18:56 +0530 Subject: [PATCH 52/85] update linter --- .../api/v20-dev/non_fungible_tokens/index.mdx | 10 +++++----- utils/js/validate_update_internal_links_userpass.js | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 5a626051..840592d2 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -470,11 +470,11 @@ This method will query the provided url to update the information stored in the ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to update NFTs for. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to update NFTs for. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | If there are no errors, this request will return an empty response. diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 210698d9..25e91a38 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -374,7 +374,8 @@ function checkUrlStatusCode(url) { async function processExternalLink(link, currFilePath) { let IgnoreURLs = [ - "https://moralis-proxy.komodo.earth" + "https://moralis-proxy.komodo.earth", + "https://nft.antispam.dragonhound.info" ] if ( link.startsWith("http://127.0.0.1") || @@ -411,11 +412,11 @@ async function processExternalLink(link, currFilePath) { `The link: ${link} has a ${statusCode} redirect to ${newLocation}` ); } else if (statusCode === 403 || statusCode === 405 || statusCode === 500) { - console.log( - `Check this link manually: [${link}] It responds with statuscode: ${statusCode} ` - ); + // console.log( + // `Check this link manually: [${link}] It responds with statuscode: ${statusCode} ` + // ); fs.appendFileSync(manualLinkFile, link + "\n"); - } else if (IgnoreURLs.includes(link)) { + } else if (IgnoreURLs.some(ignoreLink => link.includes(ignoreLink))) { fs.appendFileSync(manualLinkFile, link + "\n"); } else { throw new Error( @@ -423,8 +424,8 @@ async function processExternalLink(link, currFilePath) { ); } } catch (err) { - console.log(`Checking the URL ${link} in the file ${currFilePath}`); if (err.message.startsWith("Request timed out")) { + console.log(`Request timed out when checking the URL ${link} in the file ${currFilePath}`); return; } else { throw new Error(err); From 8d48507b5d706fe7a1910a46c03999698b45b411 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 10 Oct 2023 23:23:15 +0800 Subject: [PATCH 53/85] update contribs --- utils/_fileData.json | 344 +++++++++++++++++++++++-------------------- 1 file changed, 188 insertions(+), 156 deletions(-) diff --git a/utils/_fileData.json b/utils/_fileData.json index b0e31425..f2ee54f5 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -176,28 +176,28 @@ } }, "/antara/api/heir": { - "dateModified": "2023-09-27T13:42:56.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/api": { @@ -264,12 +264,8 @@ } }, "/antara/api/payments": { - "dateModified": "2023-10-03T07:36:45.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -278,14 +274,18 @@ "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/api/pegs": { @@ -606,28 +606,28 @@ } }, "/antara/tutorials/advanced-series-4": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/advanced-series-5": { @@ -681,37 +681,33 @@ } }, "/antara/tutorials/beginner-series-part-0": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/beginner-series-part-1": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -720,14 +716,18 @@ "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/beginner-series-part-2": { @@ -781,12 +781,8 @@ } }, "/antara/tutorials/beginner-series-part-4": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -795,14 +791,18 @@ "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/dilithium-module-tutorial": { @@ -1169,16 +1169,12 @@ } }, "/atomicdex/api": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-03T12:10:07.000Z", "contributors": [ { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2824,8 +2820,12 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-04T11:27:20.000Z", "contributors": [ + { + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3366,7 +3366,7 @@ } }, "/atomicdex/api/v20-dev/lightning": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3441,8 +3441,12 @@ } }, "/atomicdex/api/v20-dev/max_maker_vol": { - "dateModified": "2023-10-05T08:19:23.000Z", + "dateModified": "2023-10-05T08:42:26.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3462,12 +3466,16 @@ ], "lastContributor": { "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "email": "smk762@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/non_fungible_tokens": { - "dateModified": "2023-10-04T10:49:03.000Z", + "dateModified": "2023-10-04T14:48:56.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"laruh\"", "email": "oblomoff616@gmail.com" @@ -3480,18 +3488,14 @@ "name": "\"laruh\"", "email": "laruh@users.noreply.github.com" }, - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "35845239+smk762@users.noreply.github.com" } ], "lastContributor": { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_account_balance": { @@ -3508,29 +3512,45 @@ } }, "/atomicdex/api/v20-dev/task_enable_qtum": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_enable_utxo": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_enable_z_coin": { @@ -3547,16 +3567,24 @@ } }, "/atomicdex/api/v20-dev/task_init_trezor": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_withdraw": { @@ -3611,19 +3639,19 @@ } }, "/atomicdex/mobile/add-and-activate-coins-on-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3632,7 +3660,7 @@ } }, "/atomicdex/mobile/delete-seed-from-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", @@ -3653,19 +3681,19 @@ } }, "/atomicdex/mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3674,7 +3702,7 @@ } }, "/atomicdex/mobile/perform-cross-chain-atomic-swaps-using-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", @@ -3699,19 +3727,19 @@ } }, "/atomicdex/mobile/recover-seed-on-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3720,19 +3748,19 @@ } }, "/atomicdex/mobile/restore-wallet-using-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3741,19 +3769,19 @@ } }, "/atomicdex/mobile/view-ongoing-orders-and-swap-history-on-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3762,19 +3790,19 @@ } }, "/atomicdex/mobile/view-your-receiving-address-to-send-funds-for-trading": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3783,19 +3811,19 @@ } }, "/atomicdex/mobile/withdraw-or-send-funds-using-atomicdex-mobile": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -3829,12 +3857,8 @@ } }, "/atomicdex/setup": { - "dateModified": "2023-10-03T07:36:45.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3842,11 +3866,15 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/additional-information-about-atomicdex": { @@ -3871,19 +3899,19 @@ } }, "/atomicdex/tutorials/atomicdex-metrics": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { "name": "\"gaeacodes\"", @@ -3891,8 +3919,8 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/atomicdex-walkthrough": { @@ -4018,6 +4046,10 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -4787,19 +4819,19 @@ } }, "/smart-chains/api/disclosure": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { @@ -5105,8 +5137,12 @@ } }, "/smart-chains/setup/installing-from-source": { - "dateModified": "2023-10-03T07:36:45.000Z", + "dateModified": "2023-10-04T05:01:12.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -5118,15 +5154,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/smart-chains/setup/interacting-with-smart-chains": { @@ -5386,12 +5418,8 @@ } }, "/start-here/about-komodo-platform": { - "dateModified": "2023-09-11T10:12:10.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -5399,11 +5427,15 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" + }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/start-here/about-komodo-platform/orientation": { @@ -5432,28 +5464,28 @@ } }, "/start-here/about-komodo-platform/product-introductions": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" } }, "/start-here/about-komodo-platform/simple-installations": { From 8095434808f76c92546b754093a3042f8f23dedf Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 22 Nov 2023 22:36:28 +0800 Subject: [PATCH 54/85] Fix WithdrawNftData common structure --- src/pages/atomicdex/api/v20/index.mdx | 32 +++++++-------------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index fdf518c3..c1b548a4 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -726,15 +726,11 @@ The `WithdrawFee` object varies depending on the coin or token type. Refer to th The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------- | -| type | string | The withdrawl type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw\_data | object | A standard WithdrawDataErc721 or WithdrawDataErc1155 object. | +| Parameter | Type | Description | +| -------------- | ------ | --------------------------------------------------------------------------- | +| type | string | The withdrawal type. Either `withdraw_erc721` or `withdraw_erc1155`. | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | - - TODO: - sections pointed by the slugs don't exist: `[WithdrawDataErc721](/atomicdex/api/v20#withdraw-data-erc721) or [WithdrawDataErc1155](/atomicdex/api/v20#withdraw-data-erc155)` - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT @@ -747,21 +743,9 @@ The `WithdrawNftType` object is used for NFT withdrawals. It includes the follow `withdraw_erc1155`. -### WithdrawDataErc721 - -The `WithdrawDataErc721` object is used for withdrawals of NFTs on ERC721 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| -------------- | ------ | ----------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | - -### WithdrawDataErc1155 +### WithdrawNftData -The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 contracts. It includes the following items for a given coin or token: +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: | Parameter | Type | Description | | -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | @@ -769,6 +753,6 @@ The `WithdrawDataErc1155` object is used for withdrawals of NFTs on ERC1155 cont | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| amount | string | Optional, defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | -| max | boolean | Optional, defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | | fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | From da6eb079684a25c17a1a96edb8f570b0df0918f3 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 22 Nov 2023 22:47:28 +0800 Subject: [PATCH 55/85] linting and fix 302 url --- filepathSlugs.json | 3 +- src/pages/atomicdex/api/v20/index.mdx | 53 +++++++++++++-------------- utils/_fileData.json | 28 +++++++------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index ec74bf44..3169a488 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2440,8 +2440,7 @@ "example-of-tendermint-type", "example-of-utxo-type", "withdraw-nft-type", - "withdraw-data-erc721", - "withdraw-data-erc1155" + "withdraw-nft-data" ], "src/pages/atomicdex/api/v20/message_signing/index.mdx": [ "signing-and-verifying-messages", diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index c1b548a4..80a8de0d 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -482,27 +482,27 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ ### LightningPayment -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | -| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | -| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | -| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | -| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | +| Parameter | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | ### LightningPaymentFilter -| Parameter | Type | Description | -| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | ### LightningPaymentType @@ -731,7 +731,6 @@ The `WithdrawNftType` object is used for NFT withdrawals. It includes the follow | type | string | The withdrawal type. Either `withdraw_erc721` or `withdraw_erc1155`. | | withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT @@ -747,12 +746,12 @@ The `WithdrawNftType` object is used for NFT withdrawals. It includes the follow The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: -| Parameter | Type | Description | -| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | diff --git a/utils/_fileData.json b/utils/_fileData.json index 223f9821..b44dd044 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1173,16 +1173,16 @@ } }, "/atomicdex/api": { - "dateModified": "2023-10-04T06:26:45.000Z", + "dateModified": "2023-10-03T12:10:07.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -1193,8 +1193,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/active_swaps": { @@ -2824,16 +2824,16 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-10-04T11:27:20.000Z", + "dateModified": "2023-11-22T14:36:28.000Z", "contributors": [ - { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"laruh\"", + "email": "oblomoff616@gmail.com" + }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -2852,8 +2852,8 @@ } ], "lastContributor": { - "name": "\"laruh\"", - "email": "oblomoff616@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/message_signing": { From 17f6bd49957ffb2ae622753031a3ed432231e9a6 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:10:48 +0800 Subject: [PATCH 56/85] add get_nft_list --- .../get_nft_list/index.mdx | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx new file mode 100644 index 00000000..37765ddb --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -0,0 +1,236 @@ +export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; +export const description = + "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; + +# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} + +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example with no optional params + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ] + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 0, + "total": 2 + }, + "id": null + } + ``` + + +#### 📌 Example with optional limit & page\_number params + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null + } + ``` + From 0f8003c8c61866852f2929ef7275a01e8ef6c9ab Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:14:10 +0800 Subject: [PATCH 57/85] add get_nft_transfers --- .../get_nft_transfers/index.mdx | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx new file mode 100644 index 00000000..94564656 --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -0,0 +1,121 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; + +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. | +| operator | string | May be `null`. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + + +#### 📌 Example with date and `send` filters + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": 1678270296, + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null + } + ``` + From ee15fe67dd2fffe8a760a5c80effda0f97214e8c Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:14:39 +0800 Subject: [PATCH 58/85] add get_nft_metadata --- .../get_nft_metadata/index.mdx | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx new file mode 100644 index 00000000..aab3cfee --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -0,0 +1,97 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for an NFT"; + +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "chain": "BSC", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "125f8f4e952e107c257960000b4b250e", + "block_number_minted": 25810308, + "block_number": 28056721, + "contract_type": "ERC721", + "name": "Binance NFT Mystery Box-Back to Blockchain Future", + "symbol": "BMBBBF", + "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", + "token_domain": "public.nftstatic.com", + "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", + "last_token_uri_sync": "2023-02-19T19:12:09.471Z", + "last_metadata_sync": "2023-02-19T19:12:18.080Z", + "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", + "image_url": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", + "name": "Nebula Nodes", + "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", + "attributes": null, + "animation_url": null, + "animation_domain": null, + "external_url": null, + "external_domain": null, + "image_details": null + } + }, + "id": null + } + ``` + From c6201130a6bac4642ff53c9866fd85d96f8a8fa0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:23:01 +0800 Subject: [PATCH 59/85] add activation note --- .../v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index 94564656..74efd9a0 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -6,6 +6,10 @@ export const description = Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + ### Request Parameters | Parameter | Type | Description | From 57ba4e8d44f9b3cb6667418964e7a0429d279dae Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:23:37 +0800 Subject: [PATCH 60/85] split nft methods into own pages --- .../api/v20-dev/non_fungible_tokens/index.mdx | 2 +- .../refresh_nft_metadata/index.mdx | 279 ++++++++++++++++++ .../non_fungible_tokens/update_nft/index.mdx | 53 ++++ .../withdraw_nft/index.mdx | 224 ++++++++++++++ 4 files changed, 557 insertions(+), 1 deletion(-) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 840592d2..6d7b87f2 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -174,7 +174,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ``` -#### 📌 Example with no optional params +#### 📌 Example with optional limit & page\_number params ```json diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx new file mode 100644 index 00000000..b570978d --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx @@ -0,0 +1,279 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; + +# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | + + + If there are no errors, this request will return an empty response. + + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "refresh_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } + } + ``` + + + + + If there are no errors, this request will return an empty response. + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + + + Need to add some error responses here. + + +## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | --------------------------------------------------------------------------- | +| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + + + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). + When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. + + +#### 📌 ERC721 Withdraw Example + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "BSC", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", + "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC721", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + }, + "coin": "BNB", + "block_height": 0, + "timestamp": 1684239228, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Example + +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2" + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", + "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000154089437979", + "total_fee": "0.01048116357133158" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241604, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Max Example + +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "max": true + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", + "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000137182923005", + "total_fee": "0.0093311824228001" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241781, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx new file mode 100644 index 00000000..3a5bed2c --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx @@ -0,0 +1,53 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; + +# Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will query the provided url to update the information stored in the local database. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to update NFTs for. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | + + + If there are no errors, this request will return an empty response. + + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "update_nft", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + + + Need to add some error responses here. + diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx new file mode 100644 index 00000000..4fad73fd --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx @@ -0,0 +1,224 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; + +# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | --------------------------------------------------------------------------- | +| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + + + When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). + When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. + + +#### 📌 ERC721 Withdraw Example + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "BSC", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", + "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC721", + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + }, + "coin": "BNB", + "block_height": 0, + "timestamp": 1684239228, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Example + +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2" + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", + "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000154089437979", + "total_fee": "0.01048116357133158" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241604, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Max Example + +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "withdraw_type": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "max": true + } + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", + "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", + "from": [ + "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" + ], + "to": [ + "0x6FAD0eC6bb76914b2a2a800686acc22970645820" + ], + "contract_type": "ERC1155", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "2", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 68020, + "gas_price": "0.000000137182923005", + "total_fee": "0.0093311824228001" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1684241781, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + From 0d9b43c897629c7205465882609298629f5f9980 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:27:52 +0800 Subject: [PATCH 61/85] lint the updates --- filepathSlugs.json | 45 ++++++++++++++- src/data/sidebar.json | 32 ++++++++++- src/pages/atomicdex/api/index.mdx | 12 ++-- utils/_fileData.json | 94 ++++++++++++++++++++++++++++--- 4 files changed, 166 insertions(+), 17 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 3169a488..2b5105cf 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2828,6 +2828,25 @@ "response-balance-too-low", "response-transport-error" ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx": [ + "get-a-list-of-nfts", + "request-parameters", + "response-parameters", + "example-with-no-optional-params", + "example-with-optional-limit-and-page-number-params" + ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx": [ + "get-nft-metadata", + "request-parameters", + "response-parameters", + "example" + ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx": [ + "get-a-list-of-nft-transfers", + "request-parameters", + "response-parameters", + "example-with-date-and-send-filters" + ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx": [ "non-fungible-tokens-nfts", "nft-information-methods", @@ -2836,7 +2855,7 @@ "request-parameters", "response-parameters", "example-with-no-optional-params", - "example-with-no-optional-params-2", + "example-with-optional-limit-and-page-number-params", "get-a-list-of-nft-transfers", "request-parameters-2", "response-parameters-2", @@ -2858,6 +2877,30 @@ "erc-1155-withdraw-example", "erc-1155-withdraw-max-example" ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx": [ + "refresh-nft-metadata", + "request-parameters", + "example", + "withdraw-nfts", + "request-parameters-2", + "response-parameters", + "erc-721-withdraw-example", + "erc-1155-withdraw-example", + "erc-1155-withdraw-max-example" + ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx": [ + "update-nft", + "request-parameters", + "example" + ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx": [ + "withdraw-nfts", + "request-parameters", + "response-parameters", + "erc-721-withdraw-example", + "erc-1155-withdraw-example", + "erc-1155-withdraw-max-example" + ], "src/pages/atomicdex/api/v20-dev/task_account_balance/index.mdx": [ "account-balance-tasks", "init", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index 77696701..ec158cda 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -401,8 +401,36 @@ }, { "title": "Non-Fungible Tokens", - "titleLink": "/atomicdex/api/v20-dev/non_fungible_tokens/", - "links": [] + "links": [ + { + "title": "Overview", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/" + }, + { + "title": "Get NFT List", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/" + }, + { + "title": "Get NFT Transactions", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/" + }, + { + "title": "Get NFT Metadata", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/" + }, + { + "title": "Refresh NFT Metadata", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/" + }, + { + "title": "Update NFT", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/" + }, + { + "title": "Withdraw NFT", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/" + } + ] }, { "title": "Lightning Network", diff --git a/src/pages/atomicdex/api/index.mdx b/src/pages/atomicdex/api/index.mdx index 320afc23..fb133074 100644 --- a/src/pages/atomicdex/api/index.mdx +++ b/src/pages/atomicdex/api/index.mdx @@ -45,9 +45,9 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | -| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) | -| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) | -| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) | +| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | +| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | +| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -84,7 +84,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | -| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata) | +| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -124,11 +124,11 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | -| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft) | +| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | -| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#withdraw-nfts) | +| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | diff --git a/utils/_fileData.json b/utils/_fileData.json index b44dd044..0189cc80 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -2824,7 +2824,7 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-11-22T14:36:28.000Z", + "dateModified": "2023-11-22T14:47:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3473,9 +3473,52 @@ "email": "smk762@users.noreply.github.com" } }, + "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { + "dateModified": "2023-11-23T06:10:48.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { + "dateModified": "2023-11-23T06:14:39.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers": { + "dateModified": "2023-11-23T06:23:01.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, "/atomicdex/api/v20-dev/non_fungible_tokens": { - "dateModified": "2023-10-04T14:48:56.000Z", + "dateModified": "2023-11-23T06:23:37.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3484,10 +3527,6 @@ "name": "\"laruh\"", "email": "oblomoff616@gmail.com" }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"laruh\"", "email": "laruh@users.noreply.github.com" @@ -3498,8 +3537,47 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata": { + "dateModified": "2023-11-23T06:23:37.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/v20-dev/non_fungible_tokens/update_nft": { + "dateModified": "2023-11-23T06:23:37.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft": { + "dateModified": "2023-11-23T06:23:37.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/task_account_balance": { From cbe6f0a1717e27a10c89feebf9520a1c443fe3ca Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 14:30:33 +0800 Subject: [PATCH 62/85] add spam protection example for nft list method --- .../get_nft_list/index.mdx | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 37765ddb..4a013aac 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -234,3 +234,85 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } ``` + + +#### 📌 Example with optional spam protection + + + ```json +{ + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } + } +} + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null + } + ``` + \ No newline at end of file From 9319985030eb1e79f4f4ec07ebb771f01954f2c9 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 16:37:43 +0800 Subject: [PATCH 63/85] Add note to update_nft before get_nft_list --- .../api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 4a013aac..36c90b19 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -6,6 +6,11 @@ export const description = Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. + + Before using this method, you must first call the [update_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + ### Request Parameters | Parameter | Type | Description | From e13697cd8a28751554b70458692ff86b3f91d9b7 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 17:04:59 +0800 Subject: [PATCH 64/85] add get_nft_metadata responses --- .../get_nft_metadata/index.mdx | 83 ++++++++++++------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx index aab3cfee..02a87d36 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -1,6 +1,6 @@ export const title = "AtomicDEX: Non Fungible Tokens"; export const description = - "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for an NFT"; + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; # Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} @@ -59,39 +59,58 @@ export const description = { "mmrpc": "2.0", "result": { - "chain": "BSC", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "125f8f4e952e107c257960000b4b250e", - "block_number_minted": 25810308, - "block_number": 28056721, - "contract_type": "ERC721", - "name": "Binance NFT Mystery Box-Back to Blockchain Future", - "symbol": "BMBBBF", - "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", - "token_domain": "public.nftstatic.com", - "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", - "last_token_uri_sync": "2023-02-19T19:12:09.471Z", - "last_metadata_sync": "2023-02-19T19:12:18.080Z", - "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "image_url": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "name": "Nebula Nodes", - "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", - "attributes": null, - "animation_url": null, - "animation_domain": null, - "external_url": null, - "external_domain": null, - "image_details": null - } + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "amount": "1", + "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", + "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", + "name": "OpenSea Collections", + "symbol": "OPENSTORE", + "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", + "token_domain": "api.opensea.io", + "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", + "last_token_uri_sync": "2023-09-01T04:04:30.867Z", + "last_metadata_sync": "2023-09-01T04:35:01.128Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": true, + "chain": "POLYGON", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "block_number_minted": 19645247, + "block_number": 45776404, + "contract_type": "ERC1155", + "possible_phishing": false, + "uri_meta": { + "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_domain": "i.seadn.io", + "name": "Doge Napoleon", + "description": null, + "attributes": null, + "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", + "animation_domain": "openseauserdata.com", + "external_url": null, + "external_domain": null, + "image_details": null + } }, "id": null } ``` + + +## Error responses + +``` +{ + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", + "error_path": "nft", + "error_trace": "nft:123]", + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + }, + "id": null +} +``` \ No newline at end of file From decb8034d612683895b4566466d66cb3570fda75 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 17:05:36 +0800 Subject: [PATCH 65/85] add note about potentially long waits fot update_nft --- .../api/v20-dev/non_fungible_tokens/update_nft/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx index 3a5bed2c..b064d024 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx @@ -15,7 +15,7 @@ This method will query the provided url to update the information stored in the | url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | - If there are no errors, this request will return an empty response. + If there are no errors, this request will return an empty response. For wallets with numerous NFTs, this request may take a long time to complete. #### 📌 Example From 93c697eddc5b0dc054b1504c8a437bb7bcc8e0ab Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 17:07:54 +0800 Subject: [PATCH 66/85] tweak description --- .../api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index 74efd9a0..ab06984d 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -16,7 +16,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | chains | array | List of chains to scan for NFTs. | | max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | | page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | | protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | | filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | From c4f744fbdde975745078e9213bddb6c0d20d50b0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 17:12:44 +0800 Subject: [PATCH 67/85] add note about deprecation --- .../api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index ab06984d..5407afe0 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -49,7 +49,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | from\_address | string | Address of previous owner which sent the token(s). | | to\_address | string | Address of new owner which received the token(s). | | status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | | operator | string | May be `null`. | From 3b9b268c5a2482356a4d4b0430ac6631fc587f03 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 18:14:55 +0800 Subject: [PATCH 68/85] add more notes, examples and error responses --- filepathSlugs.json | 50 +- .../get_nft_list/index.mdx | 29 +- .../get_nft_metadata/index.mdx | 3 +- .../api/v20-dev/non_fungible_tokens/index.mdx | 781 +----------------- .../refresh_nft_metadata/index.mdx | 221 ----- .../withdraw_nft/index.mdx | 306 ++++--- src/pages/atomicdex/api/v20/index.mdx | 30 +- utils/_fileData.json | 10 +- 8 files changed, 240 insertions(+), 1190 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 2b5105cf..26cc1dd4 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2439,7 +2439,6 @@ "example-of-qrc20-type", "example-of-tendermint-type", "example-of-utxo-type", - "withdraw-nft-type", "withdraw-nft-data" ], "src/pages/atomicdex/api/v20/message_signing/index.mdx": [ @@ -2833,13 +2832,15 @@ "request-parameters", "response-parameters", "example-with-no-optional-params", - "example-with-optional-limit-and-page-number-params" + "example-with-optional-limit-and-page-number-params", + "example-with-optional-spam-protection" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx": [ "get-nft-metadata", "request-parameters", "response-parameters", - "example" + "example", + "error-responses" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx": [ "get-a-list-of-nft-transfers", @@ -2850,43 +2851,12 @@ "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx": [ "non-fungible-tokens-nfts", "nft-information-methods", - "nft-transaction-methods", - "get-a-list-of-nfts", - "request-parameters", - "response-parameters", - "example-with-no-optional-params", - "example-with-optional-limit-and-page-number-params", - "get-a-list-of-nft-transfers", - "request-parameters-2", - "response-parameters-2", - "example-with-date-and-send-filters", - "get-nft-metadata", - "request-parameters-3", - "response-parameters-3", - "example", - "update-nft", - "request-parameters-4", - "example-2", - "refresh-nft-metadata", - "request-parameters-5", - "example-3", - "withdraw-nfts", - "request-parameters-6", - "response-parameters-4", - "erc-721-withdraw-example", - "erc-1155-withdraw-example", - "erc-1155-withdraw-max-example" + "nft-transaction-methods" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx": [ "refresh-nft-metadata", "request-parameters", - "example", - "withdraw-nfts", - "request-parameters-2", - "response-parameters", - "erc-721-withdraw-example", - "erc-1155-withdraw-example", - "erc-1155-withdraw-max-example" + "example" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx": [ "update-nft", @@ -2899,7 +2869,13 @@ "response-parameters", "erc-721-withdraw-example", "erc-1155-withdraw-example", - "erc-1155-withdraw-max-example" + "erc-1155-withdraw-max-example", + "withdraw-nfts-error-responses", + "invalid-request-missing-field", + "invalid-request-wrong-withdraw-type", + "token-not-found-in-wallet-trying-to-send-nft-you-dont-own", + "transport-error-unable-to-estimate-gas", + "not-enough-nfts-amount-trying-to-send-more-nfts-than-you-have" ], "src/pages/atomicdex/api/v20-dev/task_account_balance/index.mdx": [ "account-balance-tasks", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 36c90b19..43dac9d8 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -7,8 +7,8 @@ export const description = Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. - Before using this method, you must first call the [update_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) - method to populate/refresh the local database. + Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. ### Request Parameters @@ -240,27 +240,26 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ``` - #### 📌 Example with optional spam protection ```json -{ + { "userpass": "testpsw", "method": "get_nft_list", "mmrpc": "2.0", "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "protect_from_spam": true, - "filters": { - "exclude_spam": true, - "exclude_phishing": true - } + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } } -} + } ``` @@ -320,4 +319,4 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` "id": null } ``` - \ No newline at end of file + diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx index 02a87d36..4828846b 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -97,7 +97,6 @@ export const description = ``` - ## Error responses ``` @@ -113,4 +112,4 @@ export const description = }, "id": null } -``` \ No newline at end of file +``` diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index 6d7b87f2..db34027e 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -8,783 +8,16 @@ The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1 ## NFT Information Methods -* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts) -* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers) -* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata) -* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft) -* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata) +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) ## NFT Transaction Methods -* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-721-withdraw-example) -* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example) - -## Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} - -Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. - -### Request Parameters - -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | - -#### 📌 Example with no optional params - - - ```json - { - "userpass": "testpsw", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ] - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "BSC", - "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", - "token_id": "0", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "b34ddf294013d20a6d70691027625839", - "block_number_minted": 25465916, - "block_number": 25919780, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", - "token_domain": "tikimetadata.s3.amazonaws.com", - "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", - "last_token_uri_sync": "2023-02-07T17:10:08.402Z", - "last_metadata_sync": "2023-02-07T17:10:16.858Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_domain": "tikimetadata.s3.amazonaws.com", - "name": "Tiki box", - "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", - "attributes": [ - { - "trait_type": "Crypto Logo", - "value": "TIKI NFT CRYPTOLOGO SCAR" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "", - "external_domain": null, - "image_details": null - } - }, - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 0, - "total": 2 - }, - "id": null - } - ``` - - -#### 📌 Example with optional limit & page\_number params - - - ```json - { - "userpass": "testpsw", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "limit": 1, - "page_number": 2 - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 1, - "total": 1 - }, - "id": null - } - ``` - - -## Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} - -Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. - -### Request Parameters - -| Parameter | Type | Description | -| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - - -#### 📌 Example with date and `send` filters - - - ```json - { - "userpass": "testpsw", - "method": "get_nft_transfers", - "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" - ], - "max": true, - "filters": { - "send": true, - "from_date": 1676636291 - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "transfer_history": [ - { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, - "value": "0", - "contract_type": "ERC1155", - "transaction_type": "Single", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", - "verified": 1, - "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "collection_name": null, - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false - } - ], - "skipped": 1, - "total": 2 - }, - "id": null - } - ``` - - -## Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | - -### Response Parameters - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | - -#### 📌 Example - - - ```json - { - "userpass": "testpsw", - "method": "get_nft_metadata", - "mmrpc": "2.0", - "params": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "chain": "BSC" - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "chain": "BSC", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "125f8f4e952e107c257960000b4b250e", - "block_number_minted": 25810308, - "block_number": 28056721, - "contract_type": "ERC721", - "name": "Binance NFT Mystery Box-Back to Blockchain Future", - "symbol": "BMBBBF", - "token_uri": "https://public.nftstatic.com/static/nft/BSC/BMBBBF/214300044414", - "token_domain": "public.nftstatic.com", - "metadata": "{\"image\":\"https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png\",\"name\":\"Nebula Nodes\",\"description\":\"Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.\"}", - "last_token_uri_sync": "2023-02-19T19:12:09.471Z", - "last_metadata_sync": "2023-02-19T19:12:18.080Z", - "minter_address": "0xdbdeb0895f3681b87fb3654b5cf3e05546ba24a9", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "image_url": "https://public.nftstatic.com/static/nft/res/4df0a5da04174e1e9be04b22a805f605.png", - "name": "Nebula Nodes", - "description": "Interchain nodes continuously exchange blockchain data amongst each other, supporting blockchain interoperability.", - "attributes": null, - "animation_url": null, - "animation_domain": null, - "external_url": null, - "external_domain": null, - "image_details": null - } - }, - "id": null - } - ``` - - -## Update NFT {{label : 'update_nft', tag : 'API-v2'}} - -This method will query the provided url to update the information stored in the local database. - -### Request Parameters - -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to update NFTs for. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | - - - If there are no errors, this request will return an empty response. - - -#### 📌 Example - - - ```json - { - "userpass": "testpsw", - "method": "update_nft", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": null, - "id": null - } - ``` - - - - Need to add some error responses here. - - -## Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} - -This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | -| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | - - - If there are no errors, this request will return an empty response. - - -#### 📌 Example - - - ```json - { - "userpass": "testpsw", - "method": "refresh_nft_metadata", - "mmrpc": "2.0", - "params": { - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "chain": "POLYGON", - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } - } - ``` - - - - - If there are no errors, this request will return an empty response. - - - ```json - { - "mmrpc": "2.0", - "result": null, - "id": null - } - ``` - - - - Need to add some error responses here. - - -## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} - - - To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | --------------------------------------------------------------------------- | -| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens to withdraw. | -| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | -| tx\_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | -| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction\_type | string | This will always be `NftTransfer`. | - - - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). - When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. - - -#### 📌 ERC721 Withdraw Example - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "BSC", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", - "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC721", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" - }, - "coin": "BNB", - "block_height": 0, - "timestamp": 1684239228, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - - -#### 📌 ERC1155 Withdraw Example - -If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2" - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", - "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000154089437979", - "total_fee": "0.01048116357133158" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241604, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - - -#### 📌 ERC1155 Withdraw Max Example - -If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "max": true - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", - "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000137182923005", - "total_fee": "0.0093311824228001" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241781, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx index b570978d..9f403e48 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx @@ -56,224 +56,3 @@ This method refreshes metadata of one NFT and metadata of related transactions w Need to add some error responses here. - -## Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} - - - To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | --------------------------------------------------------------------------- | -| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens to withdraw. | -| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | -| tx\_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | -| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction\_type | string | This will always be `NftTransfer`. | - - - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). - When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. - - -#### 📌 ERC721 Withdraw Example - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "BSC", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", - "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC721", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" - }, - "coin": "BNB", - "block_height": 0, - "timestamp": 1684239228, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - - -#### 📌 ERC1155 Withdraw Example - -If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2" - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", - "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000154089437979", - "total_fee": "0.01048116357133158" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241604, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - - -#### 📌 ERC1155 Withdraw Max Example - -If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - - - ```json - { - "userpass": "testpsw", - "method": "withdraw_nft", - "mmrpc": "2.0", - "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "max": true - } - } - } - } - ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", - "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000137182923005", - "total_fee": "0.0093311824228001" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241781, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null - } - ``` - - - - View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) - diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx index 4fad73fd..7a267028 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx @@ -6,13 +6,15 @@ export const description = To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | --------------------------------------------------------------------------- | -| withdraw\_type | object | A standard [WithdrawNftType](/atomicdex/api/v20/#withdraw-nft-type) object. | +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | ### Response Parameters @@ -33,12 +35,6 @@ export const description = | internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | | transaction\_type | string | This will always be `NftTransfer`. | - - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT is absolutely unique - it has only 1 owner and the owner can own only 1 NFT which has this `token_id` in its `token_address` (also referred to as contract address). - When the `type` value in `WithdrawType` is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the `type` value in `WithdrawType` is `withdraw_erc1155`. - - #### 📌 ERC721 Withdraw Example @@ -48,14 +44,12 @@ export const description = "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "withdraw_type": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "BSC", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" - } + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } } } @@ -65,34 +59,34 @@ export const description = ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8ca0c84b2d05e008301acab94fd913a305d70a60aac4faac70c739563738e1f8180b86442842e0e000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc2297064582000000000000000000000000000000000000000000000000000000031e5472c7e8194a07eaa06fe70087b8fef9774472c3bc72ad4c6814ea1fac6515a45987864892f0ca05806e069db608f26f7442595815fbe04f117f10171557e7228d354d0e2f2ac05", - "tx_hash": "5d93549408b3bae1c7a03fcc37a7cb7cca37b141de9119c2b87cff1d540507d7", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC721", - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", + "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 35218, + "gas_price": "0.000000040827827163", + "total_fee": "0.001437874417026534" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732198, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "coin": "BNB", - "block_height": 0, - "timestamp": 1684239228, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "id": null } ``` @@ -108,15 +102,12 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2" - } + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } } } @@ -126,34 +117,34 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c058523e0723b1b830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a04fe9a78bcc8f2f859b5ee686369d3d7655cee2646eb78c1d16d8794679b5b907a01804d88b721afcc4721dda00eee2562f433c5bb28ad3bbf4d0e5d70bc0e18ff3", - "tx_hash": "337b217448662694ca59ab0840e3f22e422b68fd8e3b52424eb9052f6b150d5c", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000154089437979", - "total_fee": "0.01048116357133158" + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", + "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 62368, + "gas_price": "0.000000012347931462", + "total_fee": "0.000770115789422016" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732805, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241604, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "id": null } ``` @@ -169,15 +160,13 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "withdraw_type": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "max": true - } + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1" } } } @@ -187,34 +176,119 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014c05851ff0bd48fd830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a02ba2e28c3ff90713ff74b73f76b5db609e2329c3322253cff4646609ea0280d0a03fcf71754cff41f2f785533d7d74b126f7b3d46d09550a17a8dc48381b01c54c", - "tx_hash": "8a98473681e66372ef87a1f40ccf145023ca1f5667560763a9a2e62403feeb83", - "from": [ - "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" - ], - "to": [ - "0x6FAD0eC6bb76914b2a2a800686acc22970645820" - ], - "contract_type": "ERC1155", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "2", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 68020, - "gas_price": "0.000000137182923005", - "total_fee": "0.0093311824228001" + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", + "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC1155", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 59963, + "gas_price": "0.00000003794123733", + "total_fee": "0.00227507041401879" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732937, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + + + ### 📌 Withdraw NFTs Error Responses + + #### InvalidRequest (missing field) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `type`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `type`", + "id": null + } + ``` + + #### InvalidRequest (wrong withdraw type) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "id": null + } + ``` + + #### TokenNotFoundInWallet (trying to send NFT you dont own) + + ``` + { + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", + "error_path": "eth.nft", + "error_trace": "eth:883] nft:1177]", + "error_type": "GetNftInfoError", + "error_data": { + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" + } + }, + "id": null + } + ``` + + #### TransportError (unable to estimate gas) + + ``` + { + "mmrpc": "2.0", + "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "error_path": "eth", + "error_trace": "eth:1004] eth:5792]", + "error_type": "Transport", + "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "id": null + } + ``` + + #### NotEnoughNftsAmount (trying to send more NFTs than you have) + + ``` + { + "mmrpc": "2.0", + "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", + "error_path": "eth", + "error_trace": "eth:897]", + "error_type": "NotEnoughNftsAmount", + "error_data": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "available": "1", + "required": "2" }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1684241781, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "id": null } ``` diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 80a8de0d..b4d37774 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -722,26 +722,6 @@ The `WithdrawFee` object varies depending on the coin or token type. Refer to th ``` -### WithdrawNftType - -The `WithdrawNftType` object is used for NFT withdrawals. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| -------------- | ------ | --------------------------------------------------------------------------- | -| type | string | The withdrawal type. Either `withdraw_erc721` or `withdraw_erc1155`. | -| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | - - - When the `type` value in `WithdrawType` is `withdraw_erc721` it means the NFT - is absolutely unique - it has only 1 owner and the owner can own only 1 NFT - which has this `token_id` in its `token_address` (also referred to as contract - address). When the `type` value in `WithdrawType` is `withdraw_erc1155`, it - means that it is possible for more than 1 user to own one or more of the same - NFT (with an identical `token_id`). Due to this difference, the `amount` and - `max` fields are only used the when `type` value in `WithdrawType` is - `withdraw_erc1155`. - - ### WithdrawNftData The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: @@ -755,3 +735,13 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | | amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + diff --git a/utils/_fileData.json b/utils/_fileData.json index 0189cc80..9910e5a8 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1173,7 +1173,7 @@ } }, "/atomicdex/api": { - "dateModified": "2023-10-03T12:10:07.000Z", + "dateModified": "2023-11-23T06:27:52.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3474,7 +3474,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { - "dateModified": "2023-11-23T06:10:48.000Z", + "dateModified": "2023-11-23T08:37:43.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3487,7 +3487,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { - "dateModified": "2023-11-23T06:14:39.000Z", + "dateModified": "2023-11-23T09:04:59.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3500,7 +3500,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers": { - "dateModified": "2023-11-23T06:23:01.000Z", + "dateModified": "2023-11-23T09:12:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3555,7 +3555,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/update_nft": { - "dateModified": "2023-11-23T06:23:37.000Z", + "dateModified": "2023-11-23T09:05:36.000Z", "contributors": [ { "name": "\"smk762\"", From 44f6ba32c9e93455c80d2b5ba55ed911ce8c77e3 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 23 Nov 2023 18:20:11 +0800 Subject: [PATCH 69/85] add NFT methods to postman --- .../mm2_dev.postman_collection.json | 341 +++++++++++++++++- 1 file changed, 340 insertions(+), 1 deletion(-) diff --git a/postman/collections/mm2_dev.postman_collection.json b/postman/collections/mm2_dev.postman_collection.json index 86abf442..8a4d631b 100644 --- a/postman/collections/mm2_dev.postman_collection.json +++ b/postman/collections/mm2_dev.postman_collection.json @@ -3218,7 +3218,346 @@ "response": [] } ] - }, + }, + { + "name": "Non Fungible Tokens", + "item": [ + { + "name": "get_nft_list", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"get_nft_list\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"chains\": [\n \"POLYGON\"\n ]\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts)" + }, + "response": [ + { + "name": "Example with optional limit & page_number params", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": " {\n \"userpass\": \"{{userpass}}\",\n \"method\": \"get_nft_list\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"chains\": [\n \"BSC\",\n \"POLYGON\"\n ],\n \"limit\": 1,\n \"page_number\": 2\n }\n }", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts)" + }, + "_postman_previewlanguage": "JSON", + "header": null, + "cookie": [], + "body": null + }, + { + "name": "Example with spam protection", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"get_nft_list\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"chains\": [\n \"BSC\",\n \"POLYGON\"\n ],\n \"protect_from_spam\": true,\n \"filters\": {\n \"exclude_spam\": true,\n \"exclude_phishing\": true\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nfts)" + }, + "_postman_previewlanguage": "JSON", + "header": null, + "cookie": [], + "body": null + } + ] + }, + { + "name": "get_nft_transfers", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"get_nft_transfers\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"chains\": [\n \"POLYGON\"\n ],\n \"max\": true,\n \"filters\": {\n \"send\": true,\n \"from_date\": 1690890685\n }\n }\n}\n", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-a-list-of-nft-transfers)" + }, + "response": [] + }, + { + "name": "get_nft_metadata", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"get_nft_metadata\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"token_address\": \"0x2953399124f0cbb46d2cbacd8a89cf0599974963\",\n \"token_id\": \"110473361632261669912565539602449606788298723469812631769659886404530570536720\",\n \"chain\": \"POLYGON\"\n }\n}", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#get-nft-metadata)" + }, + "response": [] + }, + { + "name": "refresh_nft_metadata", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"refresh_nft_metadata\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"token_address\": \"0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff\",\n \"token_id\": \"5\",\n \"chain\": \"POLYGON\",\n \"url\": \"https://moralis-proxy.komodo.earth\",\n \"url_antispam\": \"https://nft.antispam.dragonhound.info\"\n }\n}\n\n", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#refresh-nft-metadata)" + }, + "response": [] + }, + { + "name": "update_nft", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"update_nft\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"chains\": [\n \"BSC\",\n \"POLYGON\"\n ],\n \"url\": \"https://moralis-proxy.komodo.earth\",\n \"url_antispam\": \"https://nft.antispam.dragonhound.info\"\n }\n}\n", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#update-nft)" + }, + "response": [] + }, + { + "name": "withdraw_nft", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"withdraw_nft\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"type\": \"withdraw_erc721\",\n \"withdraw_data\": {\n \"chain\": \"POLYGON\",\n \"to\": \"0x27Ad1F808c1ef82626277Ae38998AfA539565660\",\n \"token_address\": \"0x73a5299824cd955af6377b56f5762dc3ca4cc078\",\n \"token_id\": \"1\"\n }\n }\n}\n", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#withdraw-nfts](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#withdraw-nfts)" + }, + "response": [] + }, + { + "name": "withdraw_nft (erc1155)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"userpass\", pm.environment.get(\"userpass\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"withdraw_nft\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"type\": \"withdraw_erc1155\",\n \"withdraw_data\": {\n \"chain\": \"POLYGON\",\n \"to\": \"0x27Ad1F808c1ef82626277Ae38998AfA539565660\",\n \"token_address\": \"0x2953399124f0cbb46d2cbacd8a89cf0599974963\",\n \"token_id\": \"110473361632261669912565539602449606788298723469812631769659886404530570536720\",\n \"amount\": \"1\"\n }\n }\n}", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + }, + "description": "[https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example](https://nft-methods.komodo-docs-revamp-2023.pages.dev/en/docs/atomicdex/api/v20-dev/non_fungible_tokens/#erc-1155-withdraw-example)" + }, + "response": [ + { + "name": "erc1155", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userpass\": \"{{userpass}}\",\n \"method\": \"withdraw_nft\",\n \"mmrpc\": \"2.0\",\n \"params\": {\n \"withdraw_type\": {\n \"type\": \"withdraw_erc721\",\n \"withdraw_data\": {\n \"chain\": \"BSC\",\n \"to\": \"0x6FAD0eC6bb76914b2a2a800686acc22970645820\",\n \"token_address\": \"0xfd913a305d70a60aac4faac70c739563738e1f81\",\n \"token_id\": \"214300044414\"\n }\n }\n }\n}\n", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{address}}", + "host": [ + "{{address}}" + ] + } + }, + "_postman_previewlanguage": null, + "header": null, + "cookie": [], + "body": null + } + ] + } + ] + }, { "name": "Wallet", "item": [ From 4d9063677267199666ef5c480b2e5c6ecf9d559f Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 4 Dec 2023 20:57:01 +0800 Subject: [PATCH 70/85] add nft db tables --- filepathSlugs.json | 13 +- .../get_nft_list/index.mdx | 20 ++- .../api/v20-dev/non_fungible_tokens/index.mdx | 5 + .../nft_database_tables/index.mdx | 126 ++++++++++++++++++ .../non_fungible_tokens/update_nft/index.mdx | 28 +++- 5 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx diff --git a/filepathSlugs.json b/filepathSlugs.json index 26cc1dd4..f7f4e1e8 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2833,7 +2833,9 @@ "response-parameters", "example-with-no-optional-params", "example-with-optional-limit-and-page-number-params", - "example-with-optional-spam-protection" + "example-with-optional-spam-protection", + "error-responses", + "unsupported-chain-type" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx": [ "get-nft-metadata", @@ -2853,6 +2855,15 @@ "nft-information-methods", "nft-transaction-methods" ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx": [ + "query-nft-database-tables", + "nft-list-tables", + "example-coin-nft-list-table-query", + "nft-transfer-table", + "example-scanned-nft-blocks-table-query", + "nft-last-scanned-block-table", + "example-scanned-nft-blocks-table-query-2" + ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx": [ "refresh-nft-metadata", "request-parameters", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 43dac9d8..399f4a56 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -15,7 +15,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` | Parameter | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | | max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | | limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | | page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | @@ -320,3 +320,21 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } ``` + +### 📌 Error responses + +#### Unsupported Chain Type + +The supported chains are + +``` +{ + "mmrpc":"2.0", + "error":"Error parsing request: UnsupportedChainType", + "error_path":"dispatcher", + "error_trace":"dispatcher:109]", + "error_type":"InvalidRequest", + "error_data":"UnsupportedChainType", + "id":null +} +``` diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx index db34027e..374a6312 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/index.mdx @@ -6,6 +6,11 @@ export const description = The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + ## NFT Information Methods * Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx new file mode 100644 index 00000000..a4b4fb23 --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx @@ -0,0 +1,126 @@ +export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; +export const description = + "This document describes how to query the local NFT database tables."; + +# Query NFT database tables + +After using the [update\_nft](atomicdex/api/v2-dev/non_fungible_tokens/update_nft) method to initialise your local NFT database, +the following tables are available in `DB/KOMODEFI.db`: + +* AVAX\_nft\_list +* AVAX\_nft\_transfer\_history +* BNB\_nft\_list +* BNB\_nft\_transfer\_history +* ETH\_nft\_list +* ETH\_nft\_transfer\_history +* FTM\_nft\_list +* FTM\_nft\_transfer\_history +* MATIC\_nft\_list +* MATIC\_nft\_transfer\_history +* scanned\_nft\_blocks + +## NFT List tables + +The COIN\_nft\_list tables contain the NFTs that you own, and have the following columns: +token\_address|token\_id|chain|amount|block\_number|contract\_type|possible\_spam|possible\_phishing|collection\_name|symbol|token\_uri|token\_domain|metadata|last\_token\_uri\_sync|last\_metadata\_sync|raw\_image\_url|image\_url|image\_domain|token\_name|description|attributes|animation\_url|animation\_domain|external\_url|external\_domain|image\_details|details\_json + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ----------- | +| 0 | token\_address | VARCHAR(256) | | +| 1 | token\_id | VARCHAR(256) | | +| 2 | chain | TEXT | | +| 3 | amount | VARCHAR(256) | | +| 4 | block\_number | INTEGER | | +| 5 | contract\_type | TEXT | | +| 6 | possible\_spam | INTEGER | | +| 7 | possible\_phishing | INTEGER | | +| 8 | collection\_name | TEXT | | +| 9 | symbol | TEXT | | +| 10 | token\_uri | TEXT | | +| 11 | token\_domain | TEXT | | +| 12 | metadata | TEXT | | +| 13 | last\_token\_uri\_sync | TEXT | | +| 14 | last\_metadata\_sync | TEXT | | +| 15 | raw\_image\_url | TEXT | | +| 16 | image\_url | TEXT | | +| 17 | image\_domain | TEXT | | +| 18 | token\_name | TEXT | | +| 19 | description | TEXT | | +| 20 | attributes | TEXT | | +| 21 | animation\_url | TEXT | | +| 22 | animation\_domain | TEXT | | +| 23 | external\_url | TEXT | | +| 24 | external\_domain | TEXT | | +| 25 | image\_details | TEXT | | +| 26 | details\_json | TEXT | | + +### Example COIN\_nft\_list table query + +> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; + +| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | +| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | +| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | +| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | +| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | +| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | +| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | + +The NFTs listed above are all spam, and will be ignored by the [list\_nfts](atomicdex/api/v2-dev/non_fungible_tokens/list_nfts) method. + +## NFT Transfer table + +The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: + +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ----------- | +| 0 | transaction\_hash | VARCHAR(256) | | +| 1 | log\_index | INTEGER | | +| 2 | chain | TEXT | | +| 3 | block\_number | INTEGER | | +| 4 | block\_timestamp | INTEGER | | +| 5 | contract\_type | TEXT | | +| 6 | token\_address | VARCHAR(256) | | +| 7 | token\_id | VARCHAR(256) | | +| 8 | status | TEXT | | +| 9 | amount | VARCHAR(256) | | +| 10 | possible\_spam | INTEGER | | +| 11 | possible\_phishing | INTEGER | | +| 12 | token\_uri | TEXT | | +| 13 | token\_domain | TEXT | | +| 14 | collection\_name | TEXT | | +| 15 | image\_url | TEXT | | +| 16 | image\_domain | TEXT | | +| 17 | token\_name | TEXT | | +| 18 | details\_json | TEXT | | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` + +| transaction\_hash | log\_index | chain | block\_number | block\_timestamp | contract\_type | token\_address | token\_id | status | amount | possible\_spam | possible\_phishing | token\_uri | token\_domain | collection\_name | image\_url | image\_domain | token\_name | details\_json | +| ------------------------------------------------------------------ | ---------- | ------- | ------------- | ---------------- | -------------- | ------------------------------------------ | --------- | ------- | ------ | -------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | -------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| | | | | | | | | | | | | | | | | | | | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | 512 | POLYGON | 50651981 | 1701519326 | ERC1155 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | Receive | 1 | 1 | 0 | [https://ipfs.io/ipfs/bafybeidyrvvtmkicjmj235lzo3ilrgd4ghwgvneqeobna6lox663i7k764/token.json](https://ipfs.io/ipfs/bafybeidyrvvtmkicjmj235lzo3ilrgd4ghwgvneqeobna6lox663i7k764/token.json) | ipfs.io | $2000 USDT Airdrop🎁 | ipfs\://bafybeibfbnyp3yabkowcfbiqkylrwufblx7kkjvsn264s3yep7zamwol5m/USDT.JPG | bafybeibfbnyp3yabkowcfbiqkylrwufblx7kkjvsn264s3yep7zamwol5m | $2000 USDT Airdrop🎁 | \{"block\_hash":"0x41a4f453b1589c43edecadd75c8c501e0d22c87268e3f56d0d03fd6a77ed37f4","transaction\_index":78,"value":"0","transaction\_type":"Single","verified":1,"operator":"0x509517aadfa276de25d0822446386dfce6ac386e","from\_address":"0x0000000000000000000000000000000000000000","to\_address":"0x0000000000000000000000000000000000000000","fee\_details":\{"coin":"MATIC","gas":2154020,"gas\_price":"0.000000031375683387","total\_fee":"0.06758384952926574"}} | + +## NFT Last Scanned Block table + +The scanned\_nft\_blocks table contains the last block that was scanned for each chain. +It has the following columns: + +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ----------- | +| 0 | chain | TEXT | | +| 1 | last\_scanned\_block | INTEGER | | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM scanned_nft_blocks;` + +| chain | last\_scanned\_block | +| ----- | -------------------- | +| MATIC | 50651981 | +| FTM | 66512090 | +| ETH | 0 | +| BNB | 0 | +| AVAX | 0 | diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx index b064d024..be02f288 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx @@ -4,18 +4,32 @@ export const description = # Update NFT {{label : 'update_nft', tag : 'API-v2'}} -This method will query the provided url to update the information stored in the local database. +This method will scan selected networks to update NFT information stored in the local database. +To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. + +See below for which coin to activate for each network: + +| Network | Coin | +| --------- | ----- | +| AVALANCHE | AVAX | +| BSC | BNB | +| ETH | ETH | +| FANTOM | FTM | +| POLYGON | MATIC | + +These coins can be activated using the [enable\_eth\_with\_tokens](/api-v2/eth/enable_eth_with_tokens) or method. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to update NFTs for. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | +| Parameter | Type | Description | +| ------------- | ------ | --------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | - If there are no errors, this request will return an empty response. For wallets with numerous NFTs, this request may take a long time to complete. + If there are no errors, this request will return an empty response. + When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. #### 📌 Example From 65ded0ba584d61195d809918b2280391551a3d87 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 4 Dec 2023 22:26:29 +0800 Subject: [PATCH 71/85] fix lint, update sidebar --- filepathSlugs.json | 2 +- src/data/sidebar.json | 4 ++++ .../index.mdx | 4 ++-- .../api/v20-dev/non_fungible_tokens/update_nft/index.mdx | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) rename src/pages/atomicdex/api/v20-dev/non_fungible_tokens/{nft_database_tables => query_nft_database_tables}/index.mdx (97%) diff --git a/filepathSlugs.json b/filepathSlugs.json index f7f4e1e8..6bdb6142 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2855,7 +2855,7 @@ "nft-information-methods", "nft-transaction-methods" ], - "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx": [ + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx": [ "query-nft-database-tables", "nft-list-tables", "example-coin-nft-list-table-query", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index ec158cda..ab29e329 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -429,6 +429,10 @@ { "title": "Withdraw NFT", "href": "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/" + }, + { + "title": "Query NFT Database Tables", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/" } ] }, diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx similarity index 97% rename from src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx rename to src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx index a4b4fb23..b694da6e 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/nft_database_tables/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx @@ -4,7 +4,7 @@ export const description = # Query NFT database tables -After using the [update\_nft](atomicdex/api/v2-dev/non_fungible_tokens/update_nft) method to initialise your local NFT database, +After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, the following tables are available in `DB/KOMODEFI.db`: * AVAX\_nft\_list @@ -66,7 +66,7 @@ token\_address|token\_id|chain|amount|block\_number|contract\_type|possible\_spa | POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | | POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | -The NFTs listed above are all spam, and will be ignored by the [list\_nfts](atomicdex/api/v2-dev/non_fungible_tokens/list_nfts) method. +The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. ## NFT Transfer table diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx index be02f288..ef142e0c 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/index.mdx @@ -17,7 +17,7 @@ See below for which coin to activate for each network: | FANTOM | FTM | | POLYGON | MATIC | -These coins can be activated using the [enable\_eth\_with\_tokens](/api-v2/eth/enable_eth_with_tokens) or method. +These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. ### Request Parameters From 7d78a11751316e0355fbf77a62a453c3b4b5d232 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 5 Dec 2023 01:15:38 +0800 Subject: [PATCH 72/85] add nft database table column descriptions --- .../query_nft_database_tables/index.mdx | 123 +++++++++--------- utils/_fileData.json | 27 +++- 2 files changed, 81 insertions(+), 69 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx index b694da6e..fbed2f65 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx @@ -21,38 +21,38 @@ the following tables are available in `DB/KOMODEFI.db`: ## NFT List tables -The COIN\_nft\_list tables contain the NFTs that you own, and have the following columns: -token\_address|token\_id|chain|amount|block\_number|contract\_type|possible\_spam|possible\_phishing|collection\_name|symbol|token\_uri|token\_domain|metadata|last\_token\_uri\_sync|last\_metadata\_sync|raw\_image\_url|image\_url|image\_domain|token\_name|description|attributes|animation\_url|animation\_domain|external\_url|external\_domain|image\_details|details\_json - -| ID | Name | Type | Description | -| -- | ---------------------- | ------------ | ----------- | -| 0 | token\_address | VARCHAR(256) | | -| 1 | token\_id | VARCHAR(256) | | -| 2 | chain | TEXT | | -| 3 | amount | VARCHAR(256) | | -| 4 | block\_number | INTEGER | | -| 5 | contract\_type | TEXT | | -| 6 | possible\_spam | INTEGER | | -| 7 | possible\_phishing | INTEGER | | -| 8 | collection\_name | TEXT | | -| 9 | symbol | TEXT | | -| 10 | token\_uri | TEXT | | -| 11 | token\_domain | TEXT | | -| 12 | metadata | TEXT | | -| 13 | last\_token\_uri\_sync | TEXT | | -| 14 | last\_metadata\_sync | TEXT | | -| 15 | raw\_image\_url | TEXT | | -| 16 | image\_url | TEXT | | -| 17 | image\_domain | TEXT | | -| 18 | token\_name | TEXT | | -| 19 | description | TEXT | | -| 20 | attributes | TEXT | | -| 21 | animation\_url | TEXT | | -| 22 | animation\_domain | TEXT | | -| 23 | external\_url | TEXT | | -| 24 | external\_domain | TEXT | | -| 25 | image\_details | TEXT | | -| 26 | details\_json | TEXT | | +The COIN\_nft\_list tables contain the NFTs that you own +It has the following columns, though not all columns are populated for all NFTs: + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | +| 0 | token\_address | VARCHAR(256) | The address of the token contract. | +| 1 | token\_id | VARCHAR(256) | The id of the token. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 4 | block\_number | INTEGER | The block height of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 8 | collection\_name | TEXT | The collection name which includes the token. | +| 9 | symbol | TEXT | An arbitrary symbol for the NFT | +| 10 | token\_uri | TEXT | A link to the token's metadata. | +| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 12 | metadata | TEXT | The token's metadata in JSON format. | +| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | +| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | +| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | +| 16 | image\_url | TEXT | A link for the token's image (or other media). | +| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 18 | token\_name | TEXT | The name of the token. | +| 19 | description | TEXT | An arbitrary description of the NFT. | +| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | +| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | +| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | +| 23 | external\_url | TEXT | Additional URL related to the NFT | +| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | +| 25 | image\_details | TEXT | Additional details about the NFT's image. | +| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | ### Example COIN\_nft\_list table query @@ -72,46 +72,45 @@ The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list]( The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: -| ID | Name | Type | Description | -| -- | ------------------ | ------------ | ----------- | -| 0 | transaction\_hash | VARCHAR(256) | | -| 1 | log\_index | INTEGER | | -| 2 | chain | TEXT | | -| 3 | block\_number | INTEGER | | -| 4 | block\_timestamp | INTEGER | | -| 5 | contract\_type | TEXT | | -| 6 | token\_address | VARCHAR(256) | | -| 7 | token\_id | VARCHAR(256) | | -| 8 | status | TEXT | | -| 9 | amount | VARCHAR(256) | | -| 10 | possible\_spam | INTEGER | | -| 11 | possible\_phishing | INTEGER | | -| 12 | token\_uri | TEXT | | -| 13 | token\_domain | TEXT | | -| 14 | collection\_name | TEXT | | -| 15 | image\_url | TEXT | | -| 16 | image\_domain | TEXT | | -| 17 | token\_name | TEXT | | -| 18 | details\_json | TEXT | | +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | +| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | +| 1 | log\_index | INTEGER | Simply a table index. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | block\_number | INTEGER | The block height of this transaction. | +| 4 | block\_timestamp | INTEGER | The block time of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | token\_address | VARCHAR(256) | The address of the token contract. | +| 7 | token\_id | VARCHAR(256) | The id of the token. | +| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | +| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 12 | token\_uri | TEXT | A link to the token's metadata. | +| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 14 | collection\_name | TEXT | The collection name which includes the token. | +| 15 | image\_url | TEXT | A link for the token's image (or other media). | +| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 17 | token\_name | TEXT | The name of the token. | +| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | ### Example scanned\_nft\_blocks table query -`SELECT * FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` +`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` -| transaction\_hash | log\_index | chain | block\_number | block\_timestamp | contract\_type | token\_address | token\_id | status | amount | possible\_spam | possible\_phishing | token\_uri | token\_domain | collection\_name | image\_url | image\_domain | token\_name | details\_json | -| ------------------------------------------------------------------ | ---------- | ------- | ------------- | ---------------- | -------------- | ------------------------------------------ | --------- | ------- | ------ | -------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | -------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| | | | | | | | | | | | | | | | | | | | -| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | 512 | POLYGON | 50651981 | 1701519326 | ERC1155 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | Receive | 1 | 1 | 0 | [https://ipfs.io/ipfs/bafybeidyrvvtmkicjmj235lzo3ilrgd4ghwgvneqeobna6lox663i7k764/token.json](https://ipfs.io/ipfs/bafybeidyrvvtmkicjmj235lzo3ilrgd4ghwgvneqeobna6lox663i7k764/token.json) | ipfs.io | $2000 USDT Airdrop🎁 | ipfs\://bafybeibfbnyp3yabkowcfbiqkylrwufblx7kkjvsn264s3yep7zamwol5m/USDT.JPG | bafybeibfbnyp3yabkowcfbiqkylrwufblx7kkjvsn264s3yep7zamwol5m | $2000 USDT Airdrop🎁 | \{"block\_hash":"0x41a4f453b1589c43edecadd75c8c501e0d22c87268e3f56d0d03fd6a77ed37f4","transaction\_index":78,"value":"0","transaction\_type":"Single","verified":1,"operator":"0x509517aadfa276de25d0822446386dfce6ac386e","from\_address":"0x0000000000000000000000000000000000000000","to\_address":"0x0000000000000000000000000000000000000000","fee\_details":\{"coin":"MATIC","gas":2154020,"gas\_price":"0.000000031375683387","total\_fee":"0.06758384952926574"}} | +| transaction\_hash | token\_name | token\_address | token\_id | +| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | ## NFT Last Scanned Block table The scanned\_nft\_blocks table contains the last block that was scanned for each chain. It has the following columns: -| ID | Name | Type | Description | -| -- | -------------------- | ------- | ----------- | -| 0 | chain | TEXT | | -| 1 | last\_scanned\_block | INTEGER | | +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ---------------------------------------------------------------------- | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | ### Example scanned\_nft\_blocks table query diff --git a/utils/_fileData.json b/utils/_fileData.json index 9910e5a8..79089001 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -2824,7 +2824,7 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-11-22T14:47:28.000Z", + "dateModified": "2023-11-23T10:14:55.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3474,7 +3474,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { - "dateModified": "2023-11-23T08:37:43.000Z", + "dateModified": "2023-12-04T12:57:01.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3487,7 +3487,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { - "dateModified": "2023-11-23T09:04:59.000Z", + "dateModified": "2023-11-23T10:14:55.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3513,7 +3513,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens": { - "dateModified": "2023-11-23T06:23:37.000Z", + "dateModified": "2023-12-04T12:57:01.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3541,8 +3541,21 @@ "email": "smk762@iinet.net.au" } }, + "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables": { + "dateModified": "2023-12-04T14:26:29.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, "/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata": { - "dateModified": "2023-11-23T06:23:37.000Z", + "dateModified": "2023-11-23T10:14:55.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3555,7 +3568,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/update_nft": { - "dateModified": "2023-11-23T09:05:36.000Z", + "dateModified": "2023-12-04T14:26:29.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3568,7 +3581,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft": { - "dateModified": "2023-11-23T06:23:37.000Z", + "dateModified": "2023-11-23T10:14:55.000Z", "contributors": [ { "name": "\"smk762\"", From 137f6a52fcbe1409dafd1bd7625468295e6dbb52 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 4 Dec 2023 17:16:47 +0000 Subject: [PATCH 73/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- data-for-gpts/all-content.txt | 6421 +++++++++++++++++---------- data-for-gpts/atomicdex-content.txt | 6421 +++++++++++++++++---------- utils/_fileData.json | 2 +- 3 files changed, 8229 insertions(+), 4615 deletions(-) diff --git a/data-for-gpts/all-content.txt b/data-for-gpts/all-content.txt index f0f2333f..9b47f4b9 100644 --- a/data-for-gpts/all-content.txt +++ b/data-for-gpts/all-content.txt @@ -28732,6 +28732,9 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | +| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | +| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | +| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -28768,6 +28771,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | +| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -28807,11 +28811,13 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | +| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | +| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | export const title = "AtomicDEX Method: Active Swaps"; export const description = @@ -40445,156 +40451,800 @@ It includes a uniform request, successful and error response formats. At the mom } ``` -export const title = "AtomicDEX: Signing and Verifying Messages"; -export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; -# Signing\_and\_Verifying\_Messages +## Common Komodo DeFi SDK Request / Response Objects -Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). +The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. -If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). +### ActivationParams -```json -{ - "coin": "DOC", - "asset": "DOC", - "fname": "DOC (TESTCOIN)", - "sign_message_prefix": "Komodo Signed Message:\n", - "rpcport": 25435, - "txversion": 4, - "overwintered": 1, - "mm2": 1, - "protocol": { - "type": "UTXO" - } -} -``` +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. -## Sign Message +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | -### Arguments + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message you want to sign | +### ActivationMode -### Response +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. -| Structure | Type | Description | -| --------- | ------ | --------------------------------------- | -| signature | string | The signature generated for the message | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | -#### Command +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | + +### ActivationServers + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example - ```json { - "userpass": "testpsw", - "method": "sign_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion" + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 } } ``` - -#### Response (success) + #### HD UTXO Activation (v2) -```json -{ - "mmrpc": "2.0", - "result": { - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" - }, - "id": 0 -} -``` + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + -### ⚠ Error types +### AddressInfos -**PrefixNotFound:** sign\_message\_prefix is not set in coin config file -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message signing is not supported by the given coin type -**InternalError:** An internal error occured during the signing process +The `addressInfos` object includes the following items for a given address: -## Verify Message +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | -### Arguments + + #### Example with balances -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message input via the `sign_message` method sign | -| signature | string | The signature generated for the message | -| address | string | The address used to sign the message | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` -### Response + #### Example without balances -| Structure | Type | Description | -| --------- | ------- | ----------------------------------------------------------- | -| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + -#### Command +### BalanceInfos - +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + ```json { - "userpass": "testpsw", - "method": "verify_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion", - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", - "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" - } + "spendable": "12.11398301", + "unspendable": "0.53" } ``` - + -#### Response (valid) +### DerivationMethod -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": true - }, - "id": 0 -} -``` +The `DerivationMethod` object includes the following items for a given coin or token: -#### Response (not valid) +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": false - }, - "id": 0 -} -``` + + Using the same seed or private key to generate keypairs using different + derivation methods will result in a different address and private key for each + method. + -### ⚠ Error types +Where the value indicates: -**PrefixNotFound:** sign\_message\_prefix is not set in coin config -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message verification is not supported by the given coin type -**InternalError:** An internal error occured during the verification process -**SignatureDecodingError:** Given signature could not be decoded -**AddressDecodingError:** Given address could not be decoded -export const title = "AtomicDEX Method: My TX History"; -export const description = "The my_tx_history method allows you to view the transaction history of coins."; +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. -# my\_tx\_history + + ```json + { + "type": "Iguana" + } + ``` + -To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ----------------------------------------------------------------------------- | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to + `false` (the default value), as the node is not expected to be reliably + online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. See + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + +### TokenFilter + +The `TokenFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### TokenMetadata + +The `TokenMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | + + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### WithdrawFee + +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. + +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + #### Example of Eth type + + ```json + { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + } + ``` + + #### Example of Qrc20 type + + ```json + { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + } + ``` + + #### Example of Tendermint type + + ```json + { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + } + ``` + + #### Example of Utxo type + + ```json + { + "type": "Utxo", + "amount": "0.00001" + } + ``` + + +### WithdrawNftData + +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; + +# Signing\_and\_Verifying\_Messages + +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). + +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). + +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` + +## Sign Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | + +### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" + } + } + ``` + + +#### Response (success) + +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process + +## Verify Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | + +### Response + +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } + } + ``` + + +#### Response (valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` + +#### Response (not valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; + +# my\_tx\_history + +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. @@ -42936,55 +43586,288 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (KMD success) + #### Response (KMD success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "KMD", + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } + }, + "id": 0 + } + ``` + + #### Response (NotSufficientBalance error) + + ```json + { + "mmrpc": "2.0", + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" + }, + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoFixed", + "amount": "0.1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "error_path": "utxo_common", + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoPerKbyte", + "amount": "1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", + "block_height": 0, + "timestamp": 1566473421, + "fee_details": { + "type": "Utxo", + "amount": "0.38378905" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + +#### Withdraw ETH, ERC20, and other ETH-based forks + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +#### ETH/ERC20 and other ETH-based forks, with gas fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } + }, + "id": 0 + } + ``` + + + + #### Response (success) ```json { "mmrpc": "2.0", "result": { + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", "block_height": 0, - "coin": "KMD", + "timestamp": 1566474670, "fee_details": { - "type": "Utxo", - "amount": "0.00001" + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" }, - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "my_balance_change": "-10.00001", - "received_by_me": "0.34417325", - "spent_by_me": "10.34418325", - "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], - "total_amount": "10.34418325", - "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", - "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", - "kmd_rewards": { - "amount": "0.0791809", - "claimed_by_my": true - } + "coin": "ETH", + "internal_id": "" }, "id": 0 } ``` - #### Response (NotSufficientBalance error) + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) ```json { "mmrpc": "2.0", - "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:449]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "DOC", - "available": "69.75066225", - "required": "1000.00001" - }, + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee +#### Withdraw maximum ```json @@ -42993,13 +43876,9 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoFixed", - "amount": "0.1" - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true }, "id": 0 } @@ -43007,49 +43886,86 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) + ##### Response (success) ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", "block_height": 0, - "timestamp": 1566472936, + "coin": "ETH", "fee_details": { - "type": "Utxo", - "amount": "0.1" + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" }, - "coin": "DOC", - "internal_id": "" + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw QRC20 coins + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 }, "id": 0 } ``` + - #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ##### Response (success) ```json { "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "error_path": "utxo_common", - "error_trace": "utxo_common:1371]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee +##### Withdraw QRC20 coins with gas limit ```json @@ -43058,12 +43974,13 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, "fee": { - "type": "UtxoPerKbyte", - "amount": "1" + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 } }, "id": 0 @@ -43072,35 +43989,36 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", - "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.00253836", - "spent_by_me": "60.00253836", - "received_by_me": "59.61874931", - "my_balance_change": "-0.38378905", "block_height": 0, - "timestamp": 1566473421, + "coin": "QRC20", + "timestamp": 1608725061, "fee_details": { - "type": "Utxo", - "amount": "0.38378905" + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" }, - "coin": "DOC", - "internal_id": "" + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, "id": 0 } ``` -#### Withdraw ETH, ERC20, and other ETH-based forks +##### Withdraw Tendermint coins with a memo ```json @@ -43109,9 +44027,10 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "amount": 10 + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } @@ -43119,54 +44038,72 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", "block_height": 0, - "coin": "ETH", + "timestamp": 0, "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } ``` + + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; -#### ETH/ERC20 and other ETH-based forks, with gas fee +# get\_current\_mtp - +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", + "method": "get_current_mtp", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "id": 42, "params": { - "coin": "COIN_NAME", - "to": "RECIPIENT_ADDRESS", - "amount": "AMOUNT", - "fee": { - "type": "EthGas", - "gas_price": "3.5", - "gas": 55000 - } - }, - "id": 0 + "coin": "DOC" + } } ``` @@ -43178,809 +44115,1039 @@ The request was failed due to an AtomicDEX API internal error. { "mmrpc": "2.0", "result": { - "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", - "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", - "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "total_amount": "10", - "spent_by_me": "10.0001925", - "received_by_me": "10", - "my_balance_change": "-0.0001925", - "block_height": 0, - "timestamp": 1566474670, - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 55000, - "gas_price": "0.0000000035", - "total_fee": "0.0001925" - }, - "coin": "ETH", - "internal_id": "" + "mtp": 1658746383 }, - "id": 0 + "id": 42 } ``` + +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) +# get\_locked\_amount + +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response + +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | + +#### 📌 Examples + +#### Command + ```json { + "userpass": "testpsw", "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", - "error_path": "eth", - "error_trace": "eth:535]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'EthGas' fee type, found UtxoFixed", - "id": 0 + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 } ``` - + -#### Withdraw maximum + + #### Response (success) - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "max": true + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } }, - "id": 0 + "id": 42 } ``` - - - ##### Response (success) + #### Response (error) ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "ETH", - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" - }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 0 + "id": 42 } ``` +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; -##### Withdraw QRC20 coins +# Heirarchical Deterministic Address Management - +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. + +## can\_get\_new\_address + +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "can_get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10 - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - ##### Response (success) + #### Response (success, allowed) ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null + } + ``` + + #### Response (success, not allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null } ``` -##### Withdraw QRC20 coins with gas limit +## get\_new\_address + +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + +Other reasons you might not be able to get a new address are: - +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10, - "fee": { - "type": "Qrc20Gas", - "gas_limit": 250000, - "gas_price": 40 - } - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` + #### Response (success) + ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 250000, - "gas_price": 40, - "total_gas_fee": "0.1" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null } ``` - - -##### Withdraw Tendermint coins with a memo - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "IRIS", - "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", - "amount": 13, - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." - }, - "id": 0 - } - ``` - + #### Response (success, not allowed) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", - "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "13.038553", - "spent_by_me": "13.038553", - "received_by_me": "13", - "my_balance_change": "-0.038553", - "block_height": 0, - "timestamp": 0, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", - "transaction_type": "StandardTransfer", - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } }, - "id": 0 + "id": null } ``` - - You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) -export const title = "AtomicDEX Method: Get Current MTP"; -export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; -# get\_current\_mtp +# HD Wallets Overview -The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! -## Arguments +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. -| Parameter | Type | Description | -| --------- | ------- | --------------------------------------------------------------------------------------- | -| coin | string | A compatible (UTXO) coin's ticker | -| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + + + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. + + +## Details for HwError error type + +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + +### FoundUnexpectedDevice + +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` + +### FoundMultipleDevices + +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` + +### NoTrezorDeviceAvailable + +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + +# AtomicDEX API RPC Protocol v2.0 (Dev) + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### Response +### Response (Error) -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | -| mtp | integer | Unix timestamp | -| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### 📌 Examples +### 📌 Examples #### Command - + ```json { - "method": "get_current_mtp", - "userpass": "testpsw", "mmrpc": "2.0", - "id": 42, + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" - } + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 } ``` - - #### Response (success) +#### Response (success) - ```json - { - "mmrpc": "2.0", - "result": { - "mtp": 1658746383 +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Get Locked Amount"; -export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` -# get\_locked\_amount +#### Response (error) -The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; -## Arguments +# Lightning Network Initialization Tasks -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -#### Response +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} -| Parameter | Type | Description | -| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. -#### 📌 Examples + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + -#### Command +### Request Parameters - +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | + +#### 📌 Example + + ```json { + "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_locked_amount", "params": { - "coin": "DOC" + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 + } }, - "id": 42 + "id": 2 } ``` - #### Response (success) + ### Response Parameters - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "DOC", - "locked_amount": { - "decimal": "0.77803", - "rational": [ - [1, [77803]], - [1, [100000]] - ], - "fraction": { - "numer": "77803", - "denom": "100000" - } - } - }, - "id": 42 - } - ``` + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | - #### Response (error) + #### Response ```json { - "mmrpc": "2.0", - "error": "No such coin: TIME", - "error_path": "lp_swap.lp_coins", - "error_trace": "lp_swap:486] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": 42 + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null } ``` -export const title = "AtomicDEX: HD Address Management"; -export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; - -# Heirarchical Deterministic Address Management - -A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. - -## can\_get\_new\_address -To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. - -#### Arguments + + #### L2ConfigIsNotFound Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", + "id": 2 + } + ``` -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.allowed | boolean | Whether or not you can get a new address. | -| result.reason | string | The reason you cant get a new address (if allowed is `false`). | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + #### InvalidRequest Error -Other reasons you might not be able to get a new address are: + A parameter is incorrect. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 + } + ``` -#### 📌 Examples + #### UnexpectedL2Protocol Error -#### Command + Coin is wrong protocol type. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "can_get_new_address", - "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "mmrpc": "2.0", + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" + } + }, + "id": 2 } ``` - - - #### Response (success, allowed) + #### Internal Error + + Address already in use. ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null } ``` - #### Response (success, not allowed) + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. ```json { - "mmrpc": "2.0", - "result": { - "allowed": false, - "reason": "LastAddressNotUsed", - "details": { - "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" - } - }, - "id": null + "mmrpc": "2.0", + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 } ``` - - -## get\_new\_address -If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + -#### Arguments + #### InvalidPlatformConfiguration Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 + } + ``` + -| Parameter | Type | Description | -| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.new\_address | object | Contains details about your new address. | -| result.address | string | The new address that was generated. | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | -| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | -| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| result.details.balance | object | Contains the spendable and unspendable balance for this address | -| result.details.balance.spendable | string(numeric) | Spendable balance for this address | -| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} -Other reasons you might not be able to get a new address are: +The `task::enable_lightning::status` request checks the status of lightning node initialization. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) +### Request Parameters -#### 📌 Examples +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_new_address", + "method": "task::enable_lightning::status", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "task_id": 1, + "forget_if_finished": false + }, + "id": 2 } ``` - #### Response (success) + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` - #### Response (success, not allowed) + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) ```json { - "mmrpc": "2.0", - "result": { - "new_address": { - "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", - "derivation_path": "m/44'/141'/0'/0/3", - "chain": "External", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null } ``` - -export const title = "AtomicDEX: HD Wallets Overview"; -export const description = - "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; - -# HD Wallets Overview - -The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! - -For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. - -To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. - -## Initialisation and authentication: - -* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) -* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) -* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) -* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) -## UTXO Coin Activation in Hardware Mode: + Possible in progress statuses: -* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. -* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) -* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile + -## QTUM Coin Activation in Hardware Mode: +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} -* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. -* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) -* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) +The `task::enable_lightning::cancel` request cancels lightning node initialization. -## Withdrawing your Funds: +### Request Parameters -* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) -* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) -* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | -## Viewing Hardware Wallet Coin Balances: +#### 📌 Example -* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) -* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_lightning::cancel", + "params": { + "task_id": 1 + }, + "id": 1 + } + ``` + -## Creating New Addresses: + + #### Response -* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. -* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + - - These methods (and others with a `task::` prefix) will be linked to a numeric - `task_id` value which is used to query the status or outcome of the task. - + + #### TaskFinished Error -## Details for HwError error type + Task has already been completed. -When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null + } + ``` + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; -### FoundUnexpectedDevice +# Lightning Network Channels -The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found unexpected device. Please re-initialize Hardware wallet", - "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", - "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", - "error_type": "HwError", - "error_data": "FoundUnexpectedDevice" - } - }, - "id": null -} -``` +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} -### FoundMultipleDevices +The `lightning::channels::open_channel` method opens a new channel with a remote node. -Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. +### Request Parameters -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found multiple devices. Please unplug unused devices", - "error_path": "init_hw.crypto_ctx.hw_client", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", - "error_type": "HwError", - "error_data": "FoundMultipleDevices" - } - }, - "id": null -} -``` +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | -### NoTrezorDeviceAvailable +#### 📌 Example using an exact amount -No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 + } + }, + "id": 22 + } + ``` + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "No Trezor device available", - "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", - "error_type": "HwError", - "error_data": "NoTrezorDeviceAvailable" - } - }, - "id": null -} -``` -export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; -export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + + #### Response -# AtomicDEX API RPC Protocol v2.0 (Dev) + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + }, + "id": 22 + } + ``` + -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. +#### 📌 Example using max available with channel options and configs -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 + } + }, + "id": null + } + ``` + -## Request + + #### Response -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + }, + "id": null + } + ``` + -### Response (Success) +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| result | object | the value of this field is determined by the method invoked on AtomicDEX API | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +The `lightning::channels::close_channel` method closes a channel with a remote node. -### Response (Error) +### Request Parameters -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | -### 📌 Examples + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + -#### Command +#### 📌 Example to force closing a channel - + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "lightning::channels::close_channel", "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true }, - "id": 0 + "id": 8 } ``` -#### Response (success) + + #### Response -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` -#### Response (error) + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + -```json -{ - "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, - "id": 0 -} -``` -export const title = "AtomicDEX: Lightning Network Initialization Tasks"; -export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + + -# Lightning Network Initialization Tasks + + #### InvalidRequest Error - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 + } + ``` -## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} + #### NoSuchChannel Error -The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` + - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. - +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} + +The `lightning::channels::update_channel` method updates channel options. ### Request Parameters -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { - "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::channels::update_channel", "params": { - "ticker": "tBTC-lightning", - "activation_params": { - "name": "AtomicDEX-Docs-Node-1", - "listening_port": 9735, - "color": "000000", - "payment_retries": 5 + "coin": "tBTC-lightning", + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 } }, "id": 2 @@ -43989,255 +45156,246 @@ The `task::enable_lightning::init` request a task to run a lightning node. Use t - ### Response Parameters - - | Parameter | Type | Description | - | --------- | ------- | --------------------------------------------------------- | - | task\_id | integer | An identifying number which is used to query task status. | - #### Response ```json { - "mmrpc": "2.0", - "result": { - "task_id": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null + } + }, + "id": 2 } ``` - #### L2ConfigIsNotFound Error + #### NoSuchChannel Error - Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. + Channel with the given uuid is not foun on the lightning network. ```json { "mmrpc": "2.0", - "error": "Layer 2 tBTC-lightning config is not found", - "error_path": "init_l2.prelude", - "error_trace": "init_l2:82] prelude:82]", - "error_type": "L2ConfigIsNotFound", - "error_data": "tBTC-lightning", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", "id": 2 } ``` + - #### InvalidRequest Error +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} - A parameter is incorrect. +The `lightning::channels::get_channel_details` method returns details about a channel. - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string "9735", expected u16", - "error_path": "dispatcher", - "error_trace": "dispatcher:110]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string "9735", expected u16", - "id": 762 - } - ``` +### Request Parameters - #### UnexpectedL2Protocol Error +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | - Coin is wrong protocol type. +#### 📌 Example to update all available channel options + ```json { - "mmrpc": "2.0", - "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", - "error_path": "init_l2.prelude.lightning_activation", - "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", - "error_type": "UnexpectedL2Protocol", - "error_data": { - "ticker": "tBTC-segwit", - "protocol": { - "type": "UTXO" - } - }, - "id": 2 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_channel_details", + "params": { + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + }, + "id": 54 } ``` + - #### Internal Error + + + The response will vary depending on whether the channel status is `open` or `closed`. + - Address already in use. + #### Response (opened channel) ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "I/O error Address already in use (os error 48)", - "error_path": "lib.lightning_activation.ln_p2p", - "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", - "error_type": "Internal", - "error_data": "I/O error Address already in use (os error 48)" - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 } ``` - #### PlatformCoinIsNotActivated Error + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + - The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + #### Response (closed channel) ```json { "mmrpc": "2.0", - "error": "Platform coin tBTC-lightning is not activated", - "error_path": "init_l2.lp_coins", - "error_trace": "init_l2:87] lp_coins:3087]", - "error_type": "PlatformCoinIsNotActivated", - "error_data": "tBTC-lightning", - "id": 2 + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 } ``` - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) - Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + - #### InvalidPlatformConfiguration Error - - Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + + #### InvalidRequest Error ```json { "mmrpc": "2.0", - "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", - "error_path": "init_l2.lightning_activation", - "error_trace": "init_l2:95] lightning_activation:254]", - "error_type": "InvalidPlatformConfiguration", - "error_data": { - "platform_coin_ticker": "tBTC-segwit", - "err": "'avg_blocktime' field is not found in platform coin config" - }, - "id": 2 + "error": "Error parsing request: missing field `coin`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `coin`", + "id": 54 } ``` -## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} -The `task::enable_lightning::status` request checks the status of lightning node initialization. +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. ### Request Parameters -| Parameter | Type | Description | -| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | -| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::status", + "method": "lightning::channels::get_claimable_balances", "params": { - "task_id": 1, - "forget_if_finished": false + "coin": "tBTC-lightning", + "include_open_channels_balances": true }, - "id": 2 + "id": 762 } ``` - ### Response Parameters - - | Parameter | Type | Description | - | -------------- | ------ | ---------------------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | - - - The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. - - - #### Response (ready, success) - - ```json - { - "mmrpc": "2.0", - "result": { - "status": "Ok", - "details": { - "platform_coin": "BTC-segwit", - "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null - } - ``` - - - In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. - Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. - For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). - - - #### Response (in progress state) + #### Response ```json { - "mmrpc": "2.0", - "result": { - "status": "InProgress", - "details": "ReadingNetworkGraphFromFile" - }, - "id": null + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], + "id": 762 } ``` - Possible in progress statuses: - - * ActivatingCoin - * GettingFeesFromRPC - * ReadingNetworkGraphFromFile - * InitializingChannelManager - * InitializingPeerManager - * ReadingScorerFromFile - * InitializingBackgroundProcessor - * ReadingChannelsAddressesFromFile + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + -## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} -The `task::enable_lightning::cancel` request cancels lightning node initialization. +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------- | -------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without using `filter` parameter - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::cancel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { - "task_id": 1 + "coin": "tBTC-lightning" }, - "id": 1 + "id": 55 } ``` @@ -44247,71 +45405,113 @@ The `task::enable_lightning::cancel` request cancels lightning node initializati ```json { - "mmrpc": "2.0", - "result": "success", - "id": null + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 } ``` - - #### TaskFinished Error +#### 📌 Example with `filter` for inbound channels only - Task has already been completed. +#### Command + ```json { - "mmrpc": "2.0", - "error": "Task is finished already", - "error_path": "init_l2.manager", - "error_trace": "init_l2:157] manager:104]", - "error_type": "TaskFinished", - "error_data": 3, - "id": null + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 } ``` - -export const title = "AtomicDEX: Lightning Network Channels"; -export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; - -# Lightning Network Channels - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} + -The `lightning::channels::open_channel` method opens a new channel with a remote node. + + #### Response -### Request Parameters + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + -| Parameter | Type | Description | -| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to open a channel for. | -| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | -| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example using an exact amount +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Exact", - "value": 0.004 + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" } }, - "id": 22 + "id": 55 } ``` @@ -44323,47 +45523,54 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 22 + "id": 55 } ``` -#### 📌 Example using max available with channel options and configs +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Max" - }, - "push_msat": 0, - "channel_options": { - "proportional_fee_in_millionths_sats": 0, - "base_fee_msat": 1000, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 - }, - "channel_configs": { - "counterparty_locktime": 144, - "our_htlc_minimum_msat": 1, - "negotiate_scid_privacy": false, - "max_inbound_in_flight_htlc_percent": 10, - "commit_upfront_shutdown_pubkey": true, - "inbound_channels_confirmations": 3, - "their_channel_reserve_sats": 10000 + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 } }, - "id": null + "id": 55 } ``` @@ -44375,45 +45582,79 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": null + "id": 55 } ``` -## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} -The `lightning::channels::close_channel` method closes a channel with a remote node. +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| ------------ | ------- | ---------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to close a channel for. | -| uuid | string | Unique channel identifier. | -| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - - It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. - Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. - +#### 📌 Example without using `filter` parameter -#### 📌 Example to force closing a channel +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::close_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "force_close": true + "coin": "tBTC-lightning" }, - "id": 8 + "id": 55 } ``` @@ -44421,86 +45662,163 @@ The `lightning::channels::close_channel` method closes a channel with a remote n #### Response + ```json + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + ```json { - "mmrpc": "2.0", - "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "channel_type": "Inbound" + } + }, + "id": 55 } ``` + - - To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. - + + #### Response - - Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) - + ```json + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` - - #### InvalidRequest Error +#### 📌 Example with `filter` for a specific `node_id` + +#### Command + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `uuid`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `uuid`", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + } + }, + "id": 55 } ``` + - #### NoSuchChannel Error + + #### Response ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "error_path": "close_channel", - "error_trace": "close_channel:55]", - "error_type": "NoSuchChannel", - "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} - -The `lightning::channels::update_channel` method updates channel options. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value -#### 📌 Example to update all available channel options +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::update_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 } }, - "id": 2 + "id": 55 } ``` @@ -44512,298 +45830,313 @@ The `lightning::channels::update_channel` method updates channel options. { "mmrpc": "2.0", "result": { - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_sats": null + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 } }, - "id": 2 + "id": 762 } ``` +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - - #### NoSuchChannel Error +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - Channel with the given uuid is not foun on the lightning network. +# Lightning Network Methods + + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + + +## Lightning Network Initialization Tasks + +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) + + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + + +## Lightning Network Nodes Methods +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) + +## Lightning Network Channels Methods + +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) + +## Lightning Network Payments Methods + +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) + +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! + +Then you can: + +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +Follow the flowchart below to visualize the process: + + + +## Lightning Network Coins File Configuration + + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + + +### Lightning Coin Config Parameters + +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + + ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", - "error_path": "update_channel", - "error_trace": "update_channel:61]", - "error_type": "NoSuchChannel", - "error_data": "dc33b998-8589-44fd-a246-256a582e8942", - "id": 2 - } + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, ``` +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} +# Lightning Network Nodes -The `lightning::channels::get_channel_details` method returns details about a channel. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------ | -| coin | string | The ticker of the coin you would like to view channel details for. | -| uuid | string | Unique channel identifier. | +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::get_channel_details", + "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, - "id": 54 + "id": 1 } ``` - - - The response will vary depending on whether the channel status is `open` or `closed`. - + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: - #### Response (opened channel) + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 959722, - "is_outbound": true, - "balance_msat": 959722000, - "outbound_capacity_msat": 950125000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": 3, - "is_ready": false, - "is_usable": false, - "is_public": false - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. - It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) - - - #### Response (closed channel) + #### Response (already connected) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_value": "98982", - "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", - "closure_reason": "null", - "claiming_tx": "null", - "claimed_balance": "null", - "funding_generated_in_block": "null", - "is_outbound": false, - "is_public": true, - "is_closed": true, - "created_at": 167273496966, - "closed_at": 171069595935 - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - - The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) - - #### InvalidRequest Error + #### InvalidRequest Error (Invalid node\_address) ```json { "mmrpc": "2.0", - "error": "Error parsing request: missing field `coin`", + "error": "Error parsing request: Could not parse node address from str rgjhk3", "error_path": "dispatcher", "error_trace": "dispatcher:109]", "error_type": "InvalidRequest", - "error_data": "missing field `coin`", - "id": 54 - } - ``` - - -## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} - -The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. - -### Request Parameters - -| Parameter | Type | Description | -| --------------------------------- | ------- | ------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view claimable balances for. | -| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | - -#### 📌 Example to update all available channel options - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::get_claimable_balances", - "params": { - "coin": "tBTC-lightning", - "include_open_channels_balances": true - }, - "id": 762 + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 } ``` - - - #### Response + #### ConnectionError Error (Timed out waiting to connect to node\_address) ```json { - "mmrpc": "2.0", - "result": [{ - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 0 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 38815 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 959539 - } - }], - "id": 762 + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null } ``` - - - This response may include additional information in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) - -## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} -The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - -#### 📌 Example without using `filter` parameter - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", - "params": { - "coin": "tBTC-lightning" - }, - "id": 55 - } - ``` - - - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": null, - "funding_tx_output_index": null, - "funding_tx_value_sats": 4000, - "is_outbound": true, - "balance_msat": 4000000, - "outbound_capacity_msat": 4000000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": null, - "is_ready": false, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning", - "filter": { - "is_outbound": false - } + "coin": "tBTC-lightning" }, - "id": 55 + "id": 1 } ``` @@ -44815,53 +46148,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -44873,54 +46190,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::remove_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 1000, - "to_funding_value_sats": 500000 - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -44932,79 +46232,49 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }, { - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 2, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; -## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} +# Lightning Network Payments -The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -### Request Parameters +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. -#### 📌 Example without using `filter` parameter +### Request Parameters -#### Command +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | - +#### 📌 Example + + ```json { + "method": "lightning::payments::generate_invoice", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 }, - "id": 55 + "id": 1 } ``` @@ -45012,111 +46282,63 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response - ```json - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }, - { - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only - -#### Command - - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "channel_type": "Inbound" - } - }, - "id": 55 + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 } ``` - + - - #### Response + + ### InvalidRequest (invalid paramater value) ```json - - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": false, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} -#### Command +The `lightning::payments::send_payment` method sends a payment to another node. - +Used to pay an invoice or send a payment via pubkey/address. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | + +#### 📌 Example using `invoice` + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" } }, - "id": 55 + "id": 6 } ``` @@ -45125,50 +46347,34 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response ```json - - {"mmrpc": "2.0", + { + "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - -#### Command +#### 📌 Example using `keysend` - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 100000, - "to_funding_value_sats": 500000 + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 } }, - "id": 55 + "id": 6 } ``` @@ -45180,311 +46386,350 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list { "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", - "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", - "funding_value": 40000, - "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", - "closure_reason": "Channel closed because the channel was cooperatively closed", - "funding_generated_in_block": 2433122, - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1684083341, - "closed_at": 1684146940 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" }, "id": 762 } ``` -export const title = "AtomicDEX: Lightning Network Methods"; -export const description = - "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - -import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - -# Lightning Network Methods - - - Lightning methods are currently only available using the native AtomicDEX-API. - WASM support should be available in late 2023. - - -## Lightning Network Initialization Tasks - -* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) -* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value - which is used to query the status or outcome of the task. - - -## Lightning Network Nodes Methods - -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) -* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) -* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - -## Lightning Network Channels Methods -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) -* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) -* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) -* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) -* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) -* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - -## Lightning Network Payments Methods - -* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) -* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -## Lightning Network Flowchart - -Once you: - -* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) - -You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! - -Then you can: + + ### PaymentError (attempt to pay self) -* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 + } + ``` -Follow the flowchart below to visualize the process: + ### PaymentError (no outbound routes) - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` -## Lightning Network Coins File Configuration + ### PaymentError (keysend - no path to destination) - - Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) - param must be set in the `coins` configuration file, and aplies to all - channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and - [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters - are set per channel. These can be defined in the `coins` configuration file to - act as the default for all opened channels, and optionally overwritten or - updated using the - [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or - [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) - methods. - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` -### Lightning Coin Config Parameters + ### PaymentError (invoice - no path to destination) -| Parameter | Type | Description | -| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | -| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | -| decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | -| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | -| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` - - For GUIs and wallet apps, it is recommended to set - `accept_forwards_to_priv_channels` to `false`. This prevents users from taking - on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) - should also be set to `false` for GUIs and wallet apps. - + ### InvalidRequest (request is missing a required field) - ```json - { - "coin": "BTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_config": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3, - "force_announced_channel_preference": false - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "BTC-segwit", - "network": "mainnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, - { - "coin": "tBTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_configs": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90, - "their_channel_reserve_sats": 10000 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3 - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "tBTC-segwit", - "network": "testnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } ``` - -export const title = "AtomicDEX: Lightning Network Nodes"; -export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -# Lightning Network Nodes + ### InvalidRequest (A required field is invalid) - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 + } + ``` + -## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} -The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ----------------------------------------------------------------------------------- | -| coin | string | The coin ticker you would like to connect to a node on. | -| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | #### 📌 Example - + ```json { + "method": "lightning::payments::get_payment_details", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" }, "id": 1 } ``` - - The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. - Other node addresses can be retrieved from any lightning explorer, such as: + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 + } + ``` + - * [https://1ml.com/](https://1ml.com/) - * [https://mempool.space/lightning/](https://mempool.space/lightning/) - + + ### NoSuchPayment (payment hash not found) - - #### Response (success) + ```json + { + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 + } + ``` + + ### InvalidRequest (payment\_hash not a hash string) ```json { - "mmrpc": "2.0", - "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 } ``` + - #### Response (already connected) +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without filter + + ```json { - "mmrpc": "2.0", - "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` - - #### InvalidRequest Error (Invalid node\_address) +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: Could not parse node address from str rgjhk3", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "Could not parse node address from str rgjhk3", - "id": 762 + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` + - #### ConnectionError Error (Timed out waiting to connect to node\_address) - + ```json { - "mmrpc": "2.0", - "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "error_path": "connect_to_node", - "error_trace": "connect_to_node:78]", - "error_type": "ConnectionError", - "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` -## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - -The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to view your trusted nodes to. | - -#### 📌 Example +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 + } }, "id": 1 } @@ -45498,35 +46743,45 @@ The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes i { "mmrpc": "2.0", "result": { - "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` -## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - -The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------------------------- | -| coin | string | The coin ticker you would like to add a trusted node for. | -| node\_id | string | ID of node you would like to add to your trusted list. | - -#### 📌 Example +#### 📌 Example for successful payments on the 20th of April 2023 - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 + } }, "id": 1 } @@ -45540,319 +46795,555 @@ The `lightning::nodes::add_trusted_node` method allows you to add a node to your { "mmrpc": "2.0", "result": { - "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; -## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} +# max\_maker\_vol -The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. -### Request Parameters +#### Arguments -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to remove a trusted node from. | -| node\_id | string | ID of node you would like to remove from your trusted list. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | -#### 📌 Example +#### Response - +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::remove_trusted_node", + "method": "max_maker_vol", "params": { - "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 + "coin": "DOC" + } } ``` - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 - } - ``` - -export const title = "AtomicDEX: Lightning Network Payments"; -export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - -# Lightning Network Payments - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} - -The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of coin to generate invoice for. | -| description | string | A note to indicate the purpose of the invoice. | -| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | -| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } + }, + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null + } + ``` -#### 📌 Example + #### Response (error) - ```json { - "method": "lightning::payments::generate_invoice", - "userpass": "testpsw", "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "expiry": 600 + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 1 + "id": null } ``` - - - #### Response + #### Response (balance too low) ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" - }, - "id": 1 + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null } ``` - - - ### InvalidRequest (invalid paramater value) + #### Response (Transport error) ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string '56', expected u64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string '56', expected u64", - "id": 762 + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 } ``` +export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; +export const description = + "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; -## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} +# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} -The `lightning::payments::send_payment` method sends a payment to another node. +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. -Used to pay an invoice or send a payment via pubkey/address. + + Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | -#### 📌 Example using `invoice` +### Response Parameters - +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example with no optional params + + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "invoice", - "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ] + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 0, + "total": 2 + }, + "id": null } ``` -#### 📌 Example using `keysend` +#### 📌 Example with optional limit & page\_number params - + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "keysend", - "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "amount_in_msat": 1000, - "expiry": 24 - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` - - ### PaymentError (attempt to pay self) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:231]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "id": 6 - } - ``` - - ### PaymentError (no outbound routes) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "id": 762 - } - ``` - - ### PaymentError (keysend - no path to destination) +#### 📌 Example with optional spam protection + ```json { - "mmrpc": "2.0", - "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:107] lightning:256]", - "error_type": "PaymentError", - "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } + } } ``` + - ### PaymentError (invoice - no path to destination) - + ```json { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` + - ### InvalidRequest (request is missing a required field) - - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `payment`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `payment`", - "id": 762 - } - ``` +### 📌 Error responses - ### InvalidRequest (A required field is invalid) +#### Unsupported Chain Type - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "ParseError(Bech32Error(MissingSeparator))", - "id": 762 - } - ``` - +The supported chains are -## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} +``` +{ + "mmrpc":"2.0", + "error":"Error parsing request: UnsupportedChainType", + "error_path":"dispatcher", + "error_trace":"dispatcher:109]", + "error_type":"InvalidRequest", + "error_data":"UnsupportedChainType", + "id":null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; -The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to query. | -| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example - + ```json { - "method": "lightning::payments::get_payment_details", "userpass": "testpsw", + "method": "get_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" - }, - "id": 1 + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } } ``` @@ -45860,448 +47351,764 @@ The `lightning::payments::get_payment_details` method returns details about a li ```json { - "mmrpc": "2.0", - "result": { - "payment_details": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", - "payment_type": { - "type": "Outbound Payment", - "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" - }, - "description": "1 Blokaccino", - "amount_in_msat": 1000000, - "fee_paid_msat": 1803, - "status": "succeeded", - "created_at": 1684081413, - "last_updated": 1684081419 - } - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "amount": "1", + "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", + "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", + "name": "OpenSea Collections", + "symbol": "OPENSTORE", + "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", + "token_domain": "api.opensea.io", + "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", + "last_token_uri_sync": "2023-09-01T04:04:30.867Z", + "last_metadata_sync": "2023-09-01T04:35:01.128Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": true, + "chain": "POLYGON", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "block_number_minted": 19645247, + "block_number": 45776404, + "contract_type": "ERC1155", + "possible_phishing": false, + "uri_meta": { + "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_domain": "i.seadn.io", + "name": "Doge Napoleon", + "description": null, + "attributes": null, + "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", + "animation_domain": "openseauserdata.com", + "external_url": null, + "external_domain": null, + "image_details": null + } + }, + "id": null } ``` - - ### NoSuchPayment (payment hash not found) +## Error responses + +``` +{ + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", + "error_path": "nft", + "error_trace": "nft:123]", + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + }, + "id": null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; + +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + + To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + +#### 📌 Example with date and `send` filters + + ```json { - "mmrpc": "2.0", - "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", - "error_path": "get_payment_details", - "error_trace": "get_payment_details:75]", - "error_type": "NoSuchPayment", - "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } } ``` + - ### InvalidRequest (payment\_hash not a hash string) - + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid value: string '', expected a hash string", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid value: string '', expected a hash string", - "id": 762 + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": 1678270296, + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null } ``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; -## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +# Non Fungible Tokens (NFTs) -The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. +The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + + Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + +## NFT Information Methods + +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) + +## NFT Transaction Methods + +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + +export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; +export const description = + "This document describes how to query the local NFT database tables."; + +# Query NFT database tables + +After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, +the following tables are available in `DB/KOMODEFI.db`: + +* AVAX\_nft\_list +* AVAX\_nft\_transfer\_history +* BNB\_nft\_list +* BNB\_nft\_transfer\_history +* ETH\_nft\_list +* ETH\_nft\_transfer\_history +* FTM\_nft\_list +* FTM\_nft\_transfer\_history +* MATIC\_nft\_list +* MATIC\_nft\_transfer\_history +* scanned\_nft\_blocks + +## NFT List tables + +The COIN\_nft\_list tables contain the NFTs that you own +It has the following columns, though not all columns are populated for all NFTs: + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | +| 0 | token\_address | VARCHAR(256) | The address of the token contract. | +| 1 | token\_id | VARCHAR(256) | The id of the token. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 4 | block\_number | INTEGER | The block height of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 8 | collection\_name | TEXT | The collection name which includes the token. | +| 9 | symbol | TEXT | An arbitrary symbol for the NFT | +| 10 | token\_uri | TEXT | A link to the token's metadata. | +| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 12 | metadata | TEXT | The token's metadata in JSON format. | +| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | +| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | +| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | +| 16 | image\_url | TEXT | A link for the token's image (or other media). | +| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 18 | token\_name | TEXT | The name of the token. | +| 19 | description | TEXT | An arbitrary description of the NFT. | +| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | +| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | +| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | +| 23 | external\_url | TEXT | Additional URL related to the NFT | +| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | +| 25 | image\_details | TEXT | Additional details about the NFT's image. | +| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example COIN\_nft\_list table query + +> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; + +| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | +| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | +| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | +| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | +| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | +| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | +| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | + +The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. + +## NFT Transfer table + +The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: + +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | +| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | +| 1 | log\_index | INTEGER | Simply a table index. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | block\_number | INTEGER | The block height of this transaction. | +| 4 | block\_timestamp | INTEGER | The block time of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | token\_address | VARCHAR(256) | The address of the token contract. | +| 7 | token\_id | VARCHAR(256) | The id of the token. | +| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | +| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 12 | token\_uri | TEXT | A link to the token's metadata. | +| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 14 | collection\_name | TEXT | The collection name which includes the token. | +| 15 | image\_url | TEXT | A link for the token's image (or other media). | +| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 17 | token\_name | TEXT | The name of the token. | +| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example scanned\_nft\_blocks table query + +`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` + +| transaction\_hash | token\_name | token\_address | token\_id | +| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | + +## NFT Last Scanned Block table + +The scanned\_nft\_blocks table contains the last block that was scanned for each chain. +It has the following columns: + +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ---------------------------------------------------------------------- | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM scanned_nft_blocks;` + +| chain | last\_scanned\_block | +| ----- | -------------------- | +| MATIC | 50651981 | +| FTM | 66512090 | +| ETH | 0 | +| BNB | 0 | +| AVAX | 0 | +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; + +# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | -#### 📌 Example without filter + + If there are no errors, this request will return an empty response. + - +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning" - }, - "id": 1 + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - #### Response + + If there are no errors, this request will return an empty response. + ```json { "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683917593, - "last_updated": 1683917593 - }, { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", - "amount_in_msat": 88000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1683714225, - "last_updated": 1683805721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "ACME shrink ray", - "amount_in_msat": 4000012, - "status": "succeeded", - "created_at": 1683814625, - "last_updated": 1683815321 - }], - "limit": 10, - "skipped": 0, - "total": 6, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "result": null, + "id": null } ``` -#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; - +# Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will scan selected networks to update NFT information stored in the local database. +To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. + +See below for which coin to activate for each network: + +| Network | Coin | +| --------- | ----- | +| AVALANCHE | AVAX | +| BSC | BNB | +| ETH | ETH | +| FANTOM | FTM | +| POLYGON | MATIC | + +These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | --------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | + + + If there are no errors, this request will return an empty response. + When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. + + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "update_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "payment_type": { - "type": "Inbound Payment" - } - }, - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }, { - "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "14 pallets of frozen spinach", - "amount_in_msat": 56005000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }], - "limit": 2, - "skipped": 2, - "total": 7, - "total_pages": 4, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null } ``` -#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; - +# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + +#### 📌 ERC721 Withdraw Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "pending", - "from_amount_msat": 10000, - "to_amount_msat": 40000 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", + "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 35218, + "gas_price": "0.000000040827827163", + "total_fee": "0.001437874417026534" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732198, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -#### 📌 Example for successful payments on the 20th of April 2023 +#### 📌 ERC1155 Withdraw Example - +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "succeeded", - "from_timestamp": 1681948800, - "to_timestamp": 1682035199 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1681998480, - "last_updated": 1682008491 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", + "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 62368, + "gas_price": "0.000000012347931462", + "total_fee": "0.000770115789422016" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732805, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -export const title = "AtomicDEX Method: Max Maker Vol"; -export const description = - "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; - -# max\_maker\_vol - -The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. - -#### Arguments - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | - -#### Response - -| Parameter | Type | Description | -| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | -#### 📌 Examples +#### 📌 ERC1155 Withdraw Max Example -#### Command +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - + ```json { "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", - "method": "max_maker_vol", "params": { - "coin": "DOC" + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1" + } } } ``` - #### Response (success) - ```json { - "mmrpc": "2.0", - "result": { - "coin": "MARTY", - "volume": { - "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", - "rational": [ - [1, [962255003, 81]], - [1, [390588672, 18]] - ], - "fraction": { - "numer": "348854605979", - "denom": "77700000000" - } - }, - "balance": { - "decimal": "5.49110027", - "rational": [ - [1, [549110027]], - [1, [100000000]] - ], - "fraction": { - "numer": "549110027", - "denom": "100000000" - } + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", + "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC1155", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 59963, + "gas_price": "0.00000003794123733", + "total_fee": "0.00227507041401879" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732937, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "locked_by_swaps": { - "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", - "rational": [ - [1, [77802331]], - [1, [77700000]] - ], - "fraction": { - "numer": "77802331", - "denom": "77700000" - } - } - }, - "id": null + "id": null } ``` + - #### Response (error) + + ### 📌 Withdraw NFTs Error Responses - ```json + #### InvalidRequest (missing field) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `type`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `type`", + "id": null + } + ``` + + #### InvalidRequest (wrong withdraw type) + + ``` { - "mmrpc": "2.0", - "error": "No such coin TIME", - "error_path": "max_maker_vol_rpc.lp_coins", - "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "id": null } ``` - #### Response (balance too low) + #### TokenNotFoundInWallet (trying to send NFT you dont own) - ```json + ``` { - "mmrpc": "2.0", - "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", - "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", - "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "QTUM", - "available": "0", - "required": "0.000728" - }, - "id": null + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", + "error_path": "eth.nft", + "error_trace": "eth:883] nft:1177]", + "error_type": "GetNftInfoError", + "error_data": { + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" + } + }, + "id": null } ``` - #### Response (Transport error) + #### TransportError (unable to estimate gas) - ```json + ``` { - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 + "mmrpc": "2.0", + "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "error_path": "eth", + "error_trace": "eth:1004] eth:5792]", + "error_type": "Transport", + "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "id": null + } + ``` + + #### NotEnoughNftsAmount (trying to send more NFTs than you have) + + ``` + { + "mmrpc": "2.0", + "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", + "error_path": "eth", + "error_trace": "eth:897]", + "error_type": "NotEnoughNftsAmount", + "error_data": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "available": "1", + "required": "2" + }, + "id": null } ``` + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; diff --git a/data-for-gpts/atomicdex-content.txt b/data-for-gpts/atomicdex-content.txt index 45e9a55d..9778836a 100644 --- a/data-for-gpts/atomicdex-content.txt +++ b/data-for-gpts/atomicdex-content.txt @@ -2164,6 +2164,9 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | +| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | +| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | +| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -2200,6 +2203,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | +| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -2239,11 +2243,13 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | +| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | +| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | export const title = "AtomicDEX Method: Active Swaps"; export const description = @@ -13877,156 +13883,800 @@ It includes a uniform request, successful and error response formats. At the mom } ``` -export const title = "AtomicDEX: Signing and Verifying Messages"; -export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; -# Signing\_and\_Verifying\_Messages +## Common Komodo DeFi SDK Request / Response Objects -Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). +The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. -If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). +### ActivationParams -```json -{ - "coin": "DOC", - "asset": "DOC", - "fname": "DOC (TESTCOIN)", - "sign_message_prefix": "Komodo Signed Message:\n", - "rpcport": 25435, - "txversion": 4, - "overwintered": 1, - "mm2": 1, - "protocol": { - "type": "UTXO" - } -} -``` +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. -## Sign Message +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | -### Arguments + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message you want to sign | +### ActivationMode -### Response +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. -| Structure | Type | Description | -| --------- | ------ | --------------------------------------- | -| signature | string | The signature generated for the message | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | -#### Command +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | + +### ActivationServers + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example - ```json { - "userpass": "testpsw", - "method": "sign_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion" + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 } } ``` - -#### Response (success) + #### HD UTXO Activation (v2) -```json -{ - "mmrpc": "2.0", - "result": { - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" - }, - "id": 0 -} -``` + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + -### ⚠ Error types +### AddressInfos -**PrefixNotFound:** sign\_message\_prefix is not set in coin config file -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message signing is not supported by the given coin type -**InternalError:** An internal error occured during the signing process +The `addressInfos` object includes the following items for a given address: -## Verify Message +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | -### Arguments + + #### Example with balances -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message input via the `sign_message` method sign | -| signature | string | The signature generated for the message | -| address | string | The address used to sign the message | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` -### Response + #### Example without balances -| Structure | Type | Description | -| --------- | ------- | ----------------------------------------------------------- | -| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + -#### Command +### BalanceInfos - +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + ```json { - "userpass": "testpsw", - "method": "verify_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion", - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", - "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" - } + "spendable": "12.11398301", + "unspendable": "0.53" } ``` - + -#### Response (valid) +### DerivationMethod -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": true - }, - "id": 0 -} -``` +The `DerivationMethod` object includes the following items for a given coin or token: -#### Response (not valid) +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": false - }, - "id": 0 -} -``` + + Using the same seed or private key to generate keypairs using different + derivation methods will result in a different address and private key for each + method. + -### ⚠ Error types +Where the value indicates: -**PrefixNotFound:** sign\_message\_prefix is not set in coin config -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message verification is not supported by the given coin type -**InternalError:** An internal error occured during the verification process -**SignatureDecodingError:** Given signature could not be decoded -**AddressDecodingError:** Given address could not be decoded -export const title = "AtomicDEX Method: My TX History"; -export const description = "The my_tx_history method allows you to view the transaction history of coins."; +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. -# my\_tx\_history + + ```json + { + "type": "Iguana" + } + ``` + -To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ----------------------------------------------------------------------------- | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to + `false` (the default value), as the node is not expected to be reliably + online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. See + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + +### TokenFilter + +The `TokenFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### TokenMetadata + +The `TokenMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | + + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### WithdrawFee + +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. + +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + #### Example of Eth type + + ```json + { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + } + ``` + + #### Example of Qrc20 type + + ```json + { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + } + ``` + + #### Example of Tendermint type + + ```json + { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + } + ``` + + #### Example of Utxo type + + ```json + { + "type": "Utxo", + "amount": "0.00001" + } + ``` + + +### WithdrawNftData + +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; + +# Signing\_and\_Verifying\_Messages + +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). + +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). + +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` + +## Sign Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | + +### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" + } + } + ``` + + +#### Response (success) + +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process + +## Verify Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | + +### Response + +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } + } + ``` + + +#### Response (valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` + +#### Response (not valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; + +# my\_tx\_history + +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. @@ -16368,55 +17018,288 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (KMD success) + #### Response (KMD success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "KMD", + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } + }, + "id": 0 + } + ``` + + #### Response (NotSufficientBalance error) + + ```json + { + "mmrpc": "2.0", + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" + }, + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoFixed", + "amount": "0.1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "error_path": "utxo_common", + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoPerKbyte", + "amount": "1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", + "block_height": 0, + "timestamp": 1566473421, + "fee_details": { + "type": "Utxo", + "amount": "0.38378905" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + +#### Withdraw ETH, ERC20, and other ETH-based forks + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +#### ETH/ERC20 and other ETH-based forks, with gas fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } + }, + "id": 0 + } + ``` + + + + #### Response (success) ```json { "mmrpc": "2.0", "result": { + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", "block_height": 0, - "coin": "KMD", + "timestamp": 1566474670, "fee_details": { - "type": "Utxo", - "amount": "0.00001" + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" }, - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "my_balance_change": "-10.00001", - "received_by_me": "0.34417325", - "spent_by_me": "10.34418325", - "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], - "total_amount": "10.34418325", - "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", - "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", - "kmd_rewards": { - "amount": "0.0791809", - "claimed_by_my": true - } + "coin": "ETH", + "internal_id": "" }, "id": 0 } ``` - #### Response (NotSufficientBalance error) + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) ```json { "mmrpc": "2.0", - "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:449]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "DOC", - "available": "69.75066225", - "required": "1000.00001" - }, + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee +#### Withdraw maximum ```json @@ -16425,13 +17308,9 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoFixed", - "amount": "0.1" - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true }, "id": 0 } @@ -16439,49 +17318,86 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) + ##### Response (success) ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", "block_height": 0, - "timestamp": 1566472936, + "coin": "ETH", "fee_details": { - "type": "Utxo", - "amount": "0.1" + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" }, - "coin": "DOC", - "internal_id": "" + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw QRC20 coins + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 }, "id": 0 } ``` + - #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ##### Response (success) ```json { "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "error_path": "utxo_common", - "error_trace": "utxo_common:1371]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee +##### Withdraw QRC20 coins with gas limit ```json @@ -16490,12 +17406,13 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, "fee": { - "type": "UtxoPerKbyte", - "amount": "1" + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 } }, "id": 0 @@ -16504,35 +17421,36 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", - "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.00253836", - "spent_by_me": "60.00253836", - "received_by_me": "59.61874931", - "my_balance_change": "-0.38378905", "block_height": 0, - "timestamp": 1566473421, + "coin": "QRC20", + "timestamp": 1608725061, "fee_details": { - "type": "Utxo", - "amount": "0.38378905" + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" }, - "coin": "DOC", - "internal_id": "" + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, "id": 0 } ``` -#### Withdraw ETH, ERC20, and other ETH-based forks +##### Withdraw Tendermint coins with a memo ```json @@ -16541,9 +17459,10 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "amount": 10 + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } @@ -16551,54 +17470,72 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", "block_height": 0, - "coin": "ETH", + "timestamp": 0, "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } ``` + + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; -#### ETH/ERC20 and other ETH-based forks, with gas fee +# get\_current\_mtp - +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", + "method": "get_current_mtp", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "id": 42, "params": { - "coin": "COIN_NAME", - "to": "RECIPIENT_ADDRESS", - "amount": "AMOUNT", - "fee": { - "type": "EthGas", - "gas_price": "3.5", - "gas": 55000 - } - }, - "id": 0 + "coin": "DOC" + } } ``` @@ -16610,809 +17547,1039 @@ The request was failed due to an AtomicDEX API internal error. { "mmrpc": "2.0", "result": { - "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", - "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", - "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "total_amount": "10", - "spent_by_me": "10.0001925", - "received_by_me": "10", - "my_balance_change": "-0.0001925", - "block_height": 0, - "timestamp": 1566474670, - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 55000, - "gas_price": "0.0000000035", - "total_fee": "0.0001925" - }, - "coin": "ETH", - "internal_id": "" + "mtp": 1658746383 }, - "id": 0 + "id": 42 } ``` + +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) +# get\_locked\_amount + +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response + +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | + +#### 📌 Examples + +#### Command + ```json { + "userpass": "testpsw", "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", - "error_path": "eth", - "error_trace": "eth:535]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'EthGas' fee type, found UtxoFixed", - "id": 0 + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 } ``` - + -#### Withdraw maximum + + #### Response (success) - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "max": true + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } }, - "id": 0 + "id": 42 } ``` - - - ##### Response (success) + #### Response (error) ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "ETH", - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" - }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 0 + "id": 42 } ``` +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; -##### Withdraw QRC20 coins +# Heirarchical Deterministic Address Management - +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. + +## can\_get\_new\_address + +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "can_get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10 - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - ##### Response (success) + #### Response (success, allowed) ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null + } + ``` + + #### Response (success, not allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null } ``` -##### Withdraw QRC20 coins with gas limit +## get\_new\_address + +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + +Other reasons you might not be able to get a new address are: - +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10, - "fee": { - "type": "Qrc20Gas", - "gas_limit": 250000, - "gas_price": 40 - } - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` + #### Response (success) + ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 250000, - "gas_price": 40, - "total_gas_fee": "0.1" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null } ``` - - -##### Withdraw Tendermint coins with a memo - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "IRIS", - "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", - "amount": 13, - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." - }, - "id": 0 - } - ``` - + #### Response (success, not allowed) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", - "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "13.038553", - "spent_by_me": "13.038553", - "received_by_me": "13", - "my_balance_change": "-0.038553", - "block_height": 0, - "timestamp": 0, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", - "transaction_type": "StandardTransfer", - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } }, - "id": 0 + "id": null } ``` - - You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) -export const title = "AtomicDEX Method: Get Current MTP"; -export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; -# get\_current\_mtp +# HD Wallets Overview -The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! -## Arguments +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. -| Parameter | Type | Description | -| --------- | ------- | --------------------------------------------------------------------------------------- | -| coin | string | A compatible (UTXO) coin's ticker | -| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + + + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. + + +## Details for HwError error type + +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + +### FoundUnexpectedDevice + +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` + +### FoundMultipleDevices + +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` + +### NoTrezorDeviceAvailable + +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + +# AtomicDEX API RPC Protocol v2.0 (Dev) + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### Response +### Response (Error) -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | -| mtp | integer | Unix timestamp | -| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### 📌 Examples +### 📌 Examples #### Command - + ```json { - "method": "get_current_mtp", - "userpass": "testpsw", "mmrpc": "2.0", - "id": 42, + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" - } + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 } ``` - - #### Response (success) +#### Response (success) - ```json - { - "mmrpc": "2.0", - "result": { - "mtp": 1658746383 +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Get Locked Amount"; -export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` -# get\_locked\_amount +#### Response (error) -The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; -## Arguments +# Lightning Network Initialization Tasks -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -#### Response +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} -| Parameter | Type | Description | -| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. -#### 📌 Examples + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + -#### Command +### Request Parameters - +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | + +#### 📌 Example + + ```json { + "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_locked_amount", "params": { - "coin": "DOC" + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 + } }, - "id": 42 + "id": 2 } ``` - #### Response (success) + ### Response Parameters - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "DOC", - "locked_amount": { - "decimal": "0.77803", - "rational": [ - [1, [77803]], - [1, [100000]] - ], - "fraction": { - "numer": "77803", - "denom": "100000" - } - } - }, - "id": 42 - } - ``` + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | - #### Response (error) + #### Response ```json { - "mmrpc": "2.0", - "error": "No such coin: TIME", - "error_path": "lp_swap.lp_coins", - "error_trace": "lp_swap:486] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": 42 + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null } ``` -export const title = "AtomicDEX: HD Address Management"; -export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; - -# Heirarchical Deterministic Address Management - -A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. - -## can\_get\_new\_address -To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. - -#### Arguments + + #### L2ConfigIsNotFound Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", + "id": 2 + } + ``` -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.allowed | boolean | Whether or not you can get a new address. | -| result.reason | string | The reason you cant get a new address (if allowed is `false`). | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + #### InvalidRequest Error -Other reasons you might not be able to get a new address are: + A parameter is incorrect. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 + } + ``` -#### 📌 Examples + #### UnexpectedL2Protocol Error -#### Command + Coin is wrong protocol type. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "can_get_new_address", - "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "mmrpc": "2.0", + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" + } + }, + "id": 2 } ``` - - - #### Response (success, allowed) + #### Internal Error + + Address already in use. ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null } ``` - #### Response (success, not allowed) + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. ```json { - "mmrpc": "2.0", - "result": { - "allowed": false, - "reason": "LastAddressNotUsed", - "details": { - "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" - } - }, - "id": null + "mmrpc": "2.0", + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 } ``` - - -## get\_new\_address -If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + -#### Arguments + #### InvalidPlatformConfiguration Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 + } + ``` + -| Parameter | Type | Description | -| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.new\_address | object | Contains details about your new address. | -| result.address | string | The new address that was generated. | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | -| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | -| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| result.details.balance | object | Contains the spendable and unspendable balance for this address | -| result.details.balance.spendable | string(numeric) | Spendable balance for this address | -| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} -Other reasons you might not be able to get a new address are: +The `task::enable_lightning::status` request checks the status of lightning node initialization. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) +### Request Parameters -#### 📌 Examples +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_new_address", + "method": "task::enable_lightning::status", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "task_id": 1, + "forget_if_finished": false + }, + "id": 2 } ``` - #### Response (success) + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` - #### Response (success, not allowed) + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) ```json { - "mmrpc": "2.0", - "result": { - "new_address": { - "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", - "derivation_path": "m/44'/141'/0'/0/3", - "chain": "External", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null } ``` - -export const title = "AtomicDEX: HD Wallets Overview"; -export const description = - "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; - -# HD Wallets Overview - -The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! - -For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. - -To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. - -## Initialisation and authentication: - -* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) -* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) -* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) -* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) -## UTXO Coin Activation in Hardware Mode: + Possible in progress statuses: -* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. -* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) -* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile + -## QTUM Coin Activation in Hardware Mode: +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} -* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. -* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) -* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) +The `task::enable_lightning::cancel` request cancels lightning node initialization. -## Withdrawing your Funds: +### Request Parameters -* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) -* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) -* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | -## Viewing Hardware Wallet Coin Balances: +#### 📌 Example -* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) -* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_lightning::cancel", + "params": { + "task_id": 1 + }, + "id": 1 + } + ``` + -## Creating New Addresses: + + #### Response -* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. -* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + - - These methods (and others with a `task::` prefix) will be linked to a numeric - `task_id` value which is used to query the status or outcome of the task. - + + #### TaskFinished Error -## Details for HwError error type + Task has already been completed. -When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null + } + ``` + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; -### FoundUnexpectedDevice +# Lightning Network Channels -The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found unexpected device. Please re-initialize Hardware wallet", - "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", - "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", - "error_type": "HwError", - "error_data": "FoundUnexpectedDevice" - } - }, - "id": null -} -``` +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} -### FoundMultipleDevices +The `lightning::channels::open_channel` method opens a new channel with a remote node. -Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. +### Request Parameters -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found multiple devices. Please unplug unused devices", - "error_path": "init_hw.crypto_ctx.hw_client", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", - "error_type": "HwError", - "error_data": "FoundMultipleDevices" - } - }, - "id": null -} -``` +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | -### NoTrezorDeviceAvailable +#### 📌 Example using an exact amount -No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 + } + }, + "id": 22 + } + ``` + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "No Trezor device available", - "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", - "error_type": "HwError", - "error_data": "NoTrezorDeviceAvailable" - } - }, - "id": null -} -``` -export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; -export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + + #### Response -# AtomicDEX API RPC Protocol v2.0 (Dev) + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + }, + "id": 22 + } + ``` + -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. +#### 📌 Example using max available with channel options and configs -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 + } + }, + "id": null + } + ``` + -## Request + + #### Response -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + }, + "id": null + } + ``` + -### Response (Success) +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| result | object | the value of this field is determined by the method invoked on AtomicDEX API | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +The `lightning::channels::close_channel` method closes a channel with a remote node. -### Response (Error) +### Request Parameters -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | -### 📌 Examples + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + -#### Command +#### 📌 Example to force closing a channel - + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "lightning::channels::close_channel", "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true }, - "id": 0 + "id": 8 } ``` -#### Response (success) + + #### Response -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` -#### Response (error) + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + -```json -{ - "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, - "id": 0 -} -``` -export const title = "AtomicDEX: Lightning Network Initialization Tasks"; -export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + + -# Lightning Network Initialization Tasks + + #### InvalidRequest Error - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 + } + ``` -## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} + #### NoSuchChannel Error -The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` + - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. - +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} + +The `lightning::channels::update_channel` method updates channel options. ### Request Parameters -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { - "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::channels::update_channel", "params": { - "ticker": "tBTC-lightning", - "activation_params": { - "name": "AtomicDEX-Docs-Node-1", - "listening_port": 9735, - "color": "000000", - "payment_retries": 5 + "coin": "tBTC-lightning", + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 } }, "id": 2 @@ -17421,255 +18588,246 @@ The `task::enable_lightning::init` request a task to run a lightning node. Use t - ### Response Parameters - - | Parameter | Type | Description | - | --------- | ------- | --------------------------------------------------------- | - | task\_id | integer | An identifying number which is used to query task status. | - #### Response ```json { - "mmrpc": "2.0", - "result": { - "task_id": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null + } + }, + "id": 2 } ``` - #### L2ConfigIsNotFound Error + #### NoSuchChannel Error - Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. + Channel with the given uuid is not foun on the lightning network. ```json { "mmrpc": "2.0", - "error": "Layer 2 tBTC-lightning config is not found", - "error_path": "init_l2.prelude", - "error_trace": "init_l2:82] prelude:82]", - "error_type": "L2ConfigIsNotFound", - "error_data": "tBTC-lightning", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", "id": 2 } ``` + - #### InvalidRequest Error +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} - A parameter is incorrect. +The `lightning::channels::get_channel_details` method returns details about a channel. - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string "9735", expected u16", - "error_path": "dispatcher", - "error_trace": "dispatcher:110]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string "9735", expected u16", - "id": 762 - } - ``` +### Request Parameters - #### UnexpectedL2Protocol Error +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | - Coin is wrong protocol type. +#### 📌 Example to update all available channel options + ```json { - "mmrpc": "2.0", - "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", - "error_path": "init_l2.prelude.lightning_activation", - "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", - "error_type": "UnexpectedL2Protocol", - "error_data": { - "ticker": "tBTC-segwit", - "protocol": { - "type": "UTXO" - } - }, - "id": 2 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_channel_details", + "params": { + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + }, + "id": 54 } ``` + - #### Internal Error + + + The response will vary depending on whether the channel status is `open` or `closed`. + - Address already in use. + #### Response (opened channel) ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "I/O error Address already in use (os error 48)", - "error_path": "lib.lightning_activation.ln_p2p", - "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", - "error_type": "Internal", - "error_data": "I/O error Address already in use (os error 48)" - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 } ``` - #### PlatformCoinIsNotActivated Error + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + - The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + #### Response (closed channel) ```json { "mmrpc": "2.0", - "error": "Platform coin tBTC-lightning is not activated", - "error_path": "init_l2.lp_coins", - "error_trace": "init_l2:87] lp_coins:3087]", - "error_type": "PlatformCoinIsNotActivated", - "error_data": "tBTC-lightning", - "id": 2 + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 } ``` - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) - Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + - #### InvalidPlatformConfiguration Error - - Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + + #### InvalidRequest Error ```json { "mmrpc": "2.0", - "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", - "error_path": "init_l2.lightning_activation", - "error_trace": "init_l2:95] lightning_activation:254]", - "error_type": "InvalidPlatformConfiguration", - "error_data": { - "platform_coin_ticker": "tBTC-segwit", - "err": "'avg_blocktime' field is not found in platform coin config" - }, - "id": 2 + "error": "Error parsing request: missing field `coin`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `coin`", + "id": 54 } ``` -## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} -The `task::enable_lightning::status` request checks the status of lightning node initialization. +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. ### Request Parameters -| Parameter | Type | Description | -| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | -| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::status", + "method": "lightning::channels::get_claimable_balances", "params": { - "task_id": 1, - "forget_if_finished": false + "coin": "tBTC-lightning", + "include_open_channels_balances": true }, - "id": 2 + "id": 762 } ``` - ### Response Parameters - - | Parameter | Type | Description | - | -------------- | ------ | ---------------------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | - - - The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. - - - #### Response (ready, success) - - ```json - { - "mmrpc": "2.0", - "result": { - "status": "Ok", - "details": { - "platform_coin": "BTC-segwit", - "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null - } - ``` - - - In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. - Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. - For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). - - - #### Response (in progress state) + #### Response ```json { - "mmrpc": "2.0", - "result": { - "status": "InProgress", - "details": "ReadingNetworkGraphFromFile" - }, - "id": null + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], + "id": 762 } ``` - Possible in progress statuses: - - * ActivatingCoin - * GettingFeesFromRPC - * ReadingNetworkGraphFromFile - * InitializingChannelManager - * InitializingPeerManager - * ReadingScorerFromFile - * InitializingBackgroundProcessor - * ReadingChannelsAddressesFromFile + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + -## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} -The `task::enable_lightning::cancel` request cancels lightning node initialization. +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------- | -------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without using `filter` parameter - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::cancel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { - "task_id": 1 + "coin": "tBTC-lightning" }, - "id": 1 + "id": 55 } ``` @@ -17679,71 +18837,113 @@ The `task::enable_lightning::cancel` request cancels lightning node initializati ```json { - "mmrpc": "2.0", - "result": "success", - "id": null + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 } ``` - - #### TaskFinished Error +#### 📌 Example with `filter` for inbound channels only - Task has already been completed. +#### Command + ```json { - "mmrpc": "2.0", - "error": "Task is finished already", - "error_path": "init_l2.manager", - "error_trace": "init_l2:157] manager:104]", - "error_type": "TaskFinished", - "error_data": 3, - "id": null + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 } ``` - -export const title = "AtomicDEX: Lightning Network Channels"; -export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; - -# Lightning Network Channels - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} + -The `lightning::channels::open_channel` method opens a new channel with a remote node. + + #### Response -### Request Parameters + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + -| Parameter | Type | Description | -| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to open a channel for. | -| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | -| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example using an exact amount +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Exact", - "value": 0.004 + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" } }, - "id": 22 + "id": 55 } ``` @@ -17755,47 +18955,54 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 22 + "id": 55 } ``` -#### 📌 Example using max available with channel options and configs +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Max" - }, - "push_msat": 0, - "channel_options": { - "proportional_fee_in_millionths_sats": 0, - "base_fee_msat": 1000, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 - }, - "channel_configs": { - "counterparty_locktime": 144, - "our_htlc_minimum_msat": 1, - "negotiate_scid_privacy": false, - "max_inbound_in_flight_htlc_percent": 10, - "commit_upfront_shutdown_pubkey": true, - "inbound_channels_confirmations": 3, - "their_channel_reserve_sats": 10000 + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 } }, - "id": null + "id": 55 } ``` @@ -17807,45 +19014,79 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": null + "id": 55 } ``` -## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} -The `lightning::channels::close_channel` method closes a channel with a remote node. +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| ------------ | ------- | ---------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to close a channel for. | -| uuid | string | Unique channel identifier. | -| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - - It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. - Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. - +#### 📌 Example without using `filter` parameter -#### 📌 Example to force closing a channel +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::close_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "force_close": true + "coin": "tBTC-lightning" }, - "id": 8 + "id": 55 } ``` @@ -17853,86 +19094,163 @@ The `lightning::channels::close_channel` method closes a channel with a remote n #### Response + ```json + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + ```json { - "mmrpc": "2.0", - "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "channel_type": "Inbound" + } + }, + "id": 55 } ``` + - - To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. - + + #### Response - - Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) - + ```json + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` - - #### InvalidRequest Error +#### 📌 Example with `filter` for a specific `node_id` + +#### Command + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `uuid`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `uuid`", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + } + }, + "id": 55 } ``` + - #### NoSuchChannel Error + + #### Response ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "error_path": "close_channel", - "error_trace": "close_channel:55]", - "error_type": "NoSuchChannel", - "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} - -The `lightning::channels::update_channel` method updates channel options. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value -#### 📌 Example to update all available channel options +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::update_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 } }, - "id": 2 + "id": 55 } ``` @@ -17944,298 +19262,313 @@ The `lightning::channels::update_channel` method updates channel options. { "mmrpc": "2.0", "result": { - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_sats": null + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 } }, - "id": 2 + "id": 762 } ``` +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - - #### NoSuchChannel Error +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - Channel with the given uuid is not foun on the lightning network. +# Lightning Network Methods + + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + + +## Lightning Network Initialization Tasks + +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) + + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + + +## Lightning Network Nodes Methods +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) + +## Lightning Network Channels Methods + +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) + +## Lightning Network Payments Methods + +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) + +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! + +Then you can: + +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +Follow the flowchart below to visualize the process: + + + +## Lightning Network Coins File Configuration + + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + + +### Lightning Coin Config Parameters + +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + + ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", - "error_path": "update_channel", - "error_trace": "update_channel:61]", - "error_type": "NoSuchChannel", - "error_data": "dc33b998-8589-44fd-a246-256a582e8942", - "id": 2 - } + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, ``` +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} +# Lightning Network Nodes -The `lightning::channels::get_channel_details` method returns details about a channel. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------ | -| coin | string | The ticker of the coin you would like to view channel details for. | -| uuid | string | Unique channel identifier. | +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::get_channel_details", + "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, - "id": 54 + "id": 1 } ``` - - - The response will vary depending on whether the channel status is `open` or `closed`. - + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: - #### Response (opened channel) + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 959722, - "is_outbound": true, - "balance_msat": 959722000, - "outbound_capacity_msat": 950125000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": 3, - "is_ready": false, - "is_usable": false, - "is_public": false - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. - It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) - - - #### Response (closed channel) + #### Response (already connected) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_value": "98982", - "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", - "closure_reason": "null", - "claiming_tx": "null", - "claimed_balance": "null", - "funding_generated_in_block": "null", - "is_outbound": false, - "is_public": true, - "is_closed": true, - "created_at": 167273496966, - "closed_at": 171069595935 - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - - The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) - - #### InvalidRequest Error + #### InvalidRequest Error (Invalid node\_address) ```json { "mmrpc": "2.0", - "error": "Error parsing request: missing field `coin`", + "error": "Error parsing request: Could not parse node address from str rgjhk3", "error_path": "dispatcher", "error_trace": "dispatcher:109]", "error_type": "InvalidRequest", - "error_data": "missing field `coin`", - "id": 54 - } - ``` - - -## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} - -The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. - -### Request Parameters - -| Parameter | Type | Description | -| --------------------------------- | ------- | ------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view claimable balances for. | -| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | - -#### 📌 Example to update all available channel options - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::get_claimable_balances", - "params": { - "coin": "tBTC-lightning", - "include_open_channels_balances": true - }, - "id": 762 + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 } ``` - - - #### Response + #### ConnectionError Error (Timed out waiting to connect to node\_address) ```json { - "mmrpc": "2.0", - "result": [{ - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 0 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 38815 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 959539 - } - }], - "id": 762 + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null } ``` - - - This response may include additional information in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) - -## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} -The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - -#### 📌 Example without using `filter` parameter - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", - "params": { - "coin": "tBTC-lightning" - }, - "id": 55 - } - ``` - - - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": null, - "funding_tx_output_index": null, - "funding_tx_value_sats": 4000, - "is_outbound": true, - "balance_msat": 4000000, - "outbound_capacity_msat": 4000000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": null, - "is_ready": false, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning", - "filter": { - "is_outbound": false - } + "coin": "tBTC-lightning" }, - "id": 55 + "id": 1 } ``` @@ -18247,53 +19580,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -18305,54 +19622,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::remove_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 1000, - "to_funding_value_sats": 500000 - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -18364,79 +19664,49 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }, { - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 2, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; -## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} +# Lightning Network Payments -The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -### Request Parameters +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. -#### 📌 Example without using `filter` parameter +### Request Parameters -#### Command +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | - +#### 📌 Example + + ```json { + "method": "lightning::payments::generate_invoice", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 }, - "id": 55 + "id": 1 } ``` @@ -18444,111 +19714,63 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response - ```json - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }, - { - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only - -#### Command - - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "channel_type": "Inbound" - } - }, - "id": 55 + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 } ``` - + - - #### Response + + ### InvalidRequest (invalid paramater value) ```json - - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": false, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} -#### Command +The `lightning::payments::send_payment` method sends a payment to another node. - +Used to pay an invoice or send a payment via pubkey/address. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | + +#### 📌 Example using `invoice` + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" } }, - "id": 55 + "id": 6 } ``` @@ -18557,50 +19779,34 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response ```json - - {"mmrpc": "2.0", + { + "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - -#### Command +#### 📌 Example using `keysend` - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 100000, - "to_funding_value_sats": 500000 + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 } }, - "id": 55 + "id": 6 } ``` @@ -18612,311 +19818,350 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list { "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", - "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", - "funding_value": 40000, - "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", - "closure_reason": "Channel closed because the channel was cooperatively closed", - "funding_generated_in_block": 2433122, - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1684083341, - "closed_at": 1684146940 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" }, "id": 762 } ``` -export const title = "AtomicDEX: Lightning Network Methods"; -export const description = - "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - -import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - -# Lightning Network Methods - - - Lightning methods are currently only available using the native AtomicDEX-API. - WASM support should be available in late 2023. - - -## Lightning Network Initialization Tasks - -* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) -* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value - which is used to query the status or outcome of the task. - - -## Lightning Network Nodes Methods - -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) -* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) -* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - -## Lightning Network Channels Methods -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) -* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) -* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) -* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) -* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) -* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - -## Lightning Network Payments Methods - -* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) -* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -## Lightning Network Flowchart - -Once you: - -* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) - -You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! - -Then you can: + + ### PaymentError (attempt to pay self) -* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 + } + ``` -Follow the flowchart below to visualize the process: + ### PaymentError (no outbound routes) - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` -## Lightning Network Coins File Configuration + ### PaymentError (keysend - no path to destination) - - Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) - param must be set in the `coins` configuration file, and aplies to all - channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and - [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters - are set per channel. These can be defined in the `coins` configuration file to - act as the default for all opened channels, and optionally overwritten or - updated using the - [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or - [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) - methods. - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` -### Lightning Coin Config Parameters + ### PaymentError (invoice - no path to destination) -| Parameter | Type | Description | -| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | -| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | -| decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | -| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | -| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` - - For GUIs and wallet apps, it is recommended to set - `accept_forwards_to_priv_channels` to `false`. This prevents users from taking - on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) - should also be set to `false` for GUIs and wallet apps. - + ### InvalidRequest (request is missing a required field) - ```json - { - "coin": "BTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_config": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3, - "force_announced_channel_preference": false - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "BTC-segwit", - "network": "mainnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, - { - "coin": "tBTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_configs": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90, - "their_channel_reserve_sats": 10000 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3 - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "tBTC-segwit", - "network": "testnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } ``` - -export const title = "AtomicDEX: Lightning Network Nodes"; -export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -# Lightning Network Nodes + ### InvalidRequest (A required field is invalid) - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 + } + ``` + -## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} -The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ----------------------------------------------------------------------------------- | -| coin | string | The coin ticker you would like to connect to a node on. | -| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | #### 📌 Example - + ```json { + "method": "lightning::payments::get_payment_details", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" }, "id": 1 } ``` - - The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. - Other node addresses can be retrieved from any lightning explorer, such as: + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 + } + ``` + - * [https://1ml.com/](https://1ml.com/) - * [https://mempool.space/lightning/](https://mempool.space/lightning/) - + + ### NoSuchPayment (payment hash not found) - - #### Response (success) + ```json + { + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 + } + ``` + + ### InvalidRequest (payment\_hash not a hash string) ```json { - "mmrpc": "2.0", - "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 } ``` + - #### Response (already connected) +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without filter + + ```json { - "mmrpc": "2.0", - "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` - - #### InvalidRequest Error (Invalid node\_address) +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: Could not parse node address from str rgjhk3", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "Could not parse node address from str rgjhk3", - "id": 762 + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` + - #### ConnectionError Error (Timed out waiting to connect to node\_address) - + ```json { - "mmrpc": "2.0", - "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "error_path": "connect_to_node", - "error_trace": "connect_to_node:78]", - "error_type": "ConnectionError", - "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` -## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - -The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to view your trusted nodes to. | - -#### 📌 Example +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 + } }, "id": 1 } @@ -18930,35 +20175,45 @@ The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes i { "mmrpc": "2.0", "result": { - "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` -## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - -The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------------------------- | -| coin | string | The coin ticker you would like to add a trusted node for. | -| node\_id | string | ID of node you would like to add to your trusted list. | - -#### 📌 Example +#### 📌 Example for successful payments on the 20th of April 2023 - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 + } }, "id": 1 } @@ -18972,319 +20227,555 @@ The `lightning::nodes::add_trusted_node` method allows you to add a node to your { "mmrpc": "2.0", "result": { - "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; -## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} +# max\_maker\_vol -The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. -### Request Parameters +#### Arguments -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to remove a trusted node from. | -| node\_id | string | ID of node you would like to remove from your trusted list. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | -#### 📌 Example +#### Response - +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::remove_trusted_node", + "method": "max_maker_vol", "params": { - "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 + "coin": "DOC" + } } ``` - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 - } - ``` - -export const title = "AtomicDEX: Lightning Network Payments"; -export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - -# Lightning Network Payments - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} - -The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of coin to generate invoice for. | -| description | string | A note to indicate the purpose of the invoice. | -| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | -| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } + }, + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null + } + ``` -#### 📌 Example + #### Response (error) - ```json { - "method": "lightning::payments::generate_invoice", - "userpass": "testpsw", "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "expiry": 600 + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 1 + "id": null } ``` - - - #### Response + #### Response (balance too low) ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" - }, - "id": 1 + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null } ``` - - - ### InvalidRequest (invalid paramater value) + #### Response (Transport error) ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string '56', expected u64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string '56', expected u64", - "id": 762 + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 } ``` +export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; +export const description = + "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; -## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} +# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} -The `lightning::payments::send_payment` method sends a payment to another node. +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. -Used to pay an invoice or send a payment via pubkey/address. + + Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | -#### 📌 Example using `invoice` +### Response Parameters - +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example with no optional params + + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "invoice", - "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ] + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 0, + "total": 2 + }, + "id": null } ``` -#### 📌 Example using `keysend` +#### 📌 Example with optional limit & page\_number params - + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "keysend", - "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "amount_in_msat": 1000, - "expiry": 24 - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` - - ### PaymentError (attempt to pay self) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:231]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "id": 6 - } - ``` - - ### PaymentError (no outbound routes) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "id": 762 - } - ``` - - ### PaymentError (keysend - no path to destination) +#### 📌 Example with optional spam protection + ```json { - "mmrpc": "2.0", - "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:107] lightning:256]", - "error_type": "PaymentError", - "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } + } } ``` + - ### PaymentError (invoice - no path to destination) - + ```json { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` + - ### InvalidRequest (request is missing a required field) - - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `payment`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `payment`", - "id": 762 - } - ``` +### 📌 Error responses - ### InvalidRequest (A required field is invalid) +#### Unsupported Chain Type - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "ParseError(Bech32Error(MissingSeparator))", - "id": 762 - } - ``` - +The supported chains are -## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} +``` +{ + "mmrpc":"2.0", + "error":"Error parsing request: UnsupportedChainType", + "error_path":"dispatcher", + "error_trace":"dispatcher:109]", + "error_type":"InvalidRequest", + "error_data":"UnsupportedChainType", + "id":null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; -The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to query. | -| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example - + ```json { - "method": "lightning::payments::get_payment_details", "userpass": "testpsw", + "method": "get_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" - }, - "id": 1 + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } } ``` @@ -19292,448 +20783,764 @@ The `lightning::payments::get_payment_details` method returns details about a li ```json { - "mmrpc": "2.0", - "result": { - "payment_details": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", - "payment_type": { - "type": "Outbound Payment", - "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" - }, - "description": "1 Blokaccino", - "amount_in_msat": 1000000, - "fee_paid_msat": 1803, - "status": "succeeded", - "created_at": 1684081413, - "last_updated": 1684081419 - } - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "amount": "1", + "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", + "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", + "name": "OpenSea Collections", + "symbol": "OPENSTORE", + "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", + "token_domain": "api.opensea.io", + "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", + "last_token_uri_sync": "2023-09-01T04:04:30.867Z", + "last_metadata_sync": "2023-09-01T04:35:01.128Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": true, + "chain": "POLYGON", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "block_number_minted": 19645247, + "block_number": 45776404, + "contract_type": "ERC1155", + "possible_phishing": false, + "uri_meta": { + "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_domain": "i.seadn.io", + "name": "Doge Napoleon", + "description": null, + "attributes": null, + "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", + "animation_domain": "openseauserdata.com", + "external_url": null, + "external_domain": null, + "image_details": null + } + }, + "id": null } ``` - - ### NoSuchPayment (payment hash not found) +## Error responses + +``` +{ + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", + "error_path": "nft", + "error_trace": "nft:123]", + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + }, + "id": null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; + +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + + To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + +#### 📌 Example with date and `send` filters + + ```json { - "mmrpc": "2.0", - "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", - "error_path": "get_payment_details", - "error_trace": "get_payment_details:75]", - "error_type": "NoSuchPayment", - "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } } ``` + - ### InvalidRequest (payment\_hash not a hash string) - + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid value: string '', expected a hash string", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid value: string '', expected a hash string", - "id": 762 + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": 1678270296, + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null } ``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; -## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +# Non Fungible Tokens (NFTs) -The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. +The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + + Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + +## NFT Information Methods + +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) + +## NFT Transaction Methods + +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + +export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; +export const description = + "This document describes how to query the local NFT database tables."; + +# Query NFT database tables + +After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, +the following tables are available in `DB/KOMODEFI.db`: + +* AVAX\_nft\_list +* AVAX\_nft\_transfer\_history +* BNB\_nft\_list +* BNB\_nft\_transfer\_history +* ETH\_nft\_list +* ETH\_nft\_transfer\_history +* FTM\_nft\_list +* FTM\_nft\_transfer\_history +* MATIC\_nft\_list +* MATIC\_nft\_transfer\_history +* scanned\_nft\_blocks + +## NFT List tables + +The COIN\_nft\_list tables contain the NFTs that you own +It has the following columns, though not all columns are populated for all NFTs: + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | +| 0 | token\_address | VARCHAR(256) | The address of the token contract. | +| 1 | token\_id | VARCHAR(256) | The id of the token. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 4 | block\_number | INTEGER | The block height of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 8 | collection\_name | TEXT | The collection name which includes the token. | +| 9 | symbol | TEXT | An arbitrary symbol for the NFT | +| 10 | token\_uri | TEXT | A link to the token's metadata. | +| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 12 | metadata | TEXT | The token's metadata in JSON format. | +| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | +| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | +| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | +| 16 | image\_url | TEXT | A link for the token's image (or other media). | +| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 18 | token\_name | TEXT | The name of the token. | +| 19 | description | TEXT | An arbitrary description of the NFT. | +| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | +| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | +| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | +| 23 | external\_url | TEXT | Additional URL related to the NFT | +| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | +| 25 | image\_details | TEXT | Additional details about the NFT's image. | +| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example COIN\_nft\_list table query + +> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; + +| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | +| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | +| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | +| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | +| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | +| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | +| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | + +The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. + +## NFT Transfer table + +The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: + +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | +| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | +| 1 | log\_index | INTEGER | Simply a table index. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | block\_number | INTEGER | The block height of this transaction. | +| 4 | block\_timestamp | INTEGER | The block time of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | token\_address | VARCHAR(256) | The address of the token contract. | +| 7 | token\_id | VARCHAR(256) | The id of the token. | +| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | +| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 12 | token\_uri | TEXT | A link to the token's metadata. | +| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 14 | collection\_name | TEXT | The collection name which includes the token. | +| 15 | image\_url | TEXT | A link for the token's image (or other media). | +| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 17 | token\_name | TEXT | The name of the token. | +| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example scanned\_nft\_blocks table query + +`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` + +| transaction\_hash | token\_name | token\_address | token\_id | +| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | + +## NFT Last Scanned Block table + +The scanned\_nft\_blocks table contains the last block that was scanned for each chain. +It has the following columns: + +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ---------------------------------------------------------------------- | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM scanned_nft_blocks;` + +| chain | last\_scanned\_block | +| ----- | -------------------- | +| MATIC | 50651981 | +| FTM | 66512090 | +| ETH | 0 | +| BNB | 0 | +| AVAX | 0 | +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; + +# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | -#### 📌 Example without filter + + If there are no errors, this request will return an empty response. + - +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning" - }, - "id": 1 + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - #### Response + + If there are no errors, this request will return an empty response. + ```json { "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683917593, - "last_updated": 1683917593 - }, { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", - "amount_in_msat": 88000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1683714225, - "last_updated": 1683805721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "ACME shrink ray", - "amount_in_msat": 4000012, - "status": "succeeded", - "created_at": 1683814625, - "last_updated": 1683815321 - }], - "limit": 10, - "skipped": 0, - "total": 6, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "result": null, + "id": null } ``` -#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; - +# Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will scan selected networks to update NFT information stored in the local database. +To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. + +See below for which coin to activate for each network: + +| Network | Coin | +| --------- | ----- | +| AVALANCHE | AVAX | +| BSC | BNB | +| ETH | ETH | +| FANTOM | FTM | +| POLYGON | MATIC | + +These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | --------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | + + + If there are no errors, this request will return an empty response. + When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. + + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "update_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "payment_type": { - "type": "Inbound Payment" - } - }, - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }, { - "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "14 pallets of frozen spinach", - "amount_in_msat": 56005000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }], - "limit": 2, - "skipped": 2, - "total": 7, - "total_pages": 4, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null } ``` -#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; - +# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + +#### 📌 ERC721 Withdraw Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "pending", - "from_amount_msat": 10000, - "to_amount_msat": 40000 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", + "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 35218, + "gas_price": "0.000000040827827163", + "total_fee": "0.001437874417026534" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732198, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -#### 📌 Example for successful payments on the 20th of April 2023 +#### 📌 ERC1155 Withdraw Example - +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "succeeded", - "from_timestamp": 1681948800, - "to_timestamp": 1682035199 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1681998480, - "last_updated": 1682008491 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", + "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 62368, + "gas_price": "0.000000012347931462", + "total_fee": "0.000770115789422016" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732805, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -export const title = "AtomicDEX Method: Max Maker Vol"; -export const description = - "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; - -# max\_maker\_vol - -The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. - -#### Arguments - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | - -#### Response - -| Parameter | Type | Description | -| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | -#### 📌 Examples +#### 📌 ERC1155 Withdraw Max Example -#### Command +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - + ```json { "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", - "method": "max_maker_vol", "params": { - "coin": "DOC" + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1" + } } } ``` - #### Response (success) - ```json { - "mmrpc": "2.0", - "result": { - "coin": "MARTY", - "volume": { - "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", - "rational": [ - [1, [962255003, 81]], - [1, [390588672, 18]] - ], - "fraction": { - "numer": "348854605979", - "denom": "77700000000" - } - }, - "balance": { - "decimal": "5.49110027", - "rational": [ - [1, [549110027]], - [1, [100000000]] - ], - "fraction": { - "numer": "549110027", - "denom": "100000000" - } + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", + "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC1155", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 59963, + "gas_price": "0.00000003794123733", + "total_fee": "0.00227507041401879" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732937, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "locked_by_swaps": { - "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", - "rational": [ - [1, [77802331]], - [1, [77700000]] - ], - "fraction": { - "numer": "77802331", - "denom": "77700000" - } - } - }, - "id": null + "id": null } ``` + - #### Response (error) + + ### 📌 Withdraw NFTs Error Responses - ```json + #### InvalidRequest (missing field) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `type`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `type`", + "id": null + } + ``` + + #### InvalidRequest (wrong withdraw type) + + ``` { - "mmrpc": "2.0", - "error": "No such coin TIME", - "error_path": "max_maker_vol_rpc.lp_coins", - "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "id": null } ``` - #### Response (balance too low) + #### TokenNotFoundInWallet (trying to send NFT you dont own) - ```json + ``` { - "mmrpc": "2.0", - "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", - "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", - "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "QTUM", - "available": "0", - "required": "0.000728" - }, - "id": null + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", + "error_path": "eth.nft", + "error_trace": "eth:883] nft:1177]", + "error_type": "GetNftInfoError", + "error_data": { + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" + } + }, + "id": null } ``` - #### Response (Transport error) + #### TransportError (unable to estimate gas) - ```json + ``` { - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 + "mmrpc": "2.0", + "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "error_path": "eth", + "error_trace": "eth:1004] eth:5792]", + "error_type": "Transport", + "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "id": null + } + ``` + + #### NotEnoughNftsAmount (trying to send more NFTs than you have) + + ``` + { + "mmrpc": "2.0", + "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", + "error_path": "eth", + "error_trace": "eth:897]", + "error_type": "NotEnoughNftsAmount", + "error_data": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "available": "1", + "required": "2" + }, + "id": null } ``` + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; diff --git a/utils/_fileData.json b/utils/_fileData.json index 79089001..6fd5e48f 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -3542,7 +3542,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables": { - "dateModified": "2023-12-04T14:26:29.000Z", + "dateModified": "2023-12-04T17:15:38.000Z", "contributors": [ { "name": "\"smk762\"", From 3b5929a4fe23ca5cfbdb81f921f49b055b63967c Mon Sep 17 00:00:00 2001 From: gcharang Date: Mon, 4 Dec 2023 17:54:39 +0000 Subject: [PATCH 74/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- .../komodefi-api/all-api-content.txt | 6421 +++++++++++------ .../komodefi-api/v20-api-content.txt | 644 ++ .../komodefi-api/v20-dev-api-content.txt | 1157 +++ 3 files changed, 5915 insertions(+), 2307 deletions(-) diff --git a/data-for-gpts/komodefi-api/all-api-content.txt b/data-for-gpts/komodefi-api/all-api-content.txt index 2f7f9bb0..69d469e4 100644 --- a/data-for-gpts/komodefi-api/all-api-content.txt +++ b/data-for-gpts/komodefi-api/all-api-content.txt @@ -2164,6 +2164,9 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | +| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | +| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | +| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -2200,6 +2203,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | +| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -2239,11 +2243,13 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | +| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | +| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | export const title = "AtomicDEX Method: Active Swaps"; export const description = @@ -13877,156 +13883,800 @@ It includes a uniform request, successful and error response formats. At the mom } ``` -export const title = "AtomicDEX: Signing and Verifying Messages"; -export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; -# Signing\_and\_Verifying\_Messages +## Common Komodo DeFi SDK Request / Response Objects -Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). +The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. -If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). +### ActivationParams -```json -{ - "coin": "DOC", - "asset": "DOC", - "fname": "DOC (TESTCOIN)", - "sign_message_prefix": "Komodo Signed Message:\n", - "rpcport": 25435, - "txversion": 4, - "overwintered": 1, - "mm2": 1, - "protocol": { - "type": "UTXO" - } -} -``` +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. -## Sign Message +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | -### Arguments + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message you want to sign | +### ActivationMode -### Response +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. -| Structure | Type | Description | -| --------- | ------ | --------------------------------------- | -| signature | string | The signature generated for the message | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | -#### Command +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | + +### ActivationServers + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example - ```json { - "userpass": "testpsw", - "method": "sign_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion" + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 } } ``` - -#### Response (success) + #### HD UTXO Activation (v2) -```json -{ - "mmrpc": "2.0", - "result": { - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" - }, - "id": 0 -} -``` + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + -### ⚠ Error types +### AddressInfos -**PrefixNotFound:** sign\_message\_prefix is not set in coin config file -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message signing is not supported by the given coin type -**InternalError:** An internal error occured during the signing process +The `addressInfos` object includes the following items for a given address: -## Verify Message +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | -### Arguments + + #### Example with balances -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message input via the `sign_message` method sign | -| signature | string | The signature generated for the message | -| address | string | The address used to sign the message | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` -### Response + #### Example without balances -| Structure | Type | Description | -| --------- | ------- | ----------------------------------------------------------- | -| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + -#### Command +### BalanceInfos - +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + ```json { - "userpass": "testpsw", - "method": "verify_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion", - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", - "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" - } + "spendable": "12.11398301", + "unspendable": "0.53" } ``` - + -#### Response (valid) +### DerivationMethod -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": true - }, - "id": 0 -} -``` +The `DerivationMethod` object includes the following items for a given coin or token: -#### Response (not valid) +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": false - }, - "id": 0 -} -``` + + Using the same seed or private key to generate keypairs using different + derivation methods will result in a different address and private key for each + method. + -### ⚠ Error types +Where the value indicates: -**PrefixNotFound:** sign\_message\_prefix is not set in coin config -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message verification is not supported by the given coin type -**InternalError:** An internal error occured during the verification process -**SignatureDecodingError:** Given signature could not be decoded -**AddressDecodingError:** Given address could not be decoded -export const title = "AtomicDEX Method: My TX History"; -export const description = "The my_tx_history method allows you to view the transaction history of coins."; +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. -# my\_tx\_history + + ```json + { + "type": "Iguana" + } + ``` + -To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ----------------------------------------------------------------------------- | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to + `false` (the default value), as the node is not expected to be reliably + online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. See + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + +### TokenFilter + +The `TokenFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### TokenMetadata + +The `TokenMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | + + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### WithdrawFee + +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. + +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + #### Example of Eth type + + ```json + { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + } + ``` + + #### Example of Qrc20 type + + ```json + { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + } + ``` + + #### Example of Tendermint type + + ```json + { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + } + ``` + + #### Example of Utxo type + + ```json + { + "type": "Utxo", + "amount": "0.00001" + } + ``` + + +### WithdrawNftData + +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; + +# Signing\_and\_Verifying\_Messages + +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). + +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). + +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` + +## Sign Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | + +### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" + } + } + ``` + + +#### Response (success) + +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process + +## Verify Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | + +### Response + +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } + } + ``` + + +#### Response (valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` + +#### Response (not valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; + +# my\_tx\_history + +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. @@ -16368,55 +17018,288 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (KMD success) + #### Response (KMD success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "KMD", + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } + }, + "id": 0 + } + ``` + + #### Response (NotSufficientBalance error) + + ```json + { + "mmrpc": "2.0", + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" + }, + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoFixed", + "amount": "0.1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "error_path": "utxo_common", + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoPerKbyte", + "amount": "1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", + "block_height": 0, + "timestamp": 1566473421, + "fee_details": { + "type": "Utxo", + "amount": "0.38378905" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + +#### Withdraw ETH, ERC20, and other ETH-based forks + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +#### ETH/ERC20 and other ETH-based forks, with gas fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } + }, + "id": 0 + } + ``` + + + + #### Response (success) ```json { "mmrpc": "2.0", "result": { + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", "block_height": 0, - "coin": "KMD", + "timestamp": 1566474670, "fee_details": { - "type": "Utxo", - "amount": "0.00001" + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" }, - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "my_balance_change": "-10.00001", - "received_by_me": "0.34417325", - "spent_by_me": "10.34418325", - "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], - "total_amount": "10.34418325", - "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", - "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", - "kmd_rewards": { - "amount": "0.0791809", - "claimed_by_my": true - } + "coin": "ETH", + "internal_id": "" }, "id": 0 } ``` - #### Response (NotSufficientBalance error) + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) ```json { "mmrpc": "2.0", - "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:449]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "DOC", - "available": "69.75066225", - "required": "1000.00001" - }, + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee +#### Withdraw maximum ```json @@ -16425,13 +17308,9 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoFixed", - "amount": "0.1" - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true }, "id": 0 } @@ -16439,49 +17318,86 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) + ##### Response (success) ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", "block_height": 0, - "timestamp": 1566472936, + "coin": "ETH", "fee_details": { - "type": "Utxo", - "amount": "0.1" + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" }, - "coin": "DOC", - "internal_id": "" + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw QRC20 coins + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 }, "id": 0 } ``` + - #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ##### Response (success) ```json { "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "error_path": "utxo_common", - "error_trace": "utxo_common:1371]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, "id": 0 } ``` -#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee +##### Withdraw QRC20 coins with gas limit ```json @@ -16490,12 +17406,13 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, "fee": { - "type": "UtxoPerKbyte", - "amount": "1" + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 } }, "id": 0 @@ -16504,35 +17421,36 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", - "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.00253836", - "spent_by_me": "60.00253836", - "received_by_me": "59.61874931", - "my_balance_change": "-0.38378905", "block_height": 0, - "timestamp": 1566473421, + "coin": "QRC20", + "timestamp": 1608725061, "fee_details": { - "type": "Utxo", - "amount": "0.38378905" + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" }, - "coin": "DOC", - "internal_id": "" + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, "id": 0 } ``` -#### Withdraw ETH, ERC20, and other ETH-based forks +##### Withdraw Tendermint coins with a memo ```json @@ -16541,9 +17459,10 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "amount": 10 + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } @@ -16551,54 +17470,72 @@ The request was failed due to an AtomicDEX API internal error. - #### Response (success) - ```json { "mmrpc": "2.0", "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", "block_height": 0, - "coin": "ETH", + "timestamp": 0, "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." }, "id": 0 } ``` + + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; -#### ETH/ERC20 and other ETH-based forks, with gas fee +# get\_current\_mtp - +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", + "method": "get_current_mtp", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "id": 42, "params": { - "coin": "COIN_NAME", - "to": "RECIPIENT_ADDRESS", - "amount": "AMOUNT", - "fee": { - "type": "EthGas", - "gas_price": "3.5", - "gas": 55000 - } - }, - "id": 0 + "coin": "DOC" + } } ``` @@ -16610,809 +17547,1039 @@ The request was failed due to an AtomicDEX API internal error. { "mmrpc": "2.0", "result": { - "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", - "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", - "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "total_amount": "10", - "spent_by_me": "10.0001925", - "received_by_me": "10", - "my_balance_change": "-0.0001925", - "block_height": 0, - "timestamp": 1566474670, - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 55000, - "gas_price": "0.0000000035", - "total_fee": "0.0001925" - }, - "coin": "ETH", - "internal_id": "" + "mtp": 1658746383 }, - "id": 0 + "id": 42 } ``` + +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) +# get\_locked\_amount + +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response + +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | + +#### 📌 Examples + +#### Command + ```json { + "userpass": "testpsw", "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", - "error_path": "eth", - "error_trace": "eth:535]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'EthGas' fee type, found UtxoFixed", - "id": 0 + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 } ``` - + -#### Withdraw maximum + + #### Response (success) - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "max": true + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } }, - "id": 0 + "id": 42 } ``` - - - ##### Response (success) + #### Response (error) ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "ETH", - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" - }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 0 + "id": 42 } ``` +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; -##### Withdraw QRC20 coins +# Heirarchical Deterministic Address Management - +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. + +## can\_get\_new\_address + +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "can_get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10 - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - ##### Response (success) + #### Response (success, allowed) ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null + } + ``` + + #### Response (success, not allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null } ``` -##### Withdraw QRC20 coins with gas limit +## get\_new\_address + +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + +Other reasons you might not be able to get a new address are: - +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "get_new_address", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10, - "fee": { - "type": "Qrc20Gas", - "gas_limit": 250000, - "gas_price": 40 - } - }, - "id": 0 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` + #### Response (success) + ```json { "mmrpc": "2.0", "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 250000, - "gas_price": 40, - "total_gas_fee": "0.1" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "allowed": true }, - "id": 0 + "id": null } ``` - - -##### Withdraw Tendermint coins with a memo - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "IRIS", - "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", - "amount": 13, - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." - }, - "id": 0 - } - ``` - + #### Response (success, not allowed) - ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", - "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "13.038553", - "spent_by_me": "13.038553", - "received_by_me": "13", - "my_balance_change": "-0.038553", - "block_height": 0, - "timestamp": 0, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", - "transaction_type": "StandardTransfer", - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } }, - "id": 0 + "id": null } ``` - - You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) -export const title = "AtomicDEX Method: Get Current MTP"; -export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; -# get\_current\_mtp +# HD Wallets Overview -The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! -## Arguments +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. -| Parameter | Type | Description | -| --------- | ------- | --------------------------------------------------------------------------------------- | -| coin | string | A compatible (UTXO) coin's ticker | -| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + + + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. + + +## Details for HwError error type + +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + +### FoundUnexpectedDevice + +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` + +### FoundMultipleDevices + +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` + +### NoTrezorDeviceAvailable + +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + +# AtomicDEX API RPC Protocol v2.0 (Dev) + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### Response +### Response (Error) -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | -| mtp | integer | Unix timestamp | -| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | -#### 📌 Examples +### 📌 Examples #### Command - + ```json { - "method": "get_current_mtp", - "userpass": "testpsw", "mmrpc": "2.0", - "id": 42, + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" - } + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 } ``` - - #### Response (success) +#### Response (success) - ```json - { - "mmrpc": "2.0", - "result": { - "mtp": 1658746383 +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Get Locked Amount"; -export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` -# get\_locked\_amount +#### Response (error) -The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; -## Arguments +# Lightning Network Initialization Tasks -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -#### Response +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} -| Parameter | Type | Description | -| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. -#### 📌 Examples + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + -#### Command +### Request Parameters - +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | + +#### 📌 Example + + ```json { + "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_locked_amount", "params": { - "coin": "DOC" + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 + } }, - "id": 42 + "id": 2 } ``` - #### Response (success) + ### Response Parameters - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "DOC", - "locked_amount": { - "decimal": "0.77803", - "rational": [ - [1, [77803]], - [1, [100000]] - ], - "fraction": { - "numer": "77803", - "denom": "100000" - } - } - }, - "id": 42 - } - ``` + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | - #### Response (error) + #### Response ```json { - "mmrpc": "2.0", - "error": "No such coin: TIME", - "error_path": "lp_swap.lp_coins", - "error_trace": "lp_swap:486] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": 42 + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null } ``` -export const title = "AtomicDEX: HD Address Management"; -export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; - -# Heirarchical Deterministic Address Management - -A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. - -## can\_get\_new\_address -To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. - -#### Arguments + + #### L2ConfigIsNotFound Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", + "id": 2 + } + ``` -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.allowed | boolean | Whether or not you can get a new address. | -| result.reason | string | The reason you cant get a new address (if allowed is `false`). | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + #### InvalidRequest Error -Other reasons you might not be able to get a new address are: + A parameter is incorrect. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 + } + ``` -#### 📌 Examples + #### UnexpectedL2Protocol Error -#### Command + Coin is wrong protocol type. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "can_get_new_address", - "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "mmrpc": "2.0", + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" + } + }, + "id": 2 } ``` - - - #### Response (success, allowed) + #### Internal Error + + Address already in use. ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null } ``` - #### Response (success, not allowed) + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. ```json { - "mmrpc": "2.0", - "result": { - "allowed": false, - "reason": "LastAddressNotUsed", - "details": { - "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" - } - }, - "id": null + "mmrpc": "2.0", + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 } ``` - - -## get\_new\_address -If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + -#### Arguments + #### InvalidPlatformConfiguration Error -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. -#### Response + ```json + { + "mmrpc": "2.0", + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 + } + ``` + -| Parameter | Type | Description | -| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.new\_address | object | Contains details about your new address. | -| result.address | string | The new address that was generated. | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | -| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | -| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| result.details.balance | object | Contains the spendable and unspendable balance for this address | -| result.details.balance.spendable | string(numeric) | Spendable balance for this address | -| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} -Other reasons you might not be able to get a new address are: +The `task::enable_lightning::status` request checks the status of lightning node initialization. -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) +### Request Parameters -#### 📌 Examples +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_new_address", + "method": "task::enable_lightning::status", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "task_id": 1, + "forget_if_finished": false + }, + "id": 2 } ``` - #### Response (success) + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) ```json { - "mmrpc": "2.0", - "result": { - "allowed": true - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` - #### Response (success, not allowed) + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) ```json { - "mmrpc": "2.0", - "result": { - "new_address": { - "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", - "derivation_path": "m/44'/141'/0'/0/3", - "chain": "External", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null } ``` - -export const title = "AtomicDEX: HD Wallets Overview"; -export const description = - "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; - -# HD Wallets Overview - -The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! - -For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. - -To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. - -## Initialisation and authentication: - -* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) -* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) -* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) -* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) -## UTXO Coin Activation in Hardware Mode: + Possible in progress statuses: -* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. -* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) -* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile + -## QTUM Coin Activation in Hardware Mode: +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} -* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. -* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) -* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) +The `task::enable_lightning::cancel` request cancels lightning node initialization. -## Withdrawing your Funds: +### Request Parameters -* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) -* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) -* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | -## Viewing Hardware Wallet Coin Balances: +#### 📌 Example -* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) -* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_lightning::cancel", + "params": { + "task_id": 1 + }, + "id": 1 + } + ``` + -## Creating New Addresses: + + #### Response -* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. -* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + - - These methods (and others with a `task::` prefix) will be linked to a numeric - `task_id` value which is used to query the status or outcome of the task. - + + #### TaskFinished Error -## Details for HwError error type + Task has already been completed. -When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null + } + ``` + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; -### FoundUnexpectedDevice +# Lightning Network Channels -The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found unexpected device. Please re-initialize Hardware wallet", - "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", - "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", - "error_type": "HwError", - "error_data": "FoundUnexpectedDevice" - } - }, - "id": null -} -``` +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} -### FoundMultipleDevices +The `lightning::channels::open_channel` method opens a new channel with a remote node. -Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. +### Request Parameters -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found multiple devices. Please unplug unused devices", - "error_path": "init_hw.crypto_ctx.hw_client", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", - "error_type": "HwError", - "error_data": "FoundMultipleDevices" - } - }, - "id": null -} -``` +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | -### NoTrezorDeviceAvailable +#### 📌 Example using an exact amount -No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 + } + }, + "id": 22 + } + ``` + -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "No Trezor device available", - "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", - "error_type": "HwError", - "error_data": "NoTrezorDeviceAvailable" - } - }, - "id": null -} -``` -export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; -export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + + #### Response -# AtomicDEX API RPC Protocol v2.0 (Dev) + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + }, + "id": 22 + } + ``` + -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. +#### 📌 Example using max available with channel options and configs -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 + } + }, + "id": null + } + ``` + -## Request + + #### Response -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + }, + "id": null + } + ``` + -### Response (Success) +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| result | object | the value of this field is determined by the method invoked on AtomicDEX API | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +The `lightning::channels::close_channel` method closes a channel with a remote node. -### Response (Error) +### Request Parameters -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | -### 📌 Examples + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + -#### Command +#### 📌 Example to force closing a channel - + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "mmrpc": "2.0", + "method": "lightning::channels::close_channel", "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true }, - "id": 0 + "id": 8 } ``` -#### Response (success) + + #### Response -```json -{ - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` -#### Response (error) + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + -```json -{ - "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, - "id": 0 -} -``` -export const title = "AtomicDEX: Lightning Network Initialization Tasks"; -export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + + -# Lightning Network Initialization Tasks + + #### InvalidRequest Error - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 + } + ``` -## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} + #### NoSuchChannel Error -The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` + - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. - +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} + +The `lightning::channels::update_channel` method updates channel options. ### Request Parameters -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { - "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::channels::update_channel", "params": { - "ticker": "tBTC-lightning", - "activation_params": { - "name": "AtomicDEX-Docs-Node-1", - "listening_port": 9735, - "color": "000000", - "payment_retries": 5 + "coin": "tBTC-lightning", + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 } }, "id": 2 @@ -17421,255 +18588,246 @@ The `task::enable_lightning::init` request a task to run a lightning node. Use t - ### Response Parameters - - | Parameter | Type | Description | - | --------- | ------- | --------------------------------------------------------- | - | task\_id | integer | An identifying number which is used to query task status. | - #### Response ```json { - "mmrpc": "2.0", - "result": { - "task_id": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null + } + }, + "id": 2 } ``` - #### L2ConfigIsNotFound Error + #### NoSuchChannel Error - Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. + Channel with the given uuid is not foun on the lightning network. ```json { "mmrpc": "2.0", - "error": "Layer 2 tBTC-lightning config is not found", - "error_path": "init_l2.prelude", - "error_trace": "init_l2:82] prelude:82]", - "error_type": "L2ConfigIsNotFound", - "error_data": "tBTC-lightning", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", "id": 2 } ``` + - #### InvalidRequest Error +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} - A parameter is incorrect. +The `lightning::channels::get_channel_details` method returns details about a channel. - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string "9735", expected u16", - "error_path": "dispatcher", - "error_trace": "dispatcher:110]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string "9735", expected u16", - "id": 762 - } - ``` +### Request Parameters - #### UnexpectedL2Protocol Error +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | - Coin is wrong protocol type. +#### 📌 Example to update all available channel options + ```json { - "mmrpc": "2.0", - "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", - "error_path": "init_l2.prelude.lightning_activation", - "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", - "error_type": "UnexpectedL2Protocol", - "error_data": { - "ticker": "tBTC-segwit", - "protocol": { - "type": "UTXO" - } - }, - "id": 2 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_channel_details", + "params": { + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + }, + "id": 54 } ``` + - #### Internal Error + + + The response will vary depending on whether the channel status is `open` or `closed`. + - Address already in use. + #### Response (opened channel) ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "I/O error Address already in use (os error 48)", - "error_path": "lib.lightning_activation.ln_p2p", - "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", - "error_type": "Internal", - "error_data": "I/O error Address already in use (os error 48)" - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 } ``` - #### PlatformCoinIsNotActivated Error + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + - The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + #### Response (closed channel) ```json { "mmrpc": "2.0", - "error": "Platform coin tBTC-lightning is not activated", - "error_path": "init_l2.lp_coins", - "error_trace": "init_l2:87] lp_coins:3087]", - "error_type": "PlatformCoinIsNotActivated", - "error_data": "tBTC-lightning", - "id": 2 + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 } ``` - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) - Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + - #### InvalidPlatformConfiguration Error - - Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + + #### InvalidRequest Error ```json { "mmrpc": "2.0", - "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", - "error_path": "init_l2.lightning_activation", - "error_trace": "init_l2:95] lightning_activation:254]", - "error_type": "InvalidPlatformConfiguration", - "error_data": { - "platform_coin_ticker": "tBTC-segwit", - "err": "'avg_blocktime' field is not found in platform coin config" - }, - "id": 2 + "error": "Error parsing request: missing field `coin`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `coin`", + "id": 54 } ``` -## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} -The `task::enable_lightning::status` request checks the status of lightning node initialization. +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. ### Request Parameters -| Parameter | Type | Description | -| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | -| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::status", + "method": "lightning::channels::get_claimable_balances", "params": { - "task_id": 1, - "forget_if_finished": false + "coin": "tBTC-lightning", + "include_open_channels_balances": true }, - "id": 2 + "id": 762 } ``` - ### Response Parameters - - | Parameter | Type | Description | - | -------------- | ------ | ---------------------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | - - - The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. - - - #### Response (ready, success) - - ```json - { - "mmrpc": "2.0", - "result": { - "status": "Ok", - "details": { - "platform_coin": "BTC-segwit", - "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null - } - ``` - - - In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. - Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. - For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). - - - #### Response (in progress state) + #### Response ```json { - "mmrpc": "2.0", - "result": { - "status": "InProgress", - "details": "ReadingNetworkGraphFromFile" - }, - "id": null + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], + "id": 762 } ``` - Possible in progress statuses: - - * ActivatingCoin - * GettingFeesFromRPC - * ReadingNetworkGraphFromFile - * InitializingChannelManager - * InitializingPeerManager - * ReadingScorerFromFile - * InitializingBackgroundProcessor - * ReadingChannelsAddressesFromFile + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + -## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} -The `task::enable_lightning::cancel` request cancels lightning node initialization. +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------- | -------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without using `filter` parameter - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::cancel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { - "task_id": 1 + "coin": "tBTC-lightning" }, - "id": 1 + "id": 55 } ``` @@ -17679,71 +18837,113 @@ The `task::enable_lightning::cancel` request cancels lightning node initializati ```json { - "mmrpc": "2.0", - "result": "success", - "id": null + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 } ``` - - #### TaskFinished Error +#### 📌 Example with `filter` for inbound channels only - Task has already been completed. +#### Command + ```json { - "mmrpc": "2.0", - "error": "Task is finished already", - "error_path": "init_l2.manager", - "error_trace": "init_l2:157] manager:104]", - "error_type": "TaskFinished", - "error_data": 3, - "id": null + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 } ``` - -export const title = "AtomicDEX: Lightning Network Channels"; -export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; - -# Lightning Network Channels - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} + -The `lightning::channels::open_channel` method opens a new channel with a remote node. + + #### Response -### Request Parameters + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + -| Parameter | Type | Description | -| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to open a channel for. | -| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | -| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example using an exact amount +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Exact", - "value": 0.004 + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" } }, - "id": 22 + "id": 55 } ``` @@ -17755,47 +18955,54 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 22 + "id": 55 } ``` -#### 📌 Example using max available with channel options and configs +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::open_channel", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Max" - }, - "push_msat": 0, - "channel_options": { - "proportional_fee_in_millionths_sats": 0, - "base_fee_msat": 1000, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 - }, - "channel_configs": { - "counterparty_locktime": 144, - "our_htlc_minimum_msat": 1, - "negotiate_scid_privacy": false, - "max_inbound_in_flight_htlc_percent": 10, - "commit_upfront_shutdown_pubkey": true, - "inbound_channels_confirmations": 3, - "their_channel_reserve_sats": 10000 + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 } }, - "id": null + "id": 55 } ``` @@ -17807,45 +19014,79 @@ The `lightning::channels::open_channel` method opens a new channel with a remote { "mmrpc": "2.0", "result": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": null + "id": 55 } ``` -## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} -The `lightning::channels::close_channel` method closes a channel with a remote node. +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| ------------ | ------- | ---------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to close a channel for. | -| uuid | string | Unique channel identifier. | -| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - - It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. - Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. - +#### 📌 Example without using `filter` parameter -#### 📌 Example to force closing a channel +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::close_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "force_close": true + "coin": "tBTC-lightning" }, - "id": 8 + "id": 55 } ``` @@ -17853,86 +19094,163 @@ The `lightning::channels::close_channel` method closes a channel with a remote n #### Response + ```json + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + ```json { - "mmrpc": "2.0", - "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "channel_type": "Inbound" + } + }, + "id": 55 } ``` + - - To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. - + + #### Response - - Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) - + ```json + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` - - #### InvalidRequest Error +#### 📌 Example with `filter` for a specific `node_id` + +#### Command + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `uuid`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `uuid`", - "id": 8 + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + } + }, + "id": 55 } ``` + - #### NoSuchChannel Error + + #### Response ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "error_path": "close_channel", - "error_trace": "close_channel:55]", - "error_type": "NoSuchChannel", - "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} - -The `lightning::channels::update_channel` method updates channel options. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value -#### 📌 Example to update all available channel options +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::update_channel", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 } }, - "id": 2 + "id": 55 } ``` @@ -17944,298 +19262,313 @@ The `lightning::channels::update_channel` method updates channel options. { "mmrpc": "2.0", "result": { - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_sats": null + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 } }, - "id": 2 + "id": 762 } ``` +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - - #### NoSuchChannel Error +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - Channel with the given uuid is not foun on the lightning network. +# Lightning Network Methods + + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + + +## Lightning Network Initialization Tasks + +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) + + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + + +## Lightning Network Nodes Methods +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) + +## Lightning Network Channels Methods + +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) + +## Lightning Network Payments Methods + +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) + +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! + +Then you can: + +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +Follow the flowchart below to visualize the process: + + + +## Lightning Network Coins File Configuration + + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + + +### Lightning Coin Config Parameters + +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + + ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", - "error_path": "update_channel", - "error_trace": "update_channel:61]", - "error_type": "NoSuchChannel", - "error_data": "dc33b998-8589-44fd-a246-256a582e8942", - "id": 2 - } + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, ``` +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} +# Lightning Network Nodes -The `lightning::channels::get_channel_details` method returns details about a channel. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------ | -| coin | string | The ticker of the coin you would like to view channel details for. | -| uuid | string | Unique channel identifier. | +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::get_channel_details", + "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, - "id": 54 + "id": 1 } ``` - - - The response will vary depending on whether the channel status is `open` or `closed`. - + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: - #### Response (opened channel) + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 959722, - "is_outbound": true, - "balance_msat": 959722000, - "outbound_capacity_msat": 950125000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": 3, - "is_ready": false, - "is_usable": false, - "is_public": false - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. - It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) - - - #### Response (closed channel) + #### Response (already connected) ```json { - "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_value": "98982", - "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", - "closure_reason": "null", - "claiming_tx": "null", - "claimed_balance": "null", - "funding_generated_in_block": "null", - "is_outbound": false, - "is_public": true, - "is_closed": true, - "created_at": 167273496966, - "closed_at": 171069595935 - } - }, - "id": 54 + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - - - The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) - - #### InvalidRequest Error + #### InvalidRequest Error (Invalid node\_address) ```json { "mmrpc": "2.0", - "error": "Error parsing request: missing field `coin`", + "error": "Error parsing request: Could not parse node address from str rgjhk3", "error_path": "dispatcher", "error_trace": "dispatcher:109]", "error_type": "InvalidRequest", - "error_data": "missing field `coin`", - "id": 54 - } - ``` - - -## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} - -The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. - -### Request Parameters - -| Parameter | Type | Description | -| --------------------------------- | ------- | ------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view claimable balances for. | -| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | - -#### 📌 Example to update all available channel options - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::get_claimable_balances", - "params": { - "coin": "tBTC-lightning", - "include_open_channels_balances": true - }, - "id": 762 + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 } ``` - - - #### Response + #### ConnectionError Error (Timed out waiting to connect to node\_address) ```json { - "mmrpc": "2.0", - "result": [{ - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 0 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 38815 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 959539 - } - }], - "id": 762 + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null } ``` - - - This response may include additional information in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) - -## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} -The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - -#### 📌 Example without using `filter` parameter - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", - "params": { - "coin": "tBTC-lightning" - }, - "id": 55 - } - ``` - - - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": null, - "funding_tx_output_index": null, - "funding_tx_value_sats": 4000, - "is_outbound": true, - "balance_msat": 4000000, - "outbound_capacity_msat": 4000000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": null, - "is_ready": false, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning", - "filter": { - "is_outbound": false - } + "coin": "tBTC-lightning" }, - "id": 55 + "id": 1 } ``` @@ -18247,53 +19580,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -18305,54 +19622,37 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} -#### Command +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. - +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | + +#### 📌 Example + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::nodes::remove_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 1000, - "to_funding_value_sats": 500000 - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` @@ -18364,79 +19664,49 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }, { - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 2, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, - "id": 55 + "id": 1 } ``` +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; -## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} +# Lightning Network Payments -The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -### Request Parameters +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. -#### 📌 Example without using `filter` parameter +### Request Parameters -#### Command +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | - +#### 📌 Example + + ```json { + "method": "lightning::payments::generate_invoice", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 }, - "id": 55 + "id": 1 } ``` @@ -18444,111 +19714,63 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response - ```json - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }, - { - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only - -#### Command - - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "channel_type": "Inbound" - } - }, - "id": 55 + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 } ``` - + - - #### Response + + ### InvalidRequest (invalid paramater value) ```json - - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": false, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 } ``` -#### 📌 Example with `filter` for a specific `node_id` +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} -#### Command +The `lightning::payments::send_payment` method sends a payment to another node. - +Used to pay an invoice or send a payment via pubkey/address. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | + +#### 📌 Example using `invoice` + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" } }, - "id": 55 + "id": 6 } ``` @@ -18557,50 +19779,34 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response ```json - - {"mmrpc": "2.0", + { + "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - -#### Command +#### 📌 Example using `keysend` - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::payments::send_payment", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 100000, - "to_funding_value_sats": 500000 + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 } }, - "id": 55 + "id": 6 } ``` @@ -18612,311 +19818,350 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list { "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", - "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", - "funding_value": 40000, - "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", - "closure_reason": "Channel closed because the channel was cooperatively closed", - "funding_generated_in_block": 2433122, - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1684083341, - "closed_at": 1684146940 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" }, "id": 762 } ``` -export const title = "AtomicDEX: Lightning Network Methods"; -export const description = - "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - -import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - -# Lightning Network Methods - - - Lightning methods are currently only available using the native AtomicDEX-API. - WASM support should be available in late 2023. - - -## Lightning Network Initialization Tasks - -* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) -* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value - which is used to query the status or outcome of the task. - - -## Lightning Network Nodes Methods - -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) -* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) -* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - -## Lightning Network Channels Methods -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) -* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) -* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) -* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) -* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) -* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - -## Lightning Network Payments Methods - -* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) -* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -## Lightning Network Flowchart - -Once you: - -* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) - -You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! - -Then you can: + + ### PaymentError (attempt to pay self) -* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 + } + ``` -Follow the flowchart below to visualize the process: + ### PaymentError (no outbound routes) - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` -## Lightning Network Coins File Configuration + ### PaymentError (keysend - no path to destination) - - Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) - param must be set in the `coins` configuration file, and aplies to all - channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and - [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters - are set per channel. These can be defined in the `coins` configuration file to - act as the default for all opened channels, and optionally overwritten or - updated using the - [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or - [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) - methods. - + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` -### Lightning Coin Config Parameters + ### PaymentError (invoice - no path to destination) -| Parameter | Type | Description | -| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | -| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | -| decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | -| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | -| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` - - For GUIs and wallet apps, it is recommended to set - `accept_forwards_to_priv_channels` to `false`. This prevents users from taking - on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) - should also be set to `false` for GUIs and wallet apps. - + ### InvalidRequest (request is missing a required field) - ```json - { - "coin": "BTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_config": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3, - "force_announced_channel_preference": false - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "BTC-segwit", - "network": "mainnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, - { - "coin": "tBTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_configs": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90, - "their_channel_reserve_sats": 10000 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3 - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "tBTC-segwit", - "network": "testnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } ``` - -export const title = "AtomicDEX: Lightning Network Nodes"; -export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -# Lightning Network Nodes + ### InvalidRequest (A required field is invalid) - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 + } + ``` + -## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} -The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ----------------------------------------------------------------------------------- | -| coin | string | The coin ticker you would like to connect to a node on. | -| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | #### 📌 Example - + ```json { + "method": "lightning::payments::get_payment_details", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::connect_to_node", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" }, "id": 1 } ``` - - The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. - Other node addresses can be retrieved from any lightning explorer, such as: + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 + } + ``` + - * [https://1ml.com/](https://1ml.com/) - * [https://mempool.space/lightning/](https://mempool.space/lightning/) - + + ### NoSuchPayment (payment hash not found) - - #### Response (success) + ```json + { + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 + } + ``` + + ### InvalidRequest (payment\_hash not a hash string) ```json { - "mmrpc": "2.0", - "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 } ``` + - #### Response (already connected) +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without filter + + ```json { - "mmrpc": "2.0", - "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` - - #### InvalidRequest Error (Invalid node\_address) +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: Could not parse node address from str rgjhk3", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "Could not parse node address from str rgjhk3", - "id": 762 + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` + - #### ConnectionError Error (Timed out waiting to connect to node\_address) - + ```json { - "mmrpc": "2.0", - "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "error_path": "connect_to_node", - "error_trace": "connect_to_node:78]", - "error_type": "ConnectionError", - "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` -## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - -The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to view your trusted nodes to. | - -#### 📌 Example +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 + } }, "id": 1 } @@ -18930,35 +20175,45 @@ The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes i { "mmrpc": "2.0", "result": { - "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` -## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - -The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------------------------- | -| coin | string | The coin ticker you would like to add a trusted node for. | -| node\_id | string | ID of node you would like to add to your trusted list. | - -#### 📌 Example +#### 📌 Example for successful payments on the 20th of April 2023 - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 + } }, "id": 1 } @@ -18972,319 +20227,555 @@ The `lightning::nodes::add_trusted_node` method allows you to add a node to your { "mmrpc": "2.0", "result": { - "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 1 } ``` +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; -## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} +# max\_maker\_vol -The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. -### Request Parameters +#### Arguments -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to remove a trusted node from. | -| node\_id | string | ID of node you would like to remove from your trusted list. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | -#### 📌 Example +#### Response - +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::remove_trusted_node", + "method": "max_maker_vol", "params": { - "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 + "coin": "DOC" + } } ``` - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 - } - ``` - -export const title = "AtomicDEX: Lightning Network Payments"; -export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - -# Lightning Network Payments - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - - -## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} - -The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of coin to generate invoice for. | -| description | string | A note to indicate the purpose of the invoice. | -| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | -| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } + }, + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null + } + ``` -#### 📌 Example + #### Response (error) - ```json { - "method": "lightning::payments::generate_invoice", - "userpass": "testpsw", "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "expiry": 600 + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" }, - "id": 1 + "id": null } ``` - - - #### Response + #### Response (balance too low) ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" - }, - "id": 1 + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null } ``` - - - ### InvalidRequest (invalid paramater value) + #### Response (Transport error) ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string '56', expected u64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string '56', expected u64", - "id": 762 + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 } ``` +export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; +export const description = + "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; -## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} +# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} -The `lightning::payments::send_payment` method sends a payment to another node. +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. -Used to pay an invoice or send a payment via pubkey/address. + + Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | -#### 📌 Example using `invoice` +### Response Parameters - +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example with no optional params + + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "invoice", - "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ] + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 0, + "total": 2 + }, + "id": null } ``` -#### 📌 Example using `keysend` +#### 📌 Example with optional limit & page\_number params - + ```json { "userpass": "testpsw", + "method": "get_nft_list", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", "params": { - "coin": "tBTC-lightning", - "payment": { - "type": "keysend", - "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "amount_in_msat": 1000, - "expiry": 24 - } - }, - "id": 6 + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` - - ### PaymentError (attempt to pay self) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:231]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "id": 6 - } - ``` - - ### PaymentError (no outbound routes) - - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "id": 762 - } - ``` - - ### PaymentError (keysend - no path to destination) +#### 📌 Example with optional spam protection + ```json { - "mmrpc": "2.0", - "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:107] lightning:256]", - "error_type": "PaymentError", - "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } + } } ``` + - ### PaymentError (invoice - no path to destination) - + ```json { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "id": 762 + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null } ``` + - ### InvalidRequest (request is missing a required field) - - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `payment`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `payment`", - "id": 762 - } - ``` +### 📌 Error responses - ### InvalidRequest (A required field is invalid) +#### Unsupported Chain Type - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "ParseError(Bech32Error(MissingSeparator))", - "id": 762 - } - ``` - +The supported chains are -## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} +``` +{ + "mmrpc":"2.0", + "error":"Error parsing request: UnsupportedChainType", + "error_path":"dispatcher", + "error_trace":"dispatcher:109]", + "error_type":"InvalidRequest", + "error_data":"UnsupportedChainType", + "id":null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; -The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to query. | -| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example - + ```json { - "method": "lightning::payments::get_payment_details", "userpass": "testpsw", + "method": "get_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" - }, - "id": 1 + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } } ``` @@ -19292,448 +20783,764 @@ The `lightning::payments::get_payment_details` method returns details about a li ```json { - "mmrpc": "2.0", - "result": { - "payment_details": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", - "payment_type": { - "type": "Outbound Payment", - "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" - }, - "description": "1 Blokaccino", - "amount_in_msat": 1000000, - "fee_paid_msat": 1803, - "status": "succeeded", - "created_at": 1684081413, - "last_updated": 1684081419 - } - }, - "id": 762 + "mmrpc": "2.0", + "result": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "amount": "1", + "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", + "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", + "name": "OpenSea Collections", + "symbol": "OPENSTORE", + "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", + "token_domain": "api.opensea.io", + "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", + "last_token_uri_sync": "2023-09-01T04:04:30.867Z", + "last_metadata_sync": "2023-09-01T04:35:01.128Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": true, + "chain": "POLYGON", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "block_number_minted": 19645247, + "block_number": 45776404, + "contract_type": "ERC1155", + "possible_phishing": false, + "uri_meta": { + "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_domain": "i.seadn.io", + "name": "Doge Napoleon", + "description": null, + "attributes": null, + "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", + "animation_domain": "openseauserdata.com", + "external_url": null, + "external_domain": null, + "image_details": null + } + }, + "id": null } ``` - - ### NoSuchPayment (payment hash not found) +## Error responses + +``` +{ + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", + "error_path": "nft", + "error_trace": "nft:123]", + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + }, + "id": null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; + +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + + To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + +#### 📌 Example with date and `send` filters + + ```json { - "mmrpc": "2.0", - "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", - "error_path": "get_payment_details", - "error_trace": "get_payment_details:75]", - "error_type": "NoSuchPayment", - "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", - "id": 762 + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } } ``` + - ### InvalidRequest (payment\_hash not a hash string) - + ```json { - "mmrpc": "2.0", - "error": "Error parsing request: invalid value: string '', expected a hash string", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid value: string '', expected a hash string", - "id": 762 + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": 1678270296, + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null } ``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; -## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +# Non Fungible Tokens (NFTs) -The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. +The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + + Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + +## NFT Information Methods + +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) + +## NFT Transaction Methods + +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + +export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; +export const description = + "This document describes how to query the local NFT database tables."; + +# Query NFT database tables + +After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, +the following tables are available in `DB/KOMODEFI.db`: + +* AVAX\_nft\_list +* AVAX\_nft\_transfer\_history +* BNB\_nft\_list +* BNB\_nft\_transfer\_history +* ETH\_nft\_list +* ETH\_nft\_transfer\_history +* FTM\_nft\_list +* FTM\_nft\_transfer\_history +* MATIC\_nft\_list +* MATIC\_nft\_transfer\_history +* scanned\_nft\_blocks + +## NFT List tables + +The COIN\_nft\_list tables contain the NFTs that you own +It has the following columns, though not all columns are populated for all NFTs: + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | +| 0 | token\_address | VARCHAR(256) | The address of the token contract. | +| 1 | token\_id | VARCHAR(256) | The id of the token. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 4 | block\_number | INTEGER | The block height of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 8 | collection\_name | TEXT | The collection name which includes the token. | +| 9 | symbol | TEXT | An arbitrary symbol for the NFT | +| 10 | token\_uri | TEXT | A link to the token's metadata. | +| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 12 | metadata | TEXT | The token's metadata in JSON format. | +| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | +| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | +| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | +| 16 | image\_url | TEXT | A link for the token's image (or other media). | +| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 18 | token\_name | TEXT | The name of the token. | +| 19 | description | TEXT | An arbitrary description of the NFT. | +| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | +| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | +| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | +| 23 | external\_url | TEXT | Additional URL related to the NFT | +| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | +| 25 | image\_details | TEXT | Additional details about the NFT's image. | +| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example COIN\_nft\_list table query + +> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; + +| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | +| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | +| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | +| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | +| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | +| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | +| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | + +The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. + +## NFT Transfer table + +The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: + +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | +| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | +| 1 | log\_index | INTEGER | Simply a table index. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | block\_number | INTEGER | The block height of this transaction. | +| 4 | block\_timestamp | INTEGER | The block time of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | token\_address | VARCHAR(256) | The address of the token contract. | +| 7 | token\_id | VARCHAR(256) | The id of the token. | +| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | +| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 12 | token\_uri | TEXT | A link to the token's metadata. | +| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 14 | collection\_name | TEXT | The collection name which includes the token. | +| 15 | image\_url | TEXT | A link for the token's image (or other media). | +| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 17 | token\_name | TEXT | The name of the token. | +| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example scanned\_nft\_blocks table query + +`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` + +| transaction\_hash | token\_name | token\_address | token\_id | +| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | + +## NFT Last Scanned Block table + +The scanned\_nft\_blocks table contains the last block that was scanned for each chain. +It has the following columns: + +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ---------------------------------------------------------------------- | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM scanned_nft_blocks;` + +| chain | last\_scanned\_block | +| ----- | -------------------- | +| MATIC | 50651981 | +| FTM | 66512090 | +| ETH | 0 | +| BNB | 0 | +| AVAX | 0 | +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; + +# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | -#### 📌 Example without filter + + If there are no errors, this request will return an empty response. + - +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning" - }, - "id": 1 + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - #### Response + + If there are no errors, this request will return an empty response. + ```json { "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683917593, - "last_updated": 1683917593 - }, { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", - "amount_in_msat": 88000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1683714225, - "last_updated": 1683805721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "ACME shrink ray", - "amount_in_msat": 4000012, - "status": "succeeded", - "created_at": 1683814625, - "last_updated": 1683815321 - }], - "limit": 10, - "skipped": 0, - "total": 6, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "result": null, + "id": null } ``` -#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; - +# Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will scan selected networks to update NFT information stored in the local database. +To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. + +See below for which coin to activate for each network: + +| Network | Coin | +| --------- | ----- | +| AVALANCHE | AVAX | +| BSC | BNB | +| ETH | ETH | +| FANTOM | FTM | +| POLYGON | MATIC | + +These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | --------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | + + + If there are no errors, this request will return an empty response. + When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. + + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "update_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "payment_type": { - "type": "Inbound Payment" - } - }, - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } } ``` - - - - ```json - { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }, { - "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "14 pallets of frozen spinach", - "amount_in_msat": 56005000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }], - "limit": 2, - "skipped": 2, - "total": 7, - "total_pages": 4, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null } ``` -#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; - +# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + +#### 📌 ERC721 Withdraw Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "pending", - "from_amount_msat": 10000, - "to_amount_msat": 40000 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", + "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 35218, + "gas_price": "0.000000040827827163", + "total_fee": "0.001437874417026534" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732198, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -#### 📌 Example for successful payments on the 20th of April 2023 +#### 📌 ERC1155 Withdraw Example - +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "succeeded", - "from_timestamp": 1681948800, - "to_timestamp": 1682035199 + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" } - }, - "id": 1 + } } ``` - #### Response - ```json { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1681998480, - "last_updated": 1682008491 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", + "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 62368, + "gas_price": "0.000000012347931462", + "total_fee": "0.000770115789422016" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732805, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null } ``` -export const title = "AtomicDEX Method: Max Maker Vol"; -export const description = - "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; - -# max\_maker\_vol - -The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. - -#### Arguments - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | - -#### Response - -| Parameter | Type | Description | -| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | -#### 📌 Examples +#### 📌 ERC1155 Withdraw Max Example -#### Command +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. - + ```json { "userpass": "testpsw", + "method": "withdraw_nft", "mmrpc": "2.0", - "method": "max_maker_vol", "params": { - "coin": "DOC" + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1" + } } } ``` - #### Response (success) - ```json { - "mmrpc": "2.0", - "result": { - "coin": "MARTY", - "volume": { - "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", - "rational": [ - [1, [962255003, 81]], - [1, [390588672, 18]] - ], - "fraction": { - "numer": "348854605979", - "denom": "77700000000" - } - }, - "balance": { - "decimal": "5.49110027", - "rational": [ - [1, [549110027]], - [1, [100000000]] - ], - "fraction": { - "numer": "549110027", - "denom": "100000000" - } + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", + "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC1155", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 59963, + "gas_price": "0.00000003794123733", + "total_fee": "0.00227507041401879" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732937, + "internal_id": 0, + "transaction_type": "NftTransfer" }, - "locked_by_swaps": { - "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", - "rational": [ - [1, [77802331]], - [1, [77700000]] - ], - "fraction": { - "numer": "77802331", - "denom": "77700000" - } - } - }, - "id": null + "id": null } ``` + - #### Response (error) + + ### 📌 Withdraw NFTs Error Responses - ```json + #### InvalidRequest (missing field) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `type`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `type`", + "id": null + } + ``` + + #### InvalidRequest (wrong withdraw type) + + ``` { - "mmrpc": "2.0", - "error": "No such coin TIME", - "error_path": "max_maker_vol_rpc.lp_coins", - "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "id": null } ``` - #### Response (balance too low) + #### TokenNotFoundInWallet (trying to send NFT you dont own) - ```json + ``` { - "mmrpc": "2.0", - "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", - "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", - "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "QTUM", - "available": "0", - "required": "0.000728" - }, - "id": null + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", + "error_path": "eth.nft", + "error_trace": "eth:883] nft:1177]", + "error_type": "GetNftInfoError", + "error_data": { + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" + } + }, + "id": null } ``` - #### Response (Transport error) + #### TransportError (unable to estimate gas) - ```json + ``` { - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 + "mmrpc": "2.0", + "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "error_path": "eth", + "error_trace": "eth:1004] eth:5792]", + "error_type": "Transport", + "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "id": null + } + ``` + + #### NotEnoughNftsAmount (trying to send more NFTs than you have) + + ``` + { + "mmrpc": "2.0", + "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", + "error_path": "eth", + "error_trace": "eth:897]", + "error_type": "NotEnoughNftsAmount", + "error_data": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "available": "1", + "required": "2" + }, + "id": null } ``` + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; diff --git a/data-for-gpts/komodefi-api/v20-api-content.txt b/data-for-gpts/komodefi-api/v20-api-content.txt index ff2fa2ad..d2b392d8 100644 --- a/data-for-gpts/komodefi-api/v20-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-api-content.txt @@ -2799,6 +2799,650 @@ It includes a uniform request, successful and error response formats. At the mom } ``` + +## Common Komodo DeFi SDK Request / Response Objects + +The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. + +### ActivationParams + +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. + +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | + + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + + +### ActivationMode + +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | + +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | + +### ActivationServers + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example + + ```json + { + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + ``` + + #### HD UTXO Activation (v2) + + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + + +### AddressInfos + +The `addressInfos` object includes the following items for a given address: + +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | + + + #### Example with balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` + + #### Example without balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + + +### BalanceInfos + +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + + ```json + { + "spendable": "12.11398301", + "unspendable": "0.53" + } + ``` + + +### DerivationMethod + +The `DerivationMethod` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | + + + Using the same seed or private key to generate keypairs using different + derivation methods will result in a different address and private key for each + method. + + +Where the value indicates: + +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. + + + ```json + { + "type": "Iguana" + } + ``` + + +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ----------------------------------------------------------------------------- | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to + `false` (the default value), as the node is not expected to be reliably + online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. See + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + +### TokenFilter + +The `TokenFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### TokenMetadata + +The `TokenMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | + + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### WithdrawFee + +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. + +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + #### Example of Eth type + + ```json + { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + } + ``` + + #### Example of Qrc20 type + + ```json + { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + } + ``` + + #### Example of Tendermint type + + ```json + { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + } + ``` + + #### Example of Utxo type + + ```json + { + "type": "Utxo", + "amount": "0.00001" + } + ``` + + +### WithdrawNftData + +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + export const title = "AtomicDEX: Signing and Verifying Messages"; export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; diff --git a/data-for-gpts/komodefi-api/v20-dev-api-content.txt b/data-for-gpts/komodefi-api/v20-dev-api-content.txt index 6568f263..fe19c910 100644 --- a/data-for-gpts/komodefi-api/v20-dev-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-dev-api-content.txt @@ -2881,6 +2881,1163 @@ The `max_maker_vol` method returns the maximum volume of a coin which can be use } ``` +export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; +export const description = + "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; + +# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} + +Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. + + + Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example with no optional params + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ] + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "BSC", + "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", + "token_id": "0", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "b34ddf294013d20a6d70691027625839", + "block_number_minted": 25465916, + "block_number": 25919780, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", + "token_domain": "tikimetadata.s3.amazonaws.com", + "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", + "last_token_uri_sync": "2023-02-07T17:10:08.402Z", + "last_metadata_sync": "2023-02-07T17:10:16.858Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", + "image_domain": "tikimetadata.s3.amazonaws.com", + "name": "Tiki box", + "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", + "attributes": [ + { + "trait_type": "Crypto Logo", + "value": "TIKI NFT CRYPTOLOGO SCAR" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "", + "external_domain": null, + "image_details": null + } + }, + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 0, + "total": 2 + }, + "id": null + } + ``` + + +#### 📌 Example with optional limit & page\_number params + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "limit": 1, + "page_number": 2 + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null + } + ``` + + +#### 📌 Example with optional spam protection + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_list", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "protect_from_spam": true, + "filters": { + "exclude_spam": true, + "exclude_phishing": true + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "nfts": [ + { + "chain": "POLYGON", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "amount": "1", + "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_hash": "28f970585fd743b056859a6e41f50a8e", + "block_number_minted": 36781490, + "block_number": 42491885, + "contract_type": "ERC1155", + "name": null, + "symbol": null, + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", + "last_token_uri_sync": "2022-12-13T13:12:50.840Z", + "last_metadata_sync": "2023-05-15T07:30:04.882Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": false, + "possible_phishing": false, + "uri_meta": { + "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "name": "Forest Mushrooms", + "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", + "attributes": [ + { + "trait_type": "Type", + "value": "Ingredient" + }, + { + "trait_type": "Category", + "value": "COMMON" + } + ], + "animation_url": null, + "animation_domain": null, + "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", + "external_domain": "app.thesmurfssociety.com", + "image_details": null + } + } + ], + "skipped": 1, + "total": 1 + }, + "id": null + } + ``` + + +### 📌 Error responses + +#### Unsupported Chain Type + +The supported chains are + +``` +{ + "mmrpc":"2.0", + "error":"Error parsing request: UnsupportedChainType", + "error_path":"dispatcher", + "error_trace":"dispatcher:109]", + "error_type":"InvalidRequest", + "error_data":"UnsupportedChainType", + "id":null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; + +# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ------------------ | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414", + "chain": "BSC" + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "amount": "1", + "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", + "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", + "name": "OpenSea Collections", + "symbol": "OPENSTORE", + "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", + "token_domain": "api.opensea.io", + "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", + "last_token_uri_sync": "2023-09-01T04:04:30.867Z", + "last_metadata_sync": "2023-09-01T04:35:01.128Z", + "minter_address": "ERC1155 tokens don't have a single minter", + "possible_spam": true, + "chain": "POLYGON", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "block_number_minted": 19645247, + "block_number": 45776404, + "contract_type": "ERC1155", + "possible_phishing": false, + "uri_meta": { + "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", + "image_domain": "i.seadn.io", + "name": "Doge Napoleon", + "description": null, + "attributes": null, + "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", + "animation_domain": "openseauserdata.com", + "external_url": null, + "external_domain": null, + "image_details": null + } + }, + "id": null + } + ``` + + +## Error responses + +``` +{ + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", + "error_path": "nft", + "error_trace": "nft:123]", + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", + "token_id": "214300044414" + }, + "id": null +} +``` +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; + +# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} + +Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. + + + To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + + +#### 📌 Example with date and `send` filters + + + ```json + { + "userpass": "testpsw", + "method": "get_nft_transfers", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON" + ], + "max": true, + "filters": { + "send": true, + "from_date": 1676636291 + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "transfer_history": [ + { + "chain": "POLYGON", + "block_number": 40103927, + "block_timestamp": 1678270296, + "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", + "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", + "transaction_index": 114, + "log_index": 307, + "value": "0", + "contract_type": "ERC1155", + "transaction_type": "Single", + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", + "status": "Send", + "amount": "1", + "verified": 1, + "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", + "token_domain": "app.thesmurfssociety.com", + "collection_name": null, + "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", + "image_domain": "metadata.thesmurfssociety.com", + "token_name": "Forest Mushrooms", + "possible_spam": false, + "possible_phishing": false + } + ], + "skipped": 1, + "total": 2 + }, + "id": null + } + ``` + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; + +# Non Fungible Tokens (NFTs) + +The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. + + + Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) + method to populate/refresh the local database. + + +## NFT Information Methods + +* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) +* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) +* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) +* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) +* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) + +## NFT Transaction Methods + +* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) +* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + +export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; +export const description = + "This document describes how to query the local NFT database tables."; + +# Query NFT database tables + +After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, +the following tables are available in `DB/KOMODEFI.db`: + +* AVAX\_nft\_list +* AVAX\_nft\_transfer\_history +* BNB\_nft\_list +* BNB\_nft\_transfer\_history +* ETH\_nft\_list +* ETH\_nft\_transfer\_history +* FTM\_nft\_list +* FTM\_nft\_transfer\_history +* MATIC\_nft\_list +* MATIC\_nft\_transfer\_history +* scanned\_nft\_blocks + +## NFT List tables + +The COIN\_nft\_list tables contain the NFTs that you own +It has the following columns, though not all columns are populated for all NFTs: + +| ID | Name | Type | Description | +| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | +| 0 | token\_address | VARCHAR(256) | The address of the token contract. | +| 1 | token\_id | VARCHAR(256) | The id of the token. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 4 | block\_number | INTEGER | The block height of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 8 | collection\_name | TEXT | The collection name which includes the token. | +| 9 | symbol | TEXT | An arbitrary symbol for the NFT | +| 10 | token\_uri | TEXT | A link to the token's metadata. | +| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 12 | metadata | TEXT | The token's metadata in JSON format. | +| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | +| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | +| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | +| 16 | image\_url | TEXT | A link for the token's image (or other media). | +| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 18 | token\_name | TEXT | The name of the token. | +| 19 | description | TEXT | An arbitrary description of the NFT. | +| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | +| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | +| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | +| 23 | external\_url | TEXT | Additional URL related to the NFT | +| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | +| 25 | image\_details | TEXT | Additional details about the NFT's image. | +| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example COIN\_nft\_list table query + +> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; + +| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | +| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | +| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | +| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | +| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | +| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | +| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | + +The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. + +## NFT Transfer table + +The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: + +| ID | Name | Type | Description | +| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | +| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | +| 1 | log\_index | INTEGER | Simply a table index. | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 3 | block\_number | INTEGER | The block height of this transaction. | +| 4 | block\_timestamp | INTEGER | The block time of this transaction. | +| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | +| 6 | token\_address | VARCHAR(256) | The address of the token contract. | +| 7 | token\_id | VARCHAR(256) | The id of the token. | +| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | +| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | +| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | +| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | +| 12 | token\_uri | TEXT | A link to the token's metadata. | +| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | +| 14 | collection\_name | TEXT | The collection name which includes the token. | +| 15 | image\_url | TEXT | A link for the token's image (or other media). | +| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | +| 17 | token\_name | TEXT | The name of the token. | +| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | + +### Example scanned\_nft\_blocks table query + +`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` + +| transaction\_hash | token\_name | token\_address | token\_id | +| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | +| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | + +## NFT Last Scanned Block table + +The scanned\_nft\_blocks table contains the last block that was scanned for each chain. +It has the following columns: + +| ID | Name | Type | Description | +| -- | -------------------- | ------- | ---------------------------------------------------------------------- | +| 2 | chain | TEXT | The coin network which the NFT is on. | +| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | + +### Example scanned\_nft\_blocks table query + +`SELECT * FROM scanned_nft_blocks;` + +| chain | last\_scanned\_block | +| ----- | -------------------- | +| MATIC | 50651981 | +| FTM | 66512090 | +| ETH | 0 | +| BNB | 0 | +| AVAX | 0 | +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; + +# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} + +This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | + + + If there are no errors, this request will return an empty response. + + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "refresh_nft_metadata", + "mmrpc": "2.0", + "params": { + "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", + "token_id": "5", + "chain": "POLYGON", + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } + } + ``` + + + + + If there are no errors, this request will return an empty response. + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; + +# Update NFT {{label : 'update_nft', tag : 'API-v2'}} + +This method will scan selected networks to update NFT information stored in the local database. +To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. + +See below for which coin to activate for each network: + +| Network | Coin | +| --------- | ----- | +| AVALANCHE | AVAX | +| BSC | BNB | +| ETH | ETH | +| FANTOM | FTM | +| POLYGON | MATIC | + +These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | --------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | +| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | + + + If there are no errors, this request will return an empty response. + When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. + + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "method": "update_nft", + "mmrpc": "2.0", + "params": { + "chains": [ + "BSC", + "POLYGON" + ], + "url": "https://moralis-proxy.komodo.earth", + "url_antispam": "https://nft.antispam.dragonhound.info" + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + + + Need to add some error responses here. + +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; + +# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} + + + To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. + The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. + + +### Request Parameters + +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens to withdraw. | +| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | +| tx\_hash | string | Transaction ID of the withdrawl. | +| from | array | List of source addresses. | +| to | array | List of destination addresses. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | +| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | +| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | +| transaction\_type | string | This will always be `NftTransfer`. | + +#### 📌 ERC721 Withdraw Example + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", + "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 35218, + "gas_price": "0.000000040827827163", + "total_fee": "0.001437874417026534" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732198, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Example + +If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "type": "withdraw_erc721", + "withdraw_data": { + "chain": "POLYGON", + "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1" + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", + "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC721", + "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", + "token_id": "1", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 62368, + "gas_price": "0.000000012347931462", + "total_fee": "0.000770115789422016" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732805, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + +#### 📌 ERC1155 Withdraw Max Example + +If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. + + + ```json + { + "userpass": "testpsw", + "method": "withdraw_nft", + "mmrpc": "2.0", + "params": { + "type": "withdraw_erc1155", + "withdraw_data": { + "chain": "POLYGON", + "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1" + } + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", + "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", + "from": [ + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" + ], + "to": [ + "0x27Ad1F808c1ef82626277Ae38998AfA539565660" + ], + "contract_type": "ERC1155", + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "amount": "1", + "fee_details": { + "type": "Eth", + "coin": "MATIC", + "gas": 59963, + "gas_price": "0.00000003794123733", + "total_fee": "0.00227507041401879" + }, + "coin": "MATIC", + "block_height": 0, + "timestamp": 1700732937, + "internal_id": 0, + "transaction_type": "NftTransfer" + }, + "id": null + } + ``` + + + + ### 📌 Withdraw NFTs Error Responses + + #### InvalidRequest (missing field) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `type`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `type`", + "id": null + } + ``` + + #### InvalidRequest (wrong withdraw type) + + ``` + { + "mmrpc": "2.0", + "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", + "id": null + } + ``` + + #### TokenNotFoundInWallet (trying to send NFT you dont own) + + ``` + { + "mmrpc": "2.0", + "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", + "error_path": "eth.nft", + "error_trace": "eth:883] nft:1177]", + "error_type": "GetNftInfoError", + "error_data": { + "error_type": "TokenNotFoundInWallet", + "error_data": { + "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" + } + }, + "id": null + } + ``` + + #### TransportError (unable to estimate gas) + + ``` + { + "mmrpc": "2.0", + "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "error_path": "eth", + "error_trace": "eth:1004] eth:5792]", + "error_type": "Transport", + "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", + "id": null + } + ``` + + #### NotEnoughNftsAmount (trying to send more NFTs than you have) + + ``` + { + "mmrpc": "2.0", + "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", + "error_path": "eth", + "error_trace": "eth:897]", + "error_type": "NotEnoughNftsAmount", + "error_data": { + "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", + "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", + "available": "1", + "required": "2" + }, + "id": null + } + ``` + + + + View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) + export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; From 566bef49a7dc46bfa9500d93024833c3b6636981 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 5 Dec 2023 02:03:09 +0800 Subject: [PATCH 75/85] review fixes --- filepathSlugs.json | 4 +- .../api/common_structures/nfts/index.mdx | 70 ++++++++++++++- .../get_nft_list/index.mdx | 45 +++------- .../get_nft_metadata/index.mdx | 11 +-- .../get_nft_transfers/index.mdx | 86 +++++++------------ .../refresh_nft_metadata/index.mdx | 2 +- .../withdraw_nft/index.mdx | 6 +- src/pages/atomicdex/api/v20/index.mdx | 4 +- utils/_fileData.json | 2 +- 9 files changed, 131 insertions(+), 99 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 6bdb6142..a77b6a6b 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1617,7 +1617,9 @@ ], "src/pages/atomicdex/api/common_structures/nfts/index.mdx": [ "non-fungible-token-structures", - "tokens-request" + "tokens-request", + "nft-info", + "nft-transfer" ], "src/pages/atomicdex/api/common_structures/orders/index.mdx": [ "order-structures", diff --git a/src/pages/atomicdex/api/common_structures/nfts/index.mdx b/src/pages/atomicdex/api/common_structures/nfts/index.mdx index 2cdde778..e204e2d2 100644 --- a/src/pages/atomicdex/api/common_structures/nfts/index.mdx +++ b/src/pages/atomicdex/api/common_structures/nfts/index.mdx @@ -5,7 +5,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given coin or token: +The `TokensRequest` object includes the following items for a given token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -20,3 +20,71 @@ The `TokensRequest` object includes the following items for a given coin or toke } ``` + +### NftInfo + +The `NftInfo` object includes the following items for a given token: + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +### NftTransfer + +The `NftTransfer` object includes the following items for each token transaction: + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | +| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 399f4a56..87865463 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -13,39 +13,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| --------- | --------------- | -------------------------------------------------------------------------------------- | +| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | +| total | string | The total number of NFTs in your wallet matching the request filters. | +| skipped | string | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params @@ -313,7 +296,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } } ], - "skipped": 1, + "skipped": 0, "total": 1 }, "id": null diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx index 4828846b..dd9a1f77 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -6,11 +6,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | ### Response Parameters diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index 5407afe0..b8ba0c79 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -23,41 +23,11 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - +| Parameter | Type | Description | +| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | +| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | +| total | string | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters @@ -73,9 +43,10 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ], "max": true, "filters": { - "send": true, - "from_date": 1676636291 - } + "receive": true, + "from_date": 1678233600 + }, + "protect_from_spam": true } } ``` @@ -88,36 +59,43 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "result": { "transfer_history": [ { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, + "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", + "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", + "transaction_index": 87, + "log_index": 468, "value": "0", - "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "amount": "2", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false, + "chain": "POLYGON", + "token_id": "5", + "block_number": 44506464, + "block_timestamp": 1688107346, + "contract_type": "ERC1155", "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", "token_domain": "app.thesmurfssociety.com", "collection_name": null, "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", "image_domain": "metadata.thesmurfssociety.com", "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false + "status": "Receive", + "possible_phishing": false, + "fee_details": { + "coin": "MATIC", + "gas": 40249, + "gas_price": "0.000000153160317706", + "total_fee": "0.006164549627348794" + }, + "confirmations": 5775855 } ], - "skipped": 1, - "total": 2 + "skipped": 0, + "total": 1 }, "id": null } diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx index 9f403e48..030a9ca1 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx @@ -10,7 +10,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| chain | string | Chains which holds the NFT you would like to updated metadata for. | | url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | | token\_address | string | Token address. | | token\_id | string | Token ID. | diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx index 7a267028..f135a58f 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx @@ -102,7 +102,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", + "type": "withdraw_erc1155", "withdraw_data": { "chain": "POLYGON", "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", @@ -166,7 +166,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1" + "max": true } } } @@ -189,7 +189,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "contract_type": "ERC1155", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1", + "amount": "7", "fee_details": { "type": "Eth", "coin": "MATIC", diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index b4d37774..dfb399ac 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -732,8 +732,8 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | diff --git a/utils/_fileData.json b/utils/_fileData.json index 79089001..6fd5e48f 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -3542,7 +3542,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables": { - "dateModified": "2023-12-04T14:26:29.000Z", + "dateModified": "2023-12-04T17:15:38.000Z", "contributors": [ { "name": "\"smk762\"", From 6c1e55a6c3bb3f00ca6fde8b08cb040257fcd78a Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 4 Dec 2023 18:04:20 +0000 Subject: [PATCH 76/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- data-for-gpts/all-content.txt | 224 ++++++++++-------- data-for-gpts/atomicdex-content.txt | 224 ++++++++++-------- .../komodefi-api/all-api-content.txt | 224 ++++++++++-------- .../komodefi-api/v20-api-content.txt | 4 +- .../komodefi-api/v20-dev-api-content.txt | 150 +++++------- utils/_fileData.json | 14 +- 6 files changed, 446 insertions(+), 394 deletions(-) diff --git a/data-for-gpts/all-content.txt b/data-for-gpts/all-content.txt index 9b47f4b9..43315840 100644 --- a/data-for-gpts/all-content.txt +++ b/data-for-gpts/all-content.txt @@ -27218,7 +27218,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given coin or token: +The `TokensRequest` object includes the following items for a given token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -27233,6 +27233,74 @@ The `TokensRequest` object includes the following items for a given coin or toke } ``` + +### NftInfo + +The `NftInfo` object includes the following items for a given token: + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +### NftTransfer + +The `NftTransfer` object includes the following items for each token transaction: + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | +| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + export const title = "Komodo DeFi SDK Common Structures: Orders"; export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; @@ -41082,8 +41150,8 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | @@ -46967,39 +47035,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| --------- | --------------- | -------------------------------------------------------------------------------------- | +| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | +| total | string | The total number of NFTs in your wallet matching the request filters. | +| skipped | string | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params @@ -47267,7 +47318,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } } ], - "skipped": 1, + "skipped": 0, "total": 1 }, "id": null @@ -47300,11 +47351,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | ### Response Parameters @@ -47432,41 +47484,11 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - +| Parameter | Type | Description | +| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | +| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | +| total | string | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters @@ -47482,9 +47504,10 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ], "max": true, "filters": { - "send": true, - "from_date": 1676636291 - } + "receive": true, + "from_date": 1678233600 + }, + "protect_from_spam": true } } ``` @@ -47497,36 +47520,43 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "result": { "transfer_history": [ { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, + "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", + "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", + "transaction_index": 87, + "log_index": 468, "value": "0", - "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "amount": "2", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false, + "chain": "POLYGON", + "token_id": "5", + "block_number": 44506464, + "block_timestamp": 1688107346, + "contract_type": "ERC1155", "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", "token_domain": "app.thesmurfssociety.com", "collection_name": null, "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", "image_domain": "metadata.thesmurfssociety.com", "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false + "status": "Receive", + "possible_phishing": false, + "fee_details": { + "coin": "MATIC", + "gas": 40249, + "gas_price": "0.000000153160317706", + "total_fee": "0.006164549627348794" + }, + "confirmations": 5775855 } ], - "skipped": 1, - "total": 2 + "skipped": 0, + "total": 1 }, "id": null } @@ -47698,7 +47728,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| chain | string | Chains which holds the NFT you would like to updated metadata for. | | url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | | token\_address | string | Token address. | | token\_id | string | Token ID. | @@ -47915,7 +47945,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", + "type": "withdraw_erc1155", "withdraw_data": { "chain": "POLYGON", "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", @@ -47979,7 +48009,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1" + "max": true } } } @@ -48002,7 +48032,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "contract_type": "ERC1155", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1", + "amount": "7", "fee_details": { "type": "Eth", "coin": "MATIC", diff --git a/data-for-gpts/atomicdex-content.txt b/data-for-gpts/atomicdex-content.txt index 9778836a..9e5ee903 100644 --- a/data-for-gpts/atomicdex-content.txt +++ b/data-for-gpts/atomicdex-content.txt @@ -650,7 +650,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given coin or token: +The `TokensRequest` object includes the following items for a given token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -665,6 +665,74 @@ The `TokensRequest` object includes the following items for a given coin or toke } ``` + +### NftInfo + +The `NftInfo` object includes the following items for a given token: + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +### NftTransfer + +The `NftTransfer` object includes the following items for each token transaction: + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | +| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + export const title = "Komodo DeFi SDK Common Structures: Orders"; export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; @@ -14514,8 +14582,8 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | @@ -20399,39 +20467,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| --------- | --------------- | -------------------------------------------------------------------------------------- | +| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | +| total | string | The total number of NFTs in your wallet matching the request filters. | +| skipped | string | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params @@ -20699,7 +20750,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } } ], - "skipped": 1, + "skipped": 0, "total": 1 }, "id": null @@ -20732,11 +20783,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | ### Response Parameters @@ -20864,41 +20916,11 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - +| Parameter | Type | Description | +| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | +| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | +| total | string | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters @@ -20914,9 +20936,10 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ], "max": true, "filters": { - "send": true, - "from_date": 1676636291 - } + "receive": true, + "from_date": 1678233600 + }, + "protect_from_spam": true } } ``` @@ -20929,36 +20952,43 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "result": { "transfer_history": [ { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, + "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", + "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", + "transaction_index": 87, + "log_index": 468, "value": "0", - "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "amount": "2", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false, + "chain": "POLYGON", + "token_id": "5", + "block_number": 44506464, + "block_timestamp": 1688107346, + "contract_type": "ERC1155", "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", "token_domain": "app.thesmurfssociety.com", "collection_name": null, "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", "image_domain": "metadata.thesmurfssociety.com", "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false + "status": "Receive", + "possible_phishing": false, + "fee_details": { + "coin": "MATIC", + "gas": 40249, + "gas_price": "0.000000153160317706", + "total_fee": "0.006164549627348794" + }, + "confirmations": 5775855 } ], - "skipped": 1, - "total": 2 + "skipped": 0, + "total": 1 }, "id": null } @@ -21130,7 +21160,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| chain | string | Chains which holds the NFT you would like to updated metadata for. | | url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | | token\_address | string | Token address. | | token\_id | string | Token ID. | @@ -21347,7 +21377,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", + "type": "withdraw_erc1155", "withdraw_data": { "chain": "POLYGON", "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", @@ -21411,7 +21441,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1" + "max": true } } } @@ -21434,7 +21464,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "contract_type": "ERC1155", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1", + "amount": "7", "fee_details": { "type": "Eth", "coin": "MATIC", diff --git a/data-for-gpts/komodefi-api/all-api-content.txt b/data-for-gpts/komodefi-api/all-api-content.txt index 69d469e4..c235ffe9 100644 --- a/data-for-gpts/komodefi-api/all-api-content.txt +++ b/data-for-gpts/komodefi-api/all-api-content.txt @@ -650,7 +650,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given coin or token: +The `TokensRequest` object includes the following items for a given token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -665,6 +665,74 @@ The `TokensRequest` object includes the following items for a given coin or toke } ``` + +### NftInfo + +The `NftInfo` object includes the following items for a given token: + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | +| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | +| block\_number | integer | The block height when the amount or owner changed. | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| name | string | May be `null`. An NFT collection name. | +| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | +| last\_token\_uri\_sync | string | When the token\_uri was last updated. | +| last\_metadata\_sync | string | When the metadata was last updated. | +| metadata | string | The metadata of the token. May be `null`. | +| minter\_address | string | Minter address. May be `null`. | +| owner\_of | string | The wallet address of the owner of the NFT. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| symbol | string | May be `null`. The symbol of the NFT contract. | +| token\_address | string | The address of the NFT contract. | +| token\_id | string | The token ID of the NFT. | +| token\_hash | string | The token hash. May be `null`. | +| token\_uri | string | The URI to the metadata of the token. May be `null`. | +| token\_domain | string | Token domain. May be `null`. | +| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | + +### NftTransfer + +The `NftTransfer` object includes the following items for each token transaction: + +| Parameter | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | string | Amount of tokens transferred. | +| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | +| block\_number | integer | Height of block in which transfer occurred. | +| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | +| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | +| token\_uri | string | May be `null`. The URI to the metadata of the token. | +| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | +| collection\_name | string | May be `null`. Name of collection which token belongs to. | +| image\_url | string | May be `null`. The URI to the token image. | +| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | +| token\_name | string | May be `null`. Name of the token. | +| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | +| token\_address | string | Address of token transferred. | +| token\_id | string | Token ID. | +| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | +| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | +| transaction\_hash | string | Transaction ID of the transfer. | +| transaction\_index | string | May be `null`. Transaction index of the transfer. | +| log\_index | string | Log index of the transfer. | +| value | string | May be `null`. Tranfer value. | +| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | +| from\_address | string | Address of previous owner which sent the token(s). | +| to\_address | string | Address of new owner which received the token(s). | +| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | +| verified | integer | May be `null`. A deprecated field which will be removed in future. | +| operator | string | May be `null`. | +| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | + + + `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. + What are the other possible values for `transaction_type`? + What is `operator`? + What does `verified` mean? + export const title = "Komodo DeFi SDK Common Structures: Orders"; export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; @@ -14514,8 +14582,8 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | @@ -20399,39 +20467,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| --------- | --------------- | -------------------------------------------------------------------------------------- | +| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | +| total | string | The total number of NFTs in your wallet matching the request filters. | +| skipped | string | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params @@ -20699,7 +20750,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } } ], - "skipped": 1, + "skipped": 0, "total": 1 }, "id": null @@ -20732,11 +20783,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | ### Response Parameters @@ -20864,41 +20916,11 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - +| Parameter | Type | Description | +| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | +| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | +| total | string | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters @@ -20914,9 +20936,10 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ], "max": true, "filters": { - "send": true, - "from_date": 1676636291 - } + "receive": true, + "from_date": 1678233600 + }, + "protect_from_spam": true } } ``` @@ -20929,36 +20952,43 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "result": { "transfer_history": [ { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, + "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", + "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", + "transaction_index": 87, + "log_index": 468, "value": "0", - "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "amount": "2", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false, + "chain": "POLYGON", + "token_id": "5", + "block_number": 44506464, + "block_timestamp": 1688107346, + "contract_type": "ERC1155", "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", "token_domain": "app.thesmurfssociety.com", "collection_name": null, "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", "image_domain": "metadata.thesmurfssociety.com", "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false + "status": "Receive", + "possible_phishing": false, + "fee_details": { + "coin": "MATIC", + "gas": 40249, + "gas_price": "0.000000153160317706", + "total_fee": "0.006164549627348794" + }, + "confirmations": 5775855 } ], - "skipped": 1, - "total": 2 + "skipped": 0, + "total": 1 }, "id": null } @@ -21130,7 +21160,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| chain | string | Chains which holds the NFT you would like to updated metadata for. | | url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | | token\_address | string | Token address. | | token\_id | string | Token ID. | @@ -21347,7 +21377,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", + "type": "withdraw_erc1155", "withdraw_data": { "chain": "POLYGON", "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", @@ -21411,7 +21441,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1" + "max": true } } } @@ -21434,7 +21464,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "contract_type": "ERC1155", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1", + "amount": "7", "fee_details": { "type": "Eth", "coin": "MATIC", diff --git a/data-for-gpts/komodefi-api/v20-api-content.txt b/data-for-gpts/komodefi-api/v20-api-content.txt index d2b392d8..e0e1c41f 100644 --- a/data-for-gpts/komodefi-api/v20-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-api-content.txt @@ -3430,8 +3430,8 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | string | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is \`true. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | diff --git a/data-for-gpts/komodefi-api/v20-dev-api-content.txt b/data-for-gpts/komodefi-api/v20-dev-api-content.txt index fe19c910..060350cb 100644 --- a/data-for-gpts/komodefi-api/v20-dev-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-dev-api-content.txt @@ -2896,39 +2896,22 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | ### Response Parameters -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| --------- | --------------- | -------------------------------------------------------------------------------------- | +| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | +| total | string | The total number of NFTs in your wallet matching the request filters. | +| skipped | string | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params @@ -3196,7 +3179,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` } } ], - "skipped": 1, + "skipped": 0, "total": 1 }, "id": null @@ -3229,11 +3212,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------ | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | +| Parameter | Type | Description | +| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | ### Response Parameters @@ -3361,41 +3345,11 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Response Parameters -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - +| Parameter | Type | Description | +| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | +| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | +| total | string | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters @@ -3411,9 +3365,10 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ], "max": true, "filters": { - "send": true, - "from_date": 1676636291 - } + "receive": true, + "from_date": 1678233600 + }, + "protect_from_spam": true } } ``` @@ -3426,36 +3381,43 @@ Returns a list of the NFT transfers involving the user, shown in descending orde "result": { "transfer_history": [ { - "chain": "POLYGON", - "block_number": 40103927, - "block_timestamp": 1678270296, - "block_hash": "0xdd5b1ad793332343e206ee0b566a30821ab39d1f79e921f787f1ea23b8a90dbd", - "transaction_hash": "0xfe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", - "transaction_index": 114, - "log_index": 307, + "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", + "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", + "transaction_index": 87, + "log_index": 468, "value": "0", - "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0x6fad0ec6bb76914b2a2a800686acc22970645820", - "status": "Send", - "amount": "1", + "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "amount": "2", "verified": 1, "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", + "possible_spam": false, + "chain": "POLYGON", + "token_id": "5", + "block_number": 44506464, + "block_timestamp": 1688107346, + "contract_type": "ERC1155", "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", "token_domain": "app.thesmurfssociety.com", "collection_name": null, "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", "image_domain": "metadata.thesmurfssociety.com", "token_name": "Forest Mushrooms", - "possible_spam": false, - "possible_phishing": false + "status": "Receive", + "possible_phishing": false, + "fee_details": { + "coin": "MATIC", + "gas": 40249, + "gas_price": "0.000000153160317706", + "total_fee": "0.006164549627348794" + }, + "confirmations": 5775855 } ], - "skipped": 1, - "total": 2 + "skipped": 0, + "total": 1 }, "id": null } @@ -3627,7 +3589,7 @@ This method refreshes metadata of one NFT and metadata of related transactions w | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | string | Chains which holds the NFT you would like to updated metadata for. | +| chain | string | Chains which holds the NFT you would like to updated metadata for. | | url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | | token\_address | string | Token address. | | token\_id | string | Token ID. | @@ -3844,7 +3806,7 @@ If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", + "type": "withdraw_erc1155", "withdraw_data": { "chain": "POLYGON", "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", @@ -3908,7 +3870,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1" + "max": true } } } @@ -3931,7 +3893,7 @@ If you would like to withdraw all NFTs from a token\_address, you must use the ` "contract_type": "ERC1155", "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "1", + "amount": "7", "fee_details": { "type": "Eth", "coin": "MATIC", diff --git a/utils/_fileData.json b/utils/_fileData.json index 6fd5e48f..388d1b48 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1108,7 +1108,7 @@ } }, "/atomicdex/api/common_structures/nfts": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2824,7 +2824,7 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-11-23T10:14:55.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3474,7 +3474,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { - "dateModified": "2023-12-04T12:57:01.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3487,7 +3487,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { - "dateModified": "2023-11-23T10:14:55.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3500,7 +3500,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers": { - "dateModified": "2023-11-23T09:12:44.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3555,7 +3555,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata": { - "dateModified": "2023-11-23T10:14:55.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3581,7 +3581,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft": { - "dateModified": "2023-11-23T10:14:55.000Z", + "dateModified": "2023-12-04T18:03:09.000Z", "contributors": [ { "name": "\"smk762\"", From f5dbaeeeb7df10a50f7baa33adc861e508676ac4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 25 Feb 2024 14:40:24 +0800 Subject: [PATCH 77/85] add gpt contents --- data-for-gpts/atomicdex-content.txt | 10615 +++++++--------- .../komodefi-api/all-api-content.txt | 10615 +++++++--------- 2 files changed, 8778 insertions(+), 12452 deletions(-) diff --git a/data-for-gpts/atomicdex-content.txt b/data-for-gpts/atomicdex-content.txt index 80bad007..6642d2d4 100644 --- a/data-for-gpts/atomicdex-content.txt +++ b/data-for-gpts/atomicdex-content.txt @@ -694,7 +694,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given token: +The `TokensRequest` object includes the following items for a given coin or token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -709,74 +709,6 @@ The `TokensRequest` object includes the following items for a given token: } ``` - -### NftInfo - -The `NftInfo` object includes the following items for a given token: - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | - -### NftTransfer - -The `NftTransfer` object includes the following items for each token transaction: - -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | -| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - export const title = "Komodo DeFi SDK Common Structures: Orders"; export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; @@ -2276,9 +2208,6 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | -| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | -| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | -| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -2315,7 +2244,6 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | -| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -2355,13 +2283,11 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | -| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | -| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | export const title = "AtomicDEX Method: Active Swaps"; export const description = @@ -13891,2983 +13817,1562 @@ It includes a uniform request, successful and error response formats. At the mom } ``` +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; -## Common Komodo DeFi SDK Request / Response Objects - -The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. - -### ActivationParams - -The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. - -| Parameter | Type | Description | -| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | -| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | -| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | -| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | -| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | -| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | -| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | -| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | -| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | -| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | - - - For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its - first transaction to see all balance and history. This may take a long time on the first - activation, but subsequent activations will be much faster. - Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, - will reduce the average CPU load during ZHTLC coin activation (at the cost of a - longer activation time). These optional fields are recommended when developing - for iOS, where a high CPU load may kill the activation process. Android & - desktop operating systems do not appear to have any problems with high CPU - load during ZHTLC coin activation. - - -### ActivationMode +# Signing\_and\_Verifying\_Messages -Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | -| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | -| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). -### ActivationRpcData +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` -Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. +## Sign Message -| Parameter | Type | Description | -| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | +### Arguments -### ActivationServers +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | -Contains information electrum servers for coins being used in `Electrum` or `Light` mode. +### Response -| Parameter | Type | Description | -| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| url | string | The URL and port for an electrum server. | -| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | -| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | -| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | - - #### ZHTLC Example +#### Command + ```json { - "activation_params": { - "mode": { - "rpc": "Light", - "rpc_data": { - "electrum_servers": [ - { - "url":"zombie.dragonhound.info:10033" - } - ], - "light_wallet_d_servers": [ - "http://zombie.dragonhound.info:443" - ] - }, - "sync_params": { - "height": 2528700 - } - }, - "zcash_params_path": "/home/username/path_to/.zcash-params", - "scan_blocks_per_iteration": 100, - "scan_interval_ms": 200 + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" } } ``` + - #### HD UTXO Activation (v2) - - ```json - { - "activation_params": { - "mode": { - "rpc": "Electrum", - "rpc_data": { - "servers": [ - { - "url": "electrum2.cipig.net:10001" - }, - { - "url": "electrum3.cipig.net:20001", - "ws_url": "electrum3.cipig.net:30001", - "protocol": "SSL" - } - ] - } - }, - "scan_policy": "scan_if_new_wallet", - "priv_key_policy": "Trezor", - "min_addresses_number": 3, - "gap_limit": 20 - } - } - ``` - - -### AddressInfos +#### Response (success) -The `addressInfos` object includes the following items for a given address: +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | +### ⚠ Error types - - #### Example with balances +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "balances": { - "spendable": "0.11398301", - "unspendable": "0.00001" - } - } - ``` +## Verify Message - #### Example without balances +### Arguments - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "tickers": ["ASLP-SLP"] - } - ``` - +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | -### BalanceInfos +### Response -The `balanceInfos` object includes the following items for a given coin or token: +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | -| Parameter | Type | Description | -| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | -| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | +#### Command - + ```json { - "spendable": "12.11398301", - "unspendable": "0.53" + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } } ``` - + -### DerivationMethod +#### Response (valid) -The `DerivationMethod` object includes the following items for a given coin or token: +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | +#### Response (not valid) - - Using the same seed or private key to generate keypairs using different - derivation methods will result in a different address and private key for each - method. - +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` -Where the value indicates: +### ⚠ Error types -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; - - ```json - { - "type": "Iguana" - } - ``` - +# my\_tx\_history -### EvmNode +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. +For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. +For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. -The `EvmNode` object includes the following items for a given coin or token: +## Arguments -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| url | string | URL of an RPC node | -| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | +| parameter | Type | Description | +| --------------- | ------- | ------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to get history for. | +| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | - +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | + +## Request (BCH from page 2) + + ```json { - "url": "http://eth1.cipig.net:8555", - "gui_auth": false + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "BCH", + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + } } ``` - - -### CoinProtocol - -| Parameter | Type | Description | -| -------------- | ------- | ----------------------------------------------------------------------------- | -| type | integer | One of the supported \[coin types]\(link TBA) | -| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | - -### CoinProtocolData - -| Parameter | Type | Description | -| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | -| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | -| network | string | Either `mainnet` or \`testnet | -| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | - -### ConfirmationTargets + -This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. -It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + + ### Response -| Parameter | Type | Description | -| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | -| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | -| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "BCH", + "target": { + "type": "iguana" + }, + "current_block": 772607, + "transactions": [ + { + "tx_hex": "0100000001b7b45d92f8f3413a0e5656258e0a51f5c7e8230c0a08cef2ebec1ddbb8f7c28200000000d747304402203ca957fdfcfbba6123d78afe28b17fd4103cc04f6ada4110eb61c2a0350c29b802204215f203d583e8bcc79bd70f33af4f4e27500b5a5375efe75a1c31ec112f3c344120b3f71dbea00eeace7f09b0911de31e46f76a48036b86ccc207dac55540912e01004c6b6304dbf67563b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a914dde61fe24ea3cfa39379c475702692fa2f080900882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0133980200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acdbf67563", + "tx_hash": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "from": [ + "bitcoincash:ppaa62685yaucdf2a54g3rgtyc9g7yawrvvmqsfumc" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00171035", + "spent_by_me": "0", + "received_by_me": "0.00170035", + "my_balance_change": "0.00170035", + "block_height": 766923, + "timestamp": 1668615553, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "transaction_type": "StandardTransfer", + "confirmations": 5685 + }, + { + "tx_hex": "0100000001eccfa8c296e7b3e229be28a8ca6a5e5a7e89ee07a2d9441faaf5905679286a3c00000000d7473044022077d38ae45bb7257b152d4cb803aab62ca879cab60e9b3a7ca05ef099078e000402203106be31513c6526c14bdf40b28b4d38f78bb1958fc995e040ac4b2165d9d79141203bffadbc5bf035674f0d0f6e1d1a121fc6d404720679ff9b6610b298b41375a3004c6b6304bc847463b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a91457c7ce14c0444edc37ee52ed32b68890b0647cd3882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0163b10200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acbc847463", + "tx_hash": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "from": [ + "bitcoincash:ppnzkha52y53d7r7qn6mq4mcmaadmxzj4clfgneaxv" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00177483", + "spent_by_me": "0", + "received_by_me": "0.00176483", + "my_balance_change": "0.00176483", + "block_height": 766752, + "timestamp": 1668519015, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "transaction_type": "StandardTransfer", + "confirmations": 5856 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 2, + "skipped": 2, + "total": 16, + "total_pages": 8, + "paging_options": { + "PageNumber": 2 + } + }, + "id": null + } + ``` + - - Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: +## Request (TTT-SLP with FromId) - * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). - * `normal`: 60 minutes (one hour). - * `high_priority`: 10 to 20 minutes. - + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "TTT-SLP", + "limit": 2, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + } + } + ``` + -### CounterpartyChannelConfig + + ### Response -| Parameter | Type | Description | -| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | -| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | -| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | -| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | -| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | -| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | -| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | -| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | -| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | -| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "TTT-SLP", + "target": { + "type": "iguana" + }, + "current_block": 772612, + "transactions": [ + { + "tx_hex": "0200000002365a29eb638da7fc57720ad6c99fdbc6cfb9c957920cfb62fd69e494b412c1c1020000006b483045022100de81bca8cfef2f95b3da8aa89edf4f5cc6cf489c565d0965b8142380ef3986f1022062d6ed47f2cd281f4860a27e835949aafbab89eeb0865fbf2280a283dfb7c417412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffffc1f73b403f893f93d95b8c7dfa1b59bb5445109d4c51107da1e08fb770e54136010000006a47304402203658375dac3b84ae17e72cf3f5157b8ad25e7caee0629fa8708868974f8d58b402206f38d016ed4e390d783627441685692d21b889d83919abd39368cba28f43f544412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffff040000000000000000406a04534c500001010453454e44205321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd080000000000002710080000002278c569d322020000000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac22020000000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac68955e03000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac00000000", + "tx_hash": "7b58248f3486079951a57d6dbd41c019a83f2b876c9fa3afa6fcc5a7c595b837", + "from": ["simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8"], + "to": [ + "simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8", + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v" + ], + "total_amount": "1480551016.67", + "spent_by_me": "0", + "received_by_me": "100", + "my_balance_change": "100", + "block_height": 772211, + "timestamp": 1671817336, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00000482" + }, + "coin": "TTT-SLP", + "internal_id": "57b78eb912a704921640a589d8bb42bb147dfb88c3d1b4b2e3df910be6b9ab31", + "transaction_type": { + "TokenTransfer": "5321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd" + }, + "confirmations": 402 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + }, + "id": null + } + ``` + -### FeeInfo +## Request (IRIS with limit = 50) -The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "IRIS", + "limit": 50 + } + } + ``` + -| Parameter | Type | Description | -| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | -| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + + ### Response -### LightningActivationParams - -| Parameter | Type | Description | -| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | -| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | -| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | - -### LightningChannelAmount - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------------------------------------------- | -| type | string | `Exact` for a specific amount or `Max` for whole balance. | -| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | - -### LightningChannelConfig - - - The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. - If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. - + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "IRIS", + "target": { + "type": "iguana" + }, + "current_block": 18120346, + "transactions": [ + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083130303030303030", + "tx_hash": "B34A8D5AD74067F01A0207DF1851A14673C859D8A6F4FB0CBE292D2104C143CA", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "10.044559", + "spent_by_me": "10.044559", + "received_by_me": "10", + "my_balance_change": "-0.044559", + "block_height": 18120218, + "timestamp": 1673016440, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.044559", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "4644373032304131304637363034374441354438413433420000000000000000", + "transaction_type": "StandardTransfer", + "memo": "while you are out, buy milk", + "confirmations": 129 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a696161317a78733476776c36326b687174376e7a7276687a676b34377467366365706677707a673537711a4d0a446962632f3237333934464230393244324543434435363132334337344633364534433146393236303031434541444139434139374541363232423235463431453545423212053130303030", + "tx_hash": "09ADDD3427A3BA4B0A94023456DF534DB5B9B6821EC17C7C1B2C168EFCF49F26", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "0.051788", + "spent_by_me": "0.051788", + "received_by_me": "0", + "my_balance_change": "-0.051788", + "block_height": 17996530, + "timestamp": 1672232661, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.051788", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "0000000000000000303941444444333432374133424134423041393430323334", + "transaction_type": "FeeForTokenTx", + "memo": null, + "confirmations": 123817 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1240343133433843414333434142363945454632344432423643414238314146454344383044413745323731433237343637453142324635463337314446353241441a4061353539343834666536316665383630326465383632353964643263663031613865393437306437666635346262323536336233393035646462366238366535", + "tx_hash": "4E30C074CED6825F3E1B6584C376A426C20FDEFC9A22EB17D8E7DA4139FA0AEB", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "182.742425", + "spent_by_me": "0.053103", + "received_by_me": "182.689322", + "my_balance_change": "182.636219", + "block_height": 17981793, + "timestamp": 1672138900, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.053103", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "3438353642314533463532383644454334373043303345340000000000000000", + "transaction_type": { + "CustomTendermintMsg": { + "msg_type": "SignClaimHtlc", + "token_id": null + } + }, + "memo": null, + "confirmations": 138554 + } + ], + "sync_status": { + "state": "NotStarted" + }, + "limit": 50, + "skipped": 0, + "total": 3, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": null + } + ``` + -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | -| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | -| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | -| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | -| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | -| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | -| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | -| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | +## Error cases - - For GUIs and wallet apps, it is recommended to set `announced_channel` to - `false` (the default value), as the node is not expected to be reliably - online. - +### Error - Coin not active -### LightningChannelOptions +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2.lp_coins", + "error_trace": "my_tx_history_v2:389] lp_coins:2847]", + "error_type": "CoinIsNotActive", + "error_data": "TTT-SLP", + "id": null +} +``` -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | -| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | -| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | +### Error - Coin not compatible -### LightningClosedChannelsFilter +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:336]", + "error_type": "NotSupportedFor", + "error_data": "TTT-SLP", + "id": null +} +``` -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | -| channel\_type | string | Optional. `Inbound` or `Outbound`. | -| closing\_tx | integer | Optional. A transaction ID which closed the channel. | -| closure\_reason | integer | Optional. The reason a channel was closed. | -| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | -| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | -| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | -| channel\_visibility | integer | Optional. `Public` or `Private`. | +### Error - Coin enabled without tx\_history = true - - Response may change to be more consistent in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) - +```json +{ + "mmrpc": "2.0", + "error": "Storage is not initialized for TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:343]", + "error_type": "StorageIsNotInitialized", + "error_data": "Storage is not initialized for TTT-SLP", + "id": null +} +``` -### LightningOpenChannelsFilter +### Error - Local database failed -| Parameter | Type | Description | -| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | -| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | -| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | -| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | -| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | -| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | -| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | -| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | -| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | -| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | -| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | +```json +{ + "mmrpc": "2.0", + "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "error_path": "my_tx_history_v2.sql_tx_history_storage", + "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]", + "error_type": "StorageError", + "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "id": null +} +``` +export const title = "AtomicDEX Method: Orderbook v2"; +export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; -### LightningPayment +# orderbook -| Parameter | Type | Description | -| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | -| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | -| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | -| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | -| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | +**orderbook base rel** -### LightningPaymentFilter +The v2 `orderbook` method requests from the network the currently available orders for the specified trading pair. -| Parameter | Type | Description | -| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +## Arguments -### LightningPaymentType +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| base | string | Base currency of a pair | +| rel | string | Related currency, also known as the "quote currency" | -| Parameter | Type | Description | -| ----------- | ------ | ----------------------------------------------------------------------------------- | -| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | -| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | +## Response - - Response may change in future. See - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) - - -### Pagination - -For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* - -| Parameter | Type | Description | -| ---------- | ------- | ------------------------------------------------------- | -| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | -| FromId | integer | Optional. Ignores any results prior to this UUID | - - - #### Example - - ```json - { - "PageNumber": 1 - } - ``` - - ```json - { - "FromId": 4 - } - ``` - - -### TokenFilter - -The `TokenFilter` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | - -### TokenTransferFilter - -The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### TokenMetadata - -The `TokenMetadata` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| image | string | Optional. Direct URL to the NFT's image. | -| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | -| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | -| name | string | Optional. Name of the token. | -| description | string | Optional. Description of the token. | -| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | -| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | -| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | -| external\_url | string | Optional. URL to the external source related to the token. | -| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | -| image\_details | object | Optional. JSON containing additional details or attributes of the image. | - - - ```json - [ - { - "trait_type": "Specialization", - "value": "Thief" - }, - { - "trait_type": "Skin Tone", - "value": "#0013b0" - }, - { - "trait_type": "Weapon", - "value": "Crossbow" - }, - { - "trait_type": "Species", - "value": "Dark Elf" - }, - { - "trait_type": "Gender", - "value": "Female" - }, - { - "trait_type": "Strength", - "value": "8" - }, - { - "trait_type": "Dexterity", - "value": "12" - }, - { - "trait_type": "Intelligence", - "value": "10" - }, - { - "trait_type": "Perks", - "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] - }, - { - "trait_type": "Weakness", - "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] - }, - { - "trait_type": "Personality", - "value": "Aggressive" - } - ] - ``` - - -### TokensRequest - -The `TokensRequest` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### WithdrawFee - -The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. - -| Parameter | Type | Description | -| --------------- | -------------- | --------------------------------------------------------------------------------- | -| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | -| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | -| coin | string | The coin which will be used to pay the transaction fee. | -| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | -| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | -| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | -| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | -| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | -| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | - - - #### Example of Eth type - - ```json - { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" - } - ``` - - #### Example of Qrc20 type - - ```json - { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - } - ``` - - #### Example of Tendermint type - - ```json - { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - } - ``` - - #### Example of Utxo type - - ```json - { - "type": "Utxo", - "amount": "0.00001" - } - ``` - - -### WithdrawNftData - -The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | -| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | - - - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, - and it has only 1 owner and the owner can own only 1 NFT with this `token_id` - in its `token_address` (also referred to as contract address). - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more - than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the when - the `type` value is `withdraw_erc1155`. - -export const title = "AtomicDEX: Signing and Verifying Messages"; -export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; - -# Signing\_and\_Verifying\_Messages - -Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). - -If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). - -```json -{ - "coin": "DOC", - "asset": "DOC", - "fname": "DOC (TESTCOIN)", - "sign_message_prefix": "Komodo Signed Message:\n", - "rpcport": 25435, - "txversion": 4, - "overwintered": 1, - "mm2": 1, - "protocol": { - "type": "UTXO" - } -} -``` - -## Sign Message - -### Arguments - -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message you want to sign | - -### Response +| Structure | Type | Description | +| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user will trade | +| numasks | integer | The number of outstanding asks | +| numbids | integer | The number of outstanding bids | +| netid | integer | The id of the network on which the request is made (default is `8762`) | +| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | +| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | +| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| Structure | Type | Description | -| --------- | ------ | --------------------------------------- | -| signature | string | The signature generated for the message | +#### 📌 Examples #### Command - + ```json { - "userpass": "testpsw", - "method": "sign_message", "mmrpc": "2.0", - "id": 0, + "userpass": "testpsw", + "method": "orderbook", "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion" - } + "base": "DGB", + "rel": "DASH" + }, + "id": 42 } ``` -#### Response (success) - -```json -{ - "mmrpc": "2.0", - "result": { - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" - }, - "id": 0 -} -``` - -### ⚠ Error types - -**PrefixNotFound:** sign\_message\_prefix is not set in coin config file -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message signing is not supported by the given coin type -**InternalError:** An internal error occured during the signing process - -## Verify Message - -### Arguments - -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message input via the `sign_message` method sign | -| signature | string | The signature generated for the message | -| address | string | The address used to sign the message | - -### Response - -| Structure | Type | Description | -| --------- | ------- | ----------------------------------------------------------- | -| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | - -#### Command - - - ```json - { - "userpass": "testpsw", - "method": "verify_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion", - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", - "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" - } - } - ``` - - -#### Response (valid) - -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": true - }, - "id": 0 -} -``` - -#### Response (not valid) - -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": false - }, - "id": 0 -} -``` - -### ⚠ Error types - -**PrefixNotFound:** sign\_message\_prefix is not set in coin config -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message verification is not supported by the given coin type -**InternalError:** An internal error occured during the verification process -**SignatureDecodingError:** Given signature could not be decoded -**AddressDecodingError:** Given address could not be decoded -export const title = "AtomicDEX Method: My TX History"; -export const description = "The my_tx_history method allows you to view the transaction history of coins."; - -# my\_tx\_history - -To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. -Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. -For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. -For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. - -## Arguments - -| parameter | Type | Description | -| --------------- | ------- | ------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to get history for. | -| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | - -#### Response - -| Structure | Type | Description | -| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| transactions | array of objects | transactions data | -| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | -| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | -| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | -| total | number | the total number of transactions available | -| page\_number | number | the page\_number that was set in the request | -| total\_pages | number | total pages available with the selected limit | -| current\_block | number | the number of the latest block of coin blockchain | -| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | - -## Request (BCH from page 2) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "BCH", - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - } - } - ``` - - - - ### Response + + #### Response ```json { "mmrpc": "2.0", "result": { - "coin": "BCH", - "target": { - "type": "iguana" - }, - "current_block": 772607, - "transactions": [ + "asks": [ { - "tx_hex": "0100000001b7b45d92f8f3413a0e5656258e0a51f5c7e8230c0a08cef2ebec1ddbb8f7c28200000000d747304402203ca957fdfcfbba6123d78afe28b17fd4103cc04f6ada4110eb61c2a0350c29b802204215f203d583e8bcc79bd70f33af4f4e27500b5a5375efe75a1c31ec112f3c344120b3f71dbea00eeace7f09b0911de31e46f76a48036b86ccc207dac55540912e01004c6b6304dbf67563b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a914dde61fe24ea3cfa39379c475702692fa2f080900882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0133980200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acdbf67563", - "tx_hash": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", - "from": [ - "bitcoincash:ppaa62685yaucdf2a54g3rgtyc9g7yawrvvmqsfumc" + "coin": "DGB", + "address": { + "address_type": "Transparent", + "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" + }, + "price": { + "decimal": "0.0002658065", + "rational": [ + [1, [531613]], + [1, [2000000000]] ], - "to": [ - "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + "fraction": { + "numer": "531613", + "denom": "2000000000" + } + }, + "pubkey": "03de96cb66dcfaceaa8b3d4993ce8914cd5fe84e3fd53cefdae45add8032792a12", + "uuid": "1115d7f2-a7b9-4ab1-913f-497db2549a2b", + "is_mine": false, + "base_max_volume": { + "decimal": "90524.256020352", + "rational": [ + [1, [2846113615, 164]], + [1, [7812500]] ], - "total_amount": "0.00171035", - "spent_by_me": "0", - "received_by_me": "0.00170035", - "my_balance_change": "0.00170035", - "block_height": 766923, - "timestamp": 1668615553, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00001" - }, - "coin": "BCH", - "internal_id": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", - "transaction_type": "StandardTransfer", - "confirmations": 5685 + "fraction": { + "numer": "707220750159", + "denom": "7812500" + } }, - { - "tx_hex": "0100000001eccfa8c296e7b3e229be28a8ca6a5e5a7e89ee07a2d9441faaf5905679286a3c00000000d7473044022077d38ae45bb7257b152d4cb803aab62ca879cab60e9b3a7ca05ef099078e000402203106be31513c6526c14bdf40b28b4d38f78bb1958fc995e040ac4b2165d9d79141203bffadbc5bf035674f0d0f6e1d1a121fc6d404720679ff9b6610b298b41375a3004c6b6304bc847463b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a91457c7ce14c0444edc37ee52ed32b68890b0647cd3882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0163b10200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acbc847463", - "tx_hash": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", - "from": [ - "bitcoincash:ppnzkha52y53d7r7qn6mq4mcmaadmxzj4clfgneaxv" + "base_min_volume": { + "decimal": "0.3762135237475381527539770472129161626973004798603495399849138376977237200745655204067620618758382508", + "rational": [ + [1, [200000]], + [1, [531613]] ], - "to": [ - "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + "fraction": { + "numer": "200000", + "denom": "531613" + } + }, + "rel_max_volume": { + "decimal": "24.061935657873693888", + "rational": [ + [1, [4213143411, 87536811]], + [1, [3466432512, 3637978]] ], - "total_amount": "0.00177483", - "spent_by_me": "0", - "received_by_me": "0.00176483", - "my_balance_change": "0.00176483", - "block_height": 766752, - "timestamp": 1668519015, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00001" - }, - "coin": "BCH", - "internal_id": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", - "transaction_type": "StandardTransfer", - "confirmations": 5856 + "fraction": { + "numer": "375967744654276467", + "denom": "15625000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + } } ], - "sync_status": { - "state": "Finished" - }, - "limit": 2, - "skipped": 2, - "total": 16, - "total_pages": 8, - "paging_options": { - "PageNumber": 2 - } - }, - "id": null - } - ``` - - -## Request (TTT-SLP with FromId) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "TTT-SLP", - "limit": 2, - "paging_options": { - "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" - } - } - } - ``` - - - - ### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "TTT-SLP", - "target": { - "type": "iguana" - }, - "current_block": 772612, - "transactions": [ + "base": "DGB", + "bids": [ { - "tx_hex": "0200000002365a29eb638da7fc57720ad6c99fdbc6cfb9c957920cfb62fd69e494b412c1c1020000006b483045022100de81bca8cfef2f95b3da8aa89edf4f5cc6cf489c565d0965b8142380ef3986f1022062d6ed47f2cd281f4860a27e835949aafbab89eeb0865fbf2280a283dfb7c417412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffffc1f73b403f893f93d95b8c7dfa1b59bb5445109d4c51107da1e08fb770e54136010000006a47304402203658375dac3b84ae17e72cf3f5157b8ad25e7caee0629fa8708868974f8d58b402206f38d016ed4e390d783627441685692d21b889d83919abd39368cba28f43f544412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffff040000000000000000406a04534c500001010453454e44205321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd080000000000002710080000002278c569d322020000000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac22020000000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac68955e03000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac00000000", - "tx_hash": "7b58248f3486079951a57d6dbd41c019a83f2b876c9fa3afa6fcc5a7c595b837", - "from": ["simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8"], - "to": [ - "simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8", - "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v" + "coin": "DASH", + "address": { + "address_type": "Transparent", + "address_data": "XcYdfQgeuM5f5V2LNo9g8o8p3rPPbKwwCg" + }, + "price": { + "decimal": "0.0002544075418788651605521516540338523799763700988224165198319218986992534200426899830070024093907274001", + "rational": [ + [1, [1410065408, 2]], + [1, [3765089107, 9151]] ], - "total_amount": "1480551016.67", - "spent_by_me": "0", - "received_by_me": "100", - "my_balance_change": "100", - "block_height": 772211, - "timestamp": 1671817336, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00000482" - }, - "coin": "TTT-SLP", - "internal_id": "57b78eb912a704921640a589d8bb42bb147dfb88c3d1b4b2e3df910be6b9ab31", - "transaction_type": { - "TokenTransfer": "5321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd" - }, - "confirmations": 402 - } - ], - "sync_status": { - "state": "Finished" - }, - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" - } - }, - "id": null - } - ``` - - -## Request (IRIS with limit = 50) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "IRIS", - "limit": 50 - } - } - ``` - - - - ### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "IRIS", - "target": { - "type": "iguana" - }, - "current_block": 18120346, - "transactions": [ - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083130303030303030", - "tx_hash": "B34A8D5AD74067F01A0207DF1851A14673C859D8A6F4FB0CBE292D2104C143CA", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "10.044559", - "spent_by_me": "10.044559", - "received_by_me": "10", - "my_balance_change": "-0.044559", - "block_height": 18120218, - "timestamp": 1673016440, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.044559", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "4644373032304131304637363034374441354438413433420000000000000000", - "transaction_type": "StandardTransfer", - "memo": "while you are out, buy milk", - "confirmations": 129 + "fraction": { + "numer": "10000000000", + "denom": "39307010814803" + } }, - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a696161317a78733476776c36326b687174376e7a7276687a676b34377467366365706677707a673537711a4d0a446962632f3237333934464230393244324543434435363132334337344633364534433146393236303031434541444139434139374541363232423235463431453545423212053130303030", - "tx_hash": "09ADDD3427A3BA4B0A94023456DF534DB5B9B6821EC17C7C1B2C168EFCF49F26", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": [], - "total_amount": "0.051788", - "spent_by_me": "0.051788", - "received_by_me": "0", - "my_balance_change": "-0.051788", - "block_height": 17996530, - "timestamp": 1672232661, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.051788", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "0000000000000000303941444444333432374133424134423041393430323334", - "transaction_type": "FeeForTokenTx", - "memo": null, - "confirmations": 123817 + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "uuid": "e9e4feb2-60b4-4184-8294-591687171e6b", + "is_mine": false, + "base_max_volume": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } }, - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1240343133433843414333434142363945454632344432423643414238314146454344383044413745323731433237343637453142324635463337314446353241441a4061353539343834666536316665383630326465383632353964643263663031613865393437306437666635346262323536336233393035646462366238366535", - "tx_hash": "4E30C074CED6825F3E1B6584C376A426C20FDEFC9A22EB17D8E7DA4139FA0AEB", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": [], - "total_amount": "182.742425", - "spent_by_me": "0.053103", - "received_by_me": "182.689322", - "my_balance_change": "182.636219", - "block_height": 17981793, - "timestamp": 1672138900, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.053103", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "3438353642314533463532383644454334373043303345340000000000000000", - "transaction_type": { - "CustomTendermintMsg": { - "msg_type": "SignClaimHtlc", - "token_id": null - } - }, - "memo": null, - "confirmations": 138554 + "base_min_volume": { + "decimal": "0.39307010814803", + "rational": [ + [1, [3765089107, 9151]], + [1, [276447232, 23283]] + ], + "fraction": { + "numer": "39307010814803", + "denom": "100000000000000" + } + }, + "rel_max_volume": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + } } ], - "sync_status": { - "state": "NotStarted" + "net_id": 8762, + "num_asks": 3, + "num_bids": 3, + "rel": "DASH", + "timestamp": 1694183345, + "total_asks_base_vol": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } }, - "limit": 50, - "skipped": 0, - "total": 3, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": null - } - ``` - - -## Error cases - -### Error - Coin not active - -```json -{ - "mmrpc": "2.0", - "error": "TTT-SLP", - "error_path": "my_tx_history_v2.lp_coins", - "error_trace": "my_tx_history_v2:389] lp_coins:2847]", - "error_type": "CoinIsNotActive", - "error_data": "TTT-SLP", - "id": null -} -``` - -### Error - Coin not compatible - -```json -{ - "mmrpc": "2.0", - "error": "TTT-SLP", - "error_path": "my_tx_history_v2", - "error_trace": "my_tx_history_v2:336]", - "error_type": "NotSupportedFor", - "error_data": "TTT-SLP", - "id": null -} -``` - -### Error - Coin enabled without tx\_history = true - -```json -{ - "mmrpc": "2.0", - "error": "Storage is not initialized for TTT-SLP", - "error_path": "my_tx_history_v2", - "error_trace": "my_tx_history_v2:343]", - "error_type": "StorageIsNotInitialized", - "error_data": "Storage is not initialized for TTT-SLP", - "id": null -} -``` - -### Error - Local database failed - -```json -{ - "mmrpc": "2.0", - "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", - "error_path": "my_tx_history_v2.sql_tx_history_storage", - "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]", - "error_type": "StorageError", - "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", - "id": null -} -``` -export const title = "AtomicDEX Method: Orderbook v2"; -export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; - -# orderbook - -**orderbook base rel** - -The v2 `orderbook` method requests from the network the currently available orders for the specified trading pair. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| base | string | Base currency of a pair | -| rel | string | Related currency, also known as the "quote currency" | - -## Response - -| Structure | Type | Description | -| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| base | string | The name of the coin the user desires to receive | -| rel | string | The name of the coin the user will trade | -| numasks | integer | The number of outstanding asks | -| numbids | integer | The number of outstanding bids | -| netid | integer | The id of the network on which the request is made (default is `8762`) | -| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | -| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | -| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | -| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "orderbook", - "params": { - "base": "DGB", - "rel": "DASH" - }, - "id": 42 - } - ``` - - - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "asks": [ - { - "coin": "DGB", - "address": { - "address_type": "Transparent", - "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" - }, - "price": { - "decimal": "0.0002658065", - "rational": [ - [1, [531613]], - [1, [2000000000]] - ], - "fraction": { - "numer": "531613", - "denom": "2000000000" - } - }, - "pubkey": "03de96cb66dcfaceaa8b3d4993ce8914cd5fe84e3fd53cefdae45add8032792a12", - "uuid": "1115d7f2-a7b9-4ab1-913f-497db2549a2b", - "is_mine": false, - "base_max_volume": { - "decimal": "90524.256020352", - "rational": [ - [1, [2846113615, 164]], - [1, [7812500]] - ], - "fraction": { - "numer": "707220750159", - "denom": "7812500" - } - }, - "base_min_volume": { - "decimal": "0.3762135237475381527539770472129161626973004798603495399849138376977237200745655204067620618758382508", - "rational": [ - [1, [200000]], - [1, [531613]] - ], - "fraction": { - "numer": "200000", - "denom": "531613" - } - }, - "rel_max_volume": { - "decimal": "24.061935657873693888", - "rational": [ - [1, [4213143411, 87536811]], - [1, [3466432512, 3637978]] - ], - "fraction": { - "numer": "375967744654276467", - "denom": "15625000000000000" - } - }, - "rel_min_volume": { - "decimal": "0.0001", - "rational": [ - [1, [1]], - [1, [10000]] - ], - "fraction": { - "numer": "1", - "denom": "10000" - } - }, - "conf_settings": { - "base_confs": 7, - "base_nota": false, - "rel_confs": 2, - "rel_nota": false - }, - "base_max_volume_aggr": { - "decimal": "133319.023345413", - "rational": [ - [1, [3238477573, 31040]], - [1, [1000000000]] - ], - "fraction": { - "numer": "133319023345413", - "denom": "1000000000" - } - }, - "rel_max_volume_aggr": { - "decimal": "35.2500366381728643576", - "rational": [ - [1, [473921343, 1669176307, 2]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "44062545797716080447", - "denom": "1250000000000000000" - } - } - } - ], - "base": "DGB", - "bids": [ - { - "coin": "DASH", - "address": { - "address_type": "Transparent", - "address_data": "XcYdfQgeuM5f5V2LNo9g8o8p3rPPbKwwCg" - }, - "price": { - "decimal": "0.0002544075418788651605521516540338523799763700988224165198319218986992534200426899830070024093907274001", - "rational": [ - [1, [1410065408, 2]], - [1, [3765089107, 9151]] - ], - "fraction": { - "numer": "10000000000", - "denom": "39307010814803" - } - }, - "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "uuid": "e9e4feb2-60b4-4184-8294-591687171e6b", - "is_mine": false, - "base_max_volume": { - "decimal": "15449.5309493280527473176", - "rational": [ - [1, [161102659, 3869502237, 1046]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "19311913686660065934147", - "denom": "1250000000000000000" - } - }, - "base_min_volume": { - "decimal": "0.39307010814803", - "rational": [ - [1, [3765089107, 9151]], - [1, [276447232, 23283]] - ], - "fraction": { - "numer": "39307010814803", - "denom": "100000000000000" - } - }, - "rel_max_volume": { - "decimal": "3.930477192", - "rational": [ - [1, [491309649]], - [1, [125000000]] - ], - "fraction": { - "numer": "491309649", - "denom": "125000000" - } - }, - "rel_min_volume": { - "decimal": "0.0001", - "rational": [ - [1, [1]], - [1, [10000]] - ], - "fraction": { - "numer": "1", - "denom": "10000" - } - }, - "conf_settings": { - "base_confs": 7, - "base_nota": false, - "rel_confs": 2, - "rel_nota": false - }, - "base_max_volume_aggr": { - "decimal": "15449.5309493280527473176", - "rational": [ - [1, [161102659, 3869502237, 1046]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "19311913686660065934147", - "denom": "1250000000000000000" - } - }, - "rel_max_volume_aggr": { - "decimal": "3.930477192", - "rational": [ - [1, [491309649]], - [1, [125000000]] - ], - "fraction": { - "numer": "491309649", - "denom": "125000000" - } - } - } - ], - "net_id": 8762, - "num_asks": 3, - "num_bids": 3, - "rel": "DASH", - "timestamp": 1694183345, - "total_asks_base_vol": { - "decimal": "133319.023345413", - "rational": [ - [1, [3238477573, 31040]], - [1, [1000000000]] - ], - "fraction": { - "numer": "133319023345413", - "denom": "1000000000" - } - }, - "total_asks_rel_vol": { - "decimal": "35.2500366381728643576", - "rational": [ - [1, [473921343, 1669176307, 2]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "44062545797716080447", - "denom": "1250000000000000000" - } - }, - "total_bids_base_vol": { - "decimal": "59100.6554157135128550633", - "rational": [ - [1, [1422777577, 2274178813, 32038]], - [1, [2313682944, 2328306436]] - ], - "fraction": { - "numer": "591006554157135128550633", - "denom": "10000000000000000000" - } - }, - "total_bids_rel_vol": { - "decimal": "14.814675225", - "rational": [ - [1, [592587009]], - [1, [40000000]] - ], - "fraction": { - "numer": "592587009", - "denom": "40000000" - } - } - }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Recreate Swap Data"; -export const description = "The recreate_swap_data method helps recover lost swap data due to storage errors or hardware failure."; - -# recreate\_swap\_data - -The `recreate_swap_data` can assist in the event of local stored swap data being lost due to storage errors related to low disk space or hardware failure, and if required, aid with the refunding of failed swaps. - -To source the opposite side of the trade, please [contact the Komodo Support team on Discord](https://discord.com/invite/RRZ8hzc). You will need to provide details about the trade you are trying to recover, such as the coins and amounts being traded, the approximate time of the trade, any known transaction IDs involved in the trade, and if available the UUID of the trade. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| swap | object | Swap data from other side of trade. For example to recreate a Maker's swap data, the input would be the corresponding Taker's swap data | - -#### Response - -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | -| result | object | Opposite side's swap data. For example if a Taker's swap data is input, the reponse would be the corresponding Maker's swap data. | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "recreate_swap_data", - "params": { - "swap": { - "type": "Taker", - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "events": [ - { - "timestamp": 1638984440546, - "event": { - "type": "Started", - "data": { - "taker_coin": "MARTY", - "maker_coin": "DOC", - "maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "my_persistent_pub": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "lock_duration": 7800, - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "taker_amount": "1", - "maker_payment_confirmations": 1, - "maker_payment_requires_nota": false, - "taker_payment_confirmations": 1, - "taker_payment_requires_nota": false, - "taker_payment_lock": 1638992240, - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "started_at": 1638984440, - "maker_payment_wait": 1638987560, - "maker_coin_start_block": 1207822, - "taker_coin_start_block": 1222573, - "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 - } - } - } - }, - { - "timestamp": 1638984456603, - "event": { - "type": "Negotiated", - "data": { - "maker_payment_locktime": 1639000040, - "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", - "maker_coin_swap_contract_addr": null, - "taker_coin_swap_contract_addr": null - } - } - }, - { - "timestamp": 1638984456814, - "event": { - "type": "TakerFeeSent", - "data": { - "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", - "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "MakerPaymentReceived", - "data": { - "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", - "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" - } - } - }, - { - "timestamp": 1638984457826, - "event": { - "type": "MakerPaymentWaitConfirmStarted" - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "MakerPaymentWaitConfirmFailed", - "data": { - "error": "An error" - } - } - }, - { - "timestamp": 1638984503615, - "event": { - "type": "Finished" - } - } - ], - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "maker_coin": "DOC", - "taker_amount": "1", - "taker_coin": "MARTY", - "gui": "atomicDEX 0.5.1 iOS", - "mm_version": "1b065636a", - "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" - ] - } - }, - "id": 0 - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": { - "swap": { - "type": "Maker", - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "events": [ - { - "timestamp": 1638984440546, - "event": { - "type": "Started", - "data": { - "taker_coin": "MARTY", - "maker_coin": "DOC", - "taker": "b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "secret": "0000000000000000000000000000000000000000000000000000000000000000", - "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", - "my_persistent_pub": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "lock_duration": 7800, - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "taker_amount": "1", - "maker_payment_confirmations": 1, - "maker_payment_requires_nota": false, - "taker_payment_confirmations": 1, - "taker_payment_requires_nota": false, - "maker_payment_lock": 1639000040, - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "started_at": 1638984440, - "maker_coin_start_block": 1207822, - "taker_coin_start_block": 1222573, - "maker_payment_trade_fee": null, - "taker_payment_spend_trade_fee": null - } - } - }, - { - "timestamp": 1638984456603, - "event": { - "type": "Negotiated", - "data": { - "taker_payment_locktime": 1638992240, - "taker_pubkey": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "maker_coin_swap_contract_addr": null, - "taker_coin_swap_contract_addr": null - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "TakerFeeValidated", - "data": { - "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", - "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "MakerPaymentSent", - "data": { - "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", - "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" - } - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "TakerPaymentValidateFailed", - "data": { - "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" - } - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "MakerPaymentWaitRefundStarted", - "data": { - "wait_until": 1639003740 - } - } - } - ], - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "maker_coin": "DOC", - "taker_amount": "1", - "taker_coin": "MARTY", - "gui": "nogui", - "mm_version": "", - "success_events": [ - "Started", - "Negotiated", - "TakerFeeValidated", - "MakerPaymentSent", - "TakerPaymentReceived", - "TakerPaymentWaitConfirmStarted", - "TakerPaymentValidatedAndConfirmed", - "TakerPaymentSpent", - "TakerPaymentSpendConfirmStarted", - "TakerPaymentSpendConfirmed", - "Finished" - ], - "error_events": [ - "StartFailed", - "NegotiateFailed", - "TakerFeeValidateFailed", - "MakerPaymentTransactionFailed", - "MakerPaymentDataSendFailed", - "MakerPaymentWaitConfirmFailed", - "TakerPaymentValidateFailed", - "TakerPaymentWaitConfirmFailed", - "TakerPaymentSpendFailed", - "TakerPaymentSpendConfirmFailed", - "MakerPaymentWaitRefundStarted", - "MakerPaymentRefunded", - "MakerPaymentRefundFailed" - ] - } - }, - "id": null - } - ``` - -export const title = "AtomicDEX Method: Remove Delegation"; -export const description = - "The remove_delegation method stops your node's staking of a compatible coin."; - -# remove\_delegation - -The `remove_delegation` method stops your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. - -Note: After running `remove_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| coin | string | the coin being staked | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "remove_delegation", - "params": { - "coin": "tQTUM" - }, - "id": 0 - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "01000000015c7f32b1b3396ce1bed4f6c161bcc3a5bf5c58e4338c66a24c9de1deffc5b94e000000006a47304402203fcdf1e48f6e43fd718b4aab79c56a7ff81b12304339ddf6d871a3f26f217a7502200c22fa8e2bcc33d16f4bf62feb71f637acbefdd34135314e6aa526e6655cba73012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000225403a086010128043d666e8b140000000000000000000000000000000000000086c280584f00000000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb8d98061", - "tx_hash": "3564859a7ff902e8d65387c44f6049943582e0b9e29161bf1075a00097e535ae", - "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], - "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], - "total_amount": "0.096", - "spent_by_me": "0.096", - "received_by_me": "0.052", - "my_balance_change": "-0.044", - "block_height": 0, - "timestamp": 1635834296, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.004", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "coin": "tQTUM", - "internal_id": "", - "transaction_type": "RemoveDelegation" - }, - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Remove Node from Version Stat"; -export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running."; - -# remove\_node\_from\_version\_stat - -The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | ----------------------------- | -| name | string | the name assigned to the node | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "remove_node_from_version_stat", - "userpass": "testpsw", - "params": { - "name": "dragonhound_DEV" - } - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Start Simple Market Maker Bot"; -export const description = "The AtomicDEX API allows for simple bot trading via the start_simple_market_maker_bot method."; - -# start\_simple\_market\_maker\_bot - -The AtomicDEX API allows for simple bot trading via the `start_simple_market_maker_bot` method. This method takes as input a url to a price service, and configuration parameters of the pair to trade at a defined spread percentage value. It will update orders every 30 seconds (or higher values if defined with the `bot_refresh_rate` parameter). - -Note: If using a custom prices API endpoint, please ensure it conforms to the same schema as the url in the example. - -For convenience, an online [tool for generating configs](https://stats.kmd.io/atomicdex/makerbot_config_form/) is available. - -## Arguments - -| Structure | Type | Description | -| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| price\_url | string | Link to a price service API | -| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) | -| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) | -| cfg.name.base | string | Ticker of the coin you wish to sell | -| cfg.name.rel | string | Ticker of the coin you wish to buy | -| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) | -| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) | -| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) | -| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) | -| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) | -| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) | -| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) | -| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) | -| cfg.name.spread\*\* | string | Target price in relation to prices API value | -| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | -| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.enable | boolean | Bot will ignore this config entry if set to false | -| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) | -| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) | - -* Percentage values are within the range of 0-1, such that 0.25 = 25% -* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url. -* At least one of the optional fields `max`, `max_volume.usd` or `max_volume.percentage` must be present, or orders will not be placed. - -#### 📌 Examples - -As demonstrated below, multiple configs can be included within the same command. It is recommended to not exceed 500-1000 simultaneous orders placed to avoid decreased performance. - -In the example below, the first config lets the bot know we want to: - -* Sell DASH in exchange for KMD -* Use whole of available DASH balance, with minimum trade volume accepted as 25% of your balance -* Sets the sell price at 2.5% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 30 seconds -* Waits for 3 confirmations and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Checks trade history within the local AtomicDEX API database to never create trades with a sell price that is less than the average trading price. - -The second config tells the bot to: - -* Sell DASH in exchange for DGB -* Trade at most 50% of your DASH balance, with minimum trade volume accepted at least $20 USD. -* Only place an order when the DASH price is $250 USD or more. -* Sets the sell price at 4% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 60 seconds -* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Ignores your trade history and average trading price, creating/updating orders regardless. - -The third config tells the bot to: - -* Sell DASH in exchange for LTC -* Trade at most $500 USD worth of DASH, with minimum trade volume accepted at least $50 USD. -* Only place an order when the DASH price is $250 USD or more. -* Sets the sell price at 5% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 60 seconds -* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Ignores your trade history and average trading price, creating/updating orders regardless. - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "start_simple_market_maker_bot", - "params": { - "price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600", - "bot_refresh_rate": 60, - "cfg": { - "DASH/KMD": { - "base": "DASH", - "rel": "KMD", - "max": true, - "min_volume": { - "percentage": "0.25" - }, - "spread": "1.025", - "base_confs": 3, - "base_nota": false, - "rel_confs": 3, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 30, - "check_last_bidirectional_trade_thresh_hold": true - }, - "DASH/DGB": { - "base": "DASH", - "rel": "DGB", - "min_volume": { - "usd": "20" - }, - "min_base_price": "250", - "spread": "1.04", - "base_confs": 1, - "base_nota": false, - "rel_confs": 1, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 60, - "check_last_bidirectional_trade_thresh_hold": false - }, - "DASH/LTC": { - "base": "DASH", - "rel": "LTC", - "max_volume": { - "usd": "500" - }, - "min_volume": { - "usd": "50" - }, - "min_base_price": "250", - "spread": "1.04", - "base_confs": 1, - "base_nota": false, - "rel_confs": 1, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 60, - "check_last_bidirectional_trade_thresh_hold": false - } - } - }, - "id": 0 - } - ``` - - -As we have `\"bot_refresh_rate\": 60,` in the above command, our bot loop will update order prices every 60 seconds, as long as the price service returns data that is no more than 30 seconds old (for DASH/KMD) or no more than 60 seconds old (for DASH/DGB). - - - #### Response (success) {{class : 'text-green-500'}} - - ```json - { - "mmrpc": "2.0", - "result": { - "result": "Success" - }, - "id": 0 - } - ``` - - #### Response (error - bot already started) {{class : 'text-red-500'}} - - ```json - { - "mmrpc": "2.0", - "error": "The bot is already started", - "error_path": "simple_market_maker", - "error_trace": "simple_market_maker:770]", - "error_type": "AlreadyStarted", - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Start Version Stat Collection"; -export const description = "The start_version_stat_collection method initiates storing version statistics for nodes previously registered via the add_node_to_version_stat method."; - -# start\_version\_stat\_collection - -The `start_version_stat_collection` method initiates storing version statistics for nodes previously registered via the `add_node_to_version_stat` method. - -## Arguments - -| Structure | Type | Description | -| --------- | ------- | ------------------------------------------------ | -| interval | integer | polling rate (in seconds) to check node versions | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "start_version_stat_collection", - "userpass": "testpsw", - "params": { - "interval": 600 - } - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - - #### Response (error - invalid peer id unable to parse) - - ```json - { - "mmrpc": "2.0", - "error": "Database error: UNIQUE constraint failed: nodes.peer_id", - "error_path": "lp_stats", - "error_trace": "lp_stats:124]", - "error_type": "DatabaseError", - "error_data": "UNIQUE constraint failed: nodes.peer_id", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Stop Simple Market Maker Bot"; -export const description = "The stop_simple_market_maker_bot method tells the bot to finish placing orders at the end of the current loop 30 seconds minimum and 30 seconds by default."; - -# stop\_simple\_market\_maker\_bot - -The `stop_simple_market_maker_bot` method tells the bot to finish placing orders at the end of the current loop (30 seconds minimum & 30 seconds by default). This method takes as input a url to a price service, and configuration parameters of the pairs to trade at a defined spread percentage value. - -At the end of the final loop, orders placed by the bot will be cancelled. Users should wait until the loop ends before exiting the AtomicDEX API, otherwise orders will not cancel, and will reappear on the orderbook next time AtomicDEX API starts. - -## Arguments - -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none ) | | | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "stop_simple_market_maker_bot", - "params": {}, - "id": 0 - } - ``` - - - - #### Response (success) {{class : 'text-green-500'}} - - ```json - { - "mmrpc": "2.0", - "result": { - "result": "Success" - }, - "id": 0 - } - ``` - - #### Response (error - bot already stopped) {{class : 'text-red-500'}} - - ```json - { - "mmrpc": "2.0", - "error": "The bot is already stopped", - "error_path": "simple_market_maker", - "error_trace": "simple_market_maker:813]", - "error_type": "AlreadyStopped", - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Stop Version Stat Collection"; -export const description = "The stop_version_stat_collection method stops the collection of version stats at the end of the current loop interval."; - -# stop\_version\_stat\_collection - -The `stop_version_stat_collection` method stops the collection of version stats at the end of the current loop interval. - -#### Arguments - -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | - -#### Response - -| Structure | Type | Description | -| --------- | ------ | ---------------- | -| result | string | success or error | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "stop_version_stat_collection", - "userpass": "testpsw", - "params": {} - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - - - - #### Response (error - stats collection not running) - - ```json - { - "mmrpc": "2.0", - "error": "start_version_stat_collection is not running", - "error_path": "lp_stats", - "error_trace": "lp_stats:395]", - "error_type": "NotRunning", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Telegram Alerts for MM Bot"; -export const description = "The AtomicDEX API Market Maker bot can be configured to send status update alerts via Telegram."; - -# Telegram Alerts for Market Maker Bot - -The AtomicDEX API Market Maker bot can be configured to send status update alerts via [Telegram!](https://telegram.org/) - -To set this up, you can add some additional parameters to your MM2.json as shown in the example below - -```json -{ - "gui": "MarketMakerBot", - "netid": 8762, - "rpc_password": "YOUR_PASSWORD", - "passphrase": "YOUR SEED PHRASE", - "dbdir": "/path/to/your/atomicdex/DB", - "message_service_cfg": { - "telegram": { - "api_key": "YOUR:TELEGRAM_API_TOKEN", - "chat_registry": { - "default": "YOUR_TELEGRAM_CHAT_ID", - "maker_bot": "YOUR_TELEGRAM_CHAT_ID", - "swap_events": "YOUR_TELEGRAM_CHAT_ID" - } - } - } -} -``` - -The extra fields required are: - -| Parameter | Type | Description | -| --------------------------- | ------ | ------------------------ | -| api\_key | string | A Telegram bot API token | -| chat\_registry.default | string | A Telegram Chat ID | -| chat\_registry.maker\_bot | string | A Telegram Chat ID | -| chat\_registry.swap\_events | string | A Telegram Chat ID | - -You can use the same Telegram chat ID for all three `chat_registry` subfields, or sent your alerts to a different chat ID if you want to separate the alerts by type. - -To get a Telegram bot API token, you need to [have chat with the BotFather](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) - -To get a Telegram chat ID, check out [this guide](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) -export const title = "AtomicDEX Method: Trade Preimage"; -export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; - -# trade\_preimage - -The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. -Depending on the parameters, the function returns different results: - -* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. - The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; -* If the `max` field is true, then the result will include the `volume`. - - - This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. - Use the resulting `volume` as an argument of the `buy` or `sell` requests. - - - - Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. - - -## Arguments - -| Structure | Type | Description | -| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| base | string | the base currency of the request | -| rel | string | the rel currency of the request | -| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | -| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | -| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | -| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | - -### Result - -| Structure | Type | Description | -| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | -| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | -| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | -| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | -| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | -| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | -| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | -| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | - -### ⚠ Error types - -#### NotSufficientBalance - -The `available` balance of the `coin` is not sufficient to start the swap. - -| Structure | Type | Description | -| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | -| coin | string | the name of the coin which balance is not sufficient | -| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | -| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | -| locked\_by\_swaps | string (numeric, optional) | the amount locked by other swaps | - -#### NotSufficientBaseCoinBalance - -The available balance of the base `coin` is not sufficient to pay transaction fees. - -For example, ERC20 fees are paid by ETH (gas), and this error type is returned if the ETH coin balance is not sufficient to start the swap. - -| Structure | Type | Description | -| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | -| coin | string | the name of the base coin which balance is not sufficient | -| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | -| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | -| locked\_by\_swaps | string (numeric, optional) | the amount is locked by other swaps | - -#### VolumeTooLow - -The specified `volume` is too low. Required at least `threshold`. - - - If the `coin` field returned in Response is the same as the `rel` argument in Request, then the base volume threshold can be calculated as follows: - `base_coin_threshold = rel_vol_threshold / price` - - -| Structure | Type | Description | -| --------- | ---------------- | -------------------------------------------------- | -| coin | string | either `base` or `rel` coin specified in Request | -| volume | string (numeric) | the amount the user was willing to trade in `coin` | -| threshold | string (numeric) | the `volume` has not to be less than this amount | - -#### NoSuchCoin - -The specified coin was not found or is not activated yet. - -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| coin | string | either `base` or `rel` coin specified in Request | - -#### CoinIsWalletOnly + "total_asks_rel_vol": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + }, + "total_bids_base_vol": { + "decimal": "59100.6554157135128550633", + "rational": [ + [1, [1422777577, 2274178813, 32038]], + [1, [2313682944, 2328306436]] + ], + "fraction": { + "numer": "591006554157135128550633", + "denom": "10000000000000000000" + } + }, + "total_bids_rel_vol": { + "decimal": "14.814675225", + "rational": [ + [1, [592587009]], + [1, [40000000]] + ], + "fraction": { + "numer": "592587009", + "denom": "40000000" + } + } + }, + "id": 42 + } + ``` + +export const title = "AtomicDEX Method: Recreate Swap Data"; +export const description = "The recreate_swap_data method helps recover lost swap data due to storage errors or hardware failure."; -The specified coin is wallet only and cannot be participated in the swap. +# recreate\_swap\_data -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| coin | string | either `base` or `rel` coin specified in Request | +The `recreate_swap_data` can assist in the event of local stored swap data being lost due to storage errors related to low disk space or hardware failure, and if required, aid with the refunding of failed swaps. -#### BaseEqualRel +To source the opposite side of the trade, please [contact the Komodo Support team on Discord](https://discord.com/invite/RRZ8hzc). You will need to provide details about the trade you are trying to recover, such as the coins and amounts being traded, the approximate time of the trade, any known transaction IDs involved in the trade, and if available the UUID of the trade. -The coin is wallet only and cannot be participated in the swap. +## Arguments -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | +| swap | object | Swap data from other side of trade. For example to recreate a Maker's swap data, the input would be the corresponding Taker's swap data | -#### InvalidParam +#### Response -Incorrect use of the `param` parameter in Request. +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | +| result | object | Opposite side's swap data. For example if a Taker's swap data is input, the reponse would be the corresponding Maker's swap data. | -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| param | string | the name of the parameter in Request | -| reason | string | the reason why the parameter is used incorrectly | +#### 📌 Examples -#### PriceTooLow +#### Command -The specified `price` is too low. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "recreate_swap_data", + "params": { + "swap": { + "type": "Taker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "my_persistent_pub": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1638992240, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_payment_wait": 1638987560, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "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 + } + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1639000040, + "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984456814, + "event": { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984457826, + "event": { + "type": "MakerPaymentWaitConfirmStarted" + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitConfirmFailed", + "data": { + "error": "An error" + } + } + }, + { + "timestamp": 1638984503615, + "event": { + "type": "Finished" + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "atomicDEX 0.5.1 iOS", + "mm_version": "1b065636a", + "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" + ] + } + }, + "id": 0 + } + ``` + -| Structure | Type | Description | -| --------- | ---------------- | ---------------------------------------------------------------------------------- | -| price | string (numeric) | the price in `rel` the user was willing to receive per one unit of the `base` coin | -| threshold | string (numeric) | the `price` has not to be less than this amount | + + #### Response (success) -#### Transport + ```json + { + "mmrpc": "2.0", + "result": { + "swap": { + "type": "Maker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "taker": "b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "secret": "0000000000000000000000000000000000000000000000000000000000000000", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "my_persistent_pub": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "maker_payment_lock": 1639000040, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "maker_payment_trade_fee": null, + "taker_payment_spend_trade_fee": null + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "taker_payment_locktime": 1638992240, + "taker_pubkey": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "TakerFeeValidated", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentSent", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "TakerPaymentValidateFailed", + "data": { + "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitRefundStarted", + "data": { + "wait_until": 1639003740 + } + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "nogui", + "mm_version": "", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ] + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Remove Delegation"; +export const description = + "The remove_delegation method stops your node's staking of a compatible coin."; -The request was failed due to a network error. +# remove\_delegation -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| (none) | string | the transport error description | +The `remove_delegation` method stops your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. -#### InternalError +Note: After running `remove_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. -The request was failed due to a AtomicDEX API internal error. +## Arguments -| Structure | Type | Description | -| --------- | ------ | ------------------------------ | -| (none) | string | the internal error description | +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| coin | string | the coin being staked | -### 📌 Examples +#### 📌 Examples -#### Command (setprice) +#### Command - + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "trade_preimage", + "mmrpc": "2.0", + "method": "remove_delegation", "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "0.1", - "swap_method": "setprice" + "coin": "tQTUM" }, "id": 0 } ``` -#### Response + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "coin": "KMD", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "coin": "DGB", - "amount": "0.00030782", - "amount_fraction": { - "numer": "15391", - "denom": "50000000" + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "01000000015c7f32b1b3396ce1bed4f6c161bcc3a5bf5c58e4338c66a24c9de1deffc5b94e000000006a47304402203fcdf1e48f6e43fd718b4aab79c56a7ff81b12304339ddf6d871a3f26f217a7502200c22fa8e2bcc33d16f4bf62feb71f637acbefdd34135314e6aa526e6655cba73012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000225403a086010128043d666e8b140000000000000000000000000000000000000086c280584f00000000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb8d98061", + "tx_hash": "3564859a7ff902e8d65387c44f6049943582e0b9e29161bf1075a00097e535ae", + "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "total_amount": "0.096", + "spent_by_me": "0.096", + "received_by_me": "0.052", + "my_balance_change": "-0.044", + "block_height": 0, + "timestamp": 1635834296, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.004", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" }, - "amount_rat": [ - [1, [15391]], - [1, [50000000]] - ], - "paid_from_trading_vol": true - }, - "volume": "1138.46868712", - "volume_fraction": { - "numer": "14230858589", - "denom": "12500000" + "coin": "tQTUM", + "internal_id": "", + "transaction_type": "RemoveDelegation" }, - "volume_rat": [ - [1, [1345956701, 3]], - [1, [12500000]] - ], - "total_fees": [ - { - "coin": "KMD", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "required_balance": "0.00001", - "required_balance_fraction": { - "numer": "1", - "denom": "100000" - }, - "required_balance_rat": [ - [1, [1]], - [1, [100000]] - ] - }, - { - "coin": "DGB", - "amount": "0.00030782", - "amount_fraction": { - "numer": "15391", - "denom": "50000000" - }, - "amount_rat": [ - [1, [15391]], - [1, [50000000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" - }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] - } - ] - }, - "id": 0 -} -``` + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Remove Node from Version Stat"; +export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running."; + +# remove\_node\_from\_version\_stat + +The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| name | string | the name assigned to the node | + +#### 📌 Examples -#### Command (buy) +#### Command - + ```json { "mmrpc": "2.0", + "method": "remove_node_from_version_stat", "userpass": "testpsw", - "method": "trade_preimage", "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "0.1", - "swap_method": "buy" - }, - "id": 0 + "name": "dragonhound_DEV" + } } ``` -#### Response + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" - }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": true - }, - "rel_coin_fee": { - "amount": "0.0001", - "amount_fraction": { - "denom": "10000", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [10000]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "taker_fee": { - "amount": "0.00012870012870012872", - "amount_fraction": { - "denom": "7770", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [7770]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "fee_to_send_taker_fee": { - "amount": "0.0001", - "amount_fraction": { - "denom": "10000", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [10000]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "coin": "DOC", - "amount": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", - "amount_fraction": { - "numer": "50777", - "denom": "38850000" - }, - "amount_rat": [ - [1, [50777]], - [1, [38850000]] - ], - "required_balance": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", - "required_balance_fraction": { - "numer": "50777", - "denom": "38850000" - }, - "required_balance_rat": [ - [1, [50777]], - [1, [38850000]] - ] - }, - { - "coin": "tBTC", - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Start Simple Market Maker Bot"; +export const description = "The AtomicDEX API allows for simple bot trading via the start_simple_market_maker_bot method."; + +# start\_simple\_market\_maker\_bot + +The AtomicDEX API allows for simple bot trading via the `start_simple_market_maker_bot` method. This method takes as input a url to a price service, and configuration parameters of the pair to trade at a defined spread percentage value. It will update orders every 30 seconds (or higher values if defined with the `bot_refresh_rate` parameter). + +Note: If using a custom prices API endpoint, please ensure it conforms to the same schema as the url in the example. + +For convenience, an online [tool for generating configs](https://stats.kmd.io/atomicdex/makerbot_config_form/) is available. + +## Arguments + +| Structure | Type | Description | +| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| price\_url | string | Link to a price service API | +| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) | +| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) | +| cfg.name.base | string | Ticker of the coin you wish to sell | +| cfg.name.rel | string | Ticker of the coin you wish to buy | +| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) | +| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) | +| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) | +| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) | +| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) | +| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) | +| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) | +| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) | +| cfg.name.spread\*\* | string | Target price in relation to prices API value | +| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.enable | boolean | Bot will ignore this config entry if set to false | +| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) | +| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) | + +* Percentage values are within the range of 0-1, such that 0.25 = 25% +* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url. +* At least one of the optional fields `max`, `max_volume.usd` or `max_volume.percentage` must be present, or orders will not be placed. + +#### 📌 Examples + +As demonstrated below, multiple configs can be included within the same command. It is recommended to not exceed 500-1000 simultaneous orders placed to avoid decreased performance. + +In the example below, the first config lets the bot know we want to: + +* Sell DASH in exchange for KMD +* Use whole of available DASH balance, with minimum trade volume accepted as 25% of your balance +* Sets the sell price at 2.5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 30 seconds +* Waits for 3 confirmations and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Checks trade history within the local AtomicDEX API database to never create trades with a sell price that is less than the average trading price. + +The second config tells the bot to: + +* Sell DASH in exchange for DGB +* Trade at most 50% of your DASH balance, with minimum trade volume accepted at least $20 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 4% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +The third config tells the bot to: + +* Sell DASH in exchange for LTC +* Trade at most $500 USD worth of DASH, with minimum trade volume accepted at least $50 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "start_simple_market_maker_bot", + "params": { + "price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600", + "bot_refresh_rate": 60, + "cfg": { + "DASH/KMD": { + "base": "DASH", + "rel": "KMD", + "max": true, + "min_volume": { + "percentage": "0.25" + }, + "spread": "1.025", + "base_confs": 3, + "base_nota": false, + "rel_confs": 3, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 30, + "check_last_bidirectional_trade_thresh_hold": true }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" + "DASH/DGB": { + "base": "DASH", + "rel": "DGB", + "min_volume": { + "usd": "20" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] + "DASH/LTC": { + "base": "DASH", + "rel": "LTC", + "max_volume": { + "usd": "500" + }, + "min_volume": { + "usd": "50" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false + } } - ] - }, - "id": 0 -} -``` + }, + "id": 0 + } + ``` + -#### Command (sell, max) +As we have `\"bot_refresh_rate\": 60,` in the above command, our bot loop will update order prices every 60 seconds, as long as the price service returns data that is no more than 30 seconds old (for DASH/KMD) or no more than 60 seconds old (for DASH/DGB). + + + #### Response (success) {{class : 'text-green-500'}} - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "trade_preimage", - "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "2.21363478", - "swap_method": "sell" + "result": { + "result": "Success" }, "id": 0 } ``` - -#### Response + #### Response (error - bot already started) {{class : 'text-red-500'}} -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" - }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "coin": "DOC", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "paid_from_trading_vol": true - }, - "taker_fee": { - "amount": "0.0028489508108108107", - "amount_fraction": { - "denom": "1850000000", - "numer": "5270559" - }, - "amount_rat": [ - [1, [5270559]], - [1, [1850000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "fee_to_send_taker_fee": { - "amount": "0.00033219", - "amount_fraction": { - "denom": "100000000", - "numer": "33219" - }, - "amount_rat": [ - [1, [33219]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "coin": "DOC", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" - }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] - }, - { - "coin": "BTC", - "amount": "0.0036016308108108106", - "amount_fraction": { - "denom": "1850000000", - "numer": "6663017" - }, - "amount_rat": [ - [1, [6663017]], - [1, [1850000000]] - ], - "required_balance": "0.0036016308108108106", - "required_balance_fraction": { - "denom": "1850000000", - "numer": "6663017" - }, - "required_balance_rat": [ - [1, [6663017]], - [1, [1850000000]] - ] - } - ] - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "error": "The bot is already started", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:770]", + "error_type": "AlreadyStarted", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Start Version Stat Collection"; +export const description = "The start_version_stat_collection method initiates storing version statistics for nodes previously registered via the add_node_to_version_stat method."; -#### Command (ERC20 and QRC20) +# start\_version\_stat\_collection - +The `start_version_stat_collection` method initiates storing version statistics for nodes previously registered via the `add_node_to_version_stat` method. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to check node versions | + +#### 📌 Examples + +#### Command + + ```json { "mmrpc": "2.0", + "method": "start_version_stat_collection", "userpass": "testpsw", - "method": "trade_preimage", "params": { - "base": "BAT", - "rel": "QC", - "price": "1", - "volume": "2.21363478", - "swap_method": "setprice" - }, - "id": 0 + "interval": 600 + } } ``` -#### Response - -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.0045", - "amount_fraction": { - "denom": "2000", - "numer": "9" - }, - "amount_rat": [ - [1, [9]], - [1, [2000]] - ], - "coin": "ETH", - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "amount": "0.00325", - "amount_fraction": { - "denom": "4000", - "numer": "13" - }, - "amount_rat": [ - [0, [13]], - [1, [4000]] - ], - "coin": "QTUM", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "amount": "0.003", - "amount_fraction": { - "denom": "1000", - "numer": "3" - }, - "amount_rat": [ - [1, [3]], - [1, [1000]] - ], - "required_balance": "0.003", - "required_balance_fraction": { - "denom": "1000", - "numer": "3" - }, - "required_balance_rat": [ - [1, [3]], - [1, [1000]] - ], - "coin": "ETH" - }, - { - "amount": "0.00325", - "amount_fraction": { - "denom": "4000", - "numer": "13" - }, - "amount_rat": [ - [0, [13]], - [1, [4000]] - ], - "required_balance": "0.00325", - "required_balance_fraction": { - "denom": "4000", - "numer": "13" - }, - "required_balance_rat": [ - [0, [13]], - [1, [4000]] - ], - "coin": "QTUM" - } - ] - }, - "id": 0 -} -``` - -#### Response (NotSufficientBalance error) + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "error": "Not enough BTC for swap: available 0.000015, required at least 0.10012, locked by swaps None", - "error_path": "maker_swap", - "error_trace": "maker_swap:1540] maker_swap:1641]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "BTC", - "available": "0.000015", - "required": "0.10012", - "locked_by_swaps": "0" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` -#### Response (VolumeTooLow error) + #### Response (error - invalid peer id unable to parse) -```json -{ - "mmrpc": "2.0", - "error": "The volume 0.00001 of the DOC coin less than minimum transaction amount 0.0001", - "error_path": "maker_swap", - "error_trace": "maker_swap:1599]", - "error_type": "VolumeTooLow", - "error_data": { - "coin": "DOC", - "volume": "0.00001", - "threshold": "0.0001" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "error": "Database error: UNIQUE constraint failed: nodes.peer_id", + "error_path": "lp_stats", + "error_trace": "lp_stats:124]", + "error_type": "DatabaseError", + "error_data": "UNIQUE constraint failed: nodes.peer_id", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Stop Simple Market Maker Bot"; +export const description = "The stop_simple_market_maker_bot method tells the bot to finish placing orders at the end of the current loop 30 seconds minimum and 30 seconds by default."; -#### Response (Transport error) +# stop\_simple\_market\_maker\_bot -```json -{ - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 -} -``` +The `stop_simple_market_maker_bot` method tells the bot to finish placing orders at the end of the current loop (30 seconds minimum & 30 seconds by default). This method takes as input a url to a price service, and configuration parameters of the pairs to trade at a defined spread percentage value. -#### Response (incorrect use of "max" error) +At the end of the final loop, orders placed by the bot will be cancelled. Users should wait until the loop ends before exiting the AtomicDEX API, otherwise orders will not cancel, and will reappear on the orderbook next time AtomicDEX API starts. -```json -{ - "mmrpc": "2.0", - "error": "Incorrect use of the 'max' parameter: 'max' cannot be used with 'sell' or 'buy' method", - "error_path": "taker_swap", - "error_trace": "taker_swap:1602]", - "error_type": "InvalidParam", - "error_data": { - "param": "max", - "reason": "'max' cannot be used with 'sell' or 'buy' method" - }, - "id": 0 -} -``` -export const title = "AtomicDEX Method: Update Version Stat Collection"; -export const description = "The update_version_stat_collection method updates the polling interval for version stats collection."; +## Arguments -# update\_version\_stat\_collection +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none ) | | | -The `update_version_stat_collection` method updates the polling interval for version stats collection. Note: the new interval will take effect after the current interval loop has completed. +#### 📌 Examples -## Arguments +#### Command -| Structure | Type | Description | -| --------- | ------- | ------------------------------------------------ | -| interval | integer | polling rate (in seconds) to query node versions | + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "stop_simple_market_maker_bot", + "params": {}, + "id": 0 + } + ``` + + + + #### Response (success) {{class : 'text-green-500'}} + + ```json + { + "mmrpc": "2.0", + "result": { + "result": "Success" + }, + "id": 0 + } + ``` + + #### Response (error - bot already stopped) {{class : 'text-red-500'}} + + ```json + { + "mmrpc": "2.0", + "error": "The bot is already stopped", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:813]", + "error_type": "AlreadyStopped", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Stop Version Stat Collection"; +export const description = "The stop_version_stat_collection method stops the collection of version stats at the end of the current loop interval."; + +# stop\_version\_stat\_collection + +The `stop_version_stat_collection` method stops the collection of version stats at the end of the current loop interval. + +#### Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | ---------------- | +| result | string | success or error | #### 📌 Examples #### Command - + ```json { "mmrpc": "2.0", - "method": "update_version_stat_collection", + "method": "stop_version_stat_collection", "userpass": "testpsw", - "params": { - "interval": 900 - } + "params": {} } ``` @@ -16887,107 +15392,187 @@ The `update_version_stat_collection` method updates the polling interval for ver #### Response (error - stats collection not running) - ```json - { - "mmrpc": "2.0", - "error": "start_version_stat_collection is not running", - "error_path": "lp_stats", - "error_trace": "lp_stats:374]", - "error_type": "NotRunning", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Withdraw"; -export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; + ```json + { + "mmrpc": "2.0", + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:395]", + "error_type": "NotRunning", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Telegram Alerts for MM Bot"; +export const description = "The AtomicDEX API Market Maker bot can be configured to send status update alerts via Telegram."; + +# Telegram Alerts for Market Maker Bot + +The AtomicDEX API Market Maker bot can be configured to send status update alerts via [Telegram!](https://telegram.org/) + +To set this up, you can add some additional parameters to your MM2.json as shown in the example below + +```json +{ + "gui": "MarketMakerBot", + "netid": 8762, + "rpc_password": "YOUR_PASSWORD", + "passphrase": "YOUR SEED PHRASE", + "dbdir": "/path/to/your/atomicdex/DB", + "message_service_cfg": { + "telegram": { + "api_key": "YOUR:TELEGRAM_API_TOKEN", + "chat_registry": { + "default": "YOUR_TELEGRAM_CHAT_ID", + "maker_bot": "YOUR_TELEGRAM_CHAT_ID", + "swap_events": "YOUR_TELEGRAM_CHAT_ID" + } + } + } +} +``` + +The extra fields required are: + +| Parameter | Type | Description | +| --------------------------- | ------ | ------------------------ | +| api\_key | string | A Telegram bot API token | +| chat\_registry.default | string | A Telegram Chat ID | +| chat\_registry.maker\_bot | string | A Telegram Chat ID | +| chat\_registry.swap\_events | string | A Telegram Chat ID | + +You can use the same Telegram chat ID for all three `chat_registry` subfields, or sent your alerts to a different chat ID if you want to separate the alerts by type. + +To get a Telegram bot API token, you need to [have chat with the BotFather](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) + +To get a Telegram chat ID, check out [this guide](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) +export const title = "AtomicDEX Method: Trade Preimage"; +export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; + +# trade\_preimage + +The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. +Depending on the parameters, the function returns different results: + +* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. + The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; +* If the `max` field is true, then the result will include the `volume`. + + + This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. + Use the resulting `volume` as an argument of the `buy` or `sell` requests. + + + + Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. + + +## Arguments + +| Structure | Type | Description | +| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| base | string | the base currency of the request | +| rel | string | the rel currency of the request | +| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | +| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | +| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | +| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | + +### Result + +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | + +### ⚠ Error types -# withdraw +#### NotSufficientBalance -The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. +The `available` balance of the `coin` is not sufficient to start the swap. -This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount locked by other swaps | -## Arguments +#### NotSufficientBaseCoinBalance -| Structure | Type | Description | -| --------- | ---------------- | ----------------------------------------------------------------------------------- | -| coin | string | the name of the coin the user desires to withdraw | -| to | string | coins are withdrawn to this address | -| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | -| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | -| max | bool | withdraw the maximum available amount | -| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | +The available balance of the base `coin` is not sufficient to pay transaction fees. -### Response +For example, ERC20 fees are paid by ETH (gas), and this error type is returned if the ETH coin balance is not sufficient to start the swap. -| Structure | Type | Description | -| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | -| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | -| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | -| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | -| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | -| total\_amount | string (numeric) | the total amount of coins transferred | -| fee\_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | -| tx\_hash | string | the hash of the generated transaction | -| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | -| coin | string | the name of the coin the user wants to withdraw | -| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | -| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | -| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the base coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount is locked by other swaps | -### ⚠ Error types +#### VolumeTooLow -#### NotSufficientBalance +The specified `volume` is too low. Required at least `threshold`. -The `available` balance is not sufficient to transfer the specified amount. + + If the `coin` field returned in Response is the same as the `rel` argument in Request, then the base volume threshold can be calculated as follows: + `base_coin_threshold = rel_vol_threshold / price` + -| Structure | Type | Description | -| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | -| available | string (numeric) | the balance available for transfer | -| required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient | +| Structure | Type | Description | +| --------- | ---------------- | -------------------------------------------------- | +| coin | string | either `base` or `rel` coin specified in Request | +| volume | string (numeric) | the amount the user was willing to trade in `coin` | +| threshold | string (numeric) | the `volume` has not to be less than this amount | -#### ZeroBalanceToWithdrawMax +#### NoSuchCoin -The available balance is zero. +The specified coin was not found or is not activated yet. -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | -#### AmountTooLow +#### CoinIsWalletOnly -The specified amount is too low. Required at least `threshold`. +The specified coin is wallet only and cannot be participated in the swap. -| Structure | Type | Description | -| --------- | ---------------- | ---------------------------------------------------- | -| amount | string (numeric) | the amount the user was willing to transfer | -| threshold | string (numeric) | the `amount` has not to be less than the `threshold` | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | -#### InvalidAddress +#### BaseEqualRel -The specified `to` address is not valid. +The coin is wallet only and cannot be participated in the swap. -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| (none) | string | the error description | +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | -#### InvalidFeePolicy +#### InvalidParam -The specified `fee` is not valid. +Incorrect use of the `param` parameter in Request. -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| (none) | string | the error description | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| param | string | the name of the parameter in Request | +| reason | string | the reason why the parameter is used incorrectly | -#### NoSuchCoin +#### PriceTooLow -The specified coin was not found or is not activated yet. +The specified `price` is too low. -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------- | -| coin | string | the not found `coin` specified in the Request | +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------- | +| price | string (numeric) | the price in `rel` the user was willing to receive per one unit of the `base` coin | +| threshold | string (numeric) | the `price` has not to be less than this amount | #### Transport @@ -16999,7 +15584,7 @@ The request was failed due to a network error. #### InternalError -The request was failed due to an AtomicDEX API internal error. +The request was failed due to a AtomicDEX API internal error. | Structure | Type | Description | | --------- | ------ | ------------------------------ | @@ -17007,189 +15592,564 @@ The request was failed due to an AtomicDEX API internal error. ### 📌 Examples -#### Withdraw BTC, KMD, and other BTC-based forks +#### Command (setprice) - + ```json { + "mmrpc": "2.0", "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "setprice" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "paid_from_trading_vol": true + }, + "volume": "1138.46868712", + "volume_fraction": { + "numer": "14230858589", + "denom": "12500000" + }, + "volume_rat": [ + [1, [1345956701, 3]], + [1, [12500000]] + ], + "total_fees": [ + { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0.00001", + "required_balance_fraction": { + "numer": "1", + "denom": "100000" + }, + "required_balance_rat": [ + [1, [1]], + [1, [100000]] + ] + }, + { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` + +#### Command (buy) + + + ```json + { "mmrpc": "2.0", - "method": "withdraw", + "userpass": "testpsw", + "method": "trade_preimage", "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "buy" }, "id": 0 } ``` - - #### Response (KMD success) +#### Response - ```json - { - "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "KMD", - "fee_details": { - "type": "Utxo", - "amount": "0.00001" +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" }, - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "my_balance_change": "-10.00001", - "received_by_me": "0.34417325", - "spent_by_me": "10.34418325", - "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], - "total_amount": "10.34418325", - "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", - "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", - "kmd_rewards": { - "amount": "0.0791809", - "claimed_by_my": true - } + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": true }, - "id": 0 - } - ``` + "rel_coin_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "taker_fee": { + "amount": "0.00012870012870012872", + "amount_fraction": { + "denom": "7770", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [7770]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "amount_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "amount_rat": [ + [1, [50777]], + [1, [38850000]] + ], + "required_balance": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "required_balance_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "required_balance_rat": [ + [1, [50777]], + [1, [38850000]] + ] + }, + { + "coin": "tBTC", + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` - #### Response (NotSufficientBalance error) +#### Command (sell, max) + ```json { "mmrpc": "2.0", - "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:449]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "DOC", - "available": "69.75066225", - "required": "1000.00001" + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "2.21363478", + "swap_method": "sell" }, "id": 0 } ``` - + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": true + }, + "taker_fee": { + "amount": "0.0028489508108108107", + "amount_fraction": { + "denom": "1850000000", + "numer": "5270559" + }, + "amount_rat": [ + [1, [5270559]], + [1, [1850000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.00033219", + "amount_fraction": { + "denom": "100000000", + "numer": "33219" + }, + "amount_rat": [ + [1, [33219]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + }, + { + "coin": "BTC", + "amount": "0.0036016308108108106", + "amount_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "amount_rat": [ + [1, [6663017]], + [1, [1850000000]] + ], + "required_balance": "0.0036016308108108106", + "required_balance_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "required_balance_rat": [ + [1, [6663017]], + [1, [1850000000]] + ] + } + ] + }, + "id": 0 +} +``` -#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee +#### Command (ERC20 and QRC20) - + ```json { "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "method": "trade_preimage", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoFixed", - "amount": "0.1" - } + "base": "BAT", + "rel": "QC", + "price": "1", + "volume": "2.21363478", + "swap_method": "setprice" }, "id": 0 } ``` - - #### Response (success) +#### Response - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.0045", + "amount_fraction": { + "denom": "2000", + "numer": "9" }, - "coin": "DOC", - "internal_id": "" + "amount_rat": [ + [1, [9]], + [1, [2000]] + ], + "coin": "ETH", + "paid_from_trading_vol": false }, - "id": 0 - } - ``` - + "rel_coin_fee": { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "amount": "0.003", + "amount_fraction": { + "denom": "1000", + "numer": "3" + }, + "amount_rat": [ + [1, [3]], + [1, [1000]] + ], + "required_balance": "0.003", + "required_balance_fraction": { + "denom": "1000", + "numer": "3" + }, + "required_balance_rat": [ + [1, [3]], + [1, [1000]] + ], + "coin": "ETH" + }, + { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "required_balance": "0.00325", + "required_balance_fraction": { + "denom": "4000", + "numer": "13" + }, + "required_balance_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM" + } + ] + }, + "id": 0 +} +``` -#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee +#### Response (NotSufficientBalance error) - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoPerKbyte", - "amount": "1" - } - }, - "id": 0 - } - ``` - +```json +{ + "mmrpc": "2.0", + "error": "Not enough BTC for swap: available 0.000015, required at least 0.10012, locked by swaps None", + "error_path": "maker_swap", + "error_trace": "maker_swap:1540] maker_swap:1641]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "BTC", + "available": "0.000015", + "required": "0.10012", + "locked_by_swaps": "0" + }, + "id": 0 +} +``` - - #### Response (success) +#### Response (VolumeTooLow error) - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", - "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.00253836", - "spent_by_me": "60.00253836", - "received_by_me": "59.61874931", - "my_balance_change": "-0.38378905", - "block_height": 0, - "timestamp": 1566473421, - "fee_details": { - "type": "Utxo", - "amount": "0.38378905" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 - } - ``` - +```json +{ + "mmrpc": "2.0", + "error": "The volume 0.00001 of the DOC coin less than minimum transaction amount 0.0001", + "error_path": "maker_swap", + "error_trace": "maker_swap:1599]", + "error_type": "VolumeTooLow", + "error_data": { + "coin": "DOC", + "volume": "0.00001", + "threshold": "0.0001" + }, + "id": 0 +} +``` -#### Withdraw ETH, ERC20, and other ETH-based forks +#### Response (Transport error) + +```json +{ + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 +} +``` + +#### Response (incorrect use of "max" error) + +```json +{ + "mmrpc": "2.0", + "error": "Incorrect use of the 'max' parameter: 'max' cannot be used with 'sell' or 'buy' method", + "error_path": "taker_swap", + "error_trace": "taker_swap:1602]", + "error_type": "InvalidParam", + "error_data": { + "param": "max", + "reason": "'max' cannot be used with 'sell' or 'buy' method" + }, + "id": 0 +} +``` +export const title = "AtomicDEX Method: Update Version Stat Collection"; +export const description = "The update_version_stat_collection method updates the polling interval for version stats collection."; + +# update\_version\_stat\_collection + +The `update_version_stat_collection` method updates the polling interval for version stats collection. Note: the new interval will take effect after the current interval loop has completed. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to query node versions | + +#### 📌 Examples + +#### Command - + ```json { "mmrpc": "2.0", + "method": "update_version_stat_collection", "userpass": "testpsw", - "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "amount": 10 - }, - "id": 0 + "interval": 900 + } } ``` @@ -17200,111 +16160,147 @@ The request was failed due to an AtomicDEX API internal error. ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "ETH", - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" - }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" - }, - "id": 0 + "result": "success", + "id": null } ``` -#### ETH/ERC20 and other ETH-based forks, with gas fee + + #### Response (error - stats collection not running) - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "COIN_NAME", - "to": "RECIPIENT_ADDRESS", - "amount": "AMOUNT", - "fee": { - "type": "EthGas", - "gas_price": "3.5", - "gas": 55000 - } - }, - "id": 0 + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:374]", + "error_type": "NotRunning", + "id": null } ``` - + +export const title = "AtomicDEX Method: Withdraw"; +export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; - - #### Response (success) +# withdraw - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", - "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", - "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "total_amount": "10", - "spent_by_me": "10.0001925", - "received_by_me": "10", - "my_balance_change": "-0.0001925", - "block_height": 0, - "timestamp": 1566474670, - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 55000, - "gas_price": "0.0000000035", - "total_fee": "0.0001925" - }, - "coin": "ETH", - "internal_id": "" - }, - "id": 0 - } - ``` +The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. - #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) +This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). - ```json - { - "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", - "error_path": "eth", - "error_trace": "eth:535]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'EthGas' fee type, found UtxoFixed", - "id": 0 - } - ``` - +## Arguments -#### Withdraw maximum +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | + +### Response + +| Structure | Type | Description | +| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | +| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | +| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | +| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | +| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | +| total\_amount | string (numeric) | the total amount of coins transferred | +| fee\_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | +| tx\_hash | string | the hash of the generated transaction | +| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | +| coin | string | the name of the coin the user wants to withdraw | +| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | +| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | +| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | + +### ⚠ Error types + +#### NotSufficientBalance + +The `available` balance is not sufficient to transfer the specified amount. + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | +| available | string (numeric) | the balance available for transfer | +| required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient | + +#### ZeroBalanceToWithdrawMax + +The available balance is zero. + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### AmountTooLow + +The specified amount is too low. Required at least `threshold`. + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------- | +| amount | string (numeric) | the amount the user was willing to transfer | +| threshold | string (numeric) | the `amount` has not to be less than the `threshold` | + +#### InvalidAddress + +The specified `to` address is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### InvalidFeePolicy + +The specified `fee` is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### NoSuchCoin + +The specified coin was not found or is not activated yet. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------- | +| coin | string | the not found `coin` specified in the Request | + +#### Transport + +The request was failed due to a network error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| (none) | string | the transport error description | + +#### InternalError + +The request was failed due to an AtomicDEX API internal error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------ | +| (none) | string | the internal error description | + +### 📌 Examples + +#### Withdraw BTC, KMD, and other BTC-based forks ```json { - "mmrpc": "2.0", "userpass": "testpsw", + "mmrpc": "2.0", "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "max": true + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" }, "id": 0 } @@ -17312,86 +16308,55 @@ The request was failed due to an AtomicDEX API internal error. - ##### Response (success) + #### Response (KMD success) ```json { "mmrpc": "2.0", "result": { "block_height": 0, - "coin": "ETH", + "coin": "KMD", "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" + "type": "Utxo", + "amount": "0.00001" }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" - }, - "id": 0 - } - ``` - - -##### Withdraw QRC20 coins - - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10 + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } }, "id": 0 } ``` - - - ##### Response (success) + #### Response (NotSufficientBalance error) ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" }, "id": 0 } ``` -##### Withdraw QRC20 coins with gas limit +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee ```json @@ -17400,13 +16365,12 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10, + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", "fee": { - "type": "Qrc20Gas", - "gas_limit": 250000, - "gas_price": 40 + "type": "UtxoFixed", + "amount": "0.1" } }, "id": 0 @@ -17415,36 +16379,35 @@ The request was failed due to an AtomicDEX API internal error. + #### Response (success) + ```json { "mmrpc": "2.0", "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, + "timestamp": 1566472936, "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 250000, - "gas_price": 40, - "total_gas_fee": "0.1" + "type": "Utxo", + "amount": "0.1" }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "coin": "DOC", + "internal_id": "" }, "id": 0 } ``` -##### Withdraw Tendermint coins with a memo and custom gas fee +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee ```json @@ -17453,14 +16416,12 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "IRIS", - "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", - "amount": 13, - "memo": "It was a bright cold day in April, and the clocks were striking thirteen.", + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", "fee": { - "type": "CosmosGas", - "gas_price": 0.05, - "gas_limit": 150000 + "type": "UtxoPerKbyte", + "amount": "1" } }, "id": 0 @@ -17469,116 +16430,48 @@ The request was failed due to an AtomicDEX API internal error. + #### Response (success) + ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", - "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "13.038553", - "spent_by_me": "13.038553", - "received_by_me": "13", - "my_balance_change": "-0.038553", + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", "block_height": 0, - "timestamp": 0, + "timestamp": 1566473421, "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 + "type": "Utxo", + "amount": "0.38378905" }, - "coin": "IRIS", - "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", - "transaction_type": "StandardTransfer", - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + "coin": "DOC", + "internal_id": "" }, "id": 0 } ``` - - You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) -### Error Responses - -#### InvalidRequest: Unknown fee type - -```json -{ - "mmrpc": "2.0", - "error": "Error parsing request: unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", - "id": 0 -} -``` - -#### InvalidRequest: wrong parameter type - -```json -{ - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string \"0.1\", expected f64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string \"0.1\", expected f64", - "id": 0 -} -``` - -#### InvalidFeePolicy: attempt to use EthGas for UTXO coin - -```json -{ - "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "error_path": "utxo_common", - "error_trace": "utxo_common:1371]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "id": 0 -} -``` -export const title = "AtomicDEX Method: Get Current MTP"; -export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; - -# get\_current\_mtp - -The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. - -## Arguments - -| Parameter | Type | Description | -| --------- | ------- | --------------------------------------------------------------------------------------- | -| coin | string | A compatible (UTXO) coin's ticker | -| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | - -#### Response - -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | -| mtp | integer | Unix timestamp | -| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | - -#### 📌 Examples - -#### Command +#### Withdraw ETH, ERC20, and other ETH-based forks - + ```json { - "method": "get_current_mtp", - "userpass": "testpsw", "mmrpc": "2.0", - "id": 42, + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 } ``` @@ -17590,49 +16483,48 @@ The `get_current_mtp` method returns the Median Time Past (MTP) from electrum se { "mmrpc": "2.0", "result": { - "mtp": 1658746383 - }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Get Locked Amount"; -export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - -# get\_locked\_amount - -The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. - -## Arguments - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | - -#### Response - -| Parameter | Type | Description | -| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | - -#### 📌 Examples + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + -#### Command +#### ETH/ERC20 and other ETH-based forks, with gas fee - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_locked_amount", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } }, - "id": 42 + "id": 0 } ``` @@ -17644,985 +16536,858 @@ The `get_locked_amount` method returns the amount of a coin which is currently l { "mmrpc": "2.0", "result": { - "coin": "DOC", - "locked_amount": { - "decimal": "0.77803", - "rational": [ - [1, [77803]], - [1, [100000]] - ], - "fraction": { - "numer": "77803", - "denom": "100000" - } - } + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", + "block_height": 0, + "timestamp": 1566474670, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" + }, + "coin": "ETH", + "internal_id": "" }, - "id": 42 + "id": 0 } ``` - #### Response (error) + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) ```json { "mmrpc": "2.0", - "error": "No such coin: TIME", - "error_path": "lp_swap.lp_coins", - "error_trace": "lp_swap:486] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": 42 + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", + "id": 0 } ``` -export const title = "AtomicDEX: HD Address Management"; -export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; - -# Heirarchical Deterministic Address Management - -A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. - -## can\_get\_new\_address - -To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. - -#### Arguments - -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | -#### Response - -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.allowed | boolean | Whether or not you can get a new address. | -| result.reason | string | The reason you cant get a new address (if allowed is `false`). | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | - -Other reasons you might not be able to get a new address are: - -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) - -#### 📌 Examples - -#### Command +#### Withdraw maximum - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "can_get_new_address", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true + }, + "id": 0 } ``` - #### Response (success, allowed) + ##### Response (success) ```json { "mmrpc": "2.0", "result": { - "allowed": true + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, - "id": null + "id": 0 } ``` + - #### Response (success, not allowed) +##### Withdraw QRC20 coins + ```json { "mmrpc": "2.0", - "result": { - "allowed": false, - "reason": "LastAddressNotUsed", - "details": { - "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" - } + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 }, - "id": null + "id": 0 } ``` - - -## get\_new\_address - -If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. - -#### Arguments - -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | - -#### Response - -| Parameter | Type | Description | -| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.new\_address | object | Contains details about your new address. | -| result.address | string | The new address that was generated. | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | -| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | -| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| result.details.balance | object | Contains the spendable and unspendable balance for this address | -| result.details.balance.spendable | string(numeric) | Spendable balance for this address | -| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | - -Other reasons you might not be able to get a new address are: + -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + + ##### Response (success) -#### 📌 Examples + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + -#### Command +##### Withdraw QRC20 coins with gas limit - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_new_address", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, + "fee": { + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 + } + }, + "id": 0 } ``` - #### Response (success) - ```json { "mmrpc": "2.0", "result": { - "allowed": true + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, - "id": null + "id": 0 } ``` + - #### Response (success, not allowed) +##### Withdraw Tendermint coins with a memo and custom gas fee + ```json { "mmrpc": "2.0", - "result": { - "new_address": { - "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", - "derivation_path": "m/44'/141'/0'/0/3", - "chain": "External", - "balance": { - "spendable": "0", - "unspendable": "0" - } + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen.", + "fee": { + "type": "CosmosGas", + "gas_price": 0.05, + "gas_limit": 150000 } }, - "id": null + "id": 0 } ``` - -export const title = "AtomicDEX: HD Wallets Overview"; -export const description = - "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; - -# HD Wallets Overview - -The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! - -For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. - -To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. - -## Initialisation and authentication: - -* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) -* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) -* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) -* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) - -## UTXO Coin Activation in Hardware Mode: - -* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. -* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) -* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) - -## QTUM Coin Activation in Hardware Mode: - -* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. -* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) -* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) - -## Withdrawing your Funds: - -* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) -* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) -* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) - -## Viewing Hardware Wallet Coin Balances: - -* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) -* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) - -## Creating New Addresses: - -* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. -* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address - - - These methods (and others with a `task::` prefix) will be linked to a numeric - `task_id` value which is used to query the status or outcome of the task. - - -## Details for HwError error type - -When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). - -### FoundUnexpectedDevice - -The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter - -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found unexpected device. Please re-initialize Hardware wallet", - "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", - "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", - "error_type": "HwError", - "error_data": "FoundUnexpectedDevice" - } - }, - "id": null -} -``` - -### FoundMultipleDevices + -Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", + "block_height": 0, + "timestamp": 0, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + }, + "id": 0 + } + ``` -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found multiple devices. Please unplug unused devices", - "error_path": "init_hw.crypto_ctx.hw_client", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", - "error_type": "HwError", - "error_data": "FoundMultipleDevices" - } - }, - "id": null -} -``` + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) + -### NoTrezorDeviceAvailable +### Error Responses -No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. +#### InvalidRequest: Unknown fee type ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "No Trezor device available", - "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", - "error_type": "HwError", - "error_data": "NoTrezorDeviceAvailable" - } - }, - "id": null -} -``` -export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; -export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; - -# AtomicDEX API RPC Protocol v2.0 (Dev) - -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. - -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. - -## Request - -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | - -### Response (Success) - -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| result | object | the value of this field is determined by the method invoked on AtomicDEX API | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### Response (Error) - -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### 📌 Examples - -#### Command - - - ```json - { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" - }, + "error": "Error parsing request: unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", "id": 0 - } - ``` - +} +``` -#### Response (success) +#### InvalidRequest: wrong parameter type ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string \"0.1\", expected f64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string \"0.1\", expected f64", + "id": 0 } ``` -#### Response (error) +#### InvalidFeePolicy: attempt to use EthGas for UTXO coin ```json { "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", "id": 0 } ``` -export const title = "AtomicDEX: Lightning Network Initialization Tasks"; -export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; -# Lightning Network Initialization Tasks +# get\_current\_mtp - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. -## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} +## Arguments -The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. - +#### Response -### Request Parameters +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | +#### 📌 Examples -#### 📌 Example +#### Command - + ```json { - "method": "task::enable_lightning::init", + "method": "get_current_mtp", "userpass": "testpsw", "mmrpc": "2.0", + "id": 42, "params": { - "ticker": "tBTC-lightning", - "activation_params": { - "name": "AtomicDEX-Docs-Node-1", - "listening_port": 9735, - "color": "000000", - "payment_retries": 5 - } - }, - "id": 2 + "coin": "DOC" + } } ``` - ### Response Parameters - - | Parameter | Type | Description | - | --------- | ------- | --------------------------------------------------------- | - | task\_id | integer | An identifying number which is used to query task status. | - - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "task_id": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "mtp": 1658746383 + }, + "id": 42 } ``` +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - - #### L2ConfigIsNotFound Error - - Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. - - ```json - { - "mmrpc": "2.0", - "error": "Layer 2 tBTC-lightning config is not found", - "error_path": "init_l2.prelude", - "error_trace": "init_l2:82] prelude:82]", - "error_type": "L2ConfigIsNotFound", - "error_data": "tBTC-lightning", - "id": 2 - } - ``` - - #### InvalidRequest Error +# get\_locked\_amount - A parameter is incorrect. +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string "9735", expected u16", - "error_path": "dispatcher", - "error_trace": "dispatcher:110]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string "9735", expected u16", - "id": 762 - } - ``` +## Arguments - #### UnexpectedL2Protocol Error +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | - Coin is wrong protocol type. +#### Response - ```json - { - "mmrpc": "2.0", - "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", - "error_path": "init_l2.prelude.lightning_activation", - "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", - "error_type": "UnexpectedL2Protocol", - "error_data": { - "ticker": "tBTC-segwit", - "protocol": { - "type": "UTXO" - } - }, - "id": 2 - } - ``` +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | - #### Internal Error +#### 📌 Examples - Address already in use. +#### Command + ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "I/O error Address already in use (os error 48)", - "error_path": "lib.lightning_activation.ln_p2p", - "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", - "error_type": "Internal", - "error_data": "I/O error Address already in use (os error 48)" - } - }, - "id": null + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 } ``` + - #### PlatformCoinIsNotActivated Error - - The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + + #### Response (success) ```json { - "mmrpc": "2.0", - "error": "Platform coin tBTC-lightning is not activated", - "error_path": "init_l2.lp_coins", - "error_trace": "init_l2:87] lp_coins:3087]", - "error_type": "PlatformCoinIsNotActivated", - "error_data": "tBTC-lightning", - "id": 2 + "mmrpc": "2.0", + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } + }, + "id": 42 } ``` - - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) - Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. - - - #### InvalidPlatformConfiguration Error - - Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + #### Response (error) ```json { - "mmrpc": "2.0", - "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", - "error_path": "init_l2.lightning_activation", - "error_trace": "init_l2:95] lightning_activation:254]", - "error_type": "InvalidPlatformConfiguration", - "error_data": { - "platform_coin_ticker": "tBTC-segwit", - "err": "'avg_blocktime' field is not found in platform coin config" - }, - "id": 2 + "mmrpc": "2.0", + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": 42 } ``` +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; -## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} +# Heirarchical Deterministic Address Management -The `task::enable_lightning::status` request checks the status of lightning node initialization. +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. -### Request Parameters +## can\_get\_new\_address -| Parameter | Type | Description | -| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | -| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. -#### 📌 Example +#### Arguments - +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::status", + "method": "can_get_new_address", "params": { - "task_id": 1, - "forget_if_finished": false - }, - "id": 2 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - ### Response Parameters - - | Parameter | Type | Description | - | -------------- | ------ | ---------------------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | - - - The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. - - - #### Response (ready, success) + #### Response (success, allowed) ```json { - "mmrpc": "2.0", - "result": { - "status": "Ok", - "details": { - "platform_coin": "BTC-segwit", - "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null } ``` - - In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. - Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. - For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). - - - #### Response (in progress state) + #### Response (success, not allowed) ```json { - "mmrpc": "2.0", - "result": { - "status": "InProgress", - "details": "ReadingNetworkGraphFromFile" - }, - "id": null + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null } ``` + - Possible in progress statuses: +## get\_new\_address - * ActivatingCoin - * GettingFeesFromRPC - * ReadingNetworkGraphFromFile - * InitializingChannelManager - * InitializingPeerManager - * ReadingScorerFromFile - * InitializingBackgroundProcessor - * ReadingChannelsAddressesFromFile - +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. -## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} +#### Arguments -The `task::enable_lightning::cancel` request cancels lightning node initialization. +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | -### Request Parameters +#### Response -| Parameter | Type | Description | -| --------- | ------- | -------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | -#### 📌 Example +Other reasons you might not be able to get a new address are: - +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::cancel", + "method": "get_new_address", "params": { - "task_id": 1 - }, - "id": 1 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": "success", - "id": null + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null } ``` - - - - #### TaskFinished Error - Task has already been completed. + #### Response (success, not allowed) ```json { - "mmrpc": "2.0", - "error": "Task is finished already", - "error_path": "init_l2.manager", - "error_trace": "init_l2:157] manager:104]", - "error_type": "TaskFinished", - "error_data": 3, - "id": null + "mmrpc": "2.0", + "result": { + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` -export const title = "AtomicDEX: Lightning Network Channels"; -export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; -# Lightning Network Channels +# HD Wallets Overview + +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! + +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. + +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. -## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} +## Details for HwError error type -The `lightning::channels::open_channel` method opens a new channel with a remote node. +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). -### Request Parameters +### FoundUnexpectedDevice -| Parameter | Type | Description | -| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to open a channel for. | -| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | -| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter -#### 📌 Example using an exact amount +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::open_channel", - "params": { - "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Exact", - "value": 0.004 - } - }, - "id": 22 - } - ``` - +### FoundMultipleDevices - - #### Response +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. - ```json - { - "mmrpc": "2.0", - "result": { - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" - }, - "id": 22 - } - ``` - +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` -#### 📌 Example using max available with channel options and configs +### NoTrezorDeviceAvailable - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::open_channel", - "params": { - "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Max" - }, - "push_msat": 0, - "channel_options": { - "proportional_fee_in_millionths_sats": 0, - "base_fee_msat": 1000, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 - }, - "channel_configs": { - "counterparty_locktime": 144, - "our_htlc_minimum_msat": 1, - "negotiate_scid_privacy": false, - "max_inbound_in_flight_htlc_percent": 10, - "commit_upfront_shutdown_pubkey": true, - "inbound_channels_confirmations": 3, - "their_channel_reserve_sats": 10000 - } - }, - "id": null - } - ``` - +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. - - #### Response +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; - ```json - { - "mmrpc": "2.0", - "result": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" - }, - "id": null - } - ``` - +# AtomicDEX API RPC Protocol v2.0 (Dev) -## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. -The `lightning::channels::close_channel` method closes a channel with a remote node. +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. -### Request Parameters +## Request -| Parameter | Type | Description | -| ------------ | ------- | ---------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to close a channel for. | -| uuid | string | Unique channel identifier. | -| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | - - It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. - Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. - +### Response (Success) -#### 📌 Example to force closing a channel +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - +### Response (Error) + +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### 📌 Examples + +#### Command + + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::close_channel", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "force_close": true + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" }, - "id": 8 + "id": 0 } ``` - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 - } - ``` +#### Response (success) - - To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. - +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` - - Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) - - +#### Response (error) - - #### InvalidRequest Error +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `uuid`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `uuid`", - "id": 8 - } - ``` +# Lightning Network Initialization Tasks - #### NoSuchChannel Error + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + - ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "error_path": "close_channel", - "error_trace": "close_channel:55]", - "error_type": "NoSuchChannel", - "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 - } - ``` - +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} -## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. -The `lightning::channels::update_channel` method updates channel options. + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + ### Request Parameters -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { + "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::update_channel", "params": { - "coin": "tBTC-lightning", - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 } }, "id": 2 @@ -18631,246 +17396,255 @@ The `lightning::channels::update_channel` method updates channel options. + ### Response Parameters + + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | + #### Response ```json { - "mmrpc": "2.0", - "result": { - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_sats": null - } - }, - "id": 2 + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null } ``` - #### NoSuchChannel Error + #### L2ConfigIsNotFound Error - Channel with the given uuid is not foun on the lightning network. + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. ```json { "mmrpc": "2.0", - "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", - "error_path": "update_channel", - "error_trace": "update_channel:61]", - "error_type": "NoSuchChannel", - "error_data": "dc33b998-8589-44fd-a246-256a582e8942", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", "id": 2 } ``` - - -## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} -The `lightning::channels::get_channel_details` method returns details about a channel. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------ | -| coin | string | The ticker of the coin you would like to view channel details for. | -| uuid | string | Unique channel identifier. | + #### InvalidRequest Error -#### 📌 Example to update all available channel options + A parameter is incorrect. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::get_channel_details", - "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" - }, - "id": 54 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 } ``` - - - - The response will vary depending on whether the channel status is `open` or `closed`. - + #### UnexpectedL2Protocol Error - #### Response (opened channel) + Coin is wrong protocol type. ```json { "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 959722, - "is_outbound": true, - "balance_msat": 959722000, - "outbound_capacity_msat": 950125000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": 3, - "is_ready": false, - "is_usable": false, - "is_public": false + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" } }, - "id": 54 + "id": 2 } ``` - - `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. - It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) - + #### Internal Error - #### Response (closed channel) + Address already in use. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null + } + ``` + + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. ```json { "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_value": "98982", - "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", - "closure_reason": "null", - "claiming_tx": "null", - "claimed_balance": "null", - "funding_generated_in_block": "null", - "is_outbound": false, - "is_public": true, - "is_closed": true, - "created_at": 167273496966, - "closed_at": 171069595935 - } - }, - "id": 54 + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 } ``` - The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. - - - #### InvalidRequest Error + #### InvalidPlatformConfiguration Error + + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. ```json { "mmrpc": "2.0", - "error": "Error parsing request: missing field `coin`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `coin`", - "id": 54 + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 } ``` -## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} -The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. +The `task::enable_lightning::status` request checks the status of lightning node initialization. ### Request Parameters -| Parameter | Type | Description | -| --------------------------------- | ------- | ------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view claimable balances for. | -| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::get_claimable_balances", + "method": "task::enable_lightning::status", "params": { - "coin": "tBTC-lightning", - "include_open_channels_balances": true + "task_id": 1, + "forget_if_finished": false }, - "id": 762 + "id": 2 } ``` - #### Response + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) ```json { - "mmrpc": "2.0", - "result": [{ - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 0 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 38815 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 959539 - } - }], - "id": 762 + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` - - This response may include additional information in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) - + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null + } + ``` + + Possible in progress statuses: + + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile -## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} -The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. +The `task::enable_lightning::cancel` request cancels lightning node initialization. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - -#### 📌 Example without using `filter` parameter +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "task::enable_lightning::cancel", "params": { - "coin": "tBTC-lightning" + "task_id": 1 }, - "id": 55 + "id": 1 } ``` @@ -18880,113 +17654,71 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of ```json { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": null, - "funding_tx_output_index": null, - "funding_tx_value_sats": 4000, - "is_outbound": true, - "balance_msat": 4000000, - "outbound_capacity_msat": 4000000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": null, - "is_ready": false, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 + "mmrpc": "2.0", + "result": "success", + "id": null } ``` -#### 📌 Example with `filter` for inbound channels only + + #### TaskFinished Error -#### Command + Task has already been completed. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "is_outbound": false - } - }, - "id": 55 + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null } ``` - + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; - - #### Response +# Lightning Network Channels - ```json - { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 - } - ``` - + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -#### 📌 Example with `filter` for a specific `node_id` +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} -#### Command +The `lightning::channels::open_channel` method opens a new channel with a remote node. - +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + +#### 📌 Example using an exact amount + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::channels::open_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 } }, - "id": 55 + "id": 22 } ``` @@ -18998,54 +17730,47 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" }, - "id": 55 + "id": 22 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - -#### Command +#### 📌 Example using max available with channel options and configs - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::channels::open_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 1000, - "to_funding_value_sats": 500000 + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 } }, - "id": 55 + "id": null } ``` @@ -19057,79 +17782,45 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }, { - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 2, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, - "id": 55 + "id": null } ``` -## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} -The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. +The `lightning::channels::close_channel` method closes a channel with a remote node. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | -#### 📌 Example without using `filter` parameter + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + -#### Command +#### 📌 Example to force closing a channel - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::channels::close_channel", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true }, - "id": 55 + "id": 8 } ``` @@ -19137,163 +17828,86 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response - ```json - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }, - { - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only - -#### Command - - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "channel_type": "Inbound" - } - }, - "id": 55 + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 } ``` - - - - #### Response - ```json + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": false, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + -#### 📌 Example with `filter` for a specific `node_id` - -#### Command + + #### InvalidRequest Error - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - } - }, - "id": 55 + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 } ``` - - - - #### Response - ```json + #### NoSuchChannel Error - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} -#### Command +The `lightning::channels::update_channel` method updates channel options. - +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | + +#### 📌 Example to update all available channel options + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::channels::update_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 100000, - "to_funding_value_sats": 500000 + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 } }, - "id": 55 + "id": 2 } ``` @@ -19305,313 +17919,356 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list { "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", - "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", - "funding_value": 40000, - "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", - "closure_reason": "Channel closed because the channel was cooperatively closed", - "funding_generated_in_block": 2433122, - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1684083341, - "closed_at": 1684146940 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null } }, - "id": 762 + "id": 2 } ``` -export const title = "AtomicDEX: Lightning Network Methods"; -export const description = - "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - -import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - -# Lightning Network Methods - - - Lightning methods are currently only available using the native AtomicDEX-API. - WASM support should be available in late 2023. - - -## Lightning Network Initialization Tasks - -* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) -* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value - which is used to query the status or outcome of the task. - - -## Lightning Network Nodes Methods - -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) -* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) -* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - -## Lightning Network Channels Methods - -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) -* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) -* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) -* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) -* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) -* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - -## Lightning Network Payments Methods - -* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) -* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -## Lightning Network Flowchart - -Once you: - -* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) - -You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! - -Then you can: - -* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -Follow the flowchart below to visualize the process: - - - -## Lightning Network Coins File Configuration - - Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) - param must be set in the `coins` configuration file, and aplies to all - channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and - [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters - are set per channel. These can be defined in the `coins` configuration file to - act as the default for all opened channels, and optionally overwritten or - updated using the - [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or - [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) - methods. - - -### Lightning Coin Config Parameters - -| Parameter | Type | Description | -| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | -| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | -| decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | -| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | -| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + #### NoSuchChannel Error - - For GUIs and wallet apps, it is recommended to set - `accept_forwards_to_priv_channels` to `false`. This prevents users from taking - on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) - should also be set to `false` for GUIs and wallet apps. - + Channel with the given uuid is not foun on the lightning network. - ```json - { - "coin": "BTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_config": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3, - "force_announced_channel_preference": false - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "BTC-segwit", - "network": "mainnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, - { - "coin": "tBTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_configs": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90, - "their_channel_reserve_sats": 10000 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3 - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "tBTC-segwit", - "network": "testnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, + { + "mmrpc": "2.0", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", + "id": 2 + } ``` -export const title = "AtomicDEX: Lightning Network Nodes"; -export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; - -# Lightning Network Nodes - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - -## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} -The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. +The `lightning::channels::get_channel_details` method returns details about a channel. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ----------------------------------------------------------------------------------- | -| coin | string | The coin ticker you would like to connect to a node on. | -| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::connect_to_node", + "method": "lightning::channels::get_channel_details", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" }, - "id": 1 + "id": 54 } ``` - - The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. - Other node addresses can be retrieved from any lightning explorer, such as: - - * [https://1ml.com/](https://1ml.com/) - * [https://mempool.space/lightning/](https://mempool.space/lightning/) - - - #### Response (success) + + The response will vary depending on whether the channel status is `open` or `closed`. + + + #### Response (opened channel) ```json { - "mmrpc": "2.0", - "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 } ``` - #### Response (already connected) + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + + + #### Response (closed channel) ```json { - "mmrpc": "2.0", - "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 } ``` + + + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + - #### InvalidRequest Error (Invalid node\_address) + #### InvalidRequest Error ```json { "mmrpc": "2.0", - "error": "Error parsing request: Could not parse node address from str rgjhk3", + "error": "Error parsing request: missing field `coin`", "error_path": "dispatcher", "error_trace": "dispatcher:109]", "error_type": "InvalidRequest", - "error_data": "Could not parse node address from str rgjhk3", + "error_data": "missing field `coin`", + "id": 54 + } + ``` + + +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} + +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. + +### Request Parameters + +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | + +#### 📌 Example to update all available channel options + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_claimable_balances", + "params": { + "coin": "tBTC-lightning", + "include_open_channels_balances": true + }, + "id": 762 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], "id": 762 } ``` - #### ConnectionError Error (Timed out waiting to connect to node\_address) + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + + + +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} + +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without using `filter` parameter + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning" + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 + } + ``` + + + + #### Response ```json { - "mmrpc": "2.0", - "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "error_path": "connect_to_node", - "error_trace": "connect_to_node:78]", - "error_type": "ConnectionError", - "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "id": null + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 } ``` -## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - -The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to view your trusted nodes to. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::list_trusted_nodes", + "method": "lightning::channels::list_open_channels_by_filter", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" + } }, - "id": 1 + "id": 55 } ``` @@ -19623,37 +18280,54 @@ The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes i { "mmrpc": "2.0", "result": { - "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 1 + "id": 55 } ``` -## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - -The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------------------------- | -| coin | string | The coin ticker you would like to add a trusted node for. | -| node\_id | string | ID of node you would like to add to your trusted list. | +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value -#### 📌 Example +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::add_trusted_node", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 + } }, - "id": 1 + "id": 55 } ``` @@ -19665,37 +18339,79 @@ The `lightning::nodes::add_trusted_node` method allows you to add a node to your { "mmrpc": "2.0", "result": { - "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 1 + "id": 55 } ``` -## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} -The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to remove a trusted node from. | -| node\_id | string | ID of node you would like to remove from your trusted list. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without using `filter` parameter - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::remove_trusted_node", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "coin": "tBTC-lightning" }, - "id": 1 + "id": 55 } ``` @@ -19704,52 +18420,59 @@ The `lightning::nodes::remove_trusted_node` method allows you to remove a node f #### Response ```json - { - "mmrpc": "2.0", + {"mmrpc": "2.0", "result": { - "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -export const title = "AtomicDEX: Lightning Network Payments"; -export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - -# Lightning Network Payments - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - -## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} - -The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of coin to generate invoice for. | -| description | string | A note to indicate the purpose of the invoice. | -| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | -| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | +#### 📌 Example with `filter` for inbound channels only -#### 📌 Example +#### Command - + ```json { - "method": "lightning::payments::generate_invoice", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "expiry": 600 + "filter": { + "channel_type": "Inbound" + } }, - "id": 1 + "id": 55 } ``` @@ -19758,62 +18481,49 @@ The `lightning::payments::generate_invoice` method generates an invoice to be pa #### Response ```json - { - "mmrpc": "2.0", - "result": { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" - }, - "id": 1 - } - ``` - - - - ### InvalidRequest (invalid paramater value) - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string '56', expected u64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string '56', expected u64", - "id": 762 + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} - -The `lightning::payments::send_payment` method sends a payment to another node. - -Used to pay an invoice or send a payment via pubkey/address. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example using `invoice` +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "payment": { - "type": "invoice", - "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" } }, - "id": 6 + "id": 55 } ``` @@ -19822,34 +18532,50 @@ Used to pay an invoice or send a payment via pubkey/address. #### Response ```json - { - "mmrpc": "2.0", + + {"mmrpc": "2.0", "result": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" - }, - "id": 762 + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -#### 📌 Example using `keysend` +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "payment": { - "type": "keysend", - "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "amount_in_msat": 1000, - "expiry": 24 + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 } }, - "id": 6 + "id": 55 } ``` @@ -19861,350 +18587,311 @@ Used to pay an invoice or send a payment via pubkey/address. { "mmrpc": "2.0", "result": { - "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 762 } ``` +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - - ### PaymentError (attempt to pay self) +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:231]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "id": 6 - } - ``` +# Lightning Network Methods - ### PaymentError (no outbound routes) + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "id": 762 - } - ``` +## Lightning Network Initialization Tasks - ### PaymentError (keysend - no path to destination) +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:107] lightning:256]", - "error_type": "PaymentError", - "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "id": 762 - } - ``` + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + - ### PaymentError (invoice - no path to destination) +## Lightning Network Nodes Methods - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "id": 762 - } - ``` +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - ### InvalidRequest (request is missing a required field) +## Lightning Network Channels Methods - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `payment`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `payment`", - "id": 762 - } - ``` +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - ### InvalidRequest (A required field is invalid) +## Lightning Network Payments Methods - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "ParseError(Bech32Error(MissingSeparator))", - "id": 762 - } - ``` - +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! -The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. +Then you can: -### Request Parameters +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to query. | -| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | +Follow the flowchart below to visualize the process: -#### 📌 Example + - - ```json - { - "method": "lightning::payments::get_payment_details", - "userpass": "testpsw", - "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" - }, - "id": 1 - } - ``` - +## Lightning Network Coins File Configuration - - ```json - { - "mmrpc": "2.0", - "result": { - "payment_details": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", - "payment_type": { - "type": "Outbound Payment", - "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" - }, - "description": "1 Blokaccino", - "amount_in_msat": 1000000, - "fee_paid_msat": 1803, - "status": "succeeded", - "created_at": 1684081413, - "last_updated": 1684081419 - } - }, - "id": 762 - } - ``` - + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + - - ### NoSuchPayment (payment hash not found) +### Lightning Coin Config Parameters - ```json - { - "mmrpc": "2.0", - "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", - "error_path": "get_payment_details", - "error_trace": "get_payment_details:75]", - "error_type": "NoSuchPayment", - "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", - "id": 762 - } - ``` +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | - ### InvalidRequest (payment\_hash not a hash string) + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid value: string '', expected a hash string", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid value: string '', expected a hash string", - "id": 762 - } + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, ``` +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +# Lightning Network Nodes -The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | -#### 📌 Example without filter +#### 📌 Example - + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::connect_to_node", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, "id": 1 } ``` - - #### Response + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: - ```json - { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683917593, - "last_updated": 1683917593 - }, { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", - "amount_in_msat": 88000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1683714225, - "last_updated": 1683805721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "ACME shrink ray", - "amount_in_msat": 4000012, - "status": "succeeded", - "created_at": 1683814625, - "last_updated": 1683815321 - }], - "limit": 10, - "skipped": 0, - "total": 6, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - -#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + #### Response (already connected) - ```json { - "method": "lightning::payments::list_payments_by_filter", - "userpass": "testpsw", - "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "filter": { - "payment_type": { - "type": "Inbound Payment" - } - }, - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - + + + + #### InvalidRequest Error (Invalid node\_address) - ```json { "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }, { - "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "14 pallets of frozen spinach", - "amount_in_msat": 56005000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }], - "limit": 2, - "skipped": 2, - "total": 7, - "total_pages": 4, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "error": "Error parsing request: Could not parse node address from str rgjhk3", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 + } + ``` + + #### ConnectionError Error (Timed out waiting to connect to node\_address) + + ```json + { + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null } ``` -#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "pending", - "from_amount_msat": 10000, - "to_amount_msat": 40000 - } + "coin": "tBTC-lightning" }, "id": 1 } @@ -20218,45 +18905,35 @@ The `lightning::payments::list_payments_by_filter` method returns a list of paym { "mmrpc": "2.0", "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] }, "id": 1 } ``` -#### 📌 Example for successful payments on the 20th of April 2023 +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "status": "succeeded", - "from_timestamp": 1681948800, - "to_timestamp": 1682035199 - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, "id": 1 } @@ -20270,539 +18947,319 @@ The `lightning::payments::list_payments_by_filter` method returns a list of paym { "mmrpc": "2.0", "result": { - "payments": [{ - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1681998480, - "last_updated": 1682008491 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, "id": 1 } ``` -export const title = "AtomicDEX Method: Max Maker Vol"; -export const description = - "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; - -# max\_maker\_vol - -The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. - -#### Arguments -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} -#### Response +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. -| Parameter | Type | Description | -| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | +### Request Parameters -#### 📌 Examples +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "max_maker_vol", + "method": "lightning::nodes::remove_trusted_node", "params": { - "coin": "DOC" - } + "coin": "tBTC-lightning", + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 } ``` - #### Response (success) + #### Response ```json { - "mmrpc": "2.0", - "result": { - "coin": "MARTY", - "volume": { - "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", - "rational": [ - [1, [962255003, 81]], - [1, [390588672, 18]] - ], - "fraction": { - "numer": "348854605979", - "denom": "77700000000" - } - }, - "balance": { - "decimal": "5.49110027", - "rational": [ - [1, [549110027]], - [1, [100000000]] - ], - "fraction": { - "numer": "549110027", - "denom": "100000000" - } - }, - "locked_by_swaps": { - "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", - "rational": [ - [1, [77802331]], - [1, [77700000]] - ], - "fraction": { - "numer": "77802331", - "denom": "77700000" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 } ``` + +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - #### Response (error) +# Lightning Network Payments + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} + +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. + +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | +#### 📌 Example + + ```json { + "method": "lightning::payments::generate_invoice", + "userpass": "testpsw", "mmrpc": "2.0", - "error": "No such coin TIME", - "error_path": "max_maker_vol_rpc.lp_coins", - "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" + "params": { + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 }, - "id": null + "id": 1 } ``` + - #### Response (balance too low) + + #### Response ```json { - "mmrpc": "2.0", - "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", - "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", - "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "QTUM", - "available": "0", - "required": "0.000728" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 } ``` + - #### Response (Transport error) + + ### InvalidRequest (invalid paramater value) ```json { - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 } ``` -export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; -export const description = - "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; -# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} -Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. +The `lightning::payments::send_payment` method sends a payment to another node. - - Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) - method to populate/refresh the local database. - +Used to pay an invoice or send a payment via pubkey/address. ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| --------- | --------------- | -------------------------------------------------------------------------------------- | -| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | -| total | string | The total number of NFTs in your wallet matching the request filters. | -| skipped | string | The number of NFTs in your wallet excluded by the request filters. | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | -#### 📌 Example with no optional params +#### 📌 Example using `invoice` - + ```json { "userpass": "testpsw", - "method": "get_nft_list", "mmrpc": "2.0", + "method": "lightning::payments::send_payment", "params": { - "chains": [ - "BSC", - "POLYGON" - ] - } + "coin": "tBTC-lightning", + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" + } + }, + "id": 6 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "BSC", - "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", - "token_id": "0", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "b34ddf294013d20a6d70691027625839", - "block_number_minted": 25465916, - "block_number": 25919780, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", - "token_domain": "tikimetadata.s3.amazonaws.com", - "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", - "last_token_uri_sync": "2023-02-07T17:10:08.402Z", - "last_metadata_sync": "2023-02-07T17:10:16.858Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_domain": "tikimetadata.s3.amazonaws.com", - "name": "Tiki box", - "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", - "attributes": [ - { - "trait_type": "Crypto Logo", - "value": "TIKI NFT CRYPTOLOGO SCAR" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "", - "external_domain": null, - "image_details": null - } - }, - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 0, - "total": 2 - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 } ``` -#### 📌 Example with optional limit & page\_number params +#### 📌 Example using `keysend` - + ```json { "userpass": "testpsw", - "method": "get_nft_list", "mmrpc": "2.0", + "method": "lightning::payments::send_payment", "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "limit": 1, - "page_number": 2 - } + "coin": "tBTC-lightning", + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 + } + }, + "id": 6 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 1, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" + }, + "id": 762 } ``` -#### 📌 Example with optional spam protection + + ### PaymentError (attempt to pay self) - ```json { - "userpass": "testpsw", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "protect_from_spam": true, - "filters": { - "exclude_spam": true, - "exclude_phishing": true - } - } + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 } ``` - - + ### PaymentError (no outbound routes) + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 0, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (keysend - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (invoice - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` + + ### InvalidRequest (request is missing a required field) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } + ``` + + ### InvalidRequest (A required field is invalid) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 } ``` -### 📌 Error responses - -#### Unsupported Chain Type - -The supported chains are - -``` -{ - "mmrpc":"2.0", - "error":"Error parsing request: UnsupportedChainType", - "error_path":"dispatcher", - "error_trace":"dispatcher:109]", - "error_type":"InvalidRequest", - "error_data":"UnsupportedChainType", - "id":null -} -``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} -# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | - -### Response Parameters - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | #### 📌 Example - + ```json { + "method": "lightning::payments::get_payment_details", "userpass": "testpsw", - "method": "get_nft_metadata", "mmrpc": "2.0", "params": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "chain": "BSC" - } + "coin": "tBTC-lightning", + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" + }, + "id": 1 } ``` @@ -20810,427 +19267,168 @@ export const description = ```json { - "mmrpc": "2.0", - "result": { - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "amount": "1", - "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", - "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", - "name": "OpenSea Collections", - "symbol": "OPENSTORE", - "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", - "token_domain": "api.opensea.io", - "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", - "last_token_uri_sync": "2023-09-01T04:04:30.867Z", - "last_metadata_sync": "2023-09-01T04:35:01.128Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": true, - "chain": "POLYGON", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "block_number_minted": 19645247, - "block_number": 45776404, - "contract_type": "ERC1155", - "possible_phishing": false, - "uri_meta": { - "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", - "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", - "image_domain": "i.seadn.io", - "name": "Doge Napoleon", - "description": null, - "attributes": null, - "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", - "animation_domain": "openseauserdata.com", - "external_url": null, - "external_domain": null, - "image_details": null - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 } ``` -## Error responses - -``` -{ - "mmrpc": "2.0", - "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", - "error_path": "nft", - "error_trace": "nft:123]", - "error_type": "TokenNotFoundInWallet", - "error_data": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" - }, - "id": null -} -``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; - -# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} - -Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. - - - To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - - -### Request Parameters - -| Parameter | Type | Description | -| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | -| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | -| total | string | The total number of NFT transfers in your wallet matching the request filters. | -| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | - -#### 📌 Example with date and `send` filters + + ### NoSuchPayment (payment hash not found) - ```json { - "userpass": "testpsw", - "method": "get_nft_transfers", - "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" - ], - "max": true, - "filters": { - "receive": true, - "from_date": 1678233600 - }, - "protect_from_spam": true - } + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 } ``` - - + ### InvalidRequest (payment\_hash not a hash string) + ```json { - "mmrpc": "2.0", - "result": { - "transfer_history": [ - { - "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", - "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", - "transaction_index": 87, - "log_index": 468, - "value": "0", - "transaction_type": "Single", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "amount": "2", - "verified": 1, - "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "possible_spam": false, - "chain": "POLYGON", - "token_id": "5", - "block_number": 44506464, - "block_timestamp": 1688107346, - "contract_type": "ERC1155", - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "collection_name": null, - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "token_name": "Forest Mushrooms", - "status": "Receive", - "possible_phishing": false, - "fee_details": { - "coin": "MATIC", - "gas": 40249, - "gas_price": "0.000000153160317706", - "total_fee": "0.006164549627348794" - }, - "confirmations": 5775855 - } - ], - "skipped": 0, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 } ``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; - -# Non Fungible Tokens (NFTs) -The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. - - - Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) - method to populate/refresh the local database. - - -## NFT Information Methods - -* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) -* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) -* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) -* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) -* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) - -## NFT Transaction Methods - -* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) -* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) - - - View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) - -export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; -export const description = - "This document describes how to query the local NFT database tables."; - -# Query NFT database tables - -After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, -the following tables are available in `DB/KOMODEFI.db`: - -* AVAX\_nft\_list -* AVAX\_nft\_transfer\_history -* BNB\_nft\_list -* BNB\_nft\_transfer\_history -* ETH\_nft\_list -* ETH\_nft\_transfer\_history -* FTM\_nft\_list -* FTM\_nft\_transfer\_history -* MATIC\_nft\_list -* MATIC\_nft\_transfer\_history -* scanned\_nft\_blocks - -## NFT List tables - -The COIN\_nft\_list tables contain the NFTs that you own -It has the following columns, though not all columns are populated for all NFTs: - -| ID | Name | Type | Description | -| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | -| 0 | token\_address | VARCHAR(256) | The address of the token contract. | -| 1 | token\_id | VARCHAR(256) | The id of the token. | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | -| 4 | block\_number | INTEGER | The block height of this transaction. | -| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | -| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | -| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | -| 8 | collection\_name | TEXT | The collection name which includes the token. | -| 9 | symbol | TEXT | An arbitrary symbol for the NFT | -| 10 | token\_uri | TEXT | A link to the token's metadata. | -| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | -| 12 | metadata | TEXT | The token's metadata in JSON format. | -| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | -| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | -| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | -| 16 | image\_url | TEXT | A link for the token's image (or other media). | -| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | -| 18 | token\_name | TEXT | The name of the token. | -| 19 | description | TEXT | An arbitrary description of the NFT. | -| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | -| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | -| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | -| 23 | external\_url | TEXT | Additional URL related to the NFT | -| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | -| 25 | image\_details | TEXT | Additional details about the NFT's image. | -| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | - -### Example COIN\_nft\_list table query - -> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; - -| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | -| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | -| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | -| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | -| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | -| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | -| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | - -The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. - -## NFT Transfer table - -The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: - -| ID | Name | Type | Description | -| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | -| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | -| 1 | log\_index | INTEGER | Simply a table index. | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 3 | block\_number | INTEGER | The block height of this transaction. | -| 4 | block\_timestamp | INTEGER | The block time of this transaction. | -| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | -| 6 | token\_address | VARCHAR(256) | The address of the token contract. | -| 7 | token\_id | VARCHAR(256) | The id of the token. | -| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | -| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | -| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | -| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | -| 12 | token\_uri | TEXT | A link to the token's metadata. | -| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | -| 14 | collection\_name | TEXT | The collection name which includes the token. | -| 15 | image\_url | TEXT | A link for the token's image (or other media). | -| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | -| 17 | token\_name | TEXT | The name of the token. | -| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | - -### Example scanned\_nft\_blocks table query - -`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` - -| transaction\_hash | token\_name | token\_address | token\_id | -| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | -| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | - -## NFT Last Scanned Block table - -The scanned\_nft\_blocks table contains the last block that was scanned for each chain. -It has the following columns: - -| ID | Name | Type | Description | -| -- | -------------------- | ------- | ---------------------------------------------------------------------- | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | - -### Example scanned\_nft\_blocks table query - -`SELECT * FROM scanned_nft_blocks;` - -| chain | last\_scanned\_block | -| ----- | -------------------- | -| MATIC | 50651981 | -| FTM | 66512090 | -| ETH | 0 | -| BNB | 0 | -| AVAX | 0 | -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; - -# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} -This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | Chains which holds the NFT you would like to updated metadata for. | -| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | - - - If there are no errors, this request will return an empty response. - +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without filter - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "chain": "POLYGON", - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } + "coin": "tBTC-lightning" + }, + "id": 1 } ``` - - If there are no errors, this request will return an empty response. - + #### Response ```json { "mmrpc": "2.0", - "result": null, - "id": null + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` - - Need to add some error responses here. - -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; - -# Update NFT {{label : 'update_nft', tag : 'API-v2'}} - -This method will scan selected networks to update NFT information stored in the local database. -To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. - -See below for which coin to activate for each network: - -| Network | Coin | -| --------- | ----- | -| AVALANCHE | AVAX | -| BSC | BNB | -| ETH | ETH | -| FANTOM | FTM | -| POLYGON | MATIC | - -These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. - -### Request Parameters - -| Parameter | Type | Description | -| ------------- | ------ | --------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | - - - If there are no errors, this request will return an empty response. - When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. - - -#### 📌 Example +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "update_nft", "mmrpc": "2.0", "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` @@ -21239,313 +19437,278 @@ These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/ap ```json { "mmrpc": "2.0", - "result": null, - "id": null + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` - - Need to add some error responses here. - -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; - -# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} - - - To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. - - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | ---------------------------------------------------------------------------------------- | -| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | -| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens to withdraw. | -| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | -| tx\_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | -| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction\_type | string | This will always be `NftTransfer`. | - -#### 📌 ERC721 Withdraw Example +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "POLYGON", - "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1" + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 } - } + }, + "id": 1 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", - "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "contract_type": "ERC721", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 35218, - "gas_price": "0.000000040827827163", - "total_fee": "0.001437874417026534" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732198, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` -#### 📌 ERC1155 Withdraw Example - -If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. +#### 📌 Example for successful payments on the 20th of April 2023 - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1" + "coin": "tBTC-lightning", + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 } - } + }, + "id": 1 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", - "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0x27Ad1F808c1ef82626277Ae38998AfA539565660" - ], - "contract_type": "ERC721", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 62368, - "gas_price": "0.000000012347931462", - "total_fee": "0.000770115789422016" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732805, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; + +# max\_maker\_vol + +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. + +#### Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response -#### 📌 ERC1155 Withdraw Max Example +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples -If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. +#### Command - + ```json { "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", + "method": "max_maker_vol", "params": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "max": true - } + "coin": "DOC" } } ``` + #### Response (success) + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", - "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0x27Ad1F808c1ef82626277Ae38998AfA539565660" - ], - "contract_type": "ERC1155", - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "7", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 59963, - "gas_price": "0.00000003794123733", - "total_fee": "0.00227507041401879" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732937, - "internal_id": 0, - "transaction_type": "NftTransfer" + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } }, - "id": null - } - ``` - - - - ### 📌 Withdraw NFTs Error Responses - - #### InvalidRequest (missing field) - - ``` - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `type`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `type`", - "id": null - } - ``` - - #### InvalidRequest (wrong withdraw type) - - ``` - { - "mmrpc": "2.0", - "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", - "id": null + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null } ``` - #### TokenNotFoundInWallet (trying to send NFT you dont own) + #### Response (error) - ``` + ```json { - "mmrpc": "2.0", - "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", - "error_path": "eth.nft", - "error_trace": "eth:883] nft:1177]", - "error_type": "GetNftInfoError", - "error_data": { - "error_type": "TokenNotFoundInWallet", - "error_data": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" - } - }, - "id": null + "mmrpc": "2.0", + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": null } ``` - #### TransportError (unable to estimate gas) + #### Response (balance too low) - ``` + ```json { - "mmrpc": "2.0", - "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", - "error_path": "eth", - "error_trace": "eth:1004] eth:5792]", - "error_type": "Transport", - "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", - "id": null + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null } ``` - #### NotEnoughNftsAmount (trying to send more NFTs than you have) + #### Response (Transport error) - ``` + ```json { - "mmrpc": "2.0", - "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", - "error_path": "eth", - "error_trace": "eth:897]", - "error_type": "NotEnoughNftsAmount", - "error_data": { - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "available": "1", - "required": "2" - }, - "id": null + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 } ``` - - - View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) - export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; diff --git a/data-for-gpts/komodefi-api/all-api-content.txt b/data-for-gpts/komodefi-api/all-api-content.txt index abea6b22..9cc6e1fd 100644 --- a/data-for-gpts/komodefi-api/all-api-content.txt +++ b/data-for-gpts/komodefi-api/all-api-content.txt @@ -694,7 +694,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi ### TokensRequest -The `TokensRequest` object includes the following items for a given token: +The `TokensRequest` object includes the following items for a given coin or token: | Parameter | Type | Description | | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | @@ -709,74 +709,6 @@ The `TokensRequest` object includes the following items for a given token: } ``` - -### NftInfo - -The `NftInfo` object includes the following items for a given token: - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | - -### NftTransfer - -The `NftTransfer` object includes the following items for each token transaction: - -| Parameter | Type | Description | -| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens transferred. | -| block\_hash | string | May be `null`. Hash of block in which transfer occurred. | -| block\_number | integer | Height of block in which transfer occurred. | -| block\_timestamp | integer | Block time in [unix epoch format](https://www.epochconverter.com/). | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| token\_uri | string | May be `null`. The URI to the metadata of the token. | -| token\_domain | string | May be `null`. Extracted domain from the `token_uri`, if valid. | -| collection\_name | string | May be `null`. Name of collection which token belongs to. | -| image\_url | string | May be `null`. The URI to the token image. | -| image\_domain | string | May be `null`. Extracted domain from the `image_url`, if valid. | -| token\_name | string | May be `null`. Name of the token. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Address of token transferred. | -| token\_id | string | Token ID. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| transaction\_hash | string | Transaction ID of the transfer. | -| transaction\_index | string | May be `null`. Transaction index of the transfer. | -| log\_index | string | Log index of the transfer. | -| value | string | May be `null`. Tranfer value. | -| transaction\_type | string | May be `null`. Transaction type. Possible values are `Single`. | -| from\_address | string | Address of previous owner which sent the token(s). | -| to\_address | string | Address of new owner which received the token(s). | -| status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | -| verified | integer | May be `null`. A deprecated field which will be removed in future. | -| operator | string | May be `null`. | -| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | - - - `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. - What are the other possible values for `transaction_type`? - What is `operator`? - What does `verified` mean? - export const title = "Komodo DeFi SDK Common Structures: Orders"; export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; @@ -2276,9 +2208,6 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | | [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | | | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | -| | | [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/#get-a-list-of-nfts) | -| | | [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/#get-nft-metadata) | -| | | [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/#get-a-list-of-nft-transfers) | | [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | | | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | | | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | @@ -2315,7 +2244,6 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | | [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | | | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | -| | | [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/#refresh-nft-metadata) | | | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | | | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | | [sell](/atomicdex/api/legacy/sell/#sell) | | | @@ -2355,13 +2283,11 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | | | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | | [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | -| | | [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) | | | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | | [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | | | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | | [version](/atomicdex/api/legacy/version/#version) | | | | [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | -| | | [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#withdraw-nfts) | | | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | export const title = "AtomicDEX Method: Active Swaps"; export const description = @@ -13891,2983 +13817,1562 @@ It includes a uniform request, successful and error response formats. At the mom } ``` +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; -## Common Komodo DeFi SDK Request / Response Objects - -The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. - -### ActivationParams - -The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. - -| Parameter | Type | Description | -| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | -| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | -| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | -| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | -| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | -| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | -| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | -| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | -| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | -| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | - - - For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its - first transaction to see all balance and history. This may take a long time on the first - activation, but subsequent activations will be much faster. - Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, - will reduce the average CPU load during ZHTLC coin activation (at the cost of a - longer activation time). These optional fields are recommended when developing - for iOS, where a high CPU load may kill the activation process. Android & - desktop operating systems do not appear to have any problems with high CPU - load during ZHTLC coin activation. - - -### ActivationMode +# Signing\_and\_Verifying\_Messages -Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | -| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | -| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). -### ActivationRpcData +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` -Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. +## Sign Message -| Parameter | Type | Description | -| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | +### Arguments -### ActivationServers +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | -Contains information electrum servers for coins being used in `Electrum` or `Light` mode. +### Response -| Parameter | Type | Description | -| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| url | string | The URL and port for an electrum server. | -| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | -| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | -| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | - - #### ZHTLC Example +#### Command + ```json { - "activation_params": { - "mode": { - "rpc": "Light", - "rpc_data": { - "electrum_servers": [ - { - "url":"zombie.dragonhound.info:10033" - } - ], - "light_wallet_d_servers": [ - "http://zombie.dragonhound.info:443" - ] - }, - "sync_params": { - "height": 2528700 - } - }, - "zcash_params_path": "/home/username/path_to/.zcash-params", - "scan_blocks_per_iteration": 100, - "scan_interval_ms": 200 + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" } } ``` + - #### HD UTXO Activation (v2) - - ```json - { - "activation_params": { - "mode": { - "rpc": "Electrum", - "rpc_data": { - "servers": [ - { - "url": "electrum2.cipig.net:10001" - }, - { - "url": "electrum3.cipig.net:20001", - "ws_url": "electrum3.cipig.net:30001", - "protocol": "SSL" - } - ] - } - }, - "scan_policy": "scan_if_new_wallet", - "priv_key_policy": "Trezor", - "min_addresses_number": 3, - "gap_limit": 20 - } - } - ``` - - -### AddressInfos +#### Response (success) -The `addressInfos` object includes the following items for a given address: +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | +### ⚠ Error types - - #### Example with balances +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "balances": { - "spendable": "0.11398301", - "unspendable": "0.00001" - } - } - ``` +## Verify Message - #### Example without balances +### Arguments - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "tickers": ["ASLP-SLP"] - } - ``` - +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | -### BalanceInfos +### Response -The `balanceInfos` object includes the following items for a given coin or token: +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | -| Parameter | Type | Description | -| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | -| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | +#### Command - + ```json { - "spendable": "12.11398301", - "unspendable": "0.53" + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } } ``` - + -### DerivationMethod +#### Response (valid) -The `DerivationMethod` object includes the following items for a given coin or token: +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | +#### Response (not valid) - - Using the same seed or private key to generate keypairs using different - derivation methods will result in a different address and private key for each - method. - +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` -Where the value indicates: +### ⚠ Error types -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; - - ```json - { - "type": "Iguana" - } - ``` - +# my\_tx\_history -### EvmNode +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. +For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. +For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. -The `EvmNode` object includes the following items for a given coin or token: +## Arguments -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| url | string | URL of an RPC node | -| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | +| parameter | Type | Description | +| --------------- | ------- | ------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to get history for. | +| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | - +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | + +## Request (BCH from page 2) + + ```json { - "url": "http://eth1.cipig.net:8555", - "gui_auth": false + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "BCH", + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + } } ``` - - -### CoinProtocol - -| Parameter | Type | Description | -| -------------- | ------- | ----------------------------------------------------------------------------- | -| type | integer | One of the supported \[coin types]\(link TBA) | -| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | - -### CoinProtocolData - -| Parameter | Type | Description | -| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | -| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | -| network | string | Either `mainnet` or \`testnet | -| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | - -### ConfirmationTargets + -This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. -It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + + ### Response -| Parameter | Type | Description | -| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | -| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | -| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "BCH", + "target": { + "type": "iguana" + }, + "current_block": 772607, + "transactions": [ + { + "tx_hex": "0100000001b7b45d92f8f3413a0e5656258e0a51f5c7e8230c0a08cef2ebec1ddbb8f7c28200000000d747304402203ca957fdfcfbba6123d78afe28b17fd4103cc04f6ada4110eb61c2a0350c29b802204215f203d583e8bcc79bd70f33af4f4e27500b5a5375efe75a1c31ec112f3c344120b3f71dbea00eeace7f09b0911de31e46f76a48036b86ccc207dac55540912e01004c6b6304dbf67563b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a914dde61fe24ea3cfa39379c475702692fa2f080900882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0133980200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acdbf67563", + "tx_hash": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "from": [ + "bitcoincash:ppaa62685yaucdf2a54g3rgtyc9g7yawrvvmqsfumc" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00171035", + "spent_by_me": "0", + "received_by_me": "0.00170035", + "my_balance_change": "0.00170035", + "block_height": 766923, + "timestamp": 1668615553, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "transaction_type": "StandardTransfer", + "confirmations": 5685 + }, + { + "tx_hex": "0100000001eccfa8c296e7b3e229be28a8ca6a5e5a7e89ee07a2d9441faaf5905679286a3c00000000d7473044022077d38ae45bb7257b152d4cb803aab62ca879cab60e9b3a7ca05ef099078e000402203106be31513c6526c14bdf40b28b4d38f78bb1958fc995e040ac4b2165d9d79141203bffadbc5bf035674f0d0f6e1d1a121fc6d404720679ff9b6610b298b41375a3004c6b6304bc847463b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a91457c7ce14c0444edc37ee52ed32b68890b0647cd3882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0163b10200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acbc847463", + "tx_hash": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "from": [ + "bitcoincash:ppnzkha52y53d7r7qn6mq4mcmaadmxzj4clfgneaxv" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00177483", + "spent_by_me": "0", + "received_by_me": "0.00176483", + "my_balance_change": "0.00176483", + "block_height": 766752, + "timestamp": 1668519015, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "transaction_type": "StandardTransfer", + "confirmations": 5856 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 2, + "skipped": 2, + "total": 16, + "total_pages": 8, + "paging_options": { + "PageNumber": 2 + } + }, + "id": null + } + ``` + - - Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: +## Request (TTT-SLP with FromId) - * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). - * `normal`: 60 minutes (one hour). - * `high_priority`: 10 to 20 minutes. - + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "TTT-SLP", + "limit": 2, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + } + } + ``` + -### CounterpartyChannelConfig + + ### Response -| Parameter | Type | Description | -| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | -| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | -| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | -| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | -| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | -| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | -| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | -| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | -| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | -| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "TTT-SLP", + "target": { + "type": "iguana" + }, + "current_block": 772612, + "transactions": [ + { + "tx_hex": "0200000002365a29eb638da7fc57720ad6c99fdbc6cfb9c957920cfb62fd69e494b412c1c1020000006b483045022100de81bca8cfef2f95b3da8aa89edf4f5cc6cf489c565d0965b8142380ef3986f1022062d6ed47f2cd281f4860a27e835949aafbab89eeb0865fbf2280a283dfb7c417412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffffc1f73b403f893f93d95b8c7dfa1b59bb5445109d4c51107da1e08fb770e54136010000006a47304402203658375dac3b84ae17e72cf3f5157b8ad25e7caee0629fa8708868974f8d58b402206f38d016ed4e390d783627441685692d21b889d83919abd39368cba28f43f544412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffff040000000000000000406a04534c500001010453454e44205321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd080000000000002710080000002278c569d322020000000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac22020000000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac68955e03000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac00000000", + "tx_hash": "7b58248f3486079951a57d6dbd41c019a83f2b876c9fa3afa6fcc5a7c595b837", + "from": ["simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8"], + "to": [ + "simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8", + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v" + ], + "total_amount": "1480551016.67", + "spent_by_me": "0", + "received_by_me": "100", + "my_balance_change": "100", + "block_height": 772211, + "timestamp": 1671817336, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00000482" + }, + "coin": "TTT-SLP", + "internal_id": "57b78eb912a704921640a589d8bb42bb147dfb88c3d1b4b2e3df910be6b9ab31", + "transaction_type": { + "TokenTransfer": "5321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd" + }, + "confirmations": 402 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + }, + "id": null + } + ``` + -### FeeInfo +## Request (IRIS with limit = 50) -The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "IRIS", + "limit": 50 + } + } + ``` + -| Parameter | Type | Description | -| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | -| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + + ### Response -### LightningActivationParams - -| Parameter | Type | Description | -| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | -| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | -| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | - -### LightningChannelAmount - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------------------------------------------- | -| type | string | `Exact` for a specific amount or `Max` for whole balance. | -| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | - -### LightningChannelConfig - - - The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. - If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. - + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "IRIS", + "target": { + "type": "iguana" + }, + "current_block": 18120346, + "transactions": [ + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083130303030303030", + "tx_hash": "B34A8D5AD74067F01A0207DF1851A14673C859D8A6F4FB0CBE292D2104C143CA", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "10.044559", + "spent_by_me": "10.044559", + "received_by_me": "10", + "my_balance_change": "-0.044559", + "block_height": 18120218, + "timestamp": 1673016440, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.044559", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "4644373032304131304637363034374441354438413433420000000000000000", + "transaction_type": "StandardTransfer", + "memo": "while you are out, buy milk", + "confirmations": 129 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a696161317a78733476776c36326b687174376e7a7276687a676b34377467366365706677707a673537711a4d0a446962632f3237333934464230393244324543434435363132334337344633364534433146393236303031434541444139434139374541363232423235463431453545423212053130303030", + "tx_hash": "09ADDD3427A3BA4B0A94023456DF534DB5B9B6821EC17C7C1B2C168EFCF49F26", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "0.051788", + "spent_by_me": "0.051788", + "received_by_me": "0", + "my_balance_change": "-0.051788", + "block_height": 17996530, + "timestamp": 1672232661, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.051788", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "0000000000000000303941444444333432374133424134423041393430323334", + "transaction_type": "FeeForTokenTx", + "memo": null, + "confirmations": 123817 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1240343133433843414333434142363945454632344432423643414238314146454344383044413745323731433237343637453142324635463337314446353241441a4061353539343834666536316665383630326465383632353964643263663031613865393437306437666635346262323536336233393035646462366238366535", + "tx_hash": "4E30C074CED6825F3E1B6584C376A426C20FDEFC9A22EB17D8E7DA4139FA0AEB", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "182.742425", + "spent_by_me": "0.053103", + "received_by_me": "182.689322", + "my_balance_change": "182.636219", + "block_height": 17981793, + "timestamp": 1672138900, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.053103", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "3438353642314533463532383644454334373043303345340000000000000000", + "transaction_type": { + "CustomTendermintMsg": { + "msg_type": "SignClaimHtlc", + "token_id": null + } + }, + "memo": null, + "confirmations": 138554 + } + ], + "sync_status": { + "state": "NotStarted" + }, + "limit": 50, + "skipped": 0, + "total": 3, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": null + } + ``` + -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | -| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | -| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | -| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | -| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | -| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | -| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | -| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | +## Error cases - - For GUIs and wallet apps, it is recommended to set `announced_channel` to - `false` (the default value), as the node is not expected to be reliably - online. - +### Error - Coin not active -### LightningChannelOptions +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2.lp_coins", + "error_trace": "my_tx_history_v2:389] lp_coins:2847]", + "error_type": "CoinIsNotActive", + "error_data": "TTT-SLP", + "id": null +} +``` -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | -| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | -| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | +### Error - Coin not compatible -### LightningClosedChannelsFilter +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:336]", + "error_type": "NotSupportedFor", + "error_data": "TTT-SLP", + "id": null +} +``` -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | -| channel\_type | string | Optional. `Inbound` or `Outbound`. | -| closing\_tx | integer | Optional. A transaction ID which closed the channel. | -| closure\_reason | integer | Optional. The reason a channel was closed. | -| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | -| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | -| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | -| channel\_visibility | integer | Optional. `Public` or `Private`. | +### Error - Coin enabled without tx\_history = true - - Response may change to be more consistent in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) - +```json +{ + "mmrpc": "2.0", + "error": "Storage is not initialized for TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:343]", + "error_type": "StorageIsNotInitialized", + "error_data": "Storage is not initialized for TTT-SLP", + "id": null +} +``` -### LightningOpenChannelsFilter +### Error - Local database failed -| Parameter | Type | Description | -| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | -| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | -| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | -| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | -| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | -| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | -| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | -| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | -| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | -| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | -| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | +```json +{ + "mmrpc": "2.0", + "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "error_path": "my_tx_history_v2.sql_tx_history_storage", + "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]", + "error_type": "StorageError", + "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "id": null +} +``` +export const title = "AtomicDEX Method: Orderbook v2"; +export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; -### LightningPayment +# orderbook -| Parameter | Type | Description | -| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | -| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | -| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | -| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | -| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | +**orderbook base rel** -### LightningPaymentFilter +The v2 `orderbook` method requests from the network the currently available orders for the specified trading pair. -| Parameter | Type | Description | -| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +## Arguments -### LightningPaymentType +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| base | string | Base currency of a pair | +| rel | string | Related currency, also known as the "quote currency" | -| Parameter | Type | Description | -| ----------- | ------ | ----------------------------------------------------------------------------------- | -| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | -| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | +## Response - - Response may change in future. See - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) - - -### Pagination - -For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* - -| Parameter | Type | Description | -| ---------- | ------- | ------------------------------------------------------- | -| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | -| FromId | integer | Optional. Ignores any results prior to this UUID | - - - #### Example - - ```json - { - "PageNumber": 1 - } - ``` - - ```json - { - "FromId": 4 - } - ``` - - -### TokenFilter - -The `TokenFilter` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | - -### TokenTransferFilter - -The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### TokenMetadata - -The `TokenMetadata` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| image | string | Optional. Direct URL to the NFT's image. | -| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | -| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | -| name | string | Optional. Name of the token. | -| description | string | Optional. Description of the token. | -| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | -| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | -| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | -| external\_url | string | Optional. URL to the external source related to the token. | -| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | -| image\_details | object | Optional. JSON containing additional details or attributes of the image. | - - - ```json - [ - { - "trait_type": "Specialization", - "value": "Thief" - }, - { - "trait_type": "Skin Tone", - "value": "#0013b0" - }, - { - "trait_type": "Weapon", - "value": "Crossbow" - }, - { - "trait_type": "Species", - "value": "Dark Elf" - }, - { - "trait_type": "Gender", - "value": "Female" - }, - { - "trait_type": "Strength", - "value": "8" - }, - { - "trait_type": "Dexterity", - "value": "12" - }, - { - "trait_type": "Intelligence", - "value": "10" - }, - { - "trait_type": "Perks", - "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] - }, - { - "trait_type": "Weakness", - "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] - }, - { - "trait_type": "Personality", - "value": "Aggressive" - } - ] - ``` - - -### TokensRequest - -The `TokensRequest` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### WithdrawFee - -The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. - -| Parameter | Type | Description | -| --------------- | -------------- | --------------------------------------------------------------------------------- | -| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | -| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | -| coin | string | The coin which will be used to pay the transaction fee. | -| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | -| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | -| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | -| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | -| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | -| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | - - - #### Example of Eth type - - ```json - { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" - } - ``` - - #### Example of Qrc20 type - - ```json - { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - } - ``` - - #### Example of Tendermint type - - ```json - { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - } - ``` - - #### Example of Utxo type - - ```json - { - "type": "Utxo", - "amount": "0.00001" - } - ``` - - -### WithdrawNftData - -The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | -| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | - - - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, - and it has only 1 owner and the owner can own only 1 NFT with this `token_id` - in its `token_address` (also referred to as contract address). - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more - than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the when - the `type` value is `withdraw_erc1155`. - -export const title = "AtomicDEX: Signing and Verifying Messages"; -export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; - -# Signing\_and\_Verifying\_Messages - -Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). - -If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). - -```json -{ - "coin": "DOC", - "asset": "DOC", - "fname": "DOC (TESTCOIN)", - "sign_message_prefix": "Komodo Signed Message:\n", - "rpcport": 25435, - "txversion": 4, - "overwintered": 1, - "mm2": 1, - "protocol": { - "type": "UTXO" - } -} -``` - -## Sign Message - -### Arguments - -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message you want to sign | - -### Response +| Structure | Type | Description | +| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user will trade | +| numasks | integer | The number of outstanding asks | +| numbids | integer | The number of outstanding bids | +| netid | integer | The id of the network on which the request is made (default is `8762`) | +| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | +| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | +| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| Structure | Type | Description | -| --------- | ------ | --------------------------------------- | -| signature | string | The signature generated for the message | +#### 📌 Examples #### Command - + ```json { - "userpass": "testpsw", - "method": "sign_message", "mmrpc": "2.0", - "id": 0, + "userpass": "testpsw", + "method": "orderbook", "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion" - } + "base": "DGB", + "rel": "DASH" + }, + "id": 42 } ``` -#### Response (success) - -```json -{ - "mmrpc": "2.0", - "result": { - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" - }, - "id": 0 -} -``` - -### ⚠ Error types - -**PrefixNotFound:** sign\_message\_prefix is not set in coin config file -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message signing is not supported by the given coin type -**InternalError:** An internal error occured during the signing process - -## Verify Message - -### Arguments - -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| coin | string | The coin to sign a message with | -| message | string | The message input via the `sign_message` method sign | -| signature | string | The signature generated for the message | -| address | string | The address used to sign the message | - -### Response - -| Structure | Type | Description | -| --------- | ------- | ----------------------------------------------------------- | -| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | - -#### Command - - - ```json - { - "userpass": "testpsw", - "method": "verify_message", - "mmrpc": "2.0", - "id": 0, - "params": { - "coin": "DOC", - "message": "Between subtle shading and the absence of light lies the nuance illusion", - "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", - "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" - } - } - ``` - - -#### Response (valid) - -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": true - }, - "id": 0 -} -``` - -#### Response (not valid) - -```json -{ - "mmrpc": "2.0", - "result": { - "is_valid": false - }, - "id": 0 -} -``` - -### ⚠ Error types - -**PrefixNotFound:** sign\_message\_prefix is not set in coin config -**CoinIsNotFound:** Specified coin is not found -**InvalidRequest:** Message verification is not supported by the given coin type -**InternalError:** An internal error occured during the verification process -**SignatureDecodingError:** Given signature could not be decoded -**AddressDecodingError:** Given address could not be decoded -export const title = "AtomicDEX Method: My TX History"; -export const description = "The my_tx_history method allows you to view the transaction history of coins."; - -# my\_tx\_history - -To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. -Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. -For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. -For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. - -## Arguments - -| parameter | Type | Description | -| --------------- | ------- | ------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to get history for. | -| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | - -#### Response - -| Structure | Type | Description | -| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| transactions | array of objects | transactions data | -| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | -| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | -| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | -| total | number | the total number of transactions available | -| page\_number | number | the page\_number that was set in the request | -| total\_pages | number | total pages available with the selected limit | -| current\_block | number | the number of the latest block of coin blockchain | -| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | - -## Request (BCH from page 2) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "BCH", - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - } - } - ``` - - - - ### Response + + #### Response ```json { "mmrpc": "2.0", "result": { - "coin": "BCH", - "target": { - "type": "iguana" - }, - "current_block": 772607, - "transactions": [ + "asks": [ { - "tx_hex": "0100000001b7b45d92f8f3413a0e5656258e0a51f5c7e8230c0a08cef2ebec1ddbb8f7c28200000000d747304402203ca957fdfcfbba6123d78afe28b17fd4103cc04f6ada4110eb61c2a0350c29b802204215f203d583e8bcc79bd70f33af4f4e27500b5a5375efe75a1c31ec112f3c344120b3f71dbea00eeace7f09b0911de31e46f76a48036b86ccc207dac55540912e01004c6b6304dbf67563b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a914dde61fe24ea3cfa39379c475702692fa2f080900882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0133980200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acdbf67563", - "tx_hash": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", - "from": [ - "bitcoincash:ppaa62685yaucdf2a54g3rgtyc9g7yawrvvmqsfumc" + "coin": "DGB", + "address": { + "address_type": "Transparent", + "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" + }, + "price": { + "decimal": "0.0002658065", + "rational": [ + [1, [531613]], + [1, [2000000000]] ], - "to": [ - "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + "fraction": { + "numer": "531613", + "denom": "2000000000" + } + }, + "pubkey": "03de96cb66dcfaceaa8b3d4993ce8914cd5fe84e3fd53cefdae45add8032792a12", + "uuid": "1115d7f2-a7b9-4ab1-913f-497db2549a2b", + "is_mine": false, + "base_max_volume": { + "decimal": "90524.256020352", + "rational": [ + [1, [2846113615, 164]], + [1, [7812500]] ], - "total_amount": "0.00171035", - "spent_by_me": "0", - "received_by_me": "0.00170035", - "my_balance_change": "0.00170035", - "block_height": 766923, - "timestamp": 1668615553, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00001" - }, - "coin": "BCH", - "internal_id": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", - "transaction_type": "StandardTransfer", - "confirmations": 5685 + "fraction": { + "numer": "707220750159", + "denom": "7812500" + } }, - { - "tx_hex": "0100000001eccfa8c296e7b3e229be28a8ca6a5e5a7e89ee07a2d9441faaf5905679286a3c00000000d7473044022077d38ae45bb7257b152d4cb803aab62ca879cab60e9b3a7ca05ef099078e000402203106be31513c6526c14bdf40b28b4d38f78bb1958fc995e040ac4b2165d9d79141203bffadbc5bf035674f0d0f6e1d1a121fc6d404720679ff9b6610b298b41375a3004c6b6304bc847463b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a91457c7ce14c0444edc37ee52ed32b68890b0647cd3882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0163b10200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acbc847463", - "tx_hash": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", - "from": [ - "bitcoincash:ppnzkha52y53d7r7qn6mq4mcmaadmxzj4clfgneaxv" + "base_min_volume": { + "decimal": "0.3762135237475381527539770472129161626973004798603495399849138376977237200745655204067620618758382508", + "rational": [ + [1, [200000]], + [1, [531613]] ], - "to": [ - "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + "fraction": { + "numer": "200000", + "denom": "531613" + } + }, + "rel_max_volume": { + "decimal": "24.061935657873693888", + "rational": [ + [1, [4213143411, 87536811]], + [1, [3466432512, 3637978]] ], - "total_amount": "0.00177483", - "spent_by_me": "0", - "received_by_me": "0.00176483", - "my_balance_change": "0.00176483", - "block_height": 766752, - "timestamp": 1668519015, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00001" - }, - "coin": "BCH", - "internal_id": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", - "transaction_type": "StandardTransfer", - "confirmations": 5856 + "fraction": { + "numer": "375967744654276467", + "denom": "15625000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + } } ], - "sync_status": { - "state": "Finished" - }, - "limit": 2, - "skipped": 2, - "total": 16, - "total_pages": 8, - "paging_options": { - "PageNumber": 2 - } - }, - "id": null - } - ``` - - -## Request (TTT-SLP with FromId) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "TTT-SLP", - "limit": 2, - "paging_options": { - "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" - } - } - } - ``` - - - - ### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "TTT-SLP", - "target": { - "type": "iguana" - }, - "current_block": 772612, - "transactions": [ + "base": "DGB", + "bids": [ { - "tx_hex": "0200000002365a29eb638da7fc57720ad6c99fdbc6cfb9c957920cfb62fd69e494b412c1c1020000006b483045022100de81bca8cfef2f95b3da8aa89edf4f5cc6cf489c565d0965b8142380ef3986f1022062d6ed47f2cd281f4860a27e835949aafbab89eeb0865fbf2280a283dfb7c417412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffffc1f73b403f893f93d95b8c7dfa1b59bb5445109d4c51107da1e08fb770e54136010000006a47304402203658375dac3b84ae17e72cf3f5157b8ad25e7caee0629fa8708868974f8d58b402206f38d016ed4e390d783627441685692d21b889d83919abd39368cba28f43f544412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffff040000000000000000406a04534c500001010453454e44205321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd080000000000002710080000002278c569d322020000000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac22020000000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac68955e03000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac00000000", - "tx_hash": "7b58248f3486079951a57d6dbd41c019a83f2b876c9fa3afa6fcc5a7c595b837", - "from": ["simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8"], - "to": [ - "simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8", - "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v" + "coin": "DASH", + "address": { + "address_type": "Transparent", + "address_data": "XcYdfQgeuM5f5V2LNo9g8o8p3rPPbKwwCg" + }, + "price": { + "decimal": "0.0002544075418788651605521516540338523799763700988224165198319218986992534200426899830070024093907274001", + "rational": [ + [1, [1410065408, 2]], + [1, [3765089107, 9151]] ], - "total_amount": "1480551016.67", - "spent_by_me": "0", - "received_by_me": "100", - "my_balance_change": "100", - "block_height": 772211, - "timestamp": 1671817336, - "fee_details": { - "type": "Utxo", - "coin": "BCH", - "amount": "0.00000482" - }, - "coin": "TTT-SLP", - "internal_id": "57b78eb912a704921640a589d8bb42bb147dfb88c3d1b4b2e3df910be6b9ab31", - "transaction_type": { - "TokenTransfer": "5321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd" - }, - "confirmations": 402 - } - ], - "sync_status": { - "state": "Finished" - }, - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" - } - }, - "id": null - } - ``` - - -## Request (IRIS with limit = 50) - - - ```json - { - "userpass": "testpsw", - "method": "my_tx_history", - "mmrpc": "2.0", - "params": { - "coin": "IRIS", - "limit": 50 - } - } - ``` - - - - ### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "coin": "IRIS", - "target": { - "type": "iguana" - }, - "current_block": 18120346, - "transactions": [ - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083130303030303030", - "tx_hash": "B34A8D5AD74067F01A0207DF1851A14673C859D8A6F4FB0CBE292D2104C143CA", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "10.044559", - "spent_by_me": "10.044559", - "received_by_me": "10", - "my_balance_change": "-0.044559", - "block_height": 18120218, - "timestamp": 1673016440, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.044559", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "4644373032304131304637363034374441354438413433420000000000000000", - "transaction_type": "StandardTransfer", - "memo": "while you are out, buy milk", - "confirmations": 129 + "fraction": { + "numer": "10000000000", + "denom": "39307010814803" + } }, - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a696161317a78733476776c36326b687174376e7a7276687a676b34377467366365706677707a673537711a4d0a446962632f3237333934464230393244324543434435363132334337344633364534433146393236303031434541444139434139374541363232423235463431453545423212053130303030", - "tx_hash": "09ADDD3427A3BA4B0A94023456DF534DB5B9B6821EC17C7C1B2C168EFCF49F26", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": [], - "total_amount": "0.051788", - "spent_by_me": "0.051788", - "received_by_me": "0", - "my_balance_change": "-0.051788", - "block_height": 17996530, - "timestamp": 1672232661, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.051788", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "0000000000000000303941444444333432374133424134423041393430323334", - "transaction_type": "FeeForTokenTx", - "memo": null, - "confirmations": 123817 + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "uuid": "e9e4feb2-60b4-4184-8294-591687171e6b", + "is_mine": false, + "base_max_volume": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } }, - { - "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1240343133433843414333434142363945454632344432423643414238314146454344383044413745323731433237343637453142324635463337314446353241441a4061353539343834666536316665383630326465383632353964643263663031613865393437306437666635346262323536336233393035646462366238366535", - "tx_hash": "4E30C074CED6825F3E1B6584C376A426C20FDEFC9A22EB17D8E7DA4139FA0AEB", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": [], - "total_amount": "182.742425", - "spent_by_me": "0.053103", - "received_by_me": "182.689322", - "my_balance_change": "182.636219", - "block_height": 17981793, - "timestamp": 1672138900, - "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.053103", - "gas_limit": 100000 - }, - "coin": "IRIS", - "internal_id": "3438353642314533463532383644454334373043303345340000000000000000", - "transaction_type": { - "CustomTendermintMsg": { - "msg_type": "SignClaimHtlc", - "token_id": null - } - }, - "memo": null, - "confirmations": 138554 + "base_min_volume": { + "decimal": "0.39307010814803", + "rational": [ + [1, [3765089107, 9151]], + [1, [276447232, 23283]] + ], + "fraction": { + "numer": "39307010814803", + "denom": "100000000000000" + } + }, + "rel_max_volume": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + } } ], - "sync_status": { - "state": "NotStarted" + "net_id": 8762, + "num_asks": 3, + "num_bids": 3, + "rel": "DASH", + "timestamp": 1694183345, + "total_asks_base_vol": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } }, - "limit": 50, - "skipped": 0, - "total": 3, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": null - } - ``` - - -## Error cases - -### Error - Coin not active - -```json -{ - "mmrpc": "2.0", - "error": "TTT-SLP", - "error_path": "my_tx_history_v2.lp_coins", - "error_trace": "my_tx_history_v2:389] lp_coins:2847]", - "error_type": "CoinIsNotActive", - "error_data": "TTT-SLP", - "id": null -} -``` - -### Error - Coin not compatible - -```json -{ - "mmrpc": "2.0", - "error": "TTT-SLP", - "error_path": "my_tx_history_v2", - "error_trace": "my_tx_history_v2:336]", - "error_type": "NotSupportedFor", - "error_data": "TTT-SLP", - "id": null -} -``` - -### Error - Coin enabled without tx\_history = true - -```json -{ - "mmrpc": "2.0", - "error": "Storage is not initialized for TTT-SLP", - "error_path": "my_tx_history_v2", - "error_trace": "my_tx_history_v2:343]", - "error_type": "StorageIsNotInitialized", - "error_data": "Storage is not initialized for TTT-SLP", - "id": null -} -``` - -### Error - Local database failed - -```json -{ - "mmrpc": "2.0", - "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", - "error_path": "my_tx_history_v2.sql_tx_history_storage", - "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]", - "error_type": "StorageError", - "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", - "id": null -} -``` -export const title = "AtomicDEX Method: Orderbook v2"; -export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; - -# orderbook - -**orderbook base rel** - -The v2 `orderbook` method requests from the network the currently available orders for the specified trading pair. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | ---------------------------------------------------- | -| base | string | Base currency of a pair | -| rel | string | Related currency, also known as the "quote currency" | - -## Response - -| Structure | Type | Description | -| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| base | string | The name of the coin the user desires to receive | -| rel | string | The name of the coin the user will trade | -| numasks | integer | The number of outstanding asks | -| numbids | integer | The number of outstanding bids | -| netid | integer | The id of the network on which the request is made (default is `8762`) | -| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | -| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | -| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | -| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | -| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "orderbook", - "params": { - "base": "DGB", - "rel": "DASH" - }, - "id": 42 - } - ``` - - - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": { - "asks": [ - { - "coin": "DGB", - "address": { - "address_type": "Transparent", - "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" - }, - "price": { - "decimal": "0.0002658065", - "rational": [ - [1, [531613]], - [1, [2000000000]] - ], - "fraction": { - "numer": "531613", - "denom": "2000000000" - } - }, - "pubkey": "03de96cb66dcfaceaa8b3d4993ce8914cd5fe84e3fd53cefdae45add8032792a12", - "uuid": "1115d7f2-a7b9-4ab1-913f-497db2549a2b", - "is_mine": false, - "base_max_volume": { - "decimal": "90524.256020352", - "rational": [ - [1, [2846113615, 164]], - [1, [7812500]] - ], - "fraction": { - "numer": "707220750159", - "denom": "7812500" - } - }, - "base_min_volume": { - "decimal": "0.3762135237475381527539770472129161626973004798603495399849138376977237200745655204067620618758382508", - "rational": [ - [1, [200000]], - [1, [531613]] - ], - "fraction": { - "numer": "200000", - "denom": "531613" - } - }, - "rel_max_volume": { - "decimal": "24.061935657873693888", - "rational": [ - [1, [4213143411, 87536811]], - [1, [3466432512, 3637978]] - ], - "fraction": { - "numer": "375967744654276467", - "denom": "15625000000000000" - } - }, - "rel_min_volume": { - "decimal": "0.0001", - "rational": [ - [1, [1]], - [1, [10000]] - ], - "fraction": { - "numer": "1", - "denom": "10000" - } - }, - "conf_settings": { - "base_confs": 7, - "base_nota": false, - "rel_confs": 2, - "rel_nota": false - }, - "base_max_volume_aggr": { - "decimal": "133319.023345413", - "rational": [ - [1, [3238477573, 31040]], - [1, [1000000000]] - ], - "fraction": { - "numer": "133319023345413", - "denom": "1000000000" - } - }, - "rel_max_volume_aggr": { - "decimal": "35.2500366381728643576", - "rational": [ - [1, [473921343, 1669176307, 2]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "44062545797716080447", - "denom": "1250000000000000000" - } - } - } - ], - "base": "DGB", - "bids": [ - { - "coin": "DASH", - "address": { - "address_type": "Transparent", - "address_data": "XcYdfQgeuM5f5V2LNo9g8o8p3rPPbKwwCg" - }, - "price": { - "decimal": "0.0002544075418788651605521516540338523799763700988224165198319218986992534200426899830070024093907274001", - "rational": [ - [1, [1410065408, 2]], - [1, [3765089107, 9151]] - ], - "fraction": { - "numer": "10000000000", - "denom": "39307010814803" - } - }, - "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "uuid": "e9e4feb2-60b4-4184-8294-591687171e6b", - "is_mine": false, - "base_max_volume": { - "decimal": "15449.5309493280527473176", - "rational": [ - [1, [161102659, 3869502237, 1046]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "19311913686660065934147", - "denom": "1250000000000000000" - } - }, - "base_min_volume": { - "decimal": "0.39307010814803", - "rational": [ - [1, [3765089107, 9151]], - [1, [276447232, 23283]] - ], - "fraction": { - "numer": "39307010814803", - "denom": "100000000000000" - } - }, - "rel_max_volume": { - "decimal": "3.930477192", - "rational": [ - [1, [491309649]], - [1, [125000000]] - ], - "fraction": { - "numer": "491309649", - "denom": "125000000" - } - }, - "rel_min_volume": { - "decimal": "0.0001", - "rational": [ - [1, [1]], - [1, [10000]] - ], - "fraction": { - "numer": "1", - "denom": "10000" - } - }, - "conf_settings": { - "base_confs": 7, - "base_nota": false, - "rel_confs": 2, - "rel_nota": false - }, - "base_max_volume_aggr": { - "decimal": "15449.5309493280527473176", - "rational": [ - [1, [161102659, 3869502237, 1046]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "19311913686660065934147", - "denom": "1250000000000000000" - } - }, - "rel_max_volume_aggr": { - "decimal": "3.930477192", - "rational": [ - [1, [491309649]], - [1, [125000000]] - ], - "fraction": { - "numer": "491309649", - "denom": "125000000" - } - } - } - ], - "net_id": 8762, - "num_asks": 3, - "num_bids": 3, - "rel": "DASH", - "timestamp": 1694183345, - "total_asks_base_vol": { - "decimal": "133319.023345413", - "rational": [ - [1, [3238477573, 31040]], - [1, [1000000000]] - ], - "fraction": { - "numer": "133319023345413", - "denom": "1000000000" - } - }, - "total_asks_rel_vol": { - "decimal": "35.2500366381728643576", - "rational": [ - [1, [473921343, 1669176307, 2]], - [1, [2436694016, 291038304]] - ], - "fraction": { - "numer": "44062545797716080447", - "denom": "1250000000000000000" - } - }, - "total_bids_base_vol": { - "decimal": "59100.6554157135128550633", - "rational": [ - [1, [1422777577, 2274178813, 32038]], - [1, [2313682944, 2328306436]] - ], - "fraction": { - "numer": "591006554157135128550633", - "denom": "10000000000000000000" - } - }, - "total_bids_rel_vol": { - "decimal": "14.814675225", - "rational": [ - [1, [592587009]], - [1, [40000000]] - ], - "fraction": { - "numer": "592587009", - "denom": "40000000" - } - } - }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Recreate Swap Data"; -export const description = "The recreate_swap_data method helps recover lost swap data due to storage errors or hardware failure."; - -# recreate\_swap\_data - -The `recreate_swap_data` can assist in the event of local stored swap data being lost due to storage errors related to low disk space or hardware failure, and if required, aid with the refunding of failed swaps. - -To source the opposite side of the trade, please [contact the Komodo Support team on Discord](https://discord.com/invite/RRZ8hzc). You will need to provide details about the trade you are trying to recover, such as the coins and amounts being traded, the approximate time of the trade, any known transaction IDs involved in the trade, and if available the UUID of the trade. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| swap | object | Swap data from other side of trade. For example to recreate a Maker's swap data, the input would be the corresponding Taker's swap data | - -#### Response - -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | -| result | object | Opposite side's swap data. For example if a Taker's swap data is input, the reponse would be the corresponding Maker's swap data. | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "recreate_swap_data", - "params": { - "swap": { - "type": "Taker", - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "events": [ - { - "timestamp": 1638984440546, - "event": { - "type": "Started", - "data": { - "taker_coin": "MARTY", - "maker_coin": "DOC", - "maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "my_persistent_pub": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "lock_duration": 7800, - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "taker_amount": "1", - "maker_payment_confirmations": 1, - "maker_payment_requires_nota": false, - "taker_payment_confirmations": 1, - "taker_payment_requires_nota": false, - "taker_payment_lock": 1638992240, - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "started_at": 1638984440, - "maker_payment_wait": 1638987560, - "maker_coin_start_block": 1207822, - "taker_coin_start_block": 1222573, - "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 - } - } - } - }, - { - "timestamp": 1638984456603, - "event": { - "type": "Negotiated", - "data": { - "maker_payment_locktime": 1639000040, - "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", - "maker_coin_swap_contract_addr": null, - "taker_coin_swap_contract_addr": null - } - } - }, - { - "timestamp": 1638984456814, - "event": { - "type": "TakerFeeSent", - "data": { - "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", - "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "MakerPaymentReceived", - "data": { - "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", - "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" - } - } - }, - { - "timestamp": 1638984457826, - "event": { - "type": "MakerPaymentWaitConfirmStarted" - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "MakerPaymentWaitConfirmFailed", - "data": { - "error": "An error" - } - } - }, - { - "timestamp": 1638984503615, - "event": { - "type": "Finished" - } - } - ], - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "maker_coin": "DOC", - "taker_amount": "1", - "taker_coin": "MARTY", - "gui": "atomicDEX 0.5.1 iOS", - "mm_version": "1b065636a", - "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" - ] - } - }, - "id": 0 - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": { - "swap": { - "type": "Maker", - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "events": [ - { - "timestamp": 1638984440546, - "event": { - "type": "Started", - "data": { - "taker_coin": "MARTY", - "maker_coin": "DOC", - "taker": "b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "secret": "0000000000000000000000000000000000000000000000000000000000000000", - "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", - "my_persistent_pub": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", - "lock_duration": 7800, - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "taker_amount": "1", - "maker_payment_confirmations": 1, - "maker_payment_requires_nota": false, - "taker_payment_confirmations": 1, - "taker_payment_requires_nota": false, - "maker_payment_lock": 1639000040, - "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", - "started_at": 1638984440, - "maker_coin_start_block": 1207822, - "taker_coin_start_block": 1222573, - "maker_payment_trade_fee": null, - "taker_payment_spend_trade_fee": null - } - } - }, - { - "timestamp": 1638984456603, - "event": { - "type": "Negotiated", - "data": { - "taker_payment_locktime": 1638992240, - "taker_pubkey": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", - "maker_coin_swap_contract_addr": null, - "taker_coin_swap_contract_addr": null - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "TakerFeeValidated", - "data": { - "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", - "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" - } - } - }, - { - "timestamp": 1638984457822, - "event": { - "type": "MakerPaymentSent", - "data": { - "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", - "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" - } - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "TakerPaymentValidateFailed", - "data": { - "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" - } - } - }, - { - "timestamp": 1638984503611, - "event": { - "type": "MakerPaymentWaitRefundStarted", - "data": { - "wait_until": 1639003740 - } - } - } - ], - "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", - "maker_coin": "DOC", - "taker_amount": "1", - "taker_coin": "MARTY", - "gui": "nogui", - "mm_version": "", - "success_events": [ - "Started", - "Negotiated", - "TakerFeeValidated", - "MakerPaymentSent", - "TakerPaymentReceived", - "TakerPaymentWaitConfirmStarted", - "TakerPaymentValidatedAndConfirmed", - "TakerPaymentSpent", - "TakerPaymentSpendConfirmStarted", - "TakerPaymentSpendConfirmed", - "Finished" - ], - "error_events": [ - "StartFailed", - "NegotiateFailed", - "TakerFeeValidateFailed", - "MakerPaymentTransactionFailed", - "MakerPaymentDataSendFailed", - "MakerPaymentWaitConfirmFailed", - "TakerPaymentValidateFailed", - "TakerPaymentWaitConfirmFailed", - "TakerPaymentSpendFailed", - "TakerPaymentSpendConfirmFailed", - "MakerPaymentWaitRefundStarted", - "MakerPaymentRefunded", - "MakerPaymentRefundFailed" - ] - } - }, - "id": null - } - ``` - -export const title = "AtomicDEX Method: Remove Delegation"; -export const description = - "The remove_delegation method stops your node's staking of a compatible coin."; - -# remove\_delegation - -The `remove_delegation` method stops your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. - -Note: After running `remove_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| coin | string | the coin being staked | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "remove_delegation", - "params": { - "coin": "tQTUM" - }, - "id": 0 - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "01000000015c7f32b1b3396ce1bed4f6c161bcc3a5bf5c58e4338c66a24c9de1deffc5b94e000000006a47304402203fcdf1e48f6e43fd718b4aab79c56a7ff81b12304339ddf6d871a3f26f217a7502200c22fa8e2bcc33d16f4bf62feb71f637acbefdd34135314e6aa526e6655cba73012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000225403a086010128043d666e8b140000000000000000000000000000000000000086c280584f00000000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb8d98061", - "tx_hash": "3564859a7ff902e8d65387c44f6049943582e0b9e29161bf1075a00097e535ae", - "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], - "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], - "total_amount": "0.096", - "spent_by_me": "0.096", - "received_by_me": "0.052", - "my_balance_change": "-0.044", - "block_height": 0, - "timestamp": 1635834296, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.004", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "coin": "tQTUM", - "internal_id": "", - "transaction_type": "RemoveDelegation" - }, - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Remove Node from Version Stat"; -export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running."; - -# remove\_node\_from\_version\_stat - -The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". - -## Arguments - -| Structure | Type | Description | -| --------- | ------ | ----------------------------- | -| name | string | the name assigned to the node | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "remove_node_from_version_stat", - "userpass": "testpsw", - "params": { - "name": "dragonhound_DEV" - } - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Start Simple Market Maker Bot"; -export const description = "The AtomicDEX API allows for simple bot trading via the start_simple_market_maker_bot method."; - -# start\_simple\_market\_maker\_bot - -The AtomicDEX API allows for simple bot trading via the `start_simple_market_maker_bot` method. This method takes as input a url to a price service, and configuration parameters of the pair to trade at a defined spread percentage value. It will update orders every 30 seconds (or higher values if defined with the `bot_refresh_rate` parameter). - -Note: If using a custom prices API endpoint, please ensure it conforms to the same schema as the url in the example. - -For convenience, an online [tool for generating configs](https://stats.kmd.io/atomicdex/makerbot_config_form/) is available. - -## Arguments - -| Structure | Type | Description | -| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| price\_url | string | Link to a price service API | -| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) | -| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) | -| cfg.name.base | string | Ticker of the coin you wish to sell | -| cfg.name.rel | string | Ticker of the coin you wish to buy | -| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) | -| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) | -| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) | -| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) | -| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) | -| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) | -| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) | -| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) | -| cfg.name.spread\*\* | string | Target price in relation to prices API value | -| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | -| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set | -| cfg.name.enable | boolean | Bot will ignore this config entry if set to false | -| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) | -| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) | - -* Percentage values are within the range of 0-1, such that 0.25 = 25% -* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url. -* At least one of the optional fields `max`, `max_volume.usd` or `max_volume.percentage` must be present, or orders will not be placed. - -#### 📌 Examples - -As demonstrated below, multiple configs can be included within the same command. It is recommended to not exceed 500-1000 simultaneous orders placed to avoid decreased performance. - -In the example below, the first config lets the bot know we want to: - -* Sell DASH in exchange for KMD -* Use whole of available DASH balance, with minimum trade volume accepted as 25% of your balance -* Sets the sell price at 2.5% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 30 seconds -* Waits for 3 confirmations and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Checks trade history within the local AtomicDEX API database to never create trades with a sell price that is less than the average trading price. - -The second config tells the bot to: - -* Sell DASH in exchange for DGB -* Trade at most 50% of your DASH balance, with minimum trade volume accepted at least $20 USD. -* Only place an order when the DASH price is $250 USD or more. -* Sets the sell price at 4% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 60 seconds -* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Ignores your trade history and average trading price, creating/updating orders regardless. - -The third config tells the bot to: - -* Sell DASH in exchange for LTC -* Trade at most $500 USD worth of DASH, with minimum trade volume accepted at least $50 USD. -* Only place an order when the DASH price is $250 USD or more. -* Sets the sell price at 5% over the value returned from the prices API (spread). -* Only accepts values from the prices API that have been updated within the last 60 seconds -* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process -* Ignores your trade history and average trading price, creating/updating orders regardless. - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "start_simple_market_maker_bot", - "params": { - "price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600", - "bot_refresh_rate": 60, - "cfg": { - "DASH/KMD": { - "base": "DASH", - "rel": "KMD", - "max": true, - "min_volume": { - "percentage": "0.25" - }, - "spread": "1.025", - "base_confs": 3, - "base_nota": false, - "rel_confs": 3, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 30, - "check_last_bidirectional_trade_thresh_hold": true - }, - "DASH/DGB": { - "base": "DASH", - "rel": "DGB", - "min_volume": { - "usd": "20" - }, - "min_base_price": "250", - "spread": "1.04", - "base_confs": 1, - "base_nota": false, - "rel_confs": 1, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 60, - "check_last_bidirectional_trade_thresh_hold": false - }, - "DASH/LTC": { - "base": "DASH", - "rel": "LTC", - "max_volume": { - "usd": "500" - }, - "min_volume": { - "usd": "50" - }, - "min_base_price": "250", - "spread": "1.04", - "base_confs": 1, - "base_nota": false, - "rel_confs": 1, - "rel_nota": false, - "enable": true, - "price_elapsed_validity": 60, - "check_last_bidirectional_trade_thresh_hold": false - } - } - }, - "id": 0 - } - ``` - - -As we have `\"bot_refresh_rate\": 60,` in the above command, our bot loop will update order prices every 60 seconds, as long as the price service returns data that is no more than 30 seconds old (for DASH/KMD) or no more than 60 seconds old (for DASH/DGB). - - - #### Response (success) {{class : 'text-green-500'}} - - ```json - { - "mmrpc": "2.0", - "result": { - "result": "Success" - }, - "id": 0 - } - ``` - - #### Response (error - bot already started) {{class : 'text-red-500'}} - - ```json - { - "mmrpc": "2.0", - "error": "The bot is already started", - "error_path": "simple_market_maker", - "error_trace": "simple_market_maker:770]", - "error_type": "AlreadyStarted", - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Start Version Stat Collection"; -export const description = "The start_version_stat_collection method initiates storing version statistics for nodes previously registered via the add_node_to_version_stat method."; - -# start\_version\_stat\_collection - -The `start_version_stat_collection` method initiates storing version statistics for nodes previously registered via the `add_node_to_version_stat` method. - -## Arguments - -| Structure | Type | Description | -| --------- | ------- | ------------------------------------------------ | -| interval | integer | polling rate (in seconds) to check node versions | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "start_version_stat_collection", - "userpass": "testpsw", - "params": { - "interval": 600 - } - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - - #### Response (error - invalid peer id unable to parse) - - ```json - { - "mmrpc": "2.0", - "error": "Database error: UNIQUE constraint failed: nodes.peer_id", - "error_path": "lp_stats", - "error_trace": "lp_stats:124]", - "error_type": "DatabaseError", - "error_data": "UNIQUE constraint failed: nodes.peer_id", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Stop Simple Market Maker Bot"; -export const description = "The stop_simple_market_maker_bot method tells the bot to finish placing orders at the end of the current loop 30 seconds minimum and 30 seconds by default."; - -# stop\_simple\_market\_maker\_bot - -The `stop_simple_market_maker_bot` method tells the bot to finish placing orders at the end of the current loop (30 seconds minimum & 30 seconds by default). This method takes as input a url to a price service, and configuration parameters of the pairs to trade at a defined spread percentage value. - -At the end of the final loop, orders placed by the bot will be cancelled. Users should wait until the loop ends before exiting the AtomicDEX API, otherwise orders will not cancel, and will reappear on the orderbook next time AtomicDEX API starts. - -## Arguments - -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none ) | | | - -#### 📌 Examples - -#### Command - - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "stop_simple_market_maker_bot", - "params": {}, - "id": 0 - } - ``` - - - - #### Response (success) {{class : 'text-green-500'}} - - ```json - { - "mmrpc": "2.0", - "result": { - "result": "Success" - }, - "id": 0 - } - ``` - - #### Response (error - bot already stopped) {{class : 'text-red-500'}} - - ```json - { - "mmrpc": "2.0", - "error": "The bot is already stopped", - "error_path": "simple_market_maker", - "error_trace": "simple_market_maker:813]", - "error_type": "AlreadyStopped", - "id": 0 - } - ``` - -export const title = "AtomicDEX Method: Stop Version Stat Collection"; -export const description = "The stop_version_stat_collection method stops the collection of version stats at the end of the current loop interval."; - -# stop\_version\_stat\_collection - -The `stop_version_stat_collection` method stops the collection of version stats at the end of the current loop interval. - -#### Arguments - -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | - -#### Response - -| Structure | Type | Description | -| --------- | ------ | ---------------- | -| result | string | success or error | - -#### 📌 Examples - -#### Command - - - ```json - { - "mmrpc": "2.0", - "method": "stop_version_stat_collection", - "userpass": "testpsw", - "params": {} - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": "success", - "id": null - } - ``` - - - - #### Response (error - stats collection not running) - - ```json - { - "mmrpc": "2.0", - "error": "start_version_stat_collection is not running", - "error_path": "lp_stats", - "error_trace": "lp_stats:395]", - "error_type": "NotRunning", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Telegram Alerts for MM Bot"; -export const description = "The AtomicDEX API Market Maker bot can be configured to send status update alerts via Telegram."; - -# Telegram Alerts for Market Maker Bot - -The AtomicDEX API Market Maker bot can be configured to send status update alerts via [Telegram!](https://telegram.org/) - -To set this up, you can add some additional parameters to your MM2.json as shown in the example below - -```json -{ - "gui": "MarketMakerBot", - "netid": 8762, - "rpc_password": "YOUR_PASSWORD", - "passphrase": "YOUR SEED PHRASE", - "dbdir": "/path/to/your/atomicdex/DB", - "message_service_cfg": { - "telegram": { - "api_key": "YOUR:TELEGRAM_API_TOKEN", - "chat_registry": { - "default": "YOUR_TELEGRAM_CHAT_ID", - "maker_bot": "YOUR_TELEGRAM_CHAT_ID", - "swap_events": "YOUR_TELEGRAM_CHAT_ID" - } - } - } -} -``` - -The extra fields required are: - -| Parameter | Type | Description | -| --------------------------- | ------ | ------------------------ | -| api\_key | string | A Telegram bot API token | -| chat\_registry.default | string | A Telegram Chat ID | -| chat\_registry.maker\_bot | string | A Telegram Chat ID | -| chat\_registry.swap\_events | string | A Telegram Chat ID | - -You can use the same Telegram chat ID for all three `chat_registry` subfields, or sent your alerts to a different chat ID if you want to separate the alerts by type. - -To get a Telegram bot API token, you need to [have chat with the BotFather](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) - -To get a Telegram chat ID, check out [this guide](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) -export const title = "AtomicDEX Method: Trade Preimage"; -export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; - -# trade\_preimage - -The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. -Depending on the parameters, the function returns different results: - -* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. - The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; -* If the `max` field is true, then the result will include the `volume`. - - - This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. - Use the resulting `volume` as an argument of the `buy` or `sell` requests. - - - - Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. - - -## Arguments - -| Structure | Type | Description | -| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| base | string | the base currency of the request | -| rel | string | the rel currency of the request | -| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | -| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | -| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | -| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | - -### Result - -| Structure | Type | Description | -| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | -| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | -| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | -| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | -| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | -| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | -| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | -| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | - -### ⚠ Error types - -#### NotSufficientBalance - -The `available` balance of the `coin` is not sufficient to start the swap. - -| Structure | Type | Description | -| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | -| coin | string | the name of the coin which balance is not sufficient | -| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | -| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | -| locked\_by\_swaps | string (numeric, optional) | the amount locked by other swaps | - -#### NotSufficientBaseCoinBalance - -The available balance of the base `coin` is not sufficient to pay transaction fees. - -For example, ERC20 fees are paid by ETH (gas), and this error type is returned if the ETH coin balance is not sufficient to start the swap. - -| Structure | Type | Description | -| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | -| coin | string | the name of the base coin which balance is not sufficient | -| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | -| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | -| locked\_by\_swaps | string (numeric, optional) | the amount is locked by other swaps | - -#### VolumeTooLow - -The specified `volume` is too low. Required at least `threshold`. - - - If the `coin` field returned in Response is the same as the `rel` argument in Request, then the base volume threshold can be calculated as follows: - `base_coin_threshold = rel_vol_threshold / price` - - -| Structure | Type | Description | -| --------- | ---------------- | -------------------------------------------------- | -| coin | string | either `base` or `rel` coin specified in Request | -| volume | string (numeric) | the amount the user was willing to trade in `coin` | -| threshold | string (numeric) | the `volume` has not to be less than this amount | - -#### NoSuchCoin - -The specified coin was not found or is not activated yet. - -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| coin | string | either `base` or `rel` coin specified in Request | - -#### CoinIsWalletOnly + "total_asks_rel_vol": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + }, + "total_bids_base_vol": { + "decimal": "59100.6554157135128550633", + "rational": [ + [1, [1422777577, 2274178813, 32038]], + [1, [2313682944, 2328306436]] + ], + "fraction": { + "numer": "591006554157135128550633", + "denom": "10000000000000000000" + } + }, + "total_bids_rel_vol": { + "decimal": "14.814675225", + "rational": [ + [1, [592587009]], + [1, [40000000]] + ], + "fraction": { + "numer": "592587009", + "denom": "40000000" + } + } + }, + "id": 42 + } + ``` + +export const title = "AtomicDEX Method: Recreate Swap Data"; +export const description = "The recreate_swap_data method helps recover lost swap data due to storage errors or hardware failure."; -The specified coin is wallet only and cannot be participated in the swap. +# recreate\_swap\_data -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| coin | string | either `base` or `rel` coin specified in Request | +The `recreate_swap_data` can assist in the event of local stored swap data being lost due to storage errors related to low disk space or hardware failure, and if required, aid with the refunding of failed swaps. -#### BaseEqualRel +To source the opposite side of the trade, please [contact the Komodo Support team on Discord](https://discord.com/invite/RRZ8hzc). You will need to provide details about the trade you are trying to recover, such as the coins and amounts being traded, the approximate time of the trade, any known transaction IDs involved in the trade, and if available the UUID of the trade. -The coin is wallet only and cannot be participated in the swap. +## Arguments -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | +| swap | object | Swap data from other side of trade. For example to recreate a Maker's swap data, the input would be the corresponding Taker's swap data | -#### InvalidParam +#### Response -Incorrect use of the `param` parameter in Request. +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | +| result | object | Opposite side's swap data. For example if a Taker's swap data is input, the reponse would be the corresponding Maker's swap data. | -| Structure | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| param | string | the name of the parameter in Request | -| reason | string | the reason why the parameter is used incorrectly | +#### 📌 Examples -#### PriceTooLow +#### Command -The specified `price` is too low. + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "recreate_swap_data", + "params": { + "swap": { + "type": "Taker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "my_persistent_pub": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1638992240, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_payment_wait": 1638987560, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "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 + } + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1639000040, + "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984456814, + "event": { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984457826, + "event": { + "type": "MakerPaymentWaitConfirmStarted" + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitConfirmFailed", + "data": { + "error": "An error" + } + } + }, + { + "timestamp": 1638984503615, + "event": { + "type": "Finished" + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "atomicDEX 0.5.1 iOS", + "mm_version": "1b065636a", + "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" + ] + } + }, + "id": 0 + } + ``` + -| Structure | Type | Description | -| --------- | ---------------- | ---------------------------------------------------------------------------------- | -| price | string (numeric) | the price in `rel` the user was willing to receive per one unit of the `base` coin | -| threshold | string (numeric) | the `price` has not to be less than this amount | + + #### Response (success) -#### Transport + ```json + { + "mmrpc": "2.0", + "result": { + "swap": { + "type": "Maker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "taker": "b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "secret": "0000000000000000000000000000000000000000000000000000000000000000", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "my_persistent_pub": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "maker_payment_lock": 1639000040, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "maker_payment_trade_fee": null, + "taker_payment_spend_trade_fee": null + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "taker_payment_locktime": 1638992240, + "taker_pubkey": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "TakerFeeValidated", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentSent", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "TakerPaymentValidateFailed", + "data": { + "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitRefundStarted", + "data": { + "wait_until": 1639003740 + } + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "nogui", + "mm_version": "", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ] + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Remove Delegation"; +export const description = + "The remove_delegation method stops your node's staking of a compatible coin."; -The request was failed due to a network error. +# remove\_delegation -| Structure | Type | Description | -| --------- | ------ | ------------------------------- | -| (none) | string | the transport error description | +The `remove_delegation` method stops your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. -#### InternalError +Note: After running `remove_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. -The request was failed due to a AtomicDEX API internal error. +## Arguments -| Structure | Type | Description | -| --------- | ------ | ------------------------------ | -| (none) | string | the internal error description | +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| coin | string | the coin being staked | -### 📌 Examples +#### 📌 Examples -#### Command (setprice) +#### Command - + ```json { - "mmrpc": "2.0", "userpass": "testpsw", - "method": "trade_preimage", + "mmrpc": "2.0", + "method": "remove_delegation", "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "0.1", - "swap_method": "setprice" + "coin": "tQTUM" }, "id": 0 } ``` -#### Response + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "coin": "KMD", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "coin": "DGB", - "amount": "0.00030782", - "amount_fraction": { - "numer": "15391", - "denom": "50000000" + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "01000000015c7f32b1b3396ce1bed4f6c161bcc3a5bf5c58e4338c66a24c9de1deffc5b94e000000006a47304402203fcdf1e48f6e43fd718b4aab79c56a7ff81b12304339ddf6d871a3f26f217a7502200c22fa8e2bcc33d16f4bf62feb71f637acbefdd34135314e6aa526e6655cba73012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000225403a086010128043d666e8b140000000000000000000000000000000000000086c280584f00000000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb8d98061", + "tx_hash": "3564859a7ff902e8d65387c44f6049943582e0b9e29161bf1075a00097e535ae", + "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "total_amount": "0.096", + "spent_by_me": "0.096", + "received_by_me": "0.052", + "my_balance_change": "-0.044", + "block_height": 0, + "timestamp": 1635834296, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.004", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" }, - "amount_rat": [ - [1, [15391]], - [1, [50000000]] - ], - "paid_from_trading_vol": true - }, - "volume": "1138.46868712", - "volume_fraction": { - "numer": "14230858589", - "denom": "12500000" + "coin": "tQTUM", + "internal_id": "", + "transaction_type": "RemoveDelegation" }, - "volume_rat": [ - [1, [1345956701, 3]], - [1, [12500000]] - ], - "total_fees": [ - { - "coin": "KMD", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "required_balance": "0.00001", - "required_balance_fraction": { - "numer": "1", - "denom": "100000" - }, - "required_balance_rat": [ - [1, [1]], - [1, [100000]] - ] - }, - { - "coin": "DGB", - "amount": "0.00030782", - "amount_fraction": { - "numer": "15391", - "denom": "50000000" - }, - "amount_rat": [ - [1, [15391]], - [1, [50000000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" - }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] - } - ] - }, - "id": 0 -} -``` + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Remove Node from Version Stat"; +export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running."; + +# remove\_node\_from\_version\_stat + +The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| name | string | the name assigned to the node | + +#### 📌 Examples -#### Command (buy) +#### Command - + ```json { "mmrpc": "2.0", + "method": "remove_node_from_version_stat", "userpass": "testpsw", - "method": "trade_preimage", "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "0.1", - "swap_method": "buy" - }, - "id": 0 + "name": "dragonhound_DEV" + } } ``` -#### Response + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" - }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": true - }, - "rel_coin_fee": { - "amount": "0.0001", - "amount_fraction": { - "denom": "10000", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [10000]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "taker_fee": { - "amount": "0.00012870012870012872", - "amount_fraction": { - "denom": "7770", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [7770]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "fee_to_send_taker_fee": { - "amount": "0.0001", - "amount_fraction": { - "denom": "10000", - "numer": "1" - }, - "amount_rat": [ - [1, [1]], - [1, [10000]] - ], - "coin": "DOC", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "coin": "DOC", - "amount": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", - "amount_fraction": { - "numer": "50777", - "denom": "38850000" - }, - "amount_rat": [ - [1, [50777]], - [1, [38850000]] - ], - "required_balance": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", - "required_balance_fraction": { - "numer": "50777", - "denom": "38850000" - }, - "required_balance_rat": [ - [1, [50777]], - [1, [38850000]] - ] - }, - { - "coin": "tBTC", - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Start Simple Market Maker Bot"; +export const description = "The AtomicDEX API allows for simple bot trading via the start_simple_market_maker_bot method."; + +# start\_simple\_market\_maker\_bot + +The AtomicDEX API allows for simple bot trading via the `start_simple_market_maker_bot` method. This method takes as input a url to a price service, and configuration parameters of the pair to trade at a defined spread percentage value. It will update orders every 30 seconds (or higher values if defined with the `bot_refresh_rate` parameter). + +Note: If using a custom prices API endpoint, please ensure it conforms to the same schema as the url in the example. + +For convenience, an online [tool for generating configs](https://stats.kmd.io/atomicdex/makerbot_config_form/) is available. + +## Arguments + +| Structure | Type | Description | +| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| price\_url | string | Link to a price service API | +| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) | +| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) | +| cfg.name.base | string | Ticker of the coin you wish to sell | +| cfg.name.rel | string | Ticker of the coin you wish to buy | +| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) | +| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) | +| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) | +| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) | +| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) | +| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) | +| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) | +| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) | +| cfg.name.spread\*\* | string | Target price in relation to prices API value | +| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.enable | boolean | Bot will ignore this config entry if set to false | +| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) | +| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) | + +* Percentage values are within the range of 0-1, such that 0.25 = 25% +* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url. +* At least one of the optional fields `max`, `max_volume.usd` or `max_volume.percentage` must be present, or orders will not be placed. + +#### 📌 Examples + +As demonstrated below, multiple configs can be included within the same command. It is recommended to not exceed 500-1000 simultaneous orders placed to avoid decreased performance. + +In the example below, the first config lets the bot know we want to: + +* Sell DASH in exchange for KMD +* Use whole of available DASH balance, with minimum trade volume accepted as 25% of your balance +* Sets the sell price at 2.5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 30 seconds +* Waits for 3 confirmations and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Checks trade history within the local AtomicDEX API database to never create trades with a sell price that is less than the average trading price. + +The second config tells the bot to: + +* Sell DASH in exchange for DGB +* Trade at most 50% of your DASH balance, with minimum trade volume accepted at least $20 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 4% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +The third config tells the bot to: + +* Sell DASH in exchange for LTC +* Trade at most $500 USD worth of DASH, with minimum trade volume accepted at least $50 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "start_simple_market_maker_bot", + "params": { + "price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600", + "bot_refresh_rate": 60, + "cfg": { + "DASH/KMD": { + "base": "DASH", + "rel": "KMD", + "max": true, + "min_volume": { + "percentage": "0.25" + }, + "spread": "1.025", + "base_confs": 3, + "base_nota": false, + "rel_confs": 3, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 30, + "check_last_bidirectional_trade_thresh_hold": true }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" + "DASH/DGB": { + "base": "DASH", + "rel": "DGB", + "min_volume": { + "usd": "20" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] + "DASH/LTC": { + "base": "DASH", + "rel": "LTC", + "max_volume": { + "usd": "500" + }, + "min_volume": { + "usd": "50" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false + } } - ] - }, - "id": 0 -} -``` + }, + "id": 0 + } + ``` + -#### Command (sell, max) +As we have `\"bot_refresh_rate\": 60,` in the above command, our bot loop will update order prices every 60 seconds, as long as the price service returns data that is no more than 30 seconds old (for DASH/KMD) or no more than 60 seconds old (for DASH/DGB). + + + #### Response (success) {{class : 'text-green-500'}} - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "trade_preimage", - "params": { - "base": "BTC", - "rel": "DOC", - "price": "1", - "volume": "2.21363478", - "swap_method": "sell" + "result": { + "result": "Success" }, "id": 0 } ``` - -#### Response + #### Response (error - bot already started) {{class : 'text-red-500'}} -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.00042049", - "amount_fraction": { - "denom": "100000000", - "numer": "42049" - }, - "amount_rat": [ - [1, [42049]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "coin": "DOC", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "paid_from_trading_vol": true - }, - "taker_fee": { - "amount": "0.0028489508108108107", - "amount_fraction": { - "denom": "1850000000", - "numer": "5270559" - }, - "amount_rat": [ - [1, [5270559]], - [1, [1850000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "fee_to_send_taker_fee": { - "amount": "0.00033219", - "amount_fraction": { - "denom": "100000000", - "numer": "33219" - }, - "amount_rat": [ - [1, [33219]], - [1, [100000000]] - ], - "coin": "BTC", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "coin": "DOC", - "amount": "0.00001", - "amount_fraction": { - "numer": "1", - "denom": "100000" - }, - "amount_rat": [ - [1, [1]], - [1, [100000]] - ], - "required_balance": "0", - "required_balance_fraction": { - "numer": "0", - "denom": "1" - }, - "required_balance_rat": [ - [0, []], - [1, [1]] - ] - }, - { - "coin": "BTC", - "amount": "0.0036016308108108106", - "amount_fraction": { - "denom": "1850000000", - "numer": "6663017" - }, - "amount_rat": [ - [1, [6663017]], - [1, [1850000000]] - ], - "required_balance": "0.0036016308108108106", - "required_balance_fraction": { - "denom": "1850000000", - "numer": "6663017" - }, - "required_balance_rat": [ - [1, [6663017]], - [1, [1850000000]] - ] - } - ] - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "error": "The bot is already started", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:770]", + "error_type": "AlreadyStarted", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Start Version Stat Collection"; +export const description = "The start_version_stat_collection method initiates storing version statistics for nodes previously registered via the add_node_to_version_stat method."; -#### Command (ERC20 and QRC20) +# start\_version\_stat\_collection - +The `start_version_stat_collection` method initiates storing version statistics for nodes previously registered via the `add_node_to_version_stat` method. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to check node versions | + +#### 📌 Examples + +#### Command + + ```json { "mmrpc": "2.0", + "method": "start_version_stat_collection", "userpass": "testpsw", - "method": "trade_preimage", "params": { - "base": "BAT", - "rel": "QC", - "price": "1", - "volume": "2.21363478", - "swap_method": "setprice" - }, - "id": 0 + "interval": 600 + } } ``` -#### Response - -```json -{ - "mmrpc": "2.0", - "result": { - "base_coin_fee": { - "amount": "0.0045", - "amount_fraction": { - "denom": "2000", - "numer": "9" - }, - "amount_rat": [ - [1, [9]], - [1, [2000]] - ], - "coin": "ETH", - "paid_from_trading_vol": false - }, - "rel_coin_fee": { - "amount": "0.00325", - "amount_fraction": { - "denom": "4000", - "numer": "13" - }, - "amount_rat": [ - [0, [13]], - [1, [4000]] - ], - "coin": "QTUM", - "paid_from_trading_vol": false - }, - "total_fees": [ - { - "amount": "0.003", - "amount_fraction": { - "denom": "1000", - "numer": "3" - }, - "amount_rat": [ - [1, [3]], - [1, [1000]] - ], - "required_balance": "0.003", - "required_balance_fraction": { - "denom": "1000", - "numer": "3" - }, - "required_balance_rat": [ - [1, [3]], - [1, [1000]] - ], - "coin": "ETH" - }, - { - "amount": "0.00325", - "amount_fraction": { - "denom": "4000", - "numer": "13" - }, - "amount_rat": [ - [0, [13]], - [1, [4000]] - ], - "required_balance": "0.00325", - "required_balance_fraction": { - "denom": "4000", - "numer": "13" - }, - "required_balance_rat": [ - [0, [13]], - [1, [4000]] - ], - "coin": "QTUM" - } - ] - }, - "id": 0 -} -``` - -#### Response (NotSufficientBalance error) + + #### Response (success) -```json -{ - "mmrpc": "2.0", - "error": "Not enough BTC for swap: available 0.000015, required at least 0.10012, locked by swaps None", - "error_path": "maker_swap", - "error_trace": "maker_swap:1540] maker_swap:1641]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "BTC", - "available": "0.000015", - "required": "0.10012", - "locked_by_swaps": "0" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` -#### Response (VolumeTooLow error) + #### Response (error - invalid peer id unable to parse) -```json -{ - "mmrpc": "2.0", - "error": "The volume 0.00001 of the DOC coin less than minimum transaction amount 0.0001", - "error_path": "maker_swap", - "error_trace": "maker_swap:1599]", - "error_type": "VolumeTooLow", - "error_data": { - "coin": "DOC", - "volume": "0.00001", - "threshold": "0.0001" - }, - "id": 0 -} -``` + ```json + { + "mmrpc": "2.0", + "error": "Database error: UNIQUE constraint failed: nodes.peer_id", + "error_path": "lp_stats", + "error_trace": "lp_stats:124]", + "error_type": "DatabaseError", + "error_data": "UNIQUE constraint failed: nodes.peer_id", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Stop Simple Market Maker Bot"; +export const description = "The stop_simple_market_maker_bot method tells the bot to finish placing orders at the end of the current loop 30 seconds minimum and 30 seconds by default."; -#### Response (Transport error) +# stop\_simple\_market\_maker\_bot -```json -{ - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 -} -``` +The `stop_simple_market_maker_bot` method tells the bot to finish placing orders at the end of the current loop (30 seconds minimum & 30 seconds by default). This method takes as input a url to a price service, and configuration parameters of the pairs to trade at a defined spread percentage value. -#### Response (incorrect use of "max" error) +At the end of the final loop, orders placed by the bot will be cancelled. Users should wait until the loop ends before exiting the AtomicDEX API, otherwise orders will not cancel, and will reappear on the orderbook next time AtomicDEX API starts. -```json -{ - "mmrpc": "2.0", - "error": "Incorrect use of the 'max' parameter: 'max' cannot be used with 'sell' or 'buy' method", - "error_path": "taker_swap", - "error_trace": "taker_swap:1602]", - "error_type": "InvalidParam", - "error_data": { - "param": "max", - "reason": "'max' cannot be used with 'sell' or 'buy' method" - }, - "id": 0 -} -``` -export const title = "AtomicDEX Method: Update Version Stat Collection"; -export const description = "The update_version_stat_collection method updates the polling interval for version stats collection."; +## Arguments -# update\_version\_stat\_collection +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none ) | | | -The `update_version_stat_collection` method updates the polling interval for version stats collection. Note: the new interval will take effect after the current interval loop has completed. +#### 📌 Examples -## Arguments +#### Command -| Structure | Type | Description | -| --------- | ------- | ------------------------------------------------ | -| interval | integer | polling rate (in seconds) to query node versions | + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "stop_simple_market_maker_bot", + "params": {}, + "id": 0 + } + ``` + + + + #### Response (success) {{class : 'text-green-500'}} + + ```json + { + "mmrpc": "2.0", + "result": { + "result": "Success" + }, + "id": 0 + } + ``` + + #### Response (error - bot already stopped) {{class : 'text-red-500'}} + + ```json + { + "mmrpc": "2.0", + "error": "The bot is already stopped", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:813]", + "error_type": "AlreadyStopped", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Stop Version Stat Collection"; +export const description = "The stop_version_stat_collection method stops the collection of version stats at the end of the current loop interval."; + +# stop\_version\_stat\_collection + +The `stop_version_stat_collection` method stops the collection of version stats at the end of the current loop interval. + +#### Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | ---------------- | +| result | string | success or error | #### 📌 Examples #### Command - + ```json { "mmrpc": "2.0", - "method": "update_version_stat_collection", + "method": "stop_version_stat_collection", "userpass": "testpsw", - "params": { - "interval": 900 - } + "params": {} } ``` @@ -16887,107 +15392,187 @@ The `update_version_stat_collection` method updates the polling interval for ver #### Response (error - stats collection not running) - ```json - { - "mmrpc": "2.0", - "error": "start_version_stat_collection is not running", - "error_path": "lp_stats", - "error_trace": "lp_stats:374]", - "error_type": "NotRunning", - "id": null - } - ``` - -export const title = "AtomicDEX Method: Withdraw"; -export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; + ```json + { + "mmrpc": "2.0", + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:395]", + "error_type": "NotRunning", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Telegram Alerts for MM Bot"; +export const description = "The AtomicDEX API Market Maker bot can be configured to send status update alerts via Telegram."; + +# Telegram Alerts for Market Maker Bot + +The AtomicDEX API Market Maker bot can be configured to send status update alerts via [Telegram!](https://telegram.org/) + +To set this up, you can add some additional parameters to your MM2.json as shown in the example below + +```json +{ + "gui": "MarketMakerBot", + "netid": 8762, + "rpc_password": "YOUR_PASSWORD", + "passphrase": "YOUR SEED PHRASE", + "dbdir": "/path/to/your/atomicdex/DB", + "message_service_cfg": { + "telegram": { + "api_key": "YOUR:TELEGRAM_API_TOKEN", + "chat_registry": { + "default": "YOUR_TELEGRAM_CHAT_ID", + "maker_bot": "YOUR_TELEGRAM_CHAT_ID", + "swap_events": "YOUR_TELEGRAM_CHAT_ID" + } + } + } +} +``` + +The extra fields required are: + +| Parameter | Type | Description | +| --------------------------- | ------ | ------------------------ | +| api\_key | string | A Telegram bot API token | +| chat\_registry.default | string | A Telegram Chat ID | +| chat\_registry.maker\_bot | string | A Telegram Chat ID | +| chat\_registry.swap\_events | string | A Telegram Chat ID | + +You can use the same Telegram chat ID for all three `chat_registry` subfields, or sent your alerts to a different chat ID if you want to separate the alerts by type. + +To get a Telegram bot API token, you need to [have chat with the BotFather](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) + +To get a Telegram chat ID, check out [this guide](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) +export const title = "AtomicDEX Method: Trade Preimage"; +export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; + +# trade\_preimage + +The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. +Depending on the parameters, the function returns different results: + +* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. + The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; +* If the `max` field is true, then the result will include the `volume`. + + + This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. + Use the resulting `volume` as an argument of the `buy` or `sell` requests. + + + + Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. + + +## Arguments + +| Structure | Type | Description | +| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| base | string | the base currency of the request | +| rel | string | the rel currency of the request | +| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | +| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | +| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | +| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | + +### Result + +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | + +### ⚠ Error types -# withdraw +#### NotSufficientBalance -The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. +The `available` balance of the `coin` is not sufficient to start the swap. -This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount locked by other swaps | -## Arguments +#### NotSufficientBaseCoinBalance -| Structure | Type | Description | -| --------- | ---------------- | ----------------------------------------------------------------------------------- | -| coin | string | the name of the coin the user desires to withdraw | -| to | string | coins are withdrawn to this address | -| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | -| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | -| max | bool | withdraw the maximum available amount | -| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | +The available balance of the base `coin` is not sufficient to pay transaction fees. -### Response +For example, ERC20 fees are paid by ETH (gas), and this error type is returned if the ETH coin balance is not sufficient to start the swap. -| Structure | Type | Description | -| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | -| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | -| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | -| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | -| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | -| total\_amount | string (numeric) | the total amount of coins transferred | -| fee\_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | -| tx\_hash | string | the hash of the generated transaction | -| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | -| coin | string | the name of the coin the user wants to withdraw | -| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | -| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | -| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the base coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount is locked by other swaps | -### ⚠ Error types +#### VolumeTooLow -#### NotSufficientBalance +The specified `volume` is too low. Required at least `threshold`. -The `available` balance is not sufficient to transfer the specified amount. + + If the `coin` field returned in Response is the same as the `rel` argument in Request, then the base volume threshold can be calculated as follows: + `base_coin_threshold = rel_vol_threshold / price` + -| Structure | Type | Description | -| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | -| available | string (numeric) | the balance available for transfer | -| required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient | +| Structure | Type | Description | +| --------- | ---------------- | -------------------------------------------------- | +| coin | string | either `base` or `rel` coin specified in Request | +| volume | string (numeric) | the amount the user was willing to trade in `coin` | +| threshold | string (numeric) | the `volume` has not to be less than this amount | -#### ZeroBalanceToWithdrawMax +#### NoSuchCoin -The available balance is zero. +The specified coin was not found or is not activated yet. -| Structure | Type | Description | -| --------- | ---- | ----------- | -| (none) | | | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | -#### AmountTooLow +#### CoinIsWalletOnly -The specified amount is too low. Required at least `threshold`. +The specified coin is wallet only and cannot be participated in the swap. -| Structure | Type | Description | -| --------- | ---------------- | ---------------------------------------------------- | -| amount | string (numeric) | the amount the user was willing to transfer | -| threshold | string (numeric) | the `amount` has not to be less than the `threshold` | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | -#### InvalidAddress +#### BaseEqualRel -The specified `to` address is not valid. +The coin is wallet only and cannot be participated in the swap. -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| (none) | string | the error description | +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | -#### InvalidFeePolicy +#### InvalidParam -The specified `fee` is not valid. +Incorrect use of the `param` parameter in Request. -| Structure | Type | Description | -| --------- | ------ | --------------------- | -| (none) | string | the error description | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| param | string | the name of the parameter in Request | +| reason | string | the reason why the parameter is used incorrectly | -#### NoSuchCoin +#### PriceTooLow -The specified coin was not found or is not activated yet. +The specified `price` is too low. -| Structure | Type | Description | -| --------- | ------ | --------------------------------------------- | -| coin | string | the not found `coin` specified in the Request | +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------- | +| price | string (numeric) | the price in `rel` the user was willing to receive per one unit of the `base` coin | +| threshold | string (numeric) | the `price` has not to be less than this amount | #### Transport @@ -16999,7 +15584,7 @@ The request was failed due to a network error. #### InternalError -The request was failed due to an AtomicDEX API internal error. +The request was failed due to a AtomicDEX API internal error. | Structure | Type | Description | | --------- | ------ | ------------------------------ | @@ -17007,189 +15592,564 @@ The request was failed due to an AtomicDEX API internal error. ### 📌 Examples -#### Withdraw BTC, KMD, and other BTC-based forks +#### Command (setprice) - + ```json { + "mmrpc": "2.0", "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "setprice" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "paid_from_trading_vol": true + }, + "volume": "1138.46868712", + "volume_fraction": { + "numer": "14230858589", + "denom": "12500000" + }, + "volume_rat": [ + [1, [1345956701, 3]], + [1, [12500000]] + ], + "total_fees": [ + { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0.00001", + "required_balance_fraction": { + "numer": "1", + "denom": "100000" + }, + "required_balance_rat": [ + [1, [1]], + [1, [100000]] + ] + }, + { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` + +#### Command (buy) + + + ```json + { "mmrpc": "2.0", - "method": "withdraw", + "userpass": "testpsw", + "method": "trade_preimage", "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "buy" }, "id": 0 } ``` - - #### Response (KMD success) +#### Response - ```json - { - "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "KMD", - "fee_details": { - "type": "Utxo", - "amount": "0.00001" +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" }, - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "my_balance_change": "-10.00001", - "received_by_me": "0.34417325", - "spent_by_me": "10.34418325", - "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], - "total_amount": "10.34418325", - "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", - "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", - "kmd_rewards": { - "amount": "0.0791809", - "claimed_by_my": true - } + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": true }, - "id": 0 - } - ``` + "rel_coin_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "taker_fee": { + "amount": "0.00012870012870012872", + "amount_fraction": { + "denom": "7770", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [7770]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "amount_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "amount_rat": [ + [1, [50777]], + [1, [38850000]] + ], + "required_balance": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "required_balance_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "required_balance_rat": [ + [1, [50777]], + [1, [38850000]] + ] + }, + { + "coin": "tBTC", + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` - #### Response (NotSufficientBalance error) +#### Command (sell, max) + ```json { "mmrpc": "2.0", - "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:449]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "DOC", - "available": "69.75066225", - "required": "1000.00001" + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "2.21363478", + "swap_method": "sell" }, "id": 0 } ``` - + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": true + }, + "taker_fee": { + "amount": "0.0028489508108108107", + "amount_fraction": { + "denom": "1850000000", + "numer": "5270559" + }, + "amount_rat": [ + [1, [5270559]], + [1, [1850000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.00033219", + "amount_fraction": { + "denom": "100000000", + "numer": "33219" + }, + "amount_rat": [ + [1, [33219]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + }, + { + "coin": "BTC", + "amount": "0.0036016308108108106", + "amount_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "amount_rat": [ + [1, [6663017]], + [1, [1850000000]] + ], + "required_balance": "0.0036016308108108106", + "required_balance_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "required_balance_rat": [ + [1, [6663017]], + [1, [1850000000]] + ] + } + ] + }, + "id": 0 +} +``` -#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee +#### Command (ERC20 and QRC20) - + ```json { "mmrpc": "2.0", "userpass": "testpsw", - "method": "withdraw", + "method": "trade_preimage", "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoFixed", - "amount": "0.1" - } + "base": "BAT", + "rel": "QC", + "price": "1", + "volume": "2.21363478", + "swap_method": "setprice" }, "id": 0 } ``` - - #### Response (success) +#### Response - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.0045", + "amount_fraction": { + "denom": "2000", + "numer": "9" }, - "coin": "DOC", - "internal_id": "" + "amount_rat": [ + [1, [9]], + [1, [2000]] + ], + "coin": "ETH", + "paid_from_trading_vol": false }, - "id": 0 - } - ``` - + "rel_coin_fee": { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "amount": "0.003", + "amount_fraction": { + "denom": "1000", + "numer": "3" + }, + "amount_rat": [ + [1, [3]], + [1, [1000]] + ], + "required_balance": "0.003", + "required_balance_fraction": { + "denom": "1000", + "numer": "3" + }, + "required_balance_rat": [ + [1, [3]], + [1, [1000]] + ], + "coin": "ETH" + }, + { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "required_balance": "0.00325", + "required_balance_fraction": { + "denom": "4000", + "numer": "13" + }, + "required_balance_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM" + } + ] + }, + "id": 0 +} +``` -#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee +#### Response (NotSufficientBalance error) - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "DOC", - "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", - "amount": "1.0", - "fee": { - "type": "UtxoPerKbyte", - "amount": "1" - } - }, - "id": 0 - } - ``` - +```json +{ + "mmrpc": "2.0", + "error": "Not enough BTC for swap: available 0.000015, required at least 0.10012, locked by swaps None", + "error_path": "maker_swap", + "error_trace": "maker_swap:1540] maker_swap:1641]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "BTC", + "available": "0.000015", + "required": "0.10012", + "locked_by_swaps": "0" + }, + "id": 0 +} +``` - - #### Response (success) +#### Response (VolumeTooLow error) - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", - "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.00253836", - "spent_by_me": "60.00253836", - "received_by_me": "59.61874931", - "my_balance_change": "-0.38378905", - "block_height": 0, - "timestamp": 1566473421, - "fee_details": { - "type": "Utxo", - "amount": "0.38378905" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 - } - ``` - +```json +{ + "mmrpc": "2.0", + "error": "The volume 0.00001 of the DOC coin less than minimum transaction amount 0.0001", + "error_path": "maker_swap", + "error_trace": "maker_swap:1599]", + "error_type": "VolumeTooLow", + "error_data": { + "coin": "DOC", + "volume": "0.00001", + "threshold": "0.0001" + }, + "id": 0 +} +``` -#### Withdraw ETH, ERC20, and other ETH-based forks +#### Response (Transport error) + +```json +{ + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 +} +``` + +#### Response (incorrect use of "max" error) + +```json +{ + "mmrpc": "2.0", + "error": "Incorrect use of the 'max' parameter: 'max' cannot be used with 'sell' or 'buy' method", + "error_path": "taker_swap", + "error_trace": "taker_swap:1602]", + "error_type": "InvalidParam", + "error_data": { + "param": "max", + "reason": "'max' cannot be used with 'sell' or 'buy' method" + }, + "id": 0 +} +``` +export const title = "AtomicDEX Method: Update Version Stat Collection"; +export const description = "The update_version_stat_collection method updates the polling interval for version stats collection."; + +# update\_version\_stat\_collection + +The `update_version_stat_collection` method updates the polling interval for version stats collection. Note: the new interval will take effect after the current interval loop has completed. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to query node versions | + +#### 📌 Examples + +#### Command - + ```json { "mmrpc": "2.0", + "method": "update_version_stat_collection", "userpass": "testpsw", - "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "amount": 10 - }, - "id": 0 + "interval": 900 + } } ``` @@ -17200,111 +16160,147 @@ The request was failed due to an AtomicDEX API internal error. ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "ETH", - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" - }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" - }, - "id": 0 + "result": "success", + "id": null } ``` -#### ETH/ERC20 and other ETH-based forks, with gas fee + + #### Response (error - stats collection not running) - ```json { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "COIN_NAME", - "to": "RECIPIENT_ADDRESS", - "amount": "AMOUNT", - "fee": { - "type": "EthGas", - "gas_price": "3.5", - "gas": 55000 - } - }, - "id": 0 + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:374]", + "error_type": "NotRunning", + "id": null } ``` - + +export const title = "AtomicDEX Method: Withdraw"; +export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; - - #### Response (success) +# withdraw - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", - "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", - "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], - "total_amount": "10", - "spent_by_me": "10.0001925", - "received_by_me": "10", - "my_balance_change": "-0.0001925", - "block_height": 0, - "timestamp": 1566474670, - "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 55000, - "gas_price": "0.0000000035", - "total_fee": "0.0001925" - }, - "coin": "ETH", - "internal_id": "" - }, - "id": 0 - } - ``` +The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. - #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) +This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). - ```json - { - "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", - "error_path": "eth", - "error_trace": "eth:535]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'EthGas' fee type, found UtxoFixed", - "id": 0 - } - ``` - +## Arguments -#### Withdraw maximum +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | + +### Response + +| Structure | Type | Description | +| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | +| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | +| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | +| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | +| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | +| total\_amount | string (numeric) | the total amount of coins transferred | +| fee\_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | +| tx\_hash | string | the hash of the generated transaction | +| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | +| coin | string | the name of the coin the user wants to withdraw | +| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | +| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | +| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | + +### ⚠ Error types + +#### NotSufficientBalance + +The `available` balance is not sufficient to transfer the specified amount. + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | +| available | string (numeric) | the balance available for transfer | +| required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient | + +#### ZeroBalanceToWithdrawMax + +The available balance is zero. + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### AmountTooLow + +The specified amount is too low. Required at least `threshold`. + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------- | +| amount | string (numeric) | the amount the user was willing to transfer | +| threshold | string (numeric) | the `amount` has not to be less than the `threshold` | + +#### InvalidAddress + +The specified `to` address is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### InvalidFeePolicy + +The specified `fee` is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### NoSuchCoin + +The specified coin was not found or is not activated yet. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------- | +| coin | string | the not found `coin` specified in the Request | + +#### Transport + +The request was failed due to a network error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| (none) | string | the transport error description | + +#### InternalError + +The request was failed due to an AtomicDEX API internal error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------ | +| (none) | string | the internal error description | + +### 📌 Examples + +#### Withdraw BTC, KMD, and other BTC-based forks ```json { - "mmrpc": "2.0", "userpass": "testpsw", + "mmrpc": "2.0", "method": "withdraw", "params": { - "coin": "ETH", - "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", - "max": true + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" }, "id": 0 } @@ -17312,86 +16308,55 @@ The request was failed due to an AtomicDEX API internal error. - ##### Response (success) + #### Response (KMD success) ```json { "mmrpc": "2.0", "result": { "block_height": 0, - "coin": "ETH", + "coin": "KMD", "fee_details": { - "type": "Eth", - "coin": "ETH", - "gas": 21000, - "gas_price": "0.000000001", - "total_fee": "0.000021" + "type": "Utxo", + "amount": "0.00001" }, - "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], - "my_balance_change": "-10.000021", - "received_by_me": "0", - "spent_by_me": "10.000021", - "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], - "total_amount": "10.000021", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" - }, - "id": 0 - } - ``` - - -##### Withdraw QRC20 coins - - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10 + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } }, "id": 0 } ``` - - - ##### Response (success) + #### Response (NotSufficientBalance error) ```json { "mmrpc": "2.0", - "result": { - "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, - "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" }, "id": 0 } ``` -##### Withdraw QRC20 coins with gas limit +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee ```json @@ -17400,13 +16365,12 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "QRC20", - "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", - "amount": 10, + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", "fee": { - "type": "Qrc20Gas", - "gas_limit": 250000, - "gas_price": 40 + "type": "UtxoFixed", + "amount": "0.1" } }, "id": 0 @@ -17415,36 +16379,35 @@ The request was failed due to an AtomicDEX API internal error. + #### Response (success) + ```json { "mmrpc": "2.0", "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", "block_height": 0, - "coin": "QRC20", - "timestamp": 1608725061, + "timestamp": 1566472936, "fee_details": { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 250000, - "gas_price": 40, - "total_gas_fee": "0.1" + "type": "Utxo", + "amount": "0.1" }, - "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], - "my_balance_change": "-10", - "received_by_me": "0", - "spent_by_me": "10", - "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], - "total_amount": "10", - "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", - "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + "coin": "DOC", + "internal_id": "" }, "id": 0 } ``` -##### Withdraw Tendermint coins with a memo and custom gas fee +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee ```json @@ -17453,14 +16416,12 @@ The request was failed due to an AtomicDEX API internal error. "userpass": "testpsw", "method": "withdraw", "params": { - "coin": "IRIS", - "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", - "amount": 13, - "memo": "It was a bright cold day in April, and the clocks were striking thirteen.", + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", "fee": { - "type": "CosmosGas", - "gas_price": 0.05, - "gas_limit": 150000 + "type": "UtxoPerKbyte", + "amount": "1" } }, "id": 0 @@ -17469,116 +16430,48 @@ The request was failed due to an AtomicDEX API internal error. + #### Response (success) + ```json { "mmrpc": "2.0", "result": { - "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", - "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", - "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], - "total_amount": "13.038553", - "spent_by_me": "13.038553", - "received_by_me": "13", - "my_balance_change": "-0.038553", + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", "block_height": 0, - "timestamp": 0, + "timestamp": 1566473421, "fee_details": { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 + "type": "Utxo", + "amount": "0.38378905" }, - "coin": "IRIS", - "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", - "transaction_type": "StandardTransfer", - "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + "coin": "DOC", + "internal_id": "" }, "id": 0 } ``` - - You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) -### Error Responses - -#### InvalidRequest: Unknown fee type - -```json -{ - "mmrpc": "2.0", - "error": "Error parsing request: unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", - "id": 0 -} -``` - -#### InvalidRequest: wrong parameter type - -```json -{ - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string \"0.1\", expected f64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string \"0.1\", expected f64", - "id": 0 -} -``` - -#### InvalidFeePolicy: attempt to use EthGas for UTXO coin - -```json -{ - "mmrpc": "2.0", - "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "error_path": "utxo_common", - "error_trace": "utxo_common:1371]", - "error_type": "InvalidFeePolicy", - "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", - "id": 0 -} -``` -export const title = "AtomicDEX Method: Get Current MTP"; -export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; - -# get\_current\_mtp - -The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. - -## Arguments - -| Parameter | Type | Description | -| --------- | ------- | --------------------------------------------------------------------------------------- | -| coin | string | A compatible (UTXO) coin's ticker | -| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | - -#### Response - -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | -| mtp | integer | Unix timestamp | -| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | - -#### 📌 Examples - -#### Command +#### Withdraw ETH, ERC20, and other ETH-based forks - + ```json { - "method": "get_current_mtp", - "userpass": "testpsw", "mmrpc": "2.0", - "id": 42, + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 } ``` @@ -17590,49 +16483,48 @@ The `get_current_mtp` method returns the Median Time Past (MTP) from electrum se { "mmrpc": "2.0", "result": { - "mtp": 1658746383 - }, - "id": 42 - } - ``` - -export const title = "AtomicDEX Method: Get Locked Amount"; -export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - -# get\_locked\_amount - -The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. - -## Arguments - -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | - -#### Response - -| Parameter | Type | Description | -| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | - -#### 📌 Examples + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + -#### Command +#### ETH/ERC20 and other ETH-based forks, with gas fee - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_locked_amount", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC" + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } }, - "id": 42 + "id": 0 } ``` @@ -17644,985 +16536,858 @@ The `get_locked_amount` method returns the amount of a coin which is currently l { "mmrpc": "2.0", "result": { - "coin": "DOC", - "locked_amount": { - "decimal": "0.77803", - "rational": [ - [1, [77803]], - [1, [100000]] - ], - "fraction": { - "numer": "77803", - "denom": "100000" - } - } + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", + "block_height": 0, + "timestamp": 1566474670, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" + }, + "coin": "ETH", + "internal_id": "" }, - "id": 42 + "id": 0 } ``` - #### Response (error) + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) ```json { "mmrpc": "2.0", - "error": "No such coin: TIME", - "error_path": "lp_swap.lp_coins", - "error_trace": "lp_swap:486] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" - }, - "id": 42 + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", + "id": 0 } ``` -export const title = "AtomicDEX: HD Address Management"; -export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; - -# Heirarchical Deterministic Address Management - -A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. - -## can\_get\_new\_address - -To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. - -#### Arguments - -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | -#### Response - -| Parameter | Type | Description | -| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.allowed | boolean | Whether or not you can get a new address. | -| result.reason | string | The reason you cant get a new address (if allowed is `false`). | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | - -Other reasons you might not be able to get a new address are: - -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) - -#### 📌 Examples - -#### Command +#### Withdraw maximum - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "can_get_new_address", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true + }, + "id": 0 } ``` - #### Response (success, allowed) + ##### Response (success) ```json { "mmrpc": "2.0", "result": { - "allowed": true + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, - "id": null + "id": 0 } ``` + - #### Response (success, not allowed) +##### Withdraw QRC20 coins + ```json { "mmrpc": "2.0", - "result": { - "allowed": false, - "reason": "LastAddressNotUsed", - "details": { - "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" - } + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 }, - "id": null + "id": 0 } ``` - - -## get\_new\_address - -If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. - -#### Arguments - -| Parameter | Type | Description | -| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you want to get a new address for | -| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | -| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| gap\_limit | integer | The maximum number of empty addresses in a row. | - -#### Response - -| Parameter | Type | Description | -| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Returns with value `success` when successful, otherwise returns the error values below | -| result.new\_address | object | Contains details about your new address. | -| result.address | string | The new address that was generated. | -| result.details | object | Contains extra contextual information about the reason why allowed is `false` | -| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | -| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | -| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | -| result.details.balance | object | Contains the spendable and unspendable balance for this address | -| result.details.balance.spendable | string(numeric) | Spendable balance for this address | -| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | - -Other reasons you might not be able to get a new address are: + -* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. -* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + + ##### Response (success) -#### 📌 Examples + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + -#### Command +##### Withdraw QRC20 coins with gas limit - + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "get_new_address", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "DOC", - "account_id": 0, - "chain": "External", - "gap_limit": 20 - } + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, + "fee": { + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 + } + }, + "id": 0 } ``` - #### Response (success) - ```json { "mmrpc": "2.0", "result": { - "allowed": true + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" }, - "id": null + "id": 0 } ``` + - #### Response (success, not allowed) +##### Withdraw Tendermint coins with a memo and custom gas fee + ```json { "mmrpc": "2.0", - "result": { - "new_address": { - "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", - "derivation_path": "m/44'/141'/0'/0/3", - "chain": "External", - "balance": { - "spendable": "0", - "unspendable": "0" - } + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen.", + "fee": { + "type": "CosmosGas", + "gas_price": 0.05, + "gas_limit": 150000 } }, - "id": null + "id": 0 } ``` - -export const title = "AtomicDEX: HD Wallets Overview"; -export const description = - "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; - -# HD Wallets Overview - -The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! - -For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. - -To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. - -## Initialisation and authentication: - -* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) -* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) -* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) -* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) - -## UTXO Coin Activation in Hardware Mode: - -* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. -* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) -* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) - -## QTUM Coin Activation in Hardware Mode: - -* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. -* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) -* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) - -## Withdrawing your Funds: - -* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) -* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) -* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) - -## Viewing Hardware Wallet Coin Balances: - -* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) -* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) - -## Creating New Addresses: - -* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. -* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address - - - These methods (and others with a `task::` prefix) will be linked to a numeric - `task_id` value which is used to query the status or outcome of the task. - - -## Details for HwError error type - -When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). - -### FoundUnexpectedDevice - -The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter - -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found unexpected device. Please re-initialize Hardware wallet", - "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", - "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", - "error_type": "HwError", - "error_data": "FoundUnexpectedDevice" - } - }, - "id": null -} -``` - -### FoundMultipleDevices + -Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", + "block_height": 0, + "timestamp": 0, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + }, + "id": 0 + } + ``` -```json -{ - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "Found multiple devices. Please unplug unused devices", - "error_path": "init_hw.crypto_ctx.hw_client", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", - "error_type": "HwError", - "error_data": "FoundMultipleDevices" - } - }, - "id": null -} -``` + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) + -### NoTrezorDeviceAvailable +### Error Responses -No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. +#### InvalidRequest: Unknown fee type ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "No Trezor device available", - "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", - "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", - "error_type": "HwError", - "error_data": "NoTrezorDeviceAvailable" - } - }, - "id": null -} -``` -export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; -export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; - -# AtomicDEX API RPC Protocol v2.0 (Dev) - -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. - -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. - -## Request - -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | - -### Response (Success) - -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| result | object | the value of this field is determined by the method invoked on AtomicDEX API | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### Response (Error) - -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### 📌 Examples - -#### Command - - - ```json - { "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" - }, + "error": "Error parsing request: unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "unknown variant `Tendermint`, expected one of `UtxoFixed`, `UtxoPerKbyte`, `EthGas`, `Qrc20Gas`, `CosmosGas`", "id": 0 - } - ``` - +} +``` -#### Response (success) +#### InvalidRequest: wrong parameter type ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string \"0.1\", expected f64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string \"0.1\", expected f64", + "id": 0 } ``` -#### Response (error) +#### InvalidFeePolicy: attempt to use EthGas for UTXO coin ```json { "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", "id": 0 } ``` -export const title = "AtomicDEX: Lightning Network Initialization Tasks"; -export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; -# Lightning Network Initialization Tasks +# get\_current\_mtp - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. -## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} +## Arguments -The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. - +#### Response -### Request Parameters +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | +#### 📌 Examples -#### 📌 Example +#### Command - + ```json { - "method": "task::enable_lightning::init", + "method": "get_current_mtp", "userpass": "testpsw", "mmrpc": "2.0", + "id": 42, "params": { - "ticker": "tBTC-lightning", - "activation_params": { - "name": "AtomicDEX-Docs-Node-1", - "listening_port": 9735, - "color": "000000", - "payment_retries": 5 - } - }, - "id": 2 + "coin": "DOC" + } } ``` - ### Response Parameters - - | Parameter | Type | Description | - | --------- | ------- | --------------------------------------------------------- | - | task\_id | integer | An identifying number which is used to query task status. | - - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": { - "task_id": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "mtp": 1658746383 + }, + "id": 42 } ``` +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; - - #### L2ConfigIsNotFound Error - - Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. - - ```json - { - "mmrpc": "2.0", - "error": "Layer 2 tBTC-lightning config is not found", - "error_path": "init_l2.prelude", - "error_trace": "init_l2:82] prelude:82]", - "error_type": "L2ConfigIsNotFound", - "error_data": "tBTC-lightning", - "id": 2 - } - ``` - - #### InvalidRequest Error +# get\_locked\_amount - A parameter is incorrect. +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string "9735", expected u16", - "error_path": "dispatcher", - "error_trace": "dispatcher:110]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string "9735", expected u16", - "id": 762 - } - ``` +## Arguments - #### UnexpectedL2Protocol Error +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | - Coin is wrong protocol type. +#### Response - ```json - { - "mmrpc": "2.0", - "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", - "error_path": "init_l2.prelude.lightning_activation", - "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", - "error_type": "UnexpectedL2Protocol", - "error_data": { - "ticker": "tBTC-segwit", - "protocol": { - "type": "UTXO" - } - }, - "id": 2 - } - ``` +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | - #### Internal Error +#### 📌 Examples - Address already in use. +#### Command + ```json { - "mmrpc": "2.0", - "result": { - "status": "Error", - "details": { - "error": "I/O error Address already in use (os error 48)", - "error_path": "lib.lightning_activation.ln_p2p", - "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", - "error_type": "Internal", - "error_data": "I/O error Address already in use (os error 48)" - } - }, - "id": null + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 } ``` + - #### PlatformCoinIsNotActivated Error - - The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + + #### Response (success) ```json { - "mmrpc": "2.0", - "error": "Platform coin tBTC-lightning is not activated", - "error_path": "init_l2.lp_coins", - "error_trace": "init_l2:87] lp_coins:3087]", - "error_type": "PlatformCoinIsNotActivated", - "error_data": "tBTC-lightning", - "id": 2 + "mmrpc": "2.0", + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } + }, + "id": 42 } ``` - - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) - Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. - - - #### InvalidPlatformConfiguration Error - - Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + #### Response (error) ```json { - "mmrpc": "2.0", - "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", - "error_path": "init_l2.lightning_activation", - "error_trace": "init_l2:95] lightning_activation:254]", - "error_type": "InvalidPlatformConfiguration", - "error_data": { - "platform_coin_ticker": "tBTC-segwit", - "err": "'avg_blocktime' field is not found in platform coin config" - }, - "id": 2 + "mmrpc": "2.0", + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": 42 } ``` +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; -## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} +# Heirarchical Deterministic Address Management -The `task::enable_lightning::status` request checks the status of lightning node initialization. +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. -### Request Parameters +## can\_get\_new\_address -| Parameter | Type | Description | -| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | -| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. -#### 📌 Example +#### Arguments - +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::status", + "method": "can_get_new_address", "params": { - "task_id": 1, - "forget_if_finished": false - }, - "id": 2 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - ### Response Parameters - - | Parameter | Type | Description | - | -------------- | ------ | ---------------------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | - - - The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. - - - #### Response (ready, success) + #### Response (success, allowed) ```json { - "mmrpc": "2.0", - "result": { - "status": "Ok", - "details": { - "platform_coin": "BTC-segwit", - "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", - "balance": { - "spendable": "0", - "unspendable": "0" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null } ``` - - In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. - Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. - For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). - - - #### Response (in progress state) + #### Response (success, not allowed) ```json { - "mmrpc": "2.0", - "result": { - "status": "InProgress", - "details": "ReadingNetworkGraphFromFile" - }, - "id": null + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null } ``` + - Possible in progress statuses: +## get\_new\_address - * ActivatingCoin - * GettingFeesFromRPC - * ReadingNetworkGraphFromFile - * InitializingChannelManager - * InitializingPeerManager - * ReadingScorerFromFile - * InitializingBackgroundProcessor - * ReadingChannelsAddressesFromFile - +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. -## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} +#### Arguments -The `task::enable_lightning::cancel` request cancels lightning node initialization. +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | -### Request Parameters +#### Response -| Parameter | Type | Description | -| --------- | ------- | -------------------------------------------------------- | -| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | -#### 📌 Example +Other reasons you might not be able to get a new address are: - +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "task::enable_lightning::cancel", + "method": "get_new_address", "params": { - "task_id": 1 - }, - "id": 1 + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } } ``` - #### Response + #### Response (success) ```json { - "mmrpc": "2.0", - "result": "success", - "id": null + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null } ``` - - - - #### TaskFinished Error - Task has already been completed. + #### Response (success, not allowed) ```json { - "mmrpc": "2.0", - "error": "Task is finished already", - "error_path": "init_l2.manager", - "error_trace": "init_l2:157] manager:104]", - "error_type": "TaskFinished", - "error_data": 3, - "id": null + "mmrpc": "2.0", + "result": { + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` -export const title = "AtomicDEX: Lightning Network Channels"; -export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; -# Lightning Network Channels +# HD Wallets Overview + +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! + +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. + +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. -## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} +## Details for HwError error type -The `lightning::channels::open_channel` method opens a new channel with a remote node. +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). -### Request Parameters +### FoundUnexpectedDevice -| Parameter | Type | Description | -| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to open a channel for. | -| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | -| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter -#### 📌 Example using an exact amount +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::open_channel", - "params": { - "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Exact", - "value": 0.004 - } - }, - "id": 22 - } - ``` - +### FoundMultipleDevices - - #### Response +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. - ```json - { - "mmrpc": "2.0", - "result": { - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" - }, - "id": 22 - } - ``` - +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` -#### 📌 Example using max available with channel options and configs +### NoTrezorDeviceAvailable - - ```json - { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::open_channel", - "params": { - "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", - "amount": { - "type": "Max" - }, - "push_msat": 0, - "channel_options": { - "proportional_fee_in_millionths_sats": 0, - "base_fee_msat": 1000, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 - }, - "channel_configs": { - "counterparty_locktime": 144, - "our_htlc_minimum_msat": 1, - "negotiate_scid_privacy": false, - "max_inbound_in_flight_htlc_percent": 10, - "commit_upfront_shutdown_pubkey": true, - "inbound_channels_confirmations": 3, - "their_channel_reserve_sats": 10000 - } - }, - "id": null - } - ``` - +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. - - #### Response +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; - ```json - { - "mmrpc": "2.0", - "result": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" - }, - "id": null - } - ``` - +# AtomicDEX API RPC Protocol v2.0 (Dev) -## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. -The `lightning::channels::close_channel` method closes a channel with a remote node. +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. -### Request Parameters +## Request -| Parameter | Type | Description | -| ------------ | ------- | ---------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to close a channel for. | -| uuid | string | Unique channel identifier. | -| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | - - It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. - Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. - +### Response (Success) -#### 📌 Example to force closing a channel +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - +### Response (Error) + +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### 📌 Examples + +#### Command + + ```json { - "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::close_channel", + "userpass": "testpsw", + "method": "withdraw", "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "force_close": true + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" }, - "id": 8 + "id": 0 } ``` - - #### Response - - ```json - { - "mmrpc": "2.0", - "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 - } - ``` +#### Response (success) - - To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. - +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` - - Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) - - +#### Response (error) - - #### InvalidRequest Error +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `uuid`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `uuid`", - "id": 8 - } - ``` +# Lightning Network Initialization Tasks - #### NoSuchChannel Error + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + - ```json - { - "mmrpc": "2.0", - "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", - "error_path": "close_channel", - "error_trace": "close_channel:55]", - "error_type": "NoSuchChannel", - "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "id": 8 - } - ``` - +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} -## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. -The `lightning::channels::update_channel` method updates channel options. + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + ### Request Parameters -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { + "method": "task::enable_lightning::init", "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::update_channel", "params": { - "coin": "tBTC-lightning", - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_satoshis": 1000 + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 } }, "id": 2 @@ -18631,246 +17396,255 @@ The `lightning::channels::update_channel` method updates channel options. + ### Response Parameters + + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | + #### Response ```json { - "mmrpc": "2.0", - "result": { - "channel_options": { - "proportional_fee_in_millionths_sats": 1, - "base_fee_msat": 1100, - "cltv_expiry_delta": 72, - "max_dust_htlc_exposure_msat": 5000000, - "force_close_avoidance_max_fee_sats": null - } - }, - "id": 2 + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null } ``` - #### NoSuchChannel Error + #### L2ConfigIsNotFound Error - Channel with the given uuid is not foun on the lightning network. + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. ```json { "mmrpc": "2.0", - "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", - "error_path": "update_channel", - "error_trace": "update_channel:61]", - "error_type": "NoSuchChannel", - "error_data": "dc33b998-8589-44fd-a246-256a582e8942", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", "id": 2 } ``` - - -## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} -The `lightning::channels::get_channel_details` method returns details about a channel. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------ | -| coin | string | The ticker of the coin you would like to view channel details for. | -| uuid | string | Unique channel identifier. | + #### InvalidRequest Error -#### 📌 Example to update all available channel options + A parameter is incorrect. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::get_channel_details", - "params": { - "coin": "tBTC-lightning", - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" - }, - "id": 54 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 } ``` - - - - The response will vary depending on whether the channel status is `open` or `closed`. - + #### UnexpectedL2Protocol Error - #### Response (opened channel) + Coin is wrong protocol type. ```json { "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 959722, - "is_outbound": true, - "balance_msat": 959722000, - "outbound_capacity_msat": 950125000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": 3, - "is_ready": false, - "is_usable": false, - "is_public": false + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" } }, - "id": 54 + "id": 2 } ``` - - `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. - It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) - + #### Internal Error - #### Response (closed channel) + Address already in use. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null + } + ``` + + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. ```json { "mmrpc": "2.0", - "result": { - "status": "Open", - "details": { - "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", - "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", - "funding_value": "98982", - "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", - "closure_reason": "null", - "claiming_tx": "null", - "claimed_balance": "null", - "funding_generated_in_block": "null", - "is_outbound": false, - "is_public": true, - "is_closed": true, - "created_at": 167273496966, - "closed_at": 171069595935 - } - }, - "id": 54 + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 } ``` - The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. - - - #### InvalidRequest Error + #### InvalidPlatformConfiguration Error + + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. ```json { "mmrpc": "2.0", - "error": "Error parsing request: missing field `coin`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `coin`", - "id": 54 + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 } ``` -## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} -The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. +The `task::enable_lightning::status` request checks the status of lightning node initialization. ### Request Parameters -| Parameter | Type | Description | -| --------------------------------- | ------- | ------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view claimable balances for. | -| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | -#### 📌 Example to update all available channel options +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::get_claimable_balances", + "method": "task::enable_lightning::status", "params": { - "coin": "tBTC-lightning", - "include_open_channels_balances": true + "task_id": 1, + "forget_if_finished": false }, - "id": 762 + "id": 2 } ``` - #### Response + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) ```json { - "mmrpc": "2.0", - "result": [{ - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 0 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 38815 - } - }, { - "ClaimableOnChannelClose": { - "claimable_amount_satoshis": 959539 - } - }], - "id": 762 + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null } ``` - - This response may include additional information in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) - + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null + } + ``` + + Possible in progress statuses: + + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile -## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} -The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. +The `task::enable_lightning::cancel` request cancels lightning node initialization. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | - -#### 📌 Example without using `filter` parameter +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "task::enable_lightning::cancel", "params": { - "coin": "tBTC-lightning" + "task_id": 1 }, - "id": 55 + "id": 1 } ``` @@ -18880,113 +17654,71 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of ```json { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "funding_tx": null, - "funding_tx_output_index": null, - "funding_tx_value_sats": 4000, - "is_outbound": true, - "balance_msat": 4000000, - "outbound_capacity_msat": 4000000, - "inbound_capacity_msat": 0, - "current_confirmations": 0, - "required_confirmations": null, - "is_ready": false, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 + "mmrpc": "2.0", + "result": "success", + "id": null } ``` -#### 📌 Example with `filter` for inbound channels only + + #### TaskFinished Error -#### Command + Task has already been completed. - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "is_outbound": false - } - }, - "id": 55 + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null } ``` - + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; - - #### Response +# Lightning Network Channels - ```json - { - "mmrpc": "2.0", - "result": { - "open_channels": [{ - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 55 - } - ``` - + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + -#### 📌 Example with `filter` for a specific `node_id` +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} -#### Command +The `lightning::channels::open_channel` method opens a new channel with a remote node. - +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + +#### 📌 Example using an exact amount + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::channels::open_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 } }, - "id": 55 + "id": 22 } ``` @@ -18998,54 +17730,47 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 215, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" }, - "id": 55 + "id": 22 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - -#### Command +#### 📌 Example using max available with channel options and configs - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_open_channels_by_filter", + "method": "lightning::channels::open_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 1000, - "to_funding_value_sats": 500000 + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 } }, - "id": 55 + "id": null } ``` @@ -19057,79 +17782,45 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of { "mmrpc": "2.0", "result": { - "open_channels": [{ - "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", - "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": true, - "balance_msat": 38998197, - "outbound_capacity_msat": 38598197, - "inbound_capacity_msat": 1803, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": true, - "is_public": false - }, { - "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", - "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", - "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", - "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", - "funding_tx_output_index": 0, - "funding_tx_value_sats": 40000, - "is_outbound": false, - "balance_msat": 5211, - "outbound_capacity_msat": 0, - "inbound_capacity_msat": 38994789, - "current_confirmations": 218, - "required_confirmations": 3, - "is_ready": true, - "is_usable": false, - "is_public": false - }], - "limit": 10, - "skipped": 0, - "total": 2, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, - "id": 55 + "id": null } ``` -## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} -The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. +The `lightning::channels::close_channel` method closes a channel with a remote node. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | -#### 📌 Example without using `filter` parameter + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + -#### Command +#### 📌 Example to force closing a channel - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::channels::close_channel", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true }, - "id": 55 + "id": 8 } ``` @@ -19137,163 +17828,86 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list #### Response - ```json - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }, - { - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` - - -#### 📌 Example with `filter` for inbound channels only - -#### Command - - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "channel_type": "Inbound" - } - }, - "id": 55 + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 } ``` - - - - #### Response - ```json + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", - "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", - "is_outbound": false, - "is_public": false, - "is_closed": true, - "created_at": 1683866505, - "closed_at": 1683866505 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 - } - ``` + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + -#### 📌 Example with `filter` for a specific `node_id` - -#### Command + + #### InvalidRequest Error - ```json { - "userpass": "testpsw", - "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", - "params": { - "coin": "tBTC-lightning", - "filter": { - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - } - }, - "id": 55 + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 } ``` - - - - #### Response - ```json + #### NoSuchChannel Error - {"mmrpc": "2.0", - "result": { - "closed_channels": [{ - "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", - "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", - "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1683864431, - "closed_at": 1683864432 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, "id": 55 + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 } ``` -#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} -#### Command +The `lightning::channels::update_channel` method updates channel options. - +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | + +#### 📌 Example to update all available channel options + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::channels::list_closed_channels_by_filter", + "method": "lightning::channels::update_channel", "params": { "coin": "tBTC-lightning", - "filter": { - "from_funding_value_sats": 100000, - "to_funding_value_sats": 500000 + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 } }, - "id": 55 + "id": 2 } ``` @@ -19305,313 +17919,356 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list { "mmrpc": "2.0", "result": { - "closed_channels": [{ - "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", - "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", - "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", - "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", - "funding_value": 40000, - "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", - "closure_reason": "Channel closed because the channel was cooperatively closed", - "funding_generated_in_block": 2433122, - "is_outbound": true, - "is_public": false, - "is_closed": true, - "created_at": 1684083341, - "closed_at": 1684146940 - }], - "limit": 10, - "skipped": 0, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null } }, - "id": 762 + "id": 2 } ``` -export const title = "AtomicDEX: Lightning Network Methods"; -export const description = - "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - -import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - -# Lightning Network Methods - - - Lightning methods are currently only available using the native AtomicDEX-API. - WASM support should be available in late 2023. - - -## Lightning Network Initialization Tasks - -* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) -* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - - - Any methods with a `task::` prefix will be linked to a numeric `task_id` value - which is used to query the status or outcome of the task. - - -## Lightning Network Nodes Methods - -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) -* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) -* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - -## Lightning Network Channels Methods - -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) -* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) -* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) -* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) -* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) -* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - -## Lightning Network Payments Methods - -* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) -* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -## Lightning Network Flowchart - -Once you: - -* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) -* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) -* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) - -You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! - -Then you can: - -* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) -* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) -* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) - -Follow the flowchart below to visualize the process: - - - -## Lightning Network Coins File Configuration - - Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) - param must be set in the `coins` configuration file, and aplies to all - channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and - [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters - are set per channel. These can be defined in the `coins` configuration file to - act as the default for all opened channels, and optionally overwritten or - updated using the - [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or - [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) - methods. - - -### Lightning Coin Config Parameters - -| Parameter | Type | Description | -| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | -| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | -| decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | -| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | -| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + #### NoSuchChannel Error - - For GUIs and wallet apps, it is recommended to set - `accept_forwards_to_priv_channels` to `false`. This prevents users from taking - on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) - should also be set to `false` for GUIs and wallet apps. - + Channel with the given uuid is not foun on the lightning network. - ```json - { - "coin": "BTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_config": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3, - "force_announced_channel_preference": false - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "BTC-segwit", - "network": "mainnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, - { - "coin": "tBTC-lightning", - "mm2": 1, - "decimals": 11, - "our_channels_configs": { - "inbound_channels_confirmations": 3, - "max_inbound_in_flight_htlc_percent": 90, - "their_channel_reserve_sats": 10000 - }, - "counterparty_channel_config_limits": { - "outbound_channels_confirmations": 3 - }, - "protocol": { - "type": "LIGHTNING", - "protocol_data":{ - "platform": "tBTC-segwit", - "network": "testnet", - "confirmation_targets": { - "background": 12, - "normal": 6, - "high_priority": 1 - } - } - } - }, + { + "mmrpc": "2.0", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", + "id": 2 + } ``` -export const title = "AtomicDEX: Lightning Network Nodes"; -export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; - -# Lightning Network Nodes - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - -## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} -The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. +The `lightning::channels::get_channel_details` method returns details about a channel. ### Request Parameters -| Parameter | Type | Description | -| ------------- | ------ | ----------------------------------------------------------------------------------- | -| coin | string | The coin ticker you would like to connect to a node on. | -| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | -#### 📌 Example +#### 📌 Example to update all available channel options - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::connect_to_node", + "method": "lightning::channels::get_channel_details", "params": { "coin": "tBTC-lightning", - "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" }, - "id": 1 + "id": 54 } ``` - - The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. - Other node addresses can be retrieved from any lightning explorer, such as: - - * [https://1ml.com/](https://1ml.com/) - * [https://mempool.space/lightning/](https://mempool.space/lightning/) - - - #### Response (success) + + The response will vary depending on whether the channel status is `open` or `closed`. + + + #### Response (opened channel) ```json { - "mmrpc": "2.0", - "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 } ``` - #### Response (already connected) + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + + + #### Response (closed channel) ```json { - "mmrpc": "2.0", - "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", - "id": null + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 } ``` + + + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + - #### InvalidRequest Error (Invalid node\_address) + #### InvalidRequest Error ```json { "mmrpc": "2.0", - "error": "Error parsing request: Could not parse node address from str rgjhk3", + "error": "Error parsing request: missing field `coin`", "error_path": "dispatcher", "error_trace": "dispatcher:109]", "error_type": "InvalidRequest", - "error_data": "Could not parse node address from str rgjhk3", + "error_data": "missing field `coin`", + "id": 54 + } + ``` + + +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} + +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. + +### Request Parameters + +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | + +#### 📌 Example to update all available channel options + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_claimable_balances", + "params": { + "coin": "tBTC-lightning", + "include_open_channels_balances": true + }, + "id": 762 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], "id": 762 } ``` - #### ConnectionError Error (Timed out waiting to connect to node\_address) + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + + + +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} + +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without using `filter` parameter + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning" + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 + } + ``` + + + + #### Response ```json { - "mmrpc": "2.0", - "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "error_path": "connect_to_node", - "error_trace": "connect_to_node:78]", - "error_type": "ConnectionError", - "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", - "id": null + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 } ``` -## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - -The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to view your trusted nodes to. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::list_trusted_nodes", + "method": "lightning::channels::list_open_channels_by_filter", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" + } }, - "id": 1 + "id": 55 } ``` @@ -19623,37 +18280,54 @@ The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes i { "mmrpc": "2.0", "result": { - "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 1 + "id": 55 } ``` -## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - -The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------------------------------------- | -| coin | string | The coin ticker you would like to add a trusted node for. | -| node\_id | string | ID of node you would like to add to your trusted list. | +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value -#### 📌 Example +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::add_trusted_node", + "method": "lightning::channels::list_open_channels_by_filter", "params": { "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 + } }, - "id": 1 + "id": 55 } ``` @@ -19665,37 +18339,79 @@ The `lightning::nodes::add_trusted_node` method allows you to add a node to your { "mmrpc": "2.0", "result": { - "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, - "id": 1 + "id": 55 } ``` -## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} -The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------- | -| coin | string | The coin ticker you would like to remove a trusted node from. | -| node\_id | string | ID of node you would like to remove from your trusted list. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without using `filter` parameter - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::nodes::remove_trusted_node", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { - "coin": "tBTC-lightning", - "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + "coin": "tBTC-lightning" }, - "id": 1 + "id": 55 } ``` @@ -19704,52 +18420,59 @@ The `lightning::nodes::remove_trusted_node` method allows you to remove a node f #### Response ```json - { - "mmrpc": "2.0", + {"mmrpc": "2.0", "result": { - "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" - }, - "id": 1 + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -export const title = "AtomicDEX: Lightning Network Payments"; -export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - -# Lightning Network Payments - - - Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. - -## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} - -The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. - -### Request Parameters - -| Parameter | Type | Description | -| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of coin to generate invoice for. | -| description | string | A note to indicate the purpose of the invoice. | -| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | -| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | +#### 📌 Example with `filter` for inbound channels only -#### 📌 Example +#### Command - + ```json { - "method": "lightning::payments::generate_invoice", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "expiry": 600 + "filter": { + "channel_type": "Inbound" + } }, - "id": 1 + "id": 55 } ``` @@ -19758,62 +18481,49 @@ The `lightning::payments::generate_invoice` method generates an invoice to be pa #### Response ```json - { - "mmrpc": "2.0", - "result": { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" - }, - "id": 1 - } - ``` - - - - ### InvalidRequest (invalid paramater value) - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid type: string '56', expected u64", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid type: string '56', expected u64", - "id": 762 + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} - -The `lightning::payments::send_payment` method sends a payment to another node. - -Used to pay an invoice or send a payment via pubkey/address. - -### Request Parameters - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | +#### 📌 Example with `filter` for a specific `node_id` -#### 📌 Example using `invoice` +#### Command - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "payment": { - "type": "invoice", - "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" } }, - "id": 6 + "id": 55 } ``` @@ -19822,34 +18532,50 @@ Used to pay an invoice or send a payment via pubkey/address. #### Response ```json - { - "mmrpc": "2.0", + + {"mmrpc": "2.0", "result": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" - }, - "id": 762 + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 } ``` -#### 📌 Example using `keysend` +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value - +#### Command + + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "lightning::payments::send_payment", + "method": "lightning::channels::list_closed_channels_by_filter", "params": { "coin": "tBTC-lightning", - "payment": { - "type": "keysend", - "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", - "amount_in_msat": 1000, - "expiry": 24 + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 } }, - "id": 6 + "id": 55 } ``` @@ -19861,350 +18587,311 @@ Used to pay an invoice or send a payment via pubkey/address. { "mmrpc": "2.0", "result": { - "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } }, "id": 762 } ``` +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; - - ### PaymentError (attempt to pay self) +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:231]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", - "id": 6 - } - ``` +# Lightning Network Methods - ### PaymentError (no outbound routes) + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", - "id": 762 - } - ``` +## Lightning Network Initialization Tasks - ### PaymentError (keysend - no path to destination) +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:107] lightning:256]", - "error_type": "PaymentError", - "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", - "id": 762 - } - ``` + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + - ### PaymentError (invoice - no path to destination) +## Lightning Network Nodes Methods - ```json - { - "mmrpc": "2.0", - "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "error_path": "send_payment.lightning", - "error_trace": "send_payment:102] lightning:232]", - "error_type": "PaymentError", - "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", - "id": 762 - } - ``` +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) - ### InvalidRequest (request is missing a required field) +## Lightning Network Channels Methods - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `payment`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `payment`", - "id": 762 - } - ``` +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) - ### InvalidRequest (A required field is invalid) +## Lightning Network Payments Methods - ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "ParseError(Bech32Error(MissingSeparator))", - "id": 762 - } - ``` - +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) -## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! -The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. +Then you can: -### Request Parameters +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) -| Parameter | Type | Description | -| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | Ticker of the coin to query. | -| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | +Follow the flowchart below to visualize the process: -#### 📌 Example + - - ```json - { - "method": "lightning::payments::get_payment_details", - "userpass": "testpsw", - "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" - }, - "id": 1 - } - ``` - +## Lightning Network Coins File Configuration - - ```json - { - "mmrpc": "2.0", - "result": { - "payment_details": { - "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", - "payment_type": { - "type": "Outbound Payment", - "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" - }, - "description": "1 Blokaccino", - "amount_in_msat": 1000000, - "fee_paid_msat": 1803, - "status": "succeeded", - "created_at": 1684081413, - "last_updated": 1684081419 - } - }, - "id": 762 - } - ``` - + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + - - ### NoSuchPayment (payment hash not found) +### Lightning Coin Config Parameters - ```json - { - "mmrpc": "2.0", - "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", - "error_path": "get_payment_details", - "error_trace": "get_payment_details:75]", - "error_type": "NoSuchPayment", - "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", - "id": 762 - } - ``` +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | - ### InvalidRequest (payment\_hash not a hash string) + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + ```json - { - "mmrpc": "2.0", - "error": "Error parsing request: invalid value: string '', expected a hash string", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "invalid value: string '', expected a hash string", - "id": 762 - } + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, ``` +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; -## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} +# Lightning Network Nodes -The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | -#### 📌 Example without filter +#### 📌 Example - + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::connect_to_node", "params": { - "coin": "tBTC-lightning" + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" }, "id": 1 } ``` - - #### Response + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: - ```json - { - "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683917593, - "last_updated": 1683917593 - }, { - "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", - "amount_in_msat": 88000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1683714225, - "last_updated": 1683805721 - }, { - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "ACME shrink ray", - "amount_in_msat": 4000012, - "status": "succeeded", - "created_at": 1683814625, - "last_updated": 1683815321 - }], - "limit": 10, - "skipped": 0, - "total": 6, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } - }, - "id": 1 + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - -#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + #### Response (already connected) - ```json { - "method": "lightning::payments::list_payments_by_filter", - "userpass": "testpsw", - "mmrpc": "2.0", - "params": { - "coin": "tBTC-lightning", - "filter": { - "payment_type": { - "type": "Inbound Payment" - } - }, - "limit": 2, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null } ``` - + + + + #### InvalidRequest Error (Invalid node\_address) - ```json { "mmrpc": "2.0", - "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }, { - "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "14 pallets of frozen spinach", - "amount_in_msat": 56005000, - "status": "succeeded", - "created_at": 1683815625, - "last_updated": 1683815721 - }], - "limit": 2, - "skipped": 2, - "total": 7, - "total_pages": 4, - "paging_options": { - "PageNumber": 2 - } - }, - "id": 1 + "error": "Error parsing request: Could not parse node address from str rgjhk3", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 + } + ``` + + #### ConnectionError Error (Timed out waiting to connect to node\_address) + + ```json + { + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null } ``` -#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} - +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::list_trusted_nodes", "params": { - "coin": "tBTC-lightning", - "filter": { - "status": "pending", - "from_amount_msat": 10000, - "to_amount_msat": 40000 - } + "coin": "tBTC-lightning" }, "id": 1 } @@ -20218,45 +18905,35 @@ The `lightning::payments::list_payments_by_filter` method returns a list of paym { "mmrpc": "2.0", "result": { - "payments": [{ - "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", - "payment_type": { - "type": "Inbound Payment" - }, - "description": "For the burger on Tuesday", - "amount_in_msat": 10000, - "status": "pending", - "created_at": 1683916900, - "last_updated": 1683916900 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] }, "id": 1 } ``` -#### 📌 Example for successful payments on the 20th of April 2023 +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} - +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + ```json { - "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", "mmrpc": "2.0", + "method": "lightning::nodes::add_trusted_node", "params": { "coin": "tBTC-lightning", - "filter": { - "status": "succeeded", - "from_timestamp": 1681948800, - "to_timestamp": 1682035199 - } + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, "id": 1 } @@ -20270,539 +18947,319 @@ The `lightning::payments::list_payments_by_filter` method returns a list of paym { "mmrpc": "2.0", "result": { - "payments": [{ - "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", - "payment_type": { - "type": "Outbound Payment" - }, - "description": "Grays Sports Almanac, 1950-2000", - "amount_in_msat": 1000000000, - "status": "succeeded", - "created_at": 1681998480, - "last_updated": 1682008491 - }], - "limit": 10, - "skipped": 6, - "total": 1, - "total_pages": 1, - "paging_options": { - "PageNumber": 1 - } + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" }, "id": 1 } ``` -export const title = "AtomicDEX Method: Max Maker Vol"; -export const description = - "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; - -# max\_maker\_vol - -The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. - -#### Arguments -| Parameter | Type | Description | -| --------- | ------ | ----------------------------------------- | -| coin | string | The ticker of the coin you want to query. | +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} -#### Response +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. -| Parameter | Type | Description | -| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | +### Request Parameters -#### 📌 Examples +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | -#### Command +#### 📌 Example - + ```json { "userpass": "testpsw", "mmrpc": "2.0", - "method": "max_maker_vol", + "method": "lightning::nodes::remove_trusted_node", "params": { - "coin": "DOC" - } + "coin": "tBTC-lightning", + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 } ``` - #### Response (success) + #### Response ```json { - "mmrpc": "2.0", - "result": { - "coin": "MARTY", - "volume": { - "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", - "rational": [ - [1, [962255003, 81]], - [1, [390588672, 18]] - ], - "fraction": { - "numer": "348854605979", - "denom": "77700000000" - } - }, - "balance": { - "decimal": "5.49110027", - "rational": [ - [1, [549110027]], - [1, [100000000]] - ], - "fraction": { - "numer": "549110027", - "denom": "100000000" - } - }, - "locked_by_swaps": { - "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", - "rational": [ - [1, [77802331]], - [1, [77700000]] - ], - "fraction": { - "numer": "77802331", - "denom": "77700000" - } - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 } ``` + +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; - #### Response (error) +# Lightning Network Payments + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} + +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. + +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | +#### 📌 Example + + ```json { + "method": "lightning::payments::generate_invoice", + "userpass": "testpsw", "mmrpc": "2.0", - "error": "No such coin TIME", - "error_path": "max_maker_vol_rpc.lp_coins", - "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", - "error_type": "NoSuchCoin", - "error_data": { - "coin": "TIME" + "params": { + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 }, - "id": null + "id": 1 } ``` + - #### Response (balance too low) + + #### Response ```json { - "mmrpc": "2.0", - "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", - "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", - "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", - "error_type": "NotSufficientBalance", - "error_data": { - "coin": "QTUM", - "available": "0", - "required": "0.000728" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 } ``` + - #### Response (Transport error) + + ### InvalidRequest (invalid paramater value) ```json { - "mmrpc": "2.0", - "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "error_path": "taker_swap.utxo_common", - "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", - "error_type": "Transport", - "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", - "id": 0 + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 } ``` -export const title = "AtomicDEX: Non Fungible Tokens - Get NFT List"; -export const description = - "This document describes all the get_nft_list method AtomicDEX-API provides to get a list of your wallets NFTs"; -# Get a list of NFTs {{label : 'get_nft_list', tag : 'API-v2'}} +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} -Returns a list of the NFTs owned by the user, shown in descending order of the `block_number` value (the block height when the amount or owner changed). If the request is for NFTs on more than one chain, this means that the order may not be chronological. In the case of ERC1155 tokens, the `block_number` will update when additional NFTs are received or when all NFTs are withdrawn, but will generally remain the same if only some NFTs are withdrawn. +The `lightning::payments::send_payment` method sends a payment to another node. - - Before using this method, you must first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) - method to populate/refresh the local database. - +Used to pay an invoice or send a payment via pubkey/address. ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFTs without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| --------- | --------------- | -------------------------------------------------------------------------------------- | -| nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | -| total | string | The total number of NFTs in your wallet matching the request filters. | -| skipped | string | The number of NFTs in your wallet excluded by the request filters. | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | -#### 📌 Example with no optional params +#### 📌 Example using `invoice` - + ```json { "userpass": "testpsw", - "method": "get_nft_list", "mmrpc": "2.0", + "method": "lightning::payments::send_payment", "params": { - "chains": [ - "BSC", - "POLYGON" - ] - } + "coin": "tBTC-lightning", + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" + } + }, + "id": 6 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "BSC", - "token_address": "0x5c7d6712dfaf0cb079d48981781c8705e8417ca0", - "token_id": "0", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "b34ddf294013d20a6d70691027625839", - "block_number_minted": 25465916, - "block_number": 25919780, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://tikimetadata.s3.amazonaws.com/tiki_box.json", - "token_domain": "tikimetadata.s3.amazonaws.com", - "metadata": "{\"name\":\"Tiki box\",\"description\":\"Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!\",\"external_url\":\"\",\"image\":\"https://tikimetadata.s3.amazonaws.com/tiki_box.png\",\"attributes\":[{\"trait_type\":\"Crypto Logo\",\"value\":\"TIKI NFT CRYPTOLOGO SCAR\"}],\"properties\":{\"category\":\"image\",\"creators\":[]}}", - "last_token_uri_sync": "2023-02-07T17:10:08.402Z", - "last_metadata_sync": "2023-02-07T17:10:16.858Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_url": "https://tikimetadata.s3.amazonaws.com/tiki_box.png", - "image_domain": "tikimetadata.s3.amazonaws.com", - "name": "Tiki box", - "description": "Born to usher in Bull markets. Tiki JumpStarters are crazed guardians that worship NGU technology. Tiki guardians attach themselves to their owners to guide and protect them from the evils of the crypto industry. Manifested by the power of community and infused with unlimited creativity, the Unlockable Road Map summons powerful gifts and surprises to all Tiki Holders. Booyaaah!!", - "attributes": [ - { - "trait_type": "Crypto Logo", - "value": "TIKI NFT CRYPTOLOGO SCAR" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "", - "external_domain": null, - "image_details": null - } - }, - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 0, - "total": 2 - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 } ``` -#### 📌 Example with optional limit & page\_number params +#### 📌 Example using `keysend` - + ```json { "userpass": "testpsw", - "method": "get_nft_list", "mmrpc": "2.0", + "method": "lightning::payments::send_payment", "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "limit": 1, - "page_number": 2 - } + "coin": "tBTC-lightning", + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 + } + }, + "id": 6 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 1, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" + }, + "id": 762 } ``` -#### 📌 Example with optional spam protection + + ### PaymentError (attempt to pay self) - ```json { - "userpass": "testpsw", - "method": "get_nft_list", - "mmrpc": "2.0", - "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "protect_from_spam": true, - "filters": { - "exclude_spam": true, - "exclude_phishing": true - } - } + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 } ``` - - + ### PaymentError (no outbound routes) + ```json { - "mmrpc": "2.0", - "result": { - "nfts": [ - { - "chain": "POLYGON", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "amount": "1", - "owner_of": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "token_hash": "28f970585fd743b056859a6e41f50a8e", - "block_number_minted": 36781490, - "block_number": 42491885, - "contract_type": "ERC1155", - "name": null, - "symbol": null, - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "metadata": "{\"name\":\"Forest Mushrooms\",\"description\":\"Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.\",\"image\":\"https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg\",\"animation_url\":null,\"external_url\":\"https://app.thesmurfssociety.com/detail/ingredients/5\",\"attributes\":[{\"trait_type\":\"Type\",\"value\":\"Ingredient\"},{\"trait_type\":\"Category\",\"value\":\"COMMON\"}]}", - "last_token_uri_sync": "2022-12-13T13:12:50.840Z", - "last_metadata_sync": "2023-05-15T07:30:04.882Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": false, - "possible_phishing": false, - "uri_meta": { - "image": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "name": "Forest Mushrooms", - "description": "Sweet and nutty with distinct earthy tones, these forest mushrooms will make a fine addition to all your soups, salads, and potions.", - "attributes": [ - { - "trait_type": "Type", - "value": "Ingredient" - }, - { - "trait_type": "Category", - "value": "COMMON" - } - ], - "animation_url": null, - "animation_domain": null, - "external_url": "https://app.thesmurfssociety.com/detail/ingredients/5", - "external_domain": "app.thesmurfssociety.com", - "image_details": null - } - } - ], - "skipped": 0, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (keysend - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (invoice - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` + + ### InvalidRequest (request is missing a required field) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } + ``` + + ### InvalidRequest (A required field is invalid) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 } ``` -### 📌 Error responses - -#### Unsupported Chain Type - -The supported chains are - -``` -{ - "mmrpc":"2.0", - "error":"Error parsing request: UnsupportedChainType", - "error_path":"dispatcher", - "error_trace":"dispatcher:109]", - "error_type":"InvalidRequest", - "error_data":"UnsupportedChainType", - "id":null -} -``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the get_nft_metadata method AtomicDEX-API provides to get metadata for your NFTs"; +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} -# Get NFT Metadata {{label : 'get_nft_metadata', tag : 'API-v2'}} +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | - -### Response Parameters - -| Parameter | Type | Description | -| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | The amount of this NFT the user owns (used by `ERC1155`). | -| block\_number\_minted | integer | The block height when the NFT was minted. May be `null`. | -| block\_number | integer | The block height when the amount or owner changed. | -| chain | string | Chain name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| name | string | May be `null`. An NFT collection name. | -| contract\_type | string | The type of NFT contract standard. One of `ERC721` or `ERC1155`. | -| last\_token\_uri\_sync | string | When the token\_uri was last updated. | -| last\_metadata\_sync | string | When the metadata was last updated. | -| metadata | string | The metadata of the token. May be `null`. | -| minter\_address | string | Minter address. May be `null`. | -| owner\_of | string | The wallet address of the owner of the NFT. | -| possible\_spam | boolean | If `true`, the contract address has [been identified](https://docs.moralis.io/web3-data-api/evm/nft-spam-detection) as associated with spam or suspicious activities. | -| possible\_phishing | boolean | If `true`, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains. | -| symbol | string | May be `null`. The symbol of the NFT contract. | -| token\_address | string | The address of the NFT contract. | -| token\_id | string | The token ID of the NFT. | -| token\_hash | string | The token hash. May be `null`. | -| token\_uri | string | The URI to the metadata of the token. May be `null`. | -| token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | #### 📌 Example - + ```json { + "method": "lightning::payments::get_payment_details", "userpass": "testpsw", - "method": "get_nft_metadata", "mmrpc": "2.0", "params": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414", - "chain": "BSC" - } + "coin": "tBTC-lightning", + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" + }, + "id": 1 } ``` @@ -20810,427 +19267,168 @@ export const description = ```json { - "mmrpc": "2.0", - "result": { - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "amount": "1", - "owner_of": "0xab95d01bc8214e4d993043e8ca1b68db2c946498", - "token_hash": "af811b641bccbdc10c444ba4f3a2ffb5", - "name": "OpenSea Collections", - "symbol": "OPENSTORE", - "token_uri": "https://api.opensea.io/api/v2/metadata/matic/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xf43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710", - "token_domain": "api.opensea.io", - "metadata": "{\"image\":\"https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format\",\"name\":\"Doge Napoleon\",\"description\":null,\"external_link\":null,\"animation_url\":\"https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4\",\"traits\":[]}", - "last_token_uri_sync": "2023-09-01T04:04:30.867Z", - "last_metadata_sync": "2023-09-01T04:35:01.128Z", - "minter_address": "ERC1155 tokens don't have a single minter", - "possible_spam": true, - "chain": "POLYGON", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "block_number_minted": 19645247, - "block_number": 45776404, - "contract_type": "ERC1155", - "possible_phishing": false, - "uri_meta": { - "image": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", - "image_url": "https://i.seadn.io/gae/nY8wjVVQqDZBl-Bk3h9kwSqR1bXt16x_tESRAQmctEb0SCFCPtvtSsBtp98TFiUzP-LpMGt_kiqHDDOfkgbxOuWxkdH4aBNkmzrjZM0?w=500&auto=format", - "image_domain": "i.seadn.io", - "name": "Doge Napoleon", - "description": null, - "attributes": null, - "animation_url": "https://openseauserdata.com/files/df71203f48e54d027bb2c47b2840cacb.mp4", - "animation_domain": "openseauserdata.com", - "external_url": null, - "external_domain": null, - "image_details": null - } - }, - "id": null + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 } ``` -## Error responses - -``` -{ - "mmrpc": "2.0", - "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f81, token_id 214300044414 was not found in wallet", - "error_path": "nft", - "error_trace": "nft:123]", - "error_type": "TokenNotFoundInWallet", - "error_data": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f81", - "token_id": "214300044414" - }, - "id": null -} -``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the get_nft_transfers method AtomicDEX-API provides to get information about your NFT transactions"; - -# Get a list of NFT transfers {{label : 'get_nft_transfers', tag : 'API-v2'}} - -Returns a list of the NFT transfers involving the user, shown in descending order of the `block_timestamp` value of the NFT's last transfer. - - - To view NFT transactions, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - - -### Request Parameters - -| Parameter | Type | Description | -| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | -| transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | -| total | string | The total number of NFT transfers in your wallet matching the request filters. | -| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | - -#### 📌 Example with date and `send` filters + + ### NoSuchPayment (payment hash not found) - ```json { - "userpass": "testpsw", - "method": "get_nft_transfers", - "mmrpc": "2.0", - "params": { - "chains": [ - "POLYGON" - ], - "max": true, - "filters": { - "receive": true, - "from_date": 1678233600 - }, - "protect_from_spam": true - } + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 } ``` - - + ### InvalidRequest (payment\_hash not a hash string) + ```json { - "mmrpc": "2.0", - "result": { - "transfer_history": [ - { - "block_hash": "0xfd012e9dc2c7fa652ae3c0923599a9e6196520ac46e55f0f467d3a1ce84b8580", - "transaction_hash": "0x4063c4ae3e56a06b6c8768ad76e0cb1523e671cf06e4325517106497778ede9e", - "transaction_index": 87, - "log_index": 468, - "value": "0", - "transaction_type": "Single", - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "from_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "to_address": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "amount": "2", - "verified": 1, - "operator": "0xf622a6c52c94b500542e2ae6bcad24c53bc5b6a2", - "possible_spam": false, - "chain": "POLYGON", - "token_id": "5", - "block_number": 44506464, - "block_timestamp": 1688107346, - "contract_type": "ERC1155", - "token_uri": "https://app.thesmurfssociety.com/metadata/public/metadata/cauldron/5", - "token_domain": "app.thesmurfssociety.com", - "collection_name": null, - "image_url": "https://metadata.thesmurfssociety.com/ingredients/nft/5.Forest_Mushrooms.jpg", - "image_domain": "metadata.thesmurfssociety.com", - "token_name": "Forest Mushrooms", - "status": "Receive", - "possible_phishing": false, - "fee_details": { - "coin": "MATIC", - "gas": 40249, - "gas_price": "0.000000153160317706", - "total_fee": "0.006164549627348794" - }, - "confirmations": 5775855 - } - ], - "skipped": 0, - "total": 1 - }, - "id": null + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 } ``` -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes all the methods AtomicDEX-API provides to get information and transact with NFTs"; - -# Non Fungible Tokens (NFTs) -The AtomicDEX API supports [ERC1155](https://www.nftstandards.wtf/Standards/ERC1155+Multi+token) and [ERC721](https://www.nftstandards.wtf/Standards/ERC721+Non+Fungible+Standard) NFTs via the [Moralis API](https://docs.moralis.io/) on the Avalanche (AVAX), BNB Smart Chain (BNB), Ethereum (ETH), Fantom (FTM), Polygon (MATIC) networks. - - - Before using other NFT methods, you should first call the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) - method to populate/refresh the local database. - - -## NFT Information Methods - -* Get a list of your tokens with [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) -* Get a list of token transfers with [get\_nft\_transfers](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/) -* Get token metadata with [get\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/) -* Update NFT [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/) -* Refresh NFT metadata with [refresh\_nft\_metadata](/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/) - -## NFT Transaction Methods - -* Withdraw ERC721 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-721-withdraw-example) -* Withdraw ERC1155 tokens with [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/#erc-1155-withdraw-example) - - - View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) - -export const title = "AtomicDEX: Non Fungible Tokens - Query NFT database tables"; -export const description = - "This document describes how to query the local NFT database tables."; - -# Query NFT database tables - -After using the [update\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/update_nft/#update-nft) method to initialise your local NFT database, -the following tables are available in `DB/KOMODEFI.db`: - -* AVAX\_nft\_list -* AVAX\_nft\_transfer\_history -* BNB\_nft\_list -* BNB\_nft\_transfer\_history -* ETH\_nft\_list -* ETH\_nft\_transfer\_history -* FTM\_nft\_list -* FTM\_nft\_transfer\_history -* MATIC\_nft\_list -* MATIC\_nft\_transfer\_history -* scanned\_nft\_blocks - -## NFT List tables - -The COIN\_nft\_list tables contain the NFTs that you own -It has the following columns, though not all columns are populated for all NFTs: - -| ID | Name | Type | Description | -| -- | ---------------------- | ------------ | ------------------------------------------------------------------------------ | -| 0 | token\_address | VARCHAR(256) | The address of the token contract. | -| 1 | token\_id | VARCHAR(256) | The id of the token. | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | -| 4 | block\_number | INTEGER | The block height of this transaction. | -| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | -| 6 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | -| 7 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | -| 8 | collection\_name | TEXT | The collection name which includes the token. | -| 9 | symbol | TEXT | An arbitrary symbol for the NFT | -| 10 | token\_uri | TEXT | A link to the token's metadata. | -| 11 | token\_domain | TEXT | The domain the token metadata is hosted on. | -| 12 | metadata | TEXT | The token's metadata in JSON format. | -| 13 | last\_token\_uri\_sync | TEXT | Date and time when the token uri was last syncronised. | -| 14 | last\_metadata\_sync | TEXT | Date and time when the token metadata was last syncronised. | -| 15 | raw\_image\_url | TEXT | The raw URL for the token image. | -| 16 | image\_url | TEXT | A link for the token's image (or other media). | -| 17 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | -| 18 | token\_name | TEXT | The name of the token. | -| 19 | description | TEXT | An arbitrary description of the NFT. | -| 20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. | -| 21 | animation\_url | TEXT | If NFT is animated, the URL of the animation. | -| 22 | animation\_domain | TEXT | If NFT is animated, the domain of the animation. | -| 23 | external\_url | TEXT | Additional URL related to the NFT | -| 24 | external\_domain | TEXT | Domain of the additional URL related to the NFT | -| 25 | image\_details | TEXT | Additional details about the NFT's image. | -| 26 | details\_json | TEXT | Additional information about the transaction in JSON format. | - -### Example COIN\_nft\_list table query - -> SELECT chain, token\_name, token\_address, token\_id, possible\_spam, possible\_phishing FROM MATIC\_nft\_list LIMIT 5; - -| chain | token\_name | token\_address | token\_id | possible\_spam | possible\_phishing | -| ------- | ---------------------- | ------------------------------------------ | --------- | -------------- | ------------------ | -| POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 | -| POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 | -| POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 | -| POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 | -| POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 | - -The NFTs listed above are all spam, and will be ignored by the [get\_nft\_list](/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/) method. - -## NFT Transfer table - -The COIN\_nft\_transfer\_history tables contain the history of transfers of your NFTs, and have the following columns: - -| ID | Name | Type | Description | -| -- | ------------------ | ------------ | ------------------------------------------------------------------------------ | -| 0 | transaction\_hash | VARCHAR(256) | Hex string, representing the transaction. | -| 1 | log\_index | INTEGER | Simply a table index. | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 3 | block\_number | INTEGER | The block height of this transaction. | -| 4 | block\_timestamp | INTEGER | The block time of this transaction. | -| 5 | contract\_type | TEXT | The contract type. Either `ERC721` or `ERC1155`. | -| 6 | token\_address | VARCHAR(256) | The address of the token contract. | -| 7 | token\_id | VARCHAR(256) | The id of the token. | -| 8 | status | TEXT | The transaction type: `Recieve` or `Send` | -| 9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. | -| 10 | possible\_spam | INTEGER | `1` indicates the NFT has been identified as spam. `0` indicates it has not. | -| 11 | possible\_phishing | INTEGER | `1` indicates the NFT has been identified as a scam. `0` indicates it has not. | -| 12 | token\_uri | TEXT | A link to the token's metadata. | -| 13 | token\_domain | TEXT | The domain the token metadata is hosted on. | -| 14 | collection\_name | TEXT | The collection name which includes the token. | -| 15 | image\_url | TEXT | A link for the token's image (or other media). | -| 16 | image\_domain | TEXT | The domain the token image (or other media) is hosted on. | -| 17 | token\_name | TEXT | The name of the token. | -| 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | - -### Example scanned\_nft\_blocks table query - -`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` - -| transaction\_hash | token\_name | token\_address | token\_id | -| ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | -| 0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | - -## NFT Last Scanned Block table - -The scanned\_nft\_blocks table contains the last block that was scanned for each chain. -It has the following columns: - -| ID | Name | Type | Description | -| -- | -------------------- | ------- | ---------------------------------------------------------------------- | -| 2 | chain | TEXT | The coin network which the NFT is on. | -| 1 | last\_scanned\_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. | - -### Example scanned\_nft\_blocks table query - -`SELECT * FROM scanned_nft_blocks;` - -| chain | last\_scanned\_block | -| ----- | -------------------- | -| MATIC | 50651981 | -| FTM | 66512090 | -| ETH | 0 | -| BNB | 0 | -| AVAX | 0 | -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes all the refresh_nft_metadata method AtomicDEX-API provides to refresh an NFT's metadata"; - -# Refresh NFT Metadata {{label : 'refresh_nft_metadata', tag : 'API-v2'}} +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} -This method refreshes metadata of one NFT and metadata of related transactions with the same token\_address and token\_id. +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | Chains which holds the NFT you would like to updated metadata for. | -| url | string | URL link to the Moralis API proxy base url ([https://moralis-proxy.komodo.earth](https://moralis-proxy.komodo.earth)) or equivalent. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. [docs](https://nft.antispam.dragonhound.info/docs). | - - - If there are no errors, this request will return an empty response. - +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | -#### 📌 Example +#### 📌 Example without filter - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "refresh_nft_metadata", "mmrpc": "2.0", "params": { - "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", - "token_id": "5", - "chain": "POLYGON", - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } + "coin": "tBTC-lightning" + }, + "id": 1 } ``` - - If there are no errors, this request will return an empty response. - + #### Response ```json { "mmrpc": "2.0", - "result": null, - "id": null + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` - - Need to add some error responses here. - -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the update_nft method AtomicDEX-API provides to update NFT information in your local database"; - -# Update NFT {{label : 'update_nft', tag : 'API-v2'}} - -This method will scan selected networks to update NFT information stored in the local database. -To interact with your NFTs, you will first need to activate the coin for the network the NFT is on. - -See below for which coin to activate for each network: - -| Network | Coin | -| --------- | ----- | -| AVALANCHE | AVAX | -| BSC | BNB | -| ETH | ETH | -| FANTOM | FTM | -| POLYGON | MATIC | - -These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) or method. - -### Request Parameters - -| Parameter | Type | Description | -| ------------- | ------ | --------------------------------------------------------------------------------------------------- | -| chains | array | List of networks to scan for NFTs. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | -| url | string | URL link to the [Moralis API proxy base url](https://moralis-proxy.komodo.earth) or equivalent. | -| url\_antispam | string | URL link to the [Antispam API proxy base url](https://nft.antispam.dragonhound.info) or equivalent. | - - - If there are no errors, this request will return an empty response. - When updating multiple networks, or wallets with numerous NFTs, this request may take a while to complete. - - -#### 📌 Example +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "update_nft", "mmrpc": "2.0", "params": { - "chains": [ - "BSC", - "POLYGON" - ], - "url": "https://moralis-proxy.komodo.earth", - "url_antispam": "https://nft.antispam.dragonhound.info" - } + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` @@ -21239,313 +19437,278 @@ These coins can be activated using the [enable\_eth\_with\_tokens](/atomicdex/ap ```json { "mmrpc": "2.0", - "result": null, - "id": null + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 } ``` - - Need to add some error responses here. - -export const title = "AtomicDEX: Non Fungible Tokens"; -export const description = - "This document describes the withdraw_nft method AtomicDEX-API provides to send NFTs to an address"; - -# Withdraw NFTs {{label : 'withdraw_nft', tag : 'API-v2'}} - - - To withdraw NFTs, you must [activate the coin](/atomicdex/api/legacy/coin_activation/) which holds the NFTs first. - The `withdraw_nft` method will return signed raw transaction hex which must be broadcast using the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) method to complete the withdrawal. - - -### Request Parameters - -| Parameter | Type | Description | -| -------------- | ------ | ---------------------------------------------------------------------------------------- | -| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | -| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | - -### Response Parameters - -| Parameter | Type | Description | -| ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| amount | string | Amount of tokens to withdraw. | -| tx\_hex | string | Raw hex of signed transaction. Use this with the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) RPC to broadcast the transaction. | -| tx\_hash | string | Transaction ID of the withdrawl. | -| from | array | List of source addresses. | -| to | array | List of destination addresses. | -| contract\_type | string | Contract type. `ERC721` or `ERC1155`. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | -| coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | -| block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | -| timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | -| internal\_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. | -| transaction\_type | string | This will always be `NftTransfer`. | - -#### 📌 ERC721 Withdraw Example +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc721", - "withdraw_data": { - "chain": "POLYGON", - "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1" + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 } - } + }, + "id": 1 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8cb2a8509818733db8289929473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c9464980000000000000000000000000000000000000000000000000000000000000001820136a0564b5c9c8309a3f8f6cc007ca957e4c411259026d68c2c34419158aff4d3ebf8a007afaa0590da01a2ce36c7edb5380f41235168f3633ed459b1fc8a750fecd38d", - "tx_hash": "bb030f618702715eb39035dccd218355f78ae5379ff6d0691f0f3c0db3c03789", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "contract_type": "ERC721", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 35218, - "gas_price": "0.000000040827827163", - "total_fee": "0.001437874417026534" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732198, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` -#### 📌 ERC1155 Withdraw Example - -If you are sending 2 or more NFTs, you must use the `withdraw_erc1155` withdraw type. +#### 📌 Example for successful payments on the 20th of April 2023 - + ```json { + "method": "lightning::payments::list_payments_by_filter", "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", "params": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1" + "coin": "tBTC-lightning", + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 } - } + }, + "id": 1 } ``` + #### Response + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f8cb2a8502dffe7b4682f3a09473a5299824cd955af6377b56f5762dc3ca4cc07880b86442842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa5395656600000000000000000000000000000000000000000000000000000000000000001820135a0476a4623c9df31cecbd319e0571c62d14a6dcedd5a760ced945ffa2e39fb12c5a03293f3c10d115edcc3795e414670f070c04ad936e2e87001da12f961df5962a7", - "tx_hash": "d6b46e70bf755617366a5c10875eb639d55586bb568010ea82ef42e8d68c6523", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0x27Ad1F808c1ef82626277Ae38998AfA539565660" - ], - "contract_type": "ERC721", - "token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078", - "token_id": "1", - "amount": "1", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 62368, - "gas_price": "0.000000012347931462", - "total_fee": "0.000770115789422016" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732805, - "internal_id": 0, - "transaction_type": "NftTransfer" - }, - "id": null + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 } ``` +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; + +# max\_maker\_vol + +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. + +#### Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response -#### 📌 ERC1155 Withdraw Max Example +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples -If you would like to withdraw all NFTs from a token\_address, you must use the `withdraw_erc1155` withdraw type and set `max` to `true`. +#### Command - + ```json { "userpass": "testpsw", - "method": "withdraw_nft", "mmrpc": "2.0", + "method": "max_maker_vol", "params": { - "type": "withdraw_erc1155", - "withdraw_data": { - "chain": "POLYGON", - "to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660", - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "max": true - } + "coin": "DOC" } } ``` + #### Response (success) + ```json { - "mmrpc": "2.0", - "result": { - "tx_hex": "f9014b2a8508d579565282ea3b942953399124f0cbb46d2cbacd8a89cf059997496380b8e4f242432a000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c94649800000000000000000000000027ad1f808c1ef82626277ae38998afa539565660f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820135a0feb67607bd5e5c58f7533c8d2c88ef0ba3beac7fea29bfe11c3ce9bd10641f2ca02f1045b9f87536e45fe63556805734293e534284efecd9210f614316a3e8dca7", - "tx_hash": "9dce8e555d388532bdafd42dd44cd6a2bdcbf74bdda079e15f71b808c8395bcc", - "from": [ - "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498" - ], - "to": [ - "0x27Ad1F808c1ef82626277Ae38998AfA539565660" - ], - "contract_type": "ERC1155", - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "amount": "7", - "fee_details": { - "type": "Eth", - "coin": "MATIC", - "gas": 59963, - "gas_price": "0.00000003794123733", - "total_fee": "0.00227507041401879" - }, - "coin": "MATIC", - "block_height": 0, - "timestamp": 1700732937, - "internal_id": 0, - "transaction_type": "NftTransfer" + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } }, - "id": null - } - ``` - - - - ### 📌 Withdraw NFTs Error Responses - - #### InvalidRequest (missing field) - - ``` - { - "mmrpc": "2.0", - "error": "Error parsing request: missing field `type`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "missing field `type`", - "id": null - } - ``` - - #### InvalidRequest (wrong withdraw type) - - ``` - { - "mmrpc": "2.0", - "error": "Error parsing request: unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", - "error_path": "dispatcher", - "error_trace": "dispatcher:109]", - "error_type": "InvalidRequest", - "error_data": "unknown variant `withdraw_erc420`, expected `withdraw_erc1155` or `withdraw_erc721`", - "id": null + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null } ``` - #### TokenNotFoundInWallet (trying to send NFT you dont own) + #### Response (error) - ``` + ```json { - "mmrpc": "2.0", - "error": "Token: token_address 0xfd913a305d70a60aac4faac70c739563738e1f82, token_id 110473361632261669912565539602449606788298723469812631769659886404530570536722 was not found in wallet", - "error_path": "eth.nft", - "error_trace": "eth:883] nft:1177]", - "error_type": "GetNftInfoError", - "error_data": { - "error_type": "TokenNotFoundInWallet", - "error_data": { - "token_address": "0xfd913a305d70a60aac4faac70c739563738e1f82", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536722" - } - }, - "id": null + "mmrpc": "2.0", + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": null } ``` - #### TransportError (unable to estimate gas) + #### Response (balance too low) - ``` + ```json { - "mmrpc": "2.0", - "error": "Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", - "error_path": "eth", - "error_trace": "eth:1004] eth:5792]", - "error_type": "Transport", - "error_data": "request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_estimateGas\", params: Array([Object({\"from\": String(\"0xab95d01bc8214e4d993043e8ca1b68db2c946498\"), \"to\": String(\"0x2953399124f0cbb46d2cbacd8a89cf0599974963\"), \"gasPrice\": String(\"0x9ddeaaffe\"), \"value\": String(\"0x0\"), \"data\": String(\"0x42842e0e000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498000000000000000000000000ab95d01bc8214e4d993043e8ca1b68db2c946498f43db4f488f644b73a9442de4978fb7572b73d85000000000000110000002710\")})]), id: Num(64) }) failed: InvalidResponse(\"Server: 'https://polygon-rpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); InvalidResponse(\"Server: 'https://polygon.blockpi.network/v1/rpc/public', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); Transport(\"Server: 'https://node.komodo.earth:8080/polygon', response !200: 502 Bad Gateway, <html>..<head><title>502 Bad Gateway</title></head>..<body>..<center><h1>502 Bad Gateway</h1></center>..<hr><center>nginx/1.18.0 (Ubuntu)</center>..</body>..</html>..\"); InvalidResponse(\"Server: 'https://polygon.llamarpc.com/', error: RPC error: Error { code: ServerError(-32000), message: \\\"execution reverted\\\", data: None }\"); ", - "id": null + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null } ``` - #### NotEnoughNftsAmount (trying to send more NFTs than you have) + #### Response (Transport error) - ``` + ```json { - "mmrpc": "2.0", - "error": "Not enough NFTs amount with token_address: 0x2953399124f0cbb46d2cbacd8a89cf0599974963 and token_id 110473361632261669912565539602449606788298723469812631769659886404530570536720. Available 1, required 2", - "error_path": "eth", - "error_trace": "eth:897]", - "error_type": "NotEnoughNftsAmount", - "error_data": { - "token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963", - "token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720", - "available": "1", - "required": "2" - }, - "id": null + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 } ``` - - - View the source code at: [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs) - export const title = "AtomicDEX: Account Balance Tasks"; export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; From 6e21f7a521234ea796352087f87f712f95add326 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 25 Feb 2024 15:55:43 +0800 Subject: [PATCH 78/85] update key type values --- .../get_nft_list/index.mdx | 4 ++-- .../get_nft_transfers/index.mdx | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 87865463..2d134089 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -27,8 +27,8 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` | Parameter | Type | Description | | --------- | --------------- | -------------------------------------------------------------------------------------- | | nfts | list of objects | A list of standard [NftInfo](/atomicdex/api/common_structures/nfts/#nft-info) objects. | -| total | string | The total number of NFTs in your wallet matching the request filters. | -| skipped | string | The number of NFTs in your wallet excluded by the request filters. | +| total | integer | The total number of NFTs in your wallet matching the request filters. | +| skipped | integer | The number of NFTs in your wallet excluded by the request filters. | #### 📌 Example with no optional params diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index b8ba0c79..02bf542e 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -12,22 +12,22 @@ Returns a list of the NFT transfers involving the user, shown in descending orde ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| chains | array | List of chains to scan for NFTs. | -| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | -| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | -| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in `collection_name`, `token_name` will be censored | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chains | array | List of chains to scan for NFTs. | +| max | boolean | Optional, defaults to `false`. If `true`, response will return all NFT transfers without pagination, and will ignore the `limit` and `page_number` values. | +| limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | +| page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | +| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | ### Response Parameters | Parameter | Type | Description | | ----------------- | --------------- | ---------------------------------------------------------------------------------------------- | | transfer\_history | list of objects | A list of standard [NftTransfer](/atomicdex/api/common_structures/nfts/#nft-transfer) objects. | -| total | string | The total number of NFT transfers in your wallet matching the request filters. | -| skipped | string | The number of NFT transfers in your wallet excluded by the request filters. | +| total | integer | The total number of NFT transfers in your wallet matching the request filters. | +| skipped | integer | The number of NFT transfers in your wallet excluded by the request filters. | #### 📌 Example with date and `send` filters From 85f8df9602a62612ab19d93b1105d522becac0d1 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 25 Feb 2024 15:56:30 +0800 Subject: [PATCH 79/85] remove duplicated common structures --- data-for-gpts/all-content.txt | 8 +- data-for-gpts/komodefi-api/code.rs | 18 +- .../komodefi-api/v20-api-content.txt | 4 +- .../komodefi-api/v20-dev-api-content.txt | 2 +- .../common_structures/activation/index.mdx | 14 +- .../atomicdex/api/common_structures/index.mdx | 112 +++ .../api/common_structures/lightning/index.mdx | 22 +- .../api/common_structures/nfts/index.mdx | 98 ++- .../get_nft_metadata/index.mdx | 14 +- src/pages/atomicdex/api/v20/index.mdx | 645 +----------------- 10 files changed, 248 insertions(+), 689 deletions(-) diff --git a/data-for-gpts/all-content.txt b/data-for-gpts/all-content.txt index 9afa368d..f9d44f4b 100644 --- a/data-for-gpts/all-content.txt +++ b/data-for-gpts/all-content.txt @@ -27429,7 +27429,7 @@ The `NftInfo` object includes the following items for a given token: | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | ### NftTransfer @@ -41056,9 +41056,9 @@ The `TokenTransferFilter` object includes the following items for a transfer of ``` -### TokenMetadata +### NftMetadata -The `TokenMetadata` object includes the following items for a given coin or token: +The `NftMetadata` object includes the following items for a given coin or token: | Parameter | Type | Description | | ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -47482,7 +47482,7 @@ export const description = | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example diff --git a/data-for-gpts/komodefi-api/code.rs b/data-for-gpts/komodefi-api/code.rs index 9a7ae14d..4a417024 100644 --- a/data-for-gpts/komodefi-api/code.rs +++ b/data-for-gpts/komodefi-api/code.rs @@ -131756,7 +131756,7 @@ pub struct GetTransactionResponse { #[prost(message, optional, tag="1")] pub transaction: ::core::option::Option, #[prost(message, optional, tag="2")] - pub token_metadata: ::core::option::Option, + pub token_metadata: ::core::option::Option, } /// Get an encoded transaction from a transaction hash. #[derive(Clone, PartialEq, ::prost::Message)] @@ -131898,7 +131898,7 @@ pub struct GetAddressUnspentOutputsResponse { #[prost(message, repeated, tag="1")] pub outputs: ::prost::alloc::vec::Vec, #[prost(message, repeated, tag="2")] - pub token_metadata: ::prost::alloc::vec::Vec, + pub token_metadata: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetUnspentOutputRequest { @@ -131936,7 +131936,7 @@ pub struct GetUnspentOutputResponse { #[prost(message, optional, tag="6")] pub slp_token: ::core::option::Option, #[prost(message, optional, tag="7")] - pub token_metadata: ::core::option::Option, + pub token_metadata: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetMerkleProofRequest { @@ -132068,14 +132068,14 @@ pub struct SubscribeBlocksRequest { pub serialize_block: bool, } #[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetSlpTokenMetadataRequest { +pub struct GetSlpNftMetadataRequest { #[prost(bytes="vec", repeated, tag="1")] pub token_ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } #[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetSlpTokenMetadataResponse { +pub struct GetSlpNftMetadataResponse { #[prost(message, repeated, tag="1")] - pub token_metadata: ::prost::alloc::vec::Vec, + pub token_metadata: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetSlpParsedScriptRequest { @@ -132628,9 +132628,9 @@ pub struct SlpV1Nft1ChildSendMetadata { #[prost(bytes="vec", tag="1")] pub group_token_id: ::prost::alloc::vec::Vec, } -/// SlpTokenMetadata is used to marshal metadata about a specific TokenID +/// SlpNftMetadata is used to marshal metadata about a specific TokenID #[derive(Clone, PartialEq, ::prost::Message)] -pub struct SlpTokenMetadata { +pub struct SlpNftMetadata { #[prost(bytes="vec", tag="1")] pub token_id: ::prost::alloc::vec::Vec, #[prost(enumeration="SlpTokenType", tag="2")] @@ -132638,7 +132638,7 @@ pub struct SlpTokenMetadata { #[prost(oneof="slp_token_metadata::TypeMetadata", tags="3, 4, 5")] pub type_metadata: ::core::option::Option, } -/// Nested message and enum types in `SlpTokenMetadata`. +/// Nested message and enum types in `SlpNftMetadata`. pub mod slp_token_metadata { /// V1Fungible is used to marshal metadata specific to Type 1 token IDs #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/data-for-gpts/komodefi-api/v20-api-content.txt b/data-for-gpts/komodefi-api/v20-api-content.txt index 440af4b7..1a958791 100644 --- a/data-for-gpts/komodefi-api/v20-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-api-content.txt @@ -3166,9 +3166,9 @@ The `TokenTransferFilter` object includes the following items for a transfer of ``` -### TokenMetadata +### NftMetadata -The `TokenMetadata` object includes the following items for a given coin or token: +The `NftMetadata` object includes the following items for a given coin or token: | Parameter | Type | Description | | ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/data-for-gpts/komodefi-api/v20-dev-api-content.txt b/data-for-gpts/komodefi-api/v20-dev-api-content.txt index 060350cb..bc337b60 100644 --- a/data-for-gpts/komodefi-api/v20-dev-api-content.txt +++ b/data-for-gpts/komodefi-api/v20-dev-api-content.txt @@ -3242,7 +3242,7 @@ export const description = | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example diff --git a/src/pages/atomicdex/api/common_structures/activation/index.mdx b/src/pages/atomicdex/api/common_structures/activation/index.mdx index 7173e9f7..b805c6ad 100644 --- a/src/pages/atomicdex/api/common_structures/activation/index.mdx +++ b/src/pages/atomicdex/api/common_structures/activation/index.mdx @@ -7,10 +7,6 @@ export const description = "The Komodo DeFi SDK uses a variety of activation met The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. -The following methods use this structure: - -* TBA - | Parameter | Type | Description | | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | @@ -40,10 +36,6 @@ The following methods use this structure: Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. -The following methods use this structure: - -* TBA - | Parameter | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | @@ -66,10 +58,6 @@ Contains information about electrum & lightwallet\_d servers for coins being use ### ActivationServers -The following methods use this structure: - -* TBA - Contains information electrum servers for coins being used in `Electrum` or `Light` mode. | Parameter | Type | Description | @@ -141,7 +129,7 @@ Contains information electrum servers for coins being used in `Electrum` or `Lig | Parameter | Type | Description | | -------------- | ------- | ------------------------------------------------------------------------------------------------------ | -| type | integer | One of the supported \[coin types]\(link TBA) | +| type | integer | One of the Coin Types supported by the Komodo DeFi Framework | | protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/common_structures/activation/#coin-protocol-data) object. | ### CoinProtocolData diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 214ae99c..63c436c5 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -331,3 +331,115 @@ The `numerator` and `denominator` are BigInteger numbers represented as a sign a } ``` + +### TokenFilter + +The `TokenFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | + +### TokenTransferFilter + +The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + +### WithdrawFee + +The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. + +| Parameter | Type | Description | +| --------------- | -------------- | --------------------------------------------------------------------------------- | +| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | +| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | +| coin | string | The coin which will be used to pay the transaction fee. | +| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | +| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | +| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | +| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | +| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | +| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | + + + #### Example of Eth type + + ```json + { + "type": "Eth", + "coin": "BNB", + "gas": 109739, + "gas_price": "0.000000003", + "total_fee": "0.000329217" + } + ``` + + #### Example of Qrc20 type + + ```json + { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + } + ``` + + #### Example of Tendermint type + + ```json + { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + } + ``` + + #### Example of Utxo type + + ```json + { + "type": "Utxo", + "amount": "0.00001" + } + ``` + diff --git a/src/pages/atomicdex/api/common_structures/lightning/index.mdx b/src/pages/atomicdex/api/common_structures/lightning/index.mdx index a9d598c6..b108d8bd 100644 --- a/src/pages/atomicdex/api/common_structures/lightning/index.mdx +++ b/src/pages/atomicdex/api/common_structures/lightning/index.mdx @@ -140,17 +140,17 @@ It is used for estimating the transaction fee rate (`feerate`) for different tra ### LightningPaymentFilter -| Parameter | Type | Description | -| --------------------- | ------- | -------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_timestamp | string | Optional. Minimum timestamp (in milliseconds) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp (in milliseconds) of payment results to return. | +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | +| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | ### LightningPaymentType diff --git a/src/pages/atomicdex/api/common_structures/nfts/index.mdx b/src/pages/atomicdex/api/common_structures/nfts/index.mdx index e204e2d2..6e7fe2b7 100644 --- a/src/pages/atomicdex/api/common_structures/nfts/index.mdx +++ b/src/pages/atomicdex/api/common_structures/nfts/index.mdx @@ -46,7 +46,7 @@ The `NftInfo` object includes the following items for a given token: | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | ### NftTransfer @@ -80,7 +80,8 @@ The `NftTransfer` object includes the following items for each token transaction | status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | | verified | integer | May be `null`. A deprecated field which will be removed in future. | | operator | string | May be `null`. | -| fee\_details | object | Optional. A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| fee\_details | object | Optional. A standard [WithdrawNftData](/atomicdex/api/common_structures/nfts/#withdraw-nft-data) object. | +| confirmations | integer | The count of blocks produced since this transaction was confirmed. | `verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. @@ -88,3 +89,96 @@ The `NftTransfer` object includes the following items for each token transaction What is `operator`? What does `verified` mean? + +### NftMetadata + +The `NftMetadata` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| image | string | Optional. Direct URL to the NFT's image. | +| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | +| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | +| name | string | Optional. Name of the token. | +| description | string | Optional. Description of the token. | +| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | +| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | +| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | +| external\_url | string | Optional. URL to the external source related to the token. | +| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | +| image\_details | object | Optional. JSON containing additional details or attributes of the image. | + + + ```json + [ + { + "trait_type": "Specialization", + "value": "Thief" + }, + { + "trait_type": "Skin Tone", + "value": "#0013b0" + }, + { + "trait_type": "Weapon", + "value": "Crossbow" + }, + { + "trait_type": "Species", + "value": "Dark Elf" + }, + { + "trait_type": "Gender", + "value": "Female" + }, + { + "trait_type": "Strength", + "value": "8" + }, + { + "trait_type": "Dexterity", + "value": "12" + }, + { + "trait_type": "Intelligence", + "value": "10" + }, + { + "trait_type": "Perks", + "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] + }, + { + "trait_type": "Weakness", + "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] + }, + { + "trait_type": "Personality", + "value": "Aggressive" + } + ] + ``` + + +### WithdrawNftData + +The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | +| to | string | Destination address to withdraw the token to. | +| token\_address | string | Token address. | +| token\_id | string | Token ID. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | +| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | + + + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, + and it has only 1 owner and the owner can own only 1 NFT with this `token_id` + in its `token_address` (also referred to as contract address). + When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more + than 1 user to own one or more of the same NFT (with an identical `token_id`). + Due to this difference, the `amount` and `max` fields are only used the when + the `type` value is `withdraw_erc1155`. + diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx index dd9a1f77..36cea573 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -6,12 +6,12 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. | -| token\_address | string | The token address. | -| token\_id | string | Token ID. | -| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potentially spam link found in collection name, token name, symbol will be censored | +| Parameter | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chain | string | The token chain. | +| token\_address | string | The token address. | +| token\_id | string | Token ID. | +| protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | ### Response Parameters @@ -36,7 +36,7 @@ export const description = | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [TokenMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | #### 📌 Example diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index dfb399ac..32d9aac5 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -104,644 +104,9 @@ It includes a uniform request, successful and error response formats. At the mom ## Common Komodo DeFi SDK Request / Response Objects -The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. +There are some common objects that are used in the Komodo DeFi SDK RPC protocol. These standard objects have been collected and grouped into the following sections: -### ActivationParams - -The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. - -| Parameter | Type | Description | -| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | -| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | -| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | -| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | -| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | -| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | -| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | -| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | -| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | -| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | - - - For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its - first transaction to see all balance and history. This may take a long time on the first - activation, but subsequent activations will be much faster. - Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, - will reduce the average CPU load during ZHTLC coin activation (at the cost of a - longer activation time). These optional fields are recommended when developing - for iOS, where a high CPU load may kill the activation process. Android & - desktop operating systems do not appear to have any problems with high CPU - load during ZHTLC coin activation. - - -### ActivationMode - -Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | -| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | -| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | - -### ActivationRpcData - -Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. - -| Parameter | Type | Description | -| ------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a timestamp in [unix epoch format](https://www.epochconverter.com/)). | - -### ActivationServers - -Contains information electrum servers for coins being used in `Electrum` or `Light` mode. - -| Parameter | Type | Description | -| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| url | string | The URL and port for an electrum server. | -| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | -| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | -| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | - - - #### ZHTLC Example - - ```json - { - "activation_params": { - "mode": { - "rpc": "Light", - "rpc_data": { - "electrum_servers": [ - { - "url":"zombie.dragonhound.info:10033" - } - ], - "light_wallet_d_servers": [ - "http://zombie.dragonhound.info:443" - ] - }, - "sync_params": { - "height": 2528700 - } - }, - "zcash_params_path": "/home/username/path_to/.zcash-params", - "scan_blocks_per_iteration": 100, - "scan_interval_ms": 200 - } - } - ``` - - #### HD UTXO Activation (v2) - - ```json - { - "activation_params": { - "mode": { - "rpc": "Electrum", - "rpc_data": { - "servers": [ - { - "url": "electrum2.cipig.net:10001" - }, - { - "url": "electrum3.cipig.net:20001", - "ws_url": "electrum3.cipig.net:30001", - "protocol": "SSL" - } - ] - } - }, - "scan_policy": "scan_if_new_wallet", - "priv_key_policy": "Trezor", - "min_addresses_number": 3, - "gap_limit": 20 - } - } - ``` - - -### AddressInfos - -The `addressInfos` object includes the following items for a given address: - -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | - - - #### Example with balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "balances": { - "spendable": "0.11398301", - "unspendable": "0.00001" - } - } - ``` - - #### Example without balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "tickers": ["ASLP-SLP"] - } - ``` - - -### BalanceInfos - -The `balanceInfos` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | -| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | - - - ```json - { - "spendable": "12.11398301", - "unspendable": "0.53" - } - ``` - - -### DerivationMethod - -The `DerivationMethod` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | - - - Using the same seed or private key to generate keypairs using different - derivation methods will result in a different address and private key for each - method. - - -Where the value indicates: - -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. - - - ```json - { - "type": "Iguana" - } - ``` - - -### EvmNode - -The `EvmNode` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| url | string | URL of an RPC node | -| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | - - - ```json - { - "url": "http://eth1.cipig.net:8555", - "gui_auth": false - } - ``` - - -### CoinProtocol - -| Parameter | Type | Description | -| -------------- | ------- | ----------------------------------------------------------------------------- | -| type | integer | One of the supported \[coin types]\(link TBA) | -| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | - -### CoinProtocolData - -| Parameter | Type | Description | -| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | -| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | -| network | string | Either `mainnet` or \`testnet | -| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | - -### ConfirmationTargets - -This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. -It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. - -| Parameter | Type | Description | -| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | -| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | -| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | - - - Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: - - * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). - * `normal`: 60 minutes (one hour). - * `high_priority`: 10 to 20 minutes. - - -### CounterpartyChannelConfig - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | -| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | -| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | -| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | -| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | -| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | -| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | -| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | -| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | -| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | - -### FeeInfo - -The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: - -| Parameter | Type | Description | -| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | -| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | - -### LightningActivationParams - -| Parameter | Type | Description | -| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | -| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | -| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | - -### LightningChannelAmount - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------------------------------------------- | -| type | string | `Exact` for a specific amount or `Max` for whole balance. | -| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | - -### LightningChannelConfig - - - The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. - If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. - - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | -| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | -| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | -| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | -| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | -| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | -| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | -| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | - - - For GUIs and wallet apps, it is recommended to set `announced_channel` to - `false` (the default value), as the node is not expected to be reliably - online. - - -### LightningChannelOptions - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | -| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | -| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | - -### LightningClosedChannelsFilter - -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | -| channel\_type | string | Optional. `Inbound` or `Outbound`. | -| closing\_tx | integer | Optional. A transaction ID which closed the channel. | -| closure\_reason | integer | Optional. The reason a channel was closed. | -| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | -| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | -| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | -| channel\_visibility | integer | Optional. `Public` or `Private`. | - - - Response may change to be more consistent in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) - - -### LightningOpenChannelsFilter - -| Parameter | Type | Description | -| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | -| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | -| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | -| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | -| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | -| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | -| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | -| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | -| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | -| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | -| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | - -### LightningPayment - -| Parameter | Type | Description | -| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | -| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | -| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | -| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | -| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | - -### LightningPaymentFilter - -| Parameter | Type | Description | -| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter) | -| from\_timestamp | string | Optional. Minimum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp in [unix epoch format](https://www.epochconverter.com/) of payment results to return. | - -### LightningPaymentType - -| Parameter | Type | Description | -| ----------- | ------ | ----------------------------------------------------------------------------------- | -| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | -| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | - - - Response may change in future. See - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) - - -### Pagination - -For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* - -| Parameter | Type | Description | -| ---------- | ------- | ------------------------------------------------------- | -| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | -| FromId | integer | Optional. Ignores any results prior to this UUID | - - - #### Example - - ```json - { - "PageNumber": 1 - } - ``` - - ```json - { - "FromId": 4 - } - ``` - - -### TokenFilter - -The `TokenFilter` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | - -### TokenTransferFilter - -The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### TokenMetadata - -The `TokenMetadata` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| image | string | Optional. Direct URL to the NFT's image. | -| image\_url | string | Optional. Optional. Url to the NFT's image. Derived from the `image` or `image_url` fields to prioritize the non-null value. Can be null if neither is provided. | -| image\_domain | string | Optional. Extracted domain from the 'image\_url', if valid. | -| name | string | Optional. Name of the token. | -| description | string | Optional. Description of the token. | -| attributes | object or array of objects | Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits. | -| animation\_url | string | Optional. Url to an animation to be displayed instead of a static image. | -| animation\_domain | string | Optional. Extracted domain from the `animation_url`, if valid. | -| external\_url | string | Optional. URL to the external source related to the token. | -| external\_domain | string | Optional. Extracted domain from the `external_url`, if valid. | -| image\_details | object | Optional. JSON containing additional details or attributes of the image. | - - - ```json - [ - { - "trait_type": "Specialization", - "value": "Thief" - }, - { - "trait_type": "Skin Tone", - "value": "#0013b0" - }, - { - "trait_type": "Weapon", - "value": "Crossbow" - }, - { - "trait_type": "Species", - "value": "Dark Elf" - }, - { - "trait_type": "Gender", - "value": "Female" - }, - { - "trait_type": "Strength", - "value": "8" - }, - { - "trait_type": "Dexterity", - "value": "12" - }, - { - "trait_type": "Intelligence", - "value": "10" - }, - { - "trait_type": "Perks", - "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] - }, - { - "trait_type": "Weakness", - "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] - }, - { - "trait_type": "Personality", - "value": "Aggressive" - } - ] - ``` - - -### TokensRequest - -The `TokensRequest` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### WithdrawFee - -The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. - -| Parameter | Type | Description | -| --------------- | -------------- | --------------------------------------------------------------------------------- | -| type | string | The fee type. Either `Utxo`, `Tendermint`, `Qrc20` or `Eth`. | -| amount | numeric string | `Utxo` or `Tendermint` type only. The fee amount. | -| coin | string | The coin which will be used to pay the transaction fee. | -| gas | integer | `Eth` type only. The amount of gas to be used for the transaction. | -| gas\_price | numeric string | `Eth` or `Qrc20` type only. Price per unit of gas to be used for the transaction. | -| gas\_limit | numeric string | `Tendermint` or `Qrc20` type only. Maximum gas to be used for the transaction. | -| miner\_fee | numeric string | `Tendermint` type only. Fee to mine the transaction. | -| total\_fee | numeric string | `Eth` type only. Gas price multiplied by gas amount. | -| total\_gas\_fee | numeric string | `Qrc20` type only. Gas price multiplied by gas amount. | - - - #### Example of Eth type - - ```json - { - "type": "Eth", - "coin": "BNB", - "gas": 109739, - "gas_price": "0.000000003", - "total_fee": "0.000329217" - } - ``` - - #### Example of Qrc20 type - - ```json - { - "type": "Qrc20", - "coin": "tQTUM", - "miner_fee": "0.00000447", - "gas_limit": 100000, - "gas_price": 40, - "total_gas_fee": "0.04" - } - ``` - - #### Example of Tendermint type - - ```json - { - "type": "Tendermint", - "coin": "IRIS", - "amount": "0.038553", - "gas_limit": 100000 - } - ``` - - #### Example of Utxo type - - ```json - { - "type": "Utxo", - "amount": "0.00001" - } - ``` - - -### WithdrawNftData - -The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token: - -| Parameter | Type | Description | -| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| chain | string | The token chain. Chain must be [activated](/atomicdex/api/legacy/coin_activation/) first. | -| to | string | Destination address to withdraw the token to. | -| token\_address | string | Token address. | -| token\_id | string | Token ID. | -| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | -| amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | -| max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | - - - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, - and it has only 1 owner and the owner can own only 1 NFT with this `token_id` - in its `token_address` (also referred to as contract address). - When the `type` parameter in a [withdraw\_nft](/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more - than 1 user to own one or more of the same NFT (with an identical `token_id`). - Due to this difference, the `amount` and `max` fields are only used the when - the `type` value is `withdraw_erc1155`. - +* [Activation](/atomicdex/api/common_structures/activation) +* [Swaps](/atomicdex/api/common_structures/swaps/) +* [Lightning Network](/atomicdex/api/common_structures/lightning/) +* [Non-fungible Tokens](/atomicdex/api/common_structures/nfts/) From 8504bb6e7fc7d3d532a84311e298383c8279058c Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 25 Feb 2024 16:36:44 +0800 Subject: [PATCH 80/85] fix anchor links --- STYLE_GUIDE.md | 2 +- filepathSlugs.json | 55 +++++------------- .../common_structures/activation/index.mdx | 18 ++++++ .../atomicdex/api/common_structures/index.mdx | 49 ---------------- .../api/common_structures/nfts/index.mdx | 55 +++++++++++------- .../get_nft_list/index.mdx | 2 +- .../get_nft_metadata/index.mdx | 2 +- .../get_nft_transfers/index.mdx | 2 +- .../withdraw_nft/index.mdx | 10 ++-- .../api/v20/enable_bch_with_tokens/index.mdx | 2 +- .../api/v20/enable_eth_with_tokens/index.mdx | 2 +- .../enable_tendermint_with_assets/index.mdx | 2 +- utils/_fileData.json | 58 +++++++++---------- 13 files changed, 107 insertions(+), 152 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index c53e507e..4d4e4fca 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -71,7 +71,7 @@ For example: | Parameter | Type | Description | | --------- | ------- | --------------------------------------------------------------------------------------- | | coin | string | The name of the coin the user desires to activate. | -| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/v20/#FeeInfo) object. | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#FeeInfo) object. | | amount | float | Required, unless `max` is `true`. The amount of balance to send. | | max | boolean | Optional, defaults to `false`. Send whole balance. | | memo | string | Optional, used for ZHTLC and Tendermint coins only. Attaches a memo to the transaction. | diff --git a/filepathSlugs.json b/filepathSlugs.json index be53c9f9..4252735d 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1592,6 +1592,7 @@ "coin-protocol", "coin-protocol-data", "evm-node", + "tokens-request", "utxo-merge-params" ], "src/pages/atomicdex/api/common_structures/index.mdx": [ @@ -1614,7 +1615,12 @@ "rational-value", "sync-status", "sync-status-extended", - "example-3" + "example-3", + "withdraw-fee", + "example-of-eth-type", + "example-of-qrc20-type", + "example-of-tendermint-type", + "example-of-utxo-type" ], "src/pages/atomicdex/api/common_structures/lightning/index.mdx": [ "lightning-network-structures", @@ -1632,9 +1638,12 @@ ], "src/pages/atomicdex/api/common_structures/nfts/index.mdx": [ "non-fungible-token-structures", - "tokens-request", "nft-info", - "nft-transfer" + "nft-filter", + "nft-transfer", + "nft-transfer-filter", + "nft-metadata", + "withdraw-nft-data" ], "src/pages/atomicdex/api/common_structures/orders/index.mdx": [ "order-structures", @@ -2420,45 +2429,7 @@ "examples", "response-success-2", "response-error-2", - "common-komodo-de-fi-sdk-request-response-objects", - "activation-params", - "activation-mode", - "activation-rpc-data", - "activation-servers", - "zhtlc-example", - "hd-utxo-activation-v2", - "address-infos", - "example-with-balances", - "example-without-balances", - "balance-infos", - "derivation-method", - "evm-node", - "coin-protocol", - "coin-protocol-data", - "confirmation-targets", - "counterparty-channel-config", - "fee-info", - "lightning-activation-params", - "lightning-channel-amount", - "lightning-channel-config", - "lightning-channel-options", - "lightning-closed-channels-filter", - "lightning-open-channels-filter", - "lightning-payment", - "lightning-payment-filter", - "lightning-payment-type", - "pagination", - "example", - "token-filter", - "token-transfer-filter", - "token-metadata", - "tokens-request", - "withdraw-fee", - "example-of-eth-type", - "example-of-qrc20-type", - "example-of-tendermint-type", - "example-of-utxo-type", - "withdraw-nft-data" + "common-komodo-de-fi-sdk-request-response-objects" ], "src/pages/atomicdex/api/v20/message_signing/index.mdx": [ "signing-and-verifying-messages", diff --git a/src/pages/atomicdex/api/common_structures/activation/index.mdx b/src/pages/atomicdex/api/common_structures/activation/index.mdx index b805c6ad..f6d305cb 100644 --- a/src/pages/atomicdex/api/common_structures/activation/index.mdx +++ b/src/pages/atomicdex/api/common_structures/activation/index.mdx @@ -158,6 +158,24 @@ The `EvmNode` object includes the following items for a given coin or token: ``` +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + ### UtxoMergeParams The `UtxoMergeParams` object defines how often and at which thresholds to merge UTXOs. This is useful for wallets which have been used for a long time, and have many small UTXOs from mining activity. diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 63c436c5..f80a2e2d 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -332,55 +332,6 @@ The `numerator` and `denominator` are BigInteger numbers represented as a sign a ``` -### TokenFilter - -The `TokenFilter` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | - -### TokenTransferFilter - -The `TokenTransferFilter` object includes the following items for a transfer of given coin or token: - -| Parameter | Type | Description | -| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | -| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | -| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | -| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | -| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | -| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - -### TokensRequest - -The `TokensRequest` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - - ### WithdrawFee The `WithdrawFee` object varies depending on the coin or token type. Refer to the examples to view the object structure for each type. diff --git a/src/pages/atomicdex/api/common_structures/nfts/index.mdx b/src/pages/atomicdex/api/common_structures/nfts/index.mdx index 6e7fe2b7..b3c21f0c 100644 --- a/src/pages/atomicdex/api/common_structures/nfts/index.mdx +++ b/src/pages/atomicdex/api/common_structures/nfts/index.mdx @@ -3,23 +3,7 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi # Non-Fungible Token Structures -### TokensRequest - -The `TokensRequest` object includes the following items for a given token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - +The following structures are used in the Komodo DeFi SDK for non-fungible tokens (NFTs). ### NftInfo @@ -46,7 +30,16 @@ The `NftInfo` object includes the following items for a given token: | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/common_structures/nfts/#nft-metadata) object. | + +### NftFilter + +The `NftFilter` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only tokens which have param `possible_phishing:false` are included in the response. | ### NftTransfer @@ -80,7 +73,7 @@ The `NftTransfer` object includes the following items for each token transaction | status | string | Transfer status. Will be either `Send` or `Receive`. When the `from_address` and `to_address` are the same (i.e. sending to yourself), this value will be `Receive`. | | verified | integer | May be `null`. A deprecated field which will be removed in future. | | operator | string | May be `null`. | -| fee\_details | object | Optional. A standard [WithdrawNftData](/atomicdex/api/common_structures/nfts/#withdraw-nft-data) object. | +| fee\_details | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures//#fee-info) object. | | confirmations | integer | The count of blocks produced since this transaction was confirmed. | @@ -90,6 +83,28 @@ The `NftTransfer` object includes the following items for each token transaction What does `verified` mean? +### NftTransferFilter + +The `NftTransferFilter` object includes the following items for a transfer of given coin or token: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| receive | boolean | Optional, defaults to `false`. If `true`, only transfers where user received NFTs are included in the response. | +| send | boolean | Optional, defaults to `false`. If `true`, only transfers where user sent NFTs are included in the response. | +| from\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers from this date onwards (inclusive). | +| to\_date | integer | Optional. A timestamp in [unix epoch format](https://www.epochconverter.com/). If `true`, filter includes transfers up to this date (inclusive). | +| exclude\_spam | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_spam:false` are included in the response. | +| exclude\_phishing | boolean | Optional, defaults to `false`. If `true`, only transfers which have param `possible_phishing:false` are included in the response. | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + + ### NftMetadata The `NftMetadata` object includes the following items for a given coin or token: @@ -169,7 +184,7 @@ The `WithdrawNftData` object is used for withdrawals of NFTs on ERC721 and ERC11 | to | string | Destination address to withdraw the token to. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. May be missing for older transfers. | +| fee | object | A standard [WithdrawFee](/atomicdex/api/common_structures/#withdraw-fee) object. May be missing for older transfers. | | amount | string | Optional, ERC1155 only. Defaults to `1`. Amount of NFTs to withdraw. Ignored if `max` is true. | | max | boolean | Optional, ERC1155 only. Defaults to `false`. If `true`, amount parameter will be ignored and all NFTs with this `token_id` will be sent. | diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx index 2d134089..8c0f521d 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx @@ -20,7 +20,7 @@ Returns a list of the NFTs owned by the user, shown in descending order of the ` | limit | integer | Optional, defaults to `10`. The number of NFTs displayed per page in response. | | page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | | protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | -| filters | object | Optional. A standard [TokenFilter](/atomicdex/api/v20/#token-filter) object. | +| filters | object | Optional. A standard [NftFilter](/atomicdex/api/common_structures/nfts/#nft-filter) object. | ### Response Parameters diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx index 36cea573..ff1ef081 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata/index.mdx @@ -36,7 +36,7 @@ export const description = | token\_hash | string | The token hash. May be `null`. | | token\_uri | string | The URI to the metadata of the token. May be `null`. | | token\_domain | string | Token domain. May be `null`. | -| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/v20/#token-metadata) object. | +| uri\_meta | object | A standard [NftMetadata](/atomicdex/api/common_structures/nfts/#nft-metadata) object. | #### 📌 Example diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx index 02bf542e..4abf3a97 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers/index.mdx @@ -19,7 +19,7 @@ Returns a list of the NFT transfers involving the user, shown in descending orde | limit | integer | Optional, defaults to `10`. The number of NFT transfers displayed per page in response. | | page\_number | integer | Optional, defaults to `1`. The page offset for items in response. | | protect\_from\_spam | boolean | Optional, defaults to `false`. If `true`, any potential spam link found in collection name, token name, symbol will be replaced with `URL redacted for user protection` | -| filters | object | Optional. A standard [TokenTransferFilter](/atomicdex/api/v20/#token-transfer-filter) object. | +| filters | object | Optional. A standard [NftTransferFilter](/atomicdex/api/common_structures/nfts/#nft-transfer-filter) object. | ### Response Parameters diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx index f135a58f..e9f9df67 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/index.mdx @@ -11,10 +11,10 @@ export const description = ### Request Parameters -| Parameter | Type | Description | -| -------------- | ------ | ---------------------------------------------------------------------------------------- | -| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | -| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/v20/#withdraw-nft-data) object. | +| Parameter | Type | Description | +| -------------- | ------ | ---------------------------------------------------------------------------------------------- | +| type | string | The contract type of the NFT to withdraw. Either `withdraw_erc721` or `withdraw_erc1155` | +| withdraw\_data | object | A standard [WithdrawNftData](/atomicdex/api/common_structures/nfts/#withdraw-nft-data) object. | ### Response Parameters @@ -28,7 +28,7 @@ export const description = | contract\_type | string | Contract type. `ERC721` or `ERC1155`. | | token\_address | string | Token address. | | token\_id | string | Token ID. | -| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/v20/#withdraw-fee) object. | +| fee\_details | object | A standard [WithdrawFee](/atomicdex/api/common_structures/#withdraw-fee) object. | | coin | string | Coin name. One of `AVALANCHE`, `BSC`, `ETH`, `FANTOM`, or `POLYGON`. | | block\_height | integer | Block height of the transaction. If the value is `0`, the transaction is unconfirmed. | | timestamp | integer | Timestamp of the block containing the withdrawl transaction in [unix epoch format](https://www.epochconverter.com/). | diff --git a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx index 86614597..a1b30eb6 100644 --- a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx @@ -13,7 +13,7 @@ The AtomicDEX-API supports Bitcoin Cash SLP tokens. Using this method, you can e | bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). | | mode | object | A standard [ActivationMode](/atomicdex/api/common_structures/activation/#activation-mode) object. | | tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. | -| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/activation/#tokens-request) objects. | | address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object. | | allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. | | get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | diff --git a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx index c02f3618..b1a009b4 100644 --- a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx @@ -15,7 +15,7 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik | swap\_contract\_address | string | Address of etomic swap smart contract | | fallback\_swap\_contract | string | Address of backup etomic swap smart contract | | nodes | array of objects | A list of standard [EvmNode](/atomicdex/api/common_structures/activation/#evm-node) objects. | -| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/activation/#tokens-request) objects. | | gas\_station\_decimals | integer | Optional, for ETH/ERC20 and other gas model chains. Defaults to `8`. Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly. | | gas\_station\_policy.policy | string | Optional, for ETH/ERC20 and other gas model chains. Defaults to `"MeanAverageFast"`. Defines the method of gas price calculation from the station response. `"MeanAverageFast"` will use the mean between average and fast fields. `"Average"` will return a simple average value. | | get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | diff --git a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx index f2d15de0..5d59aaf6 100644 --- a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx @@ -11,7 +11,7 @@ Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC asset | ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ticker | string | Ticker of the platform protocol coin. Options: `ATOM`, `IRIS`, `OSMOSIS` | | mm2 | integer | Required if not set in `coins` file. Informs the AtomicDEX API whether or not the coin is expected to function. Accepted values are `0` or `1` | -| tokens\_params | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| tokens\_params | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/activation/#tokens-request) objects. | | priv\_key\_policy | string | Optional, defaults to `ContextPrivKey`. value can be `ContextPrivKey`,`Trezor` when AtomicDEX-API is built for native platforms. value can be `ContextPrivKey`, `Trezor`, `Metamask` when the AtomicDEX-API is built targeting `wasm` | | tx\_history | boolean | Optional, defaults to `false`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | | required\_confirmations | integer | Optional, defaults to `3`. When the platform coin is involved, the number of confirmations for the AtomicDEX API to wait during the transaction steps of an atomic swap | diff --git a/utils/_fileData.json b/utils/_fileData.json index faf229ee..28fb2b66 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1523,7 +1523,7 @@ } }, "/atomicdex/api/common_structures/activation": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1536,7 +1536,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-12-22T05:16:08.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1549,24 +1549,24 @@ } }, "/atomicdex/api/common_structures/lightning": { - "dateModified": "2023-11-10T06:44:47.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" + }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/common_structures/nfts": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1751,12 +1751,8 @@ } }, "/atomicdex/api/legacy/batch_requests": { - "dateModified": "2023-10-06T04:54:44.000Z", + "dateModified": "2023-09-09T13:48:49.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1769,14 +1765,18 @@ "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "mrgcharang@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/legacy/best_orders": { @@ -3534,7 +3534,7 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4244,7 +4244,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T07:55:43.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4257,7 +4257,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T07:56:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4270,7 +4270,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T07:55:43.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4806,11 +4806,11 @@ } }, "/atomicdex/setup": { - "dateModified": "2024-01-17T16:26:22.000Z", + "dateModified": "2024-02-09T13:52:20.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -4822,11 +4822,11 @@ }, { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "mrgcharang@gmail.com" }, { - "name": "\"gcharang\"", - "email": "mrgcharang@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { "name": "\"Artem Pikulin\"", @@ -4846,8 +4846,8 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/additional-information-about-atomicdex": { From 3cd72803054e40e352df7d7f452816e539842e10 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:53:42 +0530 Subject: [PATCH 81/85] make sql commands formatting consistent --- .../non_fungible_tokens/query_nft_database_tables/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx index fbed2f65..632384b8 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx @@ -96,7 +96,7 @@ The COIN\_nft\_transfer\_history tables contain the history of transfers of your ### Example scanned\_nft\_blocks table query -`SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;` +> SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320; | transaction\_hash | token\_name | token\_address | token\_id | | ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | @@ -114,7 +114,7 @@ It has the following columns: ### Example scanned\_nft\_blocks table query -`SELECT * FROM scanned_nft_blocks;` +> SELECT * FROM scanned_nft_blocks; | chain | last\_scanned\_block | | ----- | -------------------- | From e0267a30638996e8260d3c5b5032285619c4562e Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:02:37 +0530 Subject: [PATCH 82/85] fix headings --- .../non_fungible_tokens/query_nft_database_tables/index.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx index 632384b8..b6c29ac0 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx @@ -94,9 +94,9 @@ The COIN\_nft\_transfer\_history tables contain the history of transfers of your | 17 | token\_name | TEXT | The name of the token. | | 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | -### Example scanned\_nft\_blocks table query +### Example COIN\_nft\_transfer_history table query -> SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320; +> SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp \> 1701519320; | transaction\_hash | token\_name | token\_address | token\_id | | ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | @@ -114,7 +114,7 @@ It has the following columns: ### Example scanned\_nft\_blocks table query -> SELECT * FROM scanned_nft_blocks; +> SELECT \* FROM scanned_nft_blocks; | chain | last\_scanned\_block | | ----- | -------------------- | From 423eadf139e22969f88bbd404ac5c45746e5e221 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:05:01 +0530 Subject: [PATCH 83/85] ran tests --- filepathSlugs.json | 4 +-- .../query_nft_database_tables/index.mdx | 6 ++-- utils/_fileData.json | 30 +++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 4252735d..9568b416 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2853,9 +2853,9 @@ "nft-list-tables", "example-coin-nft-list-table-query", "nft-transfer-table", - "example-scanned-nft-blocks-table-query", + "example-coin-nft-transfer-history-table-query", "nft-last-scanned-block-table", - "example-scanned-nft-blocks-table-query-2" + "example-scanned-nft-blocks-table-query" ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata/index.mdx": [ "refresh-nft-metadata", diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx index b6c29ac0..634a8208 100644 --- a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/index.mdx @@ -94,9 +94,9 @@ The COIN\_nft\_transfer\_history tables contain the history of transfers of your | 17 | token\_name | TEXT | The name of the token. | | 18 | details\_json | TEXT | Additional information about the transaction in JSON format. | -### Example COIN\_nft\_transfer_history table query +### Example COIN\_nft\_transfer\_history table query -> SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC_nft_transfer_history WHERE block_timestamp \> 1701519320; +> SELECT transaction\_hash, token\_name, token\_address, token\_id, FROM MATIC\_nft\_transfer\_history WHERE block\_timestamp > 1701519320; | transaction\_hash | token\_name | token\_address | token\_id | | ------------------------------------------------------------------ | -------------------- | ------------------------------------------ | --------- | @@ -114,7 +114,7 @@ It has the following columns: ### Example scanned\_nft\_blocks table query -> SELECT \* FROM scanned_nft_blocks; +> SELECT \* FROM scanned\_nft\_blocks; | chain | last\_scanned\_block | | ----- | -------------------- | diff --git a/utils/_fileData.json b/utils/_fileData.json index 28fb2b66..3640e803 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1523,7 +1523,7 @@ } }, "/atomicdex/api/common_structures/activation": { - "dateModified": "2024-02-25T07:56:30.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1536,7 +1536,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2024-02-25T07:56:30.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1566,7 +1566,7 @@ } }, "/atomicdex/api/common_structures/nfts": { - "dateModified": "2024-02-25T07:56:30.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3256,7 +3256,7 @@ } }, "/atomicdex/api/v20/enable_bch_with_tokens": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3314,7 +3314,7 @@ } }, "/atomicdex/api/v20/enable_eth_with_tokens": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3401,7 +3401,7 @@ } }, "/atomicdex/api/v20/enable_tendermint_with_assets": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4244,7 +4244,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list": { - "dateModified": "2024-02-25T07:55:43.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4257,7 +4257,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_metadata": { - "dateModified": "2024-02-25T07:56:30.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4270,7 +4270,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_transfers": { - "dateModified": "2024-02-25T07:55:43.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", @@ -4312,16 +4312,20 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables": { - "dateModified": "2023-12-04T17:15:38.000Z", + "dateModified": "2024-02-27T17:32:37.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/non_fungible_tokens/refresh_nft_metadata": { @@ -4351,7 +4355,7 @@ } }, "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft": { - "dateModified": "2023-12-04T18:03:09.000Z", + "dateModified": "2024-02-25T08:36:44.000Z", "contributors": [ { "name": "\"smk762\"", From 2a6297a6f44caeaf16ff6a77361e9938dd32d084 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 29 Feb 2024 18:06:46 +0800 Subject: [PATCH 84/85] add clear_nft_db doc --- filepathSlugs.json | 8 ++ src/data/sidebar.json | 12 ++- src/pages/atomicdex/api/index.mdx | 1 + .../clear_nft_db/index.mdx | 90 +++++++++++++++++++ 4 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 src/pages/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/index.mdx diff --git a/filepathSlugs.json b/filepathSlugs.json index 4252735d..a3af4e6f 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -2820,6 +2820,14 @@ "response-balance-too-low", "response-transport-error" ], + "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/index.mdx": [ + "clear-nft-database", + "request-parameters", + "example-to-clear-binance-smart-chain-and-polygon-nft-data", + "example-to-clear-all-nft-data", + "error-responses", + "unsupported-chain-type" + ], "src/pages/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/index.mdx": [ "get-a-list-of-nfts", "request-parameters", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index 432673d5..d59cc0d4 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -412,6 +412,14 @@ "title": "Overview", "href": "/atomicdex/api/v20-dev/non_fungible_tokens/" }, + { + "title": "Clear NFT Database Tables", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/" + }, + { + "title": "Query NFT Database Tables", + "href": "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/" + }, { "title": "Get NFT List", "href": "/atomicdex/api/v20-dev/non_fungible_tokens/get_nft_list/" @@ -435,10 +443,6 @@ { "title": "Withdraw NFT", "href": "/atomicdex/api/v20-dev/non_fungible_tokens/withdraw_nft/" - }, - { - "title": "Query NFT Database Tables", - "href": "/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables/" } ] }, diff --git a/src/pages/atomicdex/api/index.mdx b/src/pages/atomicdex/api/index.mdx index fb133074..8664fc20 100644 --- a/src/pages/atomicdex/api/index.mdx +++ b/src/pages/atomicdex/api/index.mdx @@ -22,6 +22,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: | | | [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) | | [cancel\_all\_orders](/atomicdex/api/legacy/cancel_all_orders/#cancel-all-orders) | | | | [cancel\_order](/atomicdex/api/legacy/cancel_order/#cancel-order) | | | +| | | [clear\_nft\_db](/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/#clear-nft-database) | | | | [close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) | | [coins\_needed\_for\_kick\_start](/atomicdex/api/legacy/coins_needed_for_kick_start/#coins-needed-for-kick-start) | | | | [convert\_utxo\_address](/atomicdex/api/legacy/convert_utxo_address/#convert-utxo-address) | | | diff --git a/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/index.mdx b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/index.mdx new file mode 100644 index 00000000..e22b7d3f --- /dev/null +++ b/src/pages/atomicdex/api/v20-dev/non_fungible_tokens/clear_nft_db/index.mdx @@ -0,0 +1,90 @@ +export const title = "AtomicDEX: Non Fungible Tokens"; +export const description = + "This document describes the clear_nft_db method AtomicDEX-API provides to clear NFT data from your local database"; + +# Clear NFT Database {{label : 'clear_nft_db', tag : 'API-v2'}} + +This method will clear the NFT database data stored in the local database for selected (or all) networks. + +### Request Parameters + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------ | +| clear\_all | boolean | Defaults to `false`. If `true` all NFT data for all networks will be purged. | +| chains | array | Optional. List of networks to remove NFT data for. Options are: `POLYGON`, `FANTOM`, `ETH`, `BSC`, or `AVALANCHE`. | + + + You can confirm the NFT database has been cleared by querying the `KOMODEFI.db` database file. + For more information, refer to the [Query NFT Database Tables](/atomicdex/api/v20-dev/non_fungible_tokens/query_nft_database_tables) documentation. + + +#### 📌 Example to clear Binance Smart chain and Polygon NFT data + + + ```json + { + "userpass": "testpsw", + "method": "clear_nft_db", + "mmrpc": "2.0", + "params": { + "chains": [ + "POLYGON", + "BSC" + ] + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + +#### 📌 Example to clear all NFT data + + + ```json + { + "userpass": "testpsw", + "method": "clear_nft_db", + "mmrpc": "2.0", + "params": { + "clear_all": true + } + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": null, + "id": null + } + ``` + + +### Error responses + +#### UnsupportedChainType + +Returned when the `chains` parameter contains an unsupported network. + +```json +{ + "mmrpc": "2.0", + "error": "Error parsing request: UnsupportedChainType", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "UnsupportedChainType", + "id": null +} +``` From 7f0bef199c868dfb6a9fe58f3e0e27aeb4364ffb Mon Sep 17 00:00:00 2001 From: gcharang Date: Thu, 29 Feb 2024 13:10:52 +0000 Subject: [PATCH 85/85] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- filepathSlugs.json | 136 ++++++++++++++++++++------------------------- 1 file changed, 61 insertions(+), 75 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index bd5b8939..7fb4a5ff 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -4036,8 +4036,6 @@ ], "src/pages/smart-chains/api/control/index.mdx": [ "control", - "getnotarysendmany", - "getiguanajson", "getinfo", "arguments", "response", @@ -4156,10 +4154,7 @@ "activate-mining-with-4-threads", "check-the-setting", "turn-off-generation", - "turning-the-setting-on-via-json-rpc", - "arguments-4", - "response-4", - "examples-4" + "turning-the-setting-on-via-json-rpc" ], "src/pages/smart-chains/api/index.mdx": [ "smart-chain-api" @@ -4525,133 +4520,125 @@ "arguments-30", "response-30", "examples-30", - "opreturn-burn", + "resendwallettransactions", "arguments-31", "response-31", "examples-31", - "command", - "response-32", - "command-2", - "response-33", - "resendwallettransactions", + "sendfrom", "arguments-32", - "response-34", + "response-32", "examples-32", - "sendfrom", + "sendmany", "arguments-33", - "response-35", + "response-33", "examples-33", - "sendmany", + "sendtoaddress", "arguments-34", - "response-36", + "response-34", "examples-34", - "sendtoaddress", + "setaccount", "arguments-35", - "response-37", "examples-35", - "setaccount", + "setpubkey", "arguments-36", + "response-35", "examples-36", - "setpubkey", + "settxfee", "arguments-37", - "response-38", + "response-36", "examples-37", - "settxfee", + "signmessage", "arguments-38", - "response-39", + "response-37", "examples-38", - "signmessage", + "walletlock", "arguments-39", - "response-40", + "response-38", "examples-39", - "walletlock", + "walletpassphrase", "arguments-40", - "response-41", + "response-39", "examples-40", - "walletpassphrase", + "walletpassphrasechange", "arguments-41", - "response-42", + "response-40", "examples-41", - "walletpassphrasechange", + "z-exportkey", "arguments-42", - "response-43", + "response-41", "examples-42", - "z-exportkey", + "z-exportviewingkey", "arguments-43", - "response-44", + "response-42", "examples-43", - "z-exportviewingkey", + "z-exportwallet", "arguments-44", - "response-45", + "response-43", "examples-44", - "z-exportwallet", + "z-getbalance", "arguments-45", - "response-46", + "response-44", "examples-45", - "z-getbalance", + "z-getnewaddress", "arguments-46", - "response-47", + "response-45", "examples-46", - "z-getnewaddress", + "z-getoperationresult", "arguments-47", - "response-48", + "response-46", "examples-47", - "z-getoperationresult", + "z-getoperationstatus", "arguments-48", - "response-49", + "response-47", "examples-48", - "z-getoperationstatus", + "z-gettotalbalance", "arguments-49", - "response-50", + "response-48", "examples-49", - "z-gettotalbalance", + "z-importkey", "arguments-50", - "response-51", + "response-49", "examples-50", - "z-importkey", + "z-importviewingkey", "arguments-51", - "response-52", + "response-50", "examples-51", - "z-importviewingkey", + "z-importwallet", "arguments-52", - "response-53", + "response-51", "examples-52", - "z-importwallet", + "z-listaddresses", "arguments-53", - "response-54", + "response-52", "examples-53", - "z-listaddresses", + "z-listoperationids", "arguments-54", - "response-55", + "response-53", "examples-54", - "z-listoperationids", - "arguments-55", - "response-56", - "examples-55", "z-listreceivedbyaddress", - "arguments-56", + "arguments-55", "result", - "examples-56", + "examples-55", "z-listunspent", - "arguments-57", + "arguments-56", "results", - "examples-57", + "examples-56", "z-mergetoaddress", "the-fromaddresses-array", + "arguments-57", + "response-54", + "examples-57", + "z-sendmany", "arguments-58", - "response-57", + "response-55", "examples-58", - "z-sendmany", + "z-shieldcoinbase", "arguments-59", - "response-58", + "response-56", "examples-59", - "z-shieldcoinbase", - "arguments-60", - "response-59", - "examples-60", "zcbenchmark", - "arguments-61", - "response-60", + "arguments-60", + "response-57", "zcrawjoinsplit", "zcrawkeygen", "zcrawreceive-zcsecretkey-encryptednote", @@ -5642,7 +5629,6 @@ "step-12-experiment-with-the-tokens-antara-module", "step-13-read-the-introduction-to-atomic-dex", "step-14-experiment-with-atomic-swaps", - "step-15-begin-the-advanced-development-tutorial", - "step-16-inspect-komodo-community-bounties" + "step-15-begin-the-advanced-development-tutorial" ] } \ No newline at end of file