Skip to content

Commit

Permalink
asyncify eth.get_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
DefiDebauchery committed Jan 18, 2022
1 parent fee4f4c commit 42a460e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ Eth
- :meth:`web3.eth.get_balance() <web3.eth.Eth.get_balance>`
- :meth:`web3.eth.get_block() <web3.eth.Eth.get_block>`
- :meth:`web3.eth.get_code() <web3.eth.Eth.get_code>`
- :meth:`web3.eth.get_logs() <web3.eth.Eth.get_logs>`
- :meth:`web3.eth.get_raw_transaction() <web3.eth.Eth.get_raw_transaction>`
- :meth:`web3.eth.get_raw_transaction_by_block() <web3.eth.Eth.get_raw_transaction_by_block>`
- :meth:`web3.eth.get_transaction() <web3.eth.Eth.get_transaction>`
Expand Down
1 change: 1 addition & 0 deletions newsfragments/2129.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add async `eth.get_logs` method
11 changes: 11 additions & 0 deletions web3/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,17 @@ async def get_code(
) -> HexBytes:
return await self._get_code(account, block_identifier)

_get_logs: Method[Callable[[FilterParams], Awaitable[List[LogReceipt]]]] = Method(
RPC.eth_getLogs,
mungers=[default_root_munger]
)

async def get_logs(
self,
filter_params: FilterParams,
) -> List[LogReceipt]:
return await self._get_logs(filter_params)

_get_transaction_count: Method[Callable[..., Awaitable[Nonce]]] = Method(
RPC.eth_getTransactionCount,
mungers=[BaseEth.block_id_munger],
Expand Down

0 comments on commit 42a460e

Please sign in to comment.