Skip to content

Commit

Permalink
Fix typing, remove @Curry
Browse files Browse the repository at this point in the history
  • Loading branch information
reedsa committed Mar 25, 2024
1 parent 18240c2 commit 06a8f94
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions web3/_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from eth_typing import (
ChecksumAddress,
HexStr,
Primitives,
TypeStr,
)
from eth_utils import (
Expand Down Expand Up @@ -99,9 +100,8 @@
)


@curry
def _log_entry_data_to_bytes(
log_entry_data: Union[HexStr, str, bytes, bytearray],
log_entry_data: Union[Primitives, HexStr, str],
) -> bytes:
return hexstr_if_str(to_bytes, log_entry_data)

Expand Down Expand Up @@ -242,15 +242,15 @@ def get_event_data(
else:
log_topics = log_entry["topics"][1:]

log_topics = [_log_entry_data_to_bytes(topic) for topic in log_topics]
log_topics_bytes = [_log_entry_data_to_bytes(topic) for topic in log_topics]
log_topics_abi = get_indexed_event_inputs(event_abi)
log_topic_normalized_inputs = normalize_event_input_types(log_topics_abi)
log_topic_types = get_event_abi_types_for_decoding(log_topic_normalized_inputs)
log_topic_names = get_abi_input_names(ABIEvent({"inputs": log_topics_abi}))

if len(log_topics) != len(log_topic_types):
if len(log_topics_bytes) != len(log_topic_types):
raise LogTopicError(
f"Expected {len(log_topic_types)} log topics. Got {len(log_topics)}"
f"Expected {len(log_topic_types)} log topics. Got {len(log_topics_bytes)}"
)

log_data = _log_entry_data_to_bytes(log_entry["data"])
Expand Down Expand Up @@ -279,7 +279,7 @@ def get_event_data(

decoded_topic_data = [
abi_codec.decode([topic_type], topic_data)[0]
for topic_type, topic_data in zip(log_topic_types, log_topics)
for topic_type, topic_data in zip(log_topic_types, log_topics_bytes)
]
normalized_topic_data = map_abi_data(
BASE_RETURN_NORMALIZERS, log_topic_types, decoded_topic_data
Expand Down

0 comments on commit 06a8f94

Please sign in to comment.