Skip to content

Commit 8eb0fbb

Browse files
author
pacrob
committed
work on typing
1 parent 1709f03 commit 8eb0fbb

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

web3/_utils/abi.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,13 +924,17 @@ def named_tree(
924924

925925

926926
def named_subtree(
927-
abi: Dict[str, Any], data: Tuple[Any, ...]
927+
# TODO make this a better type
928+
abi: Any,
929+
data: Tuple[Any, ...],
928930
) -> Union[Dict[str, Any], Tuple[Any, ...], Any]:
929-
abi_type = parse(collapse_if_tuple(abi))
931+
abi_type = parse(collapse_if_tuple(dict(abi)))
930932

931933
if abi_type.is_array:
932934
item_type = abi_type.item_type.to_type_str()
933935
item_abi = {**abi, "type": item_type, "name": ""}
936+
# cast(ABIFunctionParams, item_abi)
937+
# breakpoint()
934938
items = [named_subtree(item_abi, item) for item in data]
935939
return items
936940

web3/_utils/contracts.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
cast,
1111
)
1212

13-
from eth_abi import (
14-
decode,
15-
)
1613
from eth_abi.codec import (
1714
ABICodec,
1815
)
@@ -50,7 +47,6 @@
5047
get_receive_func_abi,
5148
map_abi_data,
5249
merge_args_and_kwargs,
53-
named_tree,
5450
)
5551
from web3._utils.blocks import (
5652
is_hex_encoded_block_hash,
@@ -317,15 +313,6 @@ def encode_transaction_data(
317313
return add_0x_prefix(encode_abi(w3, fn_abi, fn_arguments, fn_selector))
318314

319315

320-
def decode_transaction_data(fn_abi, data, normalizers=None):
321-
data = HexBytes(data)
322-
types = get_abi_input_types(fn_abi)
323-
decoded = decode(types, data[4:])
324-
if normalizers:
325-
decoded = map_abi_data(normalizers, types, decoded)
326-
return named_tree(fn_abi["inputs"], decoded)
327-
328-
329316
def get_fallback_function_info(
330317
contract_abi: Optional[ABI] = None, fn_abi: Optional[ABIFunction] = None
331318
) -> Tuple[ABIFunction, HexStr, Tuple[Any, ...]]:

0 commit comments

Comments
 (0)