From cfc599588c88c75757aa8ba0a6703a4256d7b75a Mon Sep 17 00:00:00 2001 From: Igor Sereda Date: Tue, 11 Jul 2023 20:19:03 +0700 Subject: [PATCH] Transactions fullscan fix (#732) --- src/dipdup/datasources/tzkt/datasource.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dipdup/datasources/tzkt/datasource.py b/src/dipdup/datasources/tzkt/datasource.py index 73aaf8939..54ac0a5bc 100644 --- a/src/dipdup/datasources/tzkt/datasource.py +++ b/src/dipdup/datasources/tzkt/datasource.py @@ -578,6 +578,7 @@ async def get_transactions( TRANSACTION_OPERATION_FIELDS, cursor=True, status='applied', + sort='level', ) if addresses and not code_hashes: params[f'{field}.in'] = ','.join(addresses) @@ -831,6 +832,7 @@ def _get_request_params( limit: int | None = None, select: tuple[str, ...] | None = None, cursor: bool = False, + sort: str | None = None, **kwargs: Any, ) -> dict[str, Any]: params: dict[str, Any] = { @@ -847,6 +849,13 @@ def _get_request_params( params['offset'] = offset if select: params['select'] = ','.join(select) + if sort: + if sort.startswith('-'): + sort_param_name = 'sort.desc' + sort = sort[1:] + else: + sort_param_name = 'sort' + params[sort_param_name] = sort return { **params, **kwargs,