From 1777a0509271af6d53240782699034535d69544b Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Mon, 14 Jul 2025 23:08:10 +0000 Subject: [PATCH 1/2] WIP iterator args --- multicall/call.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/multicall/call.py b/multicall/call.py index 8f0b55ed..19ffd018 100644 --- a/multicall/call.py +++ b/multicall/call.py @@ -1,9 +1,9 @@ # mypy: disable-error-code="attr-defined" -from typing import Any, Callable, Final, Generator, Iterable, List, Optional, Tuple, Union, final +from typing import Any, Callable, Final, Generator, Iterable, Iterator, List, Optional, Tuple, Union, final import eth_retry from cchecksum import to_checksum_address -from eth_typing import Address, ChecksumAddress, HexAddress, HexStr +from eth_typing import Address, BlockNumber, ChecksumAddress, HexAddress, HexStr from eth_typing.abi import Decodable from web3 import Web3 @@ -176,20 +176,20 @@ def prep_args( origin: Optional[ChecksumAddress], gas_limit: Optional[int], state_override_code: Optional[HexStr], -) -> List[Any]: - - calldata = signature.encode_data(args) - - call_dict = {"to": target, "data": calldata} - prepared_args = [call_dict, block_id] +) -> Iterator[Union[dict, Optional[BlockNumber]]]: + call_dict = { + "to": target, + "data": signature.encode_data(args), + } if origin: call_dict["from"] = origin if gas_limit: call_dict["gas"] = gas_limit # type: ignore [assignment] + + yield call_dict + yield block_id # type: ignore [misc] if state_override_code: - prepared_args.append({target: {"code": state_override_code}}) # type: ignore [dict-item] - - return prepared_args + yield {target: {"code": state_override_code}} From 83aecbe8c38102f8ad26f991812c567c55ff1c9a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 14 Jul 2025 23:08:10 +0000 Subject: [PATCH 2/2] chore: `black .` --- multicall/call.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/multicall/call.py b/multicall/call.py index 19ffd018..f1ad92b2 100644 --- a/multicall/call.py +++ b/multicall/call.py @@ -1,5 +1,17 @@ # mypy: disable-error-code="attr-defined" -from typing import Any, Callable, Final, Generator, Iterable, Iterator, List, Optional, Tuple, Union, final +from typing import ( + Any, + Callable, + Final, + Generator, + Iterable, + Iterator, + List, + Optional, + Tuple, + Union, + final, +) import eth_retry from cchecksum import to_checksum_address @@ -178,7 +190,7 @@ def prep_args( state_override_code: Optional[HexStr], ) -> Iterator[Union[dict, Optional[BlockNumber]]]: call_dict = { - "to": target, + "to": target, "data": signature.encode_data(args), } @@ -187,7 +199,7 @@ def prep_args( if gas_limit: call_dict["gas"] = gas_limit # type: ignore [assignment] - + yield call_dict yield block_id # type: ignore [misc]