diff --git a/gsrest/service/addresses_service.py b/gsrest/service/addresses_service.py index fdd0f9c..ed39a4f 100644 --- a/gsrest/service/addresses_service.py +++ b/gsrest/service/addresses_service.py @@ -110,6 +110,7 @@ async def list_address_links(request, neighbor, min_height=None, max_height=None, + order='desc', page=None, pagesize=None): address = cannonicalize_address(currency, address) @@ -120,6 +121,7 @@ async def list_address_links(request, neighbor, min_height=min_height, max_height=max_height, + order=order, page=page, pagesize=pagesize) diff --git a/gsrest/service/entities_service.py b/gsrest/service/entities_service.py index 8ec26ad..c0e45ce 100644 --- a/gsrest/service/entities_service.py +++ b/gsrest/service/entities_service.py @@ -603,6 +603,7 @@ async def list_entity_links(request, neighbor, min_height=None, max_height=None, + order='desc', page=None, pagesize=None): db = request.app['db'] @@ -611,6 +612,7 @@ async def list_entity_links(request, neighbor, min_height=min_height, max_height=max_height, + order=order, page=page, pagesize=pagesize) diff --git a/openapi_server/controllers/addresses_controller.py b/openapi_server/controllers/addresses_controller.py index cb1b59e..7272a7a 100644 --- a/openapi_server/controllers/addresses_controller.py +++ b/openapi_server/controllers/addresses_controller.py @@ -157,7 +157,7 @@ async def get_address_entity(request: web.Request, currency, address) -> web.Res raise web.HTTPInternalServerError() -async def list_address_links(request: web.Request, currency, address, neighbor, min_height=None, max_height=None, page=None, pagesize=None) -> web.Response: +async def list_address_links(request: web.Request, currency, address, neighbor, min_height=None, max_height=None, order=None, page=None, pagesize=None) -> web.Response: """Get outgoing transactions between two addresses @@ -172,6 +172,8 @@ async def list_address_links(request: web.Request, currency, address, neighbor, :type min_height: int :param max_height: Return transactions up to (including) given height :type max_height: int + :param order: Sorting order + :type order: str :param page: Resumption token for retrieving the next page :type page: str :param pagesize: Number of items returned in a single page @@ -200,11 +202,11 @@ async def list_address_links(request: web.Request, currency, address, neighbor, request.app['request_config']['show_private_tags'] = show_private_tags try: - if 'currency' in ['','currency','address','neighbor','min_height','max_height','page','pagesize']: + if 'currency' in ['','currency','address','neighbor','min_height','max_height','order','page','pagesize']: if currency is not None: currency = currency.lower() result = service.list_address_links(request - ,currency=currency,address=address,neighbor=neighbor,min_height=min_height,max_height=max_height,page=page,pagesize=pagesize) + ,currency=currency,address=address,neighbor=neighbor,min_height=min_height,max_height=max_height,order=order,page=page,pagesize=pagesize) result = await result for plugin in request.app['plugins']: diff --git a/openapi_server/controllers/entities_controller.py b/openapi_server/controllers/entities_controller.py index 522c9fa..e515f23 100644 --- a/openapi_server/controllers/entities_controller.py +++ b/openapi_server/controllers/entities_controller.py @@ -240,7 +240,7 @@ async def list_entity_addresses(request: web.Request, currency, entity, page=Non raise web.HTTPInternalServerError() -async def list_entity_links(request: web.Request, currency, entity, neighbor, min_height=None, max_height=None, page=None, pagesize=None) -> web.Response: +async def list_entity_links(request: web.Request, currency, entity, neighbor, min_height=None, max_height=None, order=None, page=None, pagesize=None) -> web.Response: """Get transactions between two entities @@ -255,6 +255,8 @@ async def list_entity_links(request: web.Request, currency, entity, neighbor, mi :type min_height: int :param max_height: Return transactions up to (including) given height :type max_height: int + :param order: Sorting order + :type order: str :param page: Resumption token for retrieving the next page :type page: str :param pagesize: Number of items returned in a single page @@ -283,11 +285,11 @@ async def list_entity_links(request: web.Request, currency, entity, neighbor, mi request.app['request_config']['show_private_tags'] = show_private_tags try: - if 'currency' in ['','currency','entity','neighbor','min_height','max_height','page','pagesize']: + if 'currency' in ['','currency','entity','neighbor','min_height','max_height','order','page','pagesize']: if currency is not None: currency = currency.lower() result = service.list_entity_links(request - ,currency=currency,entity=entity,neighbor=neighbor,min_height=min_height,max_height=max_height,page=page,pagesize=pagesize) + ,currency=currency,entity=entity,neighbor=neighbor,min_height=min_height,max_height=max_height,order=order,page=page,pagesize=pagesize) result = await result for plugin in request.app['plugins']: diff --git a/openapi_server/openapi/openapi.yaml b/openapi_server/openapi/openapi.yaml index e768fe5..9e7c49a 100644 --- a/openapi_server/openapi/openapi.yaml +++ b/openapi_server/openapi/openapi.yaml @@ -378,6 +378,19 @@ paths: schema: $ref: '#/components/schemas/height' style: form + - description: Sorting order + example: desc + explode: true + in: query + name: order + required: false + schema: + default: desc + enum: + - asc + - desc + type: string + style: form - description: Resumption token for retrieving the next page explode: true in: query @@ -1046,6 +1059,19 @@ paths: schema: $ref: '#/components/schemas/height' style: form + - description: Sorting order + example: desc + explode: true + in: query + name: order + required: false + schema: + default: desc + enum: + - asc + - desc + type: string + style: form - description: Resumption token for retrieving the next page explode: true in: query @@ -4685,6 +4711,260 @@ components: title: search_result_level6 type: object search_result_leaf: + example: + neighbor: + token_values: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + value: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + entity: + total_spent: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + in_degree: 0 + no_addresses: 1 + out_degree: 6 + first_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + total_tokens_received: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + no_address_tags: 2 + root_address: addressA + actors: + - id: id + label: example + - id: id + label: example + balance: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + no_incoming_txs: 5 + no_outgoing_txs: 5 + currency: btc + last_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + entity: 123456 + token_balances: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + total_received: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + total_tokens_spent: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + labels: + - labels + - labels + no_txs: 11 + matching_addresses: + - total_spent: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + in_degree: 1 + is_contract: true + address: addressA + out_degree: 5 + first_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + total_tokens_received: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + actors: + - id: id + label: example + - id: id + label: example + balance: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + no_incoming_txs: 5 + no_outgoing_txs: 2 + currency: btc + last_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + entity: 123456 + token_balances: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + total_received: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + total_tokens_spent: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + status: clean + - total_spent: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + in_degree: 1 + is_contract: true + address: addressA + out_degree: 5 + first_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + total_tokens_received: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + actors: + - id: id + label: example + - id: id + label: example + balance: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + no_incoming_txs: 5 + no_outgoing_txs: 2 + currency: btc + last_tx: + tx_hash: cb0baba9617e18c90b1014614b19e4101593c233ce5b58d91033173d2c7244fd + height: 47 + timestamp: 123456789 + entity: 123456 + token_balances: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + total_received: + fiat_values: + - code: code + value: 0.8008282 + - code: code + value: 0.8008282 + value: 6 + total_tokens_spent: + usdt: + fiat_values: + - 0.2 + - 0.3 + value: 0.2 + weth: + fiat_values: + - 0.2 + - 0.3 + value: 200000000000000 + status: clean properties: neighbor: $ref: '#/components/schemas/neighbor_entity'