From 11a04de4e7bed5d745343cde893d598cd904e928 Mon Sep 17 00:00:00 2001 From: Artem Pikulin Date: Wed, 27 Jan 2021 15:11:33 +0700 Subject: [PATCH 1/6] Document additions to my_recent_swaps. --- docs/basic-docs/atomicdex/atomicdex-api.md | 65 +++++++++++++++++----- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/docs/basic-docs/atomicdex/atomicdex-api.md b/docs/basic-docs/atomicdex/atomicdex-api.md index 8e2dcb060..7a0ab300e 100644 --- a/docs/basic-docs/atomicdex/atomicdex-api.md +++ b/docs/basic-docs/atomicdex/atomicdex-api.md @@ -1828,33 +1828,65 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ **(from_uuid limit=10)** -The `my_recent_swaps` method returns the data of the most recent atomic swaps executed by the MM2 node. +The `my_recent_swaps` method returns the data of the most recent atomic swaps executed by the MM2 node. Please note that all filters (my_coin, from_timestamp, etc.) are combined using logical AND. #### Arguments -| Structure | Type | Description | -| --------- | ------ | ----------------------------------------------------------------------- | -| limit | number | limits the number of returned swaps | -| from_uuid | string | MM2 will skip records until this uuid, skipping the `from_uuid` as well | +| Structure | Type | Description | +| -------------- | ------ | ----------------------------------------------------------------------- | +| limit | number | limits the number of returned swaps. The default is `10`. | +| from_uuid | string | MM2 will skip records until this uuid, skipping the `from_uuid` as well; The `from_uuid` approach is convenient for infinite scrolling implementation | +| page_number | number | MM2 will return `limit` swaps from the selected page; This param will be ignored if `from_uuid` is set. | +| my_coin | string | return only swaps, which match the `swap.my_coin = request.my_coin` condition | +| other_coin | string | return only swaps, which match the `swap.other_coin = request.other_coin` condition | +| from_timestamp | string | return only swaps, which match the `swap.started_at >= request.from_timestamp` condition | +| to_timestamp | string | return only swaps, which match the `swap.started_at < request.to_timestamp` condition | #### Response -| Structure | Type | Description | -| --------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| swaps | array of objects | swaps data; each record has the format of the `my_swap_status` response | -| from_uuid | string | the from_uuid that was set in the request; this value is null if nothing was set | -| skipped | number | the number of skipped records (i.e. the position of `from_uuid` in the list + 1; the value is 0 if `from_uuid` was not set | -| limit | number | the limit that was set in the request; note that the actual number of swaps can differ from the specified limit (e.g. on the last page) | -| total | number | total number of swaps available | +| Structure | Type | Description | +| ------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| swaps | array of objects | swaps data; each record has the format of the `my_swap_status` response | +| from_uuid | string | the from_uuid that was set in the request; this value is null if nothing was set | +| skipped | number | the number of skipped records (i.e. the position of `from_uuid` in the list + 1 or `(page_number - 1) * limit`; the value is 0 if `from_uuid` or `page_number` were not set or `page_number` is 1) | +| limit | number | the limit that was set in the request; note that the actual number of swaps can differ from the specified limit (e.g. on the last page) | +| total | number | total number of swaps available with the selected filters | +| page_number | number | the page_number that was set in the request; this value is null if nothing was set | +| total_pages | number | total pages available with the selected filters and limit | +| found_records | number | the number of returned swaps | #### :pushpin: Examples -#### Command +#### Command (limit + from_uuid) ```bash curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"from_uuid\":\"e299c6ece7a7ddc42444eda64d46b163eaa992da65ce6de24eb812d715184e4c\",\"limit\":2}" ``` +#### Command (limit + page_number) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"page_number\":3,\"limit\":2}" +``` + +#### Command (select swaps, which have my_coin = RICK and other_coin = MORTY) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"other_coin\":\"MORTY\"}" +``` + +#### Command (select swaps, which have my_coin = RICK and started_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"from_timestamp\":1611705600}" +``` + +#### Command (select swaps, which have started_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started_at < 1611792001 (January 28, 2021 0:00:01 GMT)) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"from_timestamp\":1611705600,\"to_timestamp\":1611792001}" +``` +
+## all\_swaps\_uuids\_by\_filter + +**(my_coin other_coin from_timestamp to_timestamp)** + +The `all_swaps_uuids_by_filter` method returns all uuids of swaps that match the selected filters. Please note that all filters (my_coin, from_timestamp, etc.) are combined using logical AND. + +#### Arguments + +| Structure | Type | Description | +| -------------- | ----------------------------- | ----------------------------------------------------------------------- | +| my_coin | string | return only swaps that match the `swap.my_coin = request.my_coin` condition | +| other_coin | string | return only swaps that match the `swap.other_coin = request.other_coin` condition | +| from_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at >= request.from_timestamp` condition | +| to_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at < request.to_timestamp` condition | + +#### Response + +| Structure | Type | Description | +| --------------------- | ---------------- | --------------------------------------------------------------- | +| result | result object | | +| result.uuids | array of strings | uuids of swaps that match the selected filters | +| result.my_coin | string | my_coin that was set in request | +| result.other_coin | string | other_coin that was set in request | +| result.from_timestamp | number | from_timestamp that was set in request | +| result.to_timestamp | number | to_timestamp that was set in request | +| result.records_found | number | the number of found uuids | + +#### :pushpin: Examples + +#### Command (select swaps uuids that have my_coin = RICK and other_coin = MORTY) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"all_swaps_uuids_by_filter\"\"my_coin\":\"RICK\",\"other_coin\":\"MORTY\"}" +``` + +#### Command (select swaps uuids that have my_coin = RICK and started_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"all_swaps_uuids_by_filter\",\"my_coin\":\"RICK\",\"from_timestamp\":1611705600}" +``` + +#### Command (select swaps uuids that have started_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started_at < 1611792001 (January 28, 2021 0:00:01 GMT)) + +```bash +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"all_swaps_uuids_by_filter\",\"my_coin\":\"RICK\",\"from_timestamp\":1611705600,\"to_timestamp\":1611792001}" +``` + +
+ + + +
+ + ## buy **buy base rel price volume (match_by order_type base_confs base_nota rel_confs rel_nota)** @@ -1826,7 +1902,7 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ ## my\_recent\_swaps -**(from_uuid limit=10)** +**(from_uuid page_number=1 limit=10 my_coin other_coin from_timestamp to_timestamp)** The `my_recent_swaps` method returns the data of the most recent atomic swaps executed by the MM2 node. Please note that all filters (my_coin, from_timestamp, etc.) are combined using logical AND. @@ -1837,10 +1913,10 @@ The `my_recent_swaps` method returns the data of the most recent atomic swaps ex | limit | number | limits the number of returned swaps. The default is `10`. | | from_uuid | string | MM2 will skip records until this uuid, skipping the `from_uuid` as well; The `from_uuid` approach is convenient for infinite scrolling implementation | | page_number | number | MM2 will return `limit` swaps from the selected page; This param will be ignored if `from_uuid` is set. | -| my_coin | string | return only swaps, which match the `swap.my_coin = request.my_coin` condition | -| other_coin | string | return only swaps, which match the `swap.other_coin = request.other_coin` condition | -| from_timestamp | number (timestamp in seconds) | return only swaps, which match the `swap.started_at >= request.from_timestamp` condition | -| to_timestamp | number (timestamp in seconds) | return only swaps, which match the `swap.started_at < request.to_timestamp` condition | +| my_coin | string | return only swaps that match the `swap.my_coin = request.my_coin` condition | +| other_coin | string | return only swaps that match the `swap.other_coin = request.other_coin` condition | +| from_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at >= request.from_timestamp` condition | +| to_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at < request.to_timestamp` condition | #### Response @@ -1869,19 +1945,19 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"page_number\":3,\"limit\":2}" ``` -#### Command (select swaps, which have my_coin = RICK and other_coin = MORTY) +#### Command (select swaps that have my_coin = RICK and other_coin = MORTY) ```bash curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"other_coin\":\"MORTY\"}" ``` -#### Command (select swaps, which have my_coin = RICK and started_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) +#### Command (select swaps that have my_coin = RICK and started_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) ```bash curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"from_timestamp\":1611705600}" ``` -#### Command (select swaps, which have started_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started_at < 1611792001 (January 28, 2021 0:00:01 GMT)) +#### Command (select swaps that have started_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started_at < 1611792001 (January 28, 2021 0:00:01 GMT)) ```bash curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"my_recent_swaps\",\"limit\":2,\"my_coin\":\"RICK\",\"from_timestamp\":1611705600,\"to_timestamp\":1611792001}"