From 6ad8cf413b53dbb9128db2321fc6614b373e3c1e Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Wed, 15 Jan 2025 02:44:45 -0300 Subject: [PATCH] comments, sorting in codegen --- src/dipdup/codegen/substrate.py | 2 +- src/dipdup/runtimes.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dipdup/codegen/substrate.py b/src/dipdup/codegen/substrate.py index 4cd53a4ad..1f7377837 100644 --- a/src/dipdup/codegen/substrate.py +++ b/src/dipdup/codegen/substrate.py @@ -212,7 +212,7 @@ async def _generate_types(self, force: bool = False) -> None: typeclass_name = f'{snake_to_pascal(typeclass_dir.name)}Payload' - versions = [p.stem[1:] for p in typeclass_dir.glob('*.py') if p.name.startswith('v')] + versions = [p.stem[1:] for p in sorted_glob(typeclass_dir, '*.py') if p.name.startswith('v')] root_lines = [ *(f'from .v{v} import V{v}' for v in versions), '', diff --git a/src/dipdup/runtimes.py b/src/dipdup/runtimes.py index 230ad261b..e370ed798 100644 --- a/src/dipdup/runtimes.py +++ b/src/dipdup/runtimes.py @@ -160,15 +160,16 @@ def decode_event_args( event_abi = spec_obj.get_event_abi( qualname=name, ) + # FIXME: Do we need original type names? arg_types = event_abi.get('args_type_name') or event_abi['args'] if isinstance(args, list): arg_names = get_event_arg_names(event_abi) - # NOTE: Optionals + # FIXME: Optionals are processed incorrectly now args, unprocessed_args = [], [*args] for arg_type in arg_types: - if arg_type.startswith('option<'): + if arg_type.lower().startswith('option<'): args.append(None) else: args.append(unprocessed_args.pop(0))