From 60a8d68e8190b1f09d92273daf40a2e74db9c6fd Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Tue, 14 Jan 2025 16:48:25 -0300 Subject: [PATCH] optionals wip --- src/dipdup/runtimes.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dipdup/runtimes.py b/src/dipdup/runtimes.py index 48da0c763..67cbb9e46 100644 --- a/src/dipdup/runtimes.py +++ b/src/dipdup/runtimes.py @@ -141,8 +141,18 @@ def decode_event_args( ) if isinstance(args, list): - assert 'args_name' not in event_abi - arg_names = extract_args_name(event_abi['docs'][0]) + # NOTE: Old metadata + if 'args_name' not in event_abi: + arg_names = extract_args_name(event_abi['docs'][0]) + # NOTE: Optionals + else: + args, unprocessed_args = [], [*args] + for arg_type in event_abi['args']: + if arg_type.startswith('option<'): + args.append(None) + else: + args.append(unprocessed_args.pop(0)) + args = dict(zip(arg_names, args, strict=True)) else: arg_names = event_abi['args_name']