Skip to content

Commit

Permalink
comments, sorting in codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Jan 15, 2025
1 parent b29465c commit 6ad8cf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dipdup/codegen/substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
'',
Expand Down
5 changes: 3 additions & 2 deletions src/dipdup/runtimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6ad8cf4

Please sign in to comment.