Skip to content

Commit

Permalink
Reuse calls (#87)
Browse files Browse the repository at this point in the history
* feat: make Calls reusable at different block heights

* chore: bump version
  • Loading branch information
BobTheBuidler authored Sep 27, 2023
1 parent 426bd7e commit 9ed2883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions multicall/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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):
Expand All @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit 9ed2883

Please sign in to comment.