From 9ed28830c50d9d5ade529b1204b441167030feac Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:36:44 -0400 Subject: [PATCH] Reuse calls (#87) * feat: make Calls reusable at different block heights * chore: bump version --- multicall/call.py | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/multicall/call.py b/multicall/call.py index c5ed6f7..c431807 100644 --- a/multicall/call.py +++ b/multicall/call.py @@ -86,13 +86,13 @@ def decode_output( return decoded if len(decoded) > 1 else decoded[0] @eth_retry.auto_retry - def __call__(self, args: Optional[Any] = None, _w3: Optional[Web3] = None) -> Any: + def __call__(self, args: Optional[Any] = None, _w3: Optional[Web3] = None, *, block_id: Optional[int] = None) -> Any: _w3 = self.w3 or _w3 or w3 args = prep_args( self.target, self.signature, args or self.args, - self.block_id, + block_id or self.block_id, self.gas_limit, self.state_override_code, ) @@ -106,7 +106,7 @@ def __await__(self) -> Any: return self.coroutine().__await__() @eth_retry.auto_retry - async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None) -> Any: + async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None, *, block_id: Optional[int] = None) -> Any: _w3 = self.w3 or _w3 or w3 if self.state_override_code and not state_override_supported(_w3): @@ -119,7 +119,7 @@ async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None self.target, self.signature, args or self.args, - self.block_id, + block_id or self.block_id, self.gas_limit, self.state_override_code, ) diff --git a/pyproject.toml b/pyproject.toml index f539ebf..7d1b907 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "multicall" -version = "0.7.9" +version = "0.8.0" description = "aggregate results from multiple ethereum contract calls" authors = ["banteg"]