From f688316c1fd9f744cea2f0977f4c2e5a46aab293 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 20 Nov 2024 10:45:58 +0100 Subject: [PATCH] add include_actors to get_address_entity endpoint, bump version --- CHANGELOG.md | 6 ++++++ README.md | 3 +-- gsrest/service/addresses_service.py | 4 ++-- .../controllers/addresses_controller.py | 8 +++++--- openapi_server/openapi/openapi.yaml | 20 ++++++++++++++++++- openapi_spec/graphsense.yaml | 3 ++- setup.py | 2 +- templates/README.mustache | 3 +-- tox.ini | 3 +-- 9 files changed, 38 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe63c817..8926c536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [24.11.0] - 2024-11-20 + +### Added + +- added parameter `include_actors` for endpoint `/{currency}/addresses/{address}/entity` (by default true) + ## [24.10.1] - 2024-10-30 ### Fixed diff --git a/README.md b/README.md index ea02ac73..3b108176 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The GraphSense REST Interface provides access to denormalized views computed by the [graphsense-transformation][graphsense-transformation] pipeline. It is used by the [graphsense-dashboard][graphsense-dashboard] component. -It is based on a server stub generated by the [OpenAPI Generator][openapi-generator] project against the [graphsense-openapi][graphsense-openapi] specification version 1.7.0. +It is based on a server stub generated by the [OpenAPI Generator][openapi-generator] project against the [OpenAPI specification](./openapi_spec/graphsense.yaml) version 1.8.0. It uses the [Connexion][connexion] library on top of [aiohttp][aiohttp]. *Note:* This `README.md` is also generated. Changes must be made in @@ -158,7 +158,6 @@ On OS X you need to install GNU sed and link it on your system as `sed`. [graphsense-blocksci]: https://github.com/graphsense/graphsense-blocksci [graphsense-transformation]: https://github.com/graphsense/graphsense-transformation [graphsense-dashboard]: https://github.com/graphsense/graphsense-dashboard -[graphsense-openapi]: https://github.com/graphsense/graphsense-openapi [openapi-generator]: https://openapi-generator.tech [connexion]: https://github.com/zalando/connexion [aiohttp]: https://docs.aiohttp.org/en/stable/ diff --git a/gsrest/service/addresses_service.py b/gsrest/service/addresses_service.py index 69bbe0a5..1729520a 100644 --- a/gsrest/service/addresses_service.py +++ b/gsrest/service/addresses_service.py @@ -181,7 +181,7 @@ async def list_address_links(request, return await common.links_response(request, currency, result) -async def get_address_entity(request, currency, address): +async def get_address_entity(request, currency, address, include_actors=True): address_canonical = cannonicalize_address(currency, address) db = request.app['db'] try: @@ -199,7 +199,7 @@ async def get_address_entity(request, currency, address): return await get_entity(request, currency, entity_id, - include_actors=True) + include_actors=include_actors) except ClusterNotFoundException: raise DBInconsistencyException( f'entity referenced by {address} in {currency} not found') diff --git a/openapi_server/controllers/addresses_controller.py b/openapi_server/controllers/addresses_controller.py index df37d570..25f5d0f7 100644 --- a/openapi_server/controllers/addresses_controller.py +++ b/openapi_server/controllers/addresses_controller.py @@ -90,7 +90,7 @@ async def get_address(request: web.Request, currency, address, include_actors=No raise web.HTTPInternalServerError() -async def get_address_entity(request: web.Request, currency, address) -> web.Response: +async def get_address_entity(request: web.Request, currency, address, include_actors=None) -> web.Response: """Get the entity of an address @@ -99,6 +99,8 @@ async def get_address_entity(request: web.Request, currency, address) -> web.Res :type currency: str :param address: The cryptocurrency address :type address: str + :param include_actors: Whether to include information about the actor behind the address + :type include_actors: bool """ @@ -123,11 +125,11 @@ async def get_address_entity(request: web.Request, currency, address) -> web.Res request.app['request_config']['show_private_tags'] = show_private_tags try: - if 'currency' in ['','currency','address']: + if 'currency' in ['','currency','address','include_actors']: if currency is not None: currency = currency.lower() result = service.get_address_entity(request - ,currency=currency,address=address) + ,currency=currency,address=address,include_actors=include_actors) result = await result for plugin in request.app['plugins']: diff --git a/openapi_server/openapi/openapi.yaml b/openapi_server/openapi/openapi.yaml index 1be54a7e..47d95b26 100644 --- a/openapi_server/openapi/openapi.yaml +++ b/openapi_server/openapi/openapi.yaml @@ -5,7 +5,7 @@ info: name: Iknaio Cryptoasset Analytics GmbH description: GraphSense API provides programmatic access to various ledgers' addresses, entities, blocks, transactions and tags for automated and highly efficient forensics tasks. title: GraphSense API - version: 1.7.1 + version: 1.8.0 servers: - url: https://api.ikna.io paths: @@ -326,6 +326,15 @@ paths: schema: $ref: '#/components/schemas/address_id' style: simple + - description: Whether to include information about the actor behind the address + explode: true + in: query + name: include_actors + required: false + schema: + default: true + type: boolean + style: form responses: "200": content: @@ -894,7 +903,10 @@ paths: - list_entity_links - list_entity_addresses - get_tx + - list_token_txs - get_tx_io + - get_spent_in_txs + - get_spending_txs - get_exchange_rates type: string style: simple @@ -973,7 +985,10 @@ paths: - list_entity_links - list_entity_addresses - get_tx + - list_token_txs - get_tx_io + - get_spent_in_txs + - get_spending_txs - get_exchange_rates type: string style: simple @@ -2783,7 +2798,10 @@ components: - list_entity_links - list_entity_addresses - get_tx + - list_token_txs - get_tx_io + - get_spent_in_txs + - get_spending_txs - get_exchange_rates type: string style: simple diff --git a/openapi_spec/graphsense.yaml b/openapi_spec/graphsense.yaml index 5bfa996f..1d71c91c 100644 --- a/openapi_spec/graphsense.yaml +++ b/openapi_spec/graphsense.yaml @@ -5,7 +5,7 @@ info: contact: name: Iknaio Cryptoasset Analytics GmbH email: contact@ikna.io - version: "1.7.1" + version: "1.8.0" servers: - url: 'https://api.ikna.io' paths: @@ -235,6 +235,7 @@ paths: parameters: - $ref: '#/components/parameters/currency' - $ref: '#/components/parameters/address' + - $ref: '#/components/parameters/include_actors_defaulttrue' responses: "200": description: OK diff --git a/setup.py b/setup.py index e91e9639..6a86df86 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages NAME = "openapi_server" -VERSION = "24.10.1-rc1" +VERSION = "24.11.0-rc1" # To install the library, run the following # diff --git a/templates/README.mustache b/templates/README.mustache index 9e2b1027..63c02e3e 100644 --- a/templates/README.mustache +++ b/templates/README.mustache @@ -7,7 +7,7 @@ The GraphSense REST Interface provides access to denormalized views computed by the [graphsense-transformation][graphsense-transformation] pipeline. It is used by the [graphsense-dashboard][graphsense-dashboard] component. -It is based on a server stub generated by the [OpenAPI Generator][openapi-generator] project against the [graphsense-openapi][graphsense-openapi] specification version {{appVersion}}. +It is based on a server stub generated by the [OpenAPI Generator][openapi-generator] project against the [OpenAPI specification](./openapi_spec/graphsense.yaml) version {{appVersion}}. It uses the [Connexion][connexion] library on top of [aiohttp][aiohttp]. *Note:* This `README.md` is also generated. Changes must be made in @@ -158,7 +158,6 @@ On OS X you need to install GNU sed and link it on your system as `sed`. [graphsense-blocksci]: https://github.com/graphsense/graphsense-blocksci [graphsense-transformation]: https://github.com/graphsense/graphsense-transformation [graphsense-dashboard]: https://github.com/graphsense/graphsense-dashboard -[graphsense-openapi]: https://github.com/graphsense/graphsense-openapi [openapi-generator]: https://openapi-generator.tech [connexion]: https://github.com/zalando/connexion [aiohttp]: https://docs.aiohttp.org/en/stable/ diff --git a/tox.ini b/tox.ini index 3aa81bea..8bc2a656 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] skipsdist=True -envlist = py310 +envlist = py39,py310 ;requires=tox-venv [gh-actions] @@ -10,7 +10,6 @@ python = [pytest] asyncio_mode=auto -#log_cli=True # uncomment to output logs during testing [testenv] allowlist_externals=bash