7373)
7474from eth_utils .toolz import (
7575 curry ,
76- partial ,
7776 pipe ,
7877)
7978
@@ -611,17 +610,19 @@ def normalizer(datatype, data):
611610 2. Recursively mapping each of the normalizers to the data
612611 3. Stripping the types back out of the tree
613612 """
614- pipeline = itertools .chain (
615- [abi_data_tree (types )],
616- map (data_tree_map , normalizers ),
617- [partial (recursive_map , strip_abi_type )],
613+ return pipe (
614+ data ,
615+ # 1. Decorating the data tree with types
616+ abi_data_tree (types ),
617+ # 2. Recursively mapping each of the normalizers to the data
618+ * map (data_tree_map , normalizers ),
619+ # 3. Stripping the types back out of the tree
620+ strip_abi_types ,
618621 )
619622
620- return pipe (data , * pipeline )
621-
622623
623624@curry
624- def abi_data_tree (types : Sequence [TypeStr ], data : Sequence [Any ]) -> List [Any ]:
625+ def abi_data_tree (types : Sequence [TypeStr ], data : Sequence [Any ]) -> List ["ABITypedData" ]:
625626 """
626627 Decorate the data tree with pairs of (type, data). The pair tuple is actually an
627628 ABITypedData, but can be accessed as a tuple.
@@ -631,10 +632,7 @@ def abi_data_tree(types: Sequence[TypeStr], data: Sequence[Any]) -> List[Any]:
631632 >>> abi_data_tree(types=["bool[2]", "uint"], data=[[True, False], 0])
632633 [("bool[2]", [("bool", True), ("bool", False)]), ("uint256", 0)]
633634 """
634- return [
635- abi_sub_tree (data_type , data_value )
636- for data_type , data_value in zip (types , data )
637- ]
635+ return list (map (abi_sub_tree , types , data ))
638636
639637
640638@curry
@@ -723,6 +721,10 @@ def strip_abi_type(elements: Any) -> Any:
723721 return elements
724722
725723
724+ def strip_abi_types (elements : Any ) -> Any :
725+ return recursive_map (strip_abi_type , elements )
726+
727+
726728def build_non_strict_registry () -> ABIRegistry :
727729 # We make a copy here just to make sure that eth-abi's default registry is not
728730 # affected by our custom encoder subclasses
0 commit comments