Skip to content

Commit

Permalink
add include_actors to get_address_entity endpoint, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
myrho committed Nov 20, 2024
1 parent 0e8e1aa commit f688316
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions gsrest/service/addresses_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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')
8 changes: 5 additions & 3 deletions openapi_server/controllers/addresses_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""

Expand All @@ -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']:
Expand Down
20 changes: 19 additions & 1 deletion openapi_server/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion openapi_spec/graphsense.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
contact:
name: Iknaio Cryptoasset Analytics GmbH
email: [email protected]
version: "1.7.1"
version: "1.8.0"
servers:
- url: 'https://api.ikna.io'
paths:
Expand Down Expand Up @@ -235,6 +235,7 @@ paths:
parameters:
- $ref: '#/components/parameters/currency'
- $ref: '#/components/parameters/address'
- $ref: '#/components/parameters/include_actors_defaulttrue'
responses:
"200":
description: OK
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
3 changes: 1 addition & 2 deletions templates/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist=True
envlist = py310
envlist = py39,py310
;requires=tox-venv

[gh-actions]
Expand All @@ -10,7 +10,6 @@ python =

[pytest]
asyncio_mode=auto
#log_cli=True # uncomment to output logs during testing

[testenv]
allowlist_externals=bash
Expand Down

0 comments on commit f688316

Please sign in to comment.