@@ -359,7 +359,7 @@ def _convert_abi_input(arg_abi, arg):
359
359
360
360
if isinstance (arg , abc .Mapping ):
361
361
# Arg is mapping. Convert to properly ordered sequence.
362
- arg = tuple (arg [c ['name' ]] for c in sub_abis )
362
+ arg = tuple (arg [abi ['name' ]] for abi in sub_abis )
363
363
364
364
if not is_list_like (arg ):
365
365
raise TypeError (
@@ -369,7 +369,10 @@ def _convert_abi_input(arg_abi, arg):
369
369
),
370
370
)
371
371
372
- return type (arg )(_convert_abi_input (c , a ) for c , a in zip (sub_abis , arg ))
372
+ return type (arg )(
373
+ _convert_abi_input (sub_abi , sub_arg )
374
+ for sub_abi , sub_arg in zip (sub_abis , arg )
375
+ )
373
376
374
377
375
378
def get_aligned_abi_inputs (abi , args ):
@@ -380,15 +383,18 @@ def get_aligned_abi_inputs(abi, args):
380
383
contained in ``args`` may contain nested mappings or sequences corresponding
381
384
to tuple-encoded values in ``abi``.
382
385
"""
383
- inputs = abi .get ('inputs' , [])
386
+ input_abis = abi .get ('inputs' , [])
384
387
385
388
if isinstance (args , abc .Mapping ):
386
389
# `args` is mapping, convert to properly ordered sequence
387
- args = tuple (args [i ['name' ]] for i in inputs )
390
+ args = tuple (args [abi ['name' ]] for abi in input_abis )
388
391
389
392
return (
390
- tuple (collapse_if_tuple (i ) for i in inputs ),
391
- type (args )(_convert_abi_input (i , a ) for i , a in zip (inputs , args )),
393
+ tuple (collapse_if_tuple (abi ) for abi in input_abis ),
394
+ type (args )(
395
+ _convert_abi_input (abi , arg )
396
+ for abi , arg in zip (input_abis , args )
397
+ ),
392
398
)
393
399
394
400
@@ -676,13 +682,16 @@ def abi_sub_tree(abi_type: Optional[Union[TypeStr, ABIType]], data_value: Any) -
676
682
# If type is array, determine item type and annotate all
677
683
# items in iterable with that type
678
684
item_type_str = abi_type .item_type .to_type_str ()
679
- data_value = [abi_sub_tree (item_type_str , i ) for i in data_value ]
685
+ data_value = [
686
+ abi_sub_tree (item_type_str , item_value )
687
+ for item_value in data_value
688
+ ]
680
689
elif isinstance (abi_type , TupleType ):
681
690
# Otherwise, if type is tuple, determine component types and annotate
682
- # items in iterable respectively with those types
691
+ # tuple components in iterable respectively with those types
683
692
data_value = type (data_value )(
684
- abi_sub_tree (comp_type .to_type_str (), i )
685
- for comp_type , i in zip (abi_type .components , data_value )
693
+ abi_sub_tree (comp_type .to_type_str (), comp_value )
694
+ for comp_type , comp_value in zip (abi_type .components , data_value )
686
695
)
687
696
688
697
return ABITypedData ([
0 commit comments