Skip to content

Commit 039619c

Browse files
asyncify eth.get_logs
1 parent fee4f4c commit 039619c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

docs/providers.rst

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ Eth
418418
- :meth:`web3.eth.get_balance() <web3.eth.Eth.get_balance>`
419419
- :meth:`web3.eth.get_block() <web3.eth.Eth.get_block>`
420420
- :meth:`web3.eth.get_code() <web3.eth.Eth.get_code>`
421+
- :meth:`web3.eth.get_logs() <web3.eth.Eth.get_logs>`
421422
- :meth:`web3.eth.get_raw_transaction() <web3.eth.Eth.get_raw_transaction>`
422423
- :meth:`web3.eth.get_raw_transaction_by_block() <web3.eth.Eth.get_raw_transaction_by_block>`
423424
- :meth:`web3.eth.get_transaction() <web3.eth.Eth.get_transaction>`

newsfragments/2129.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add async `eth.get_logs` method

web3/eth.py

+11
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,17 @@ async def get_code(
401401
) -> HexBytes:
402402
return await self._get_code(account, block_identifier)
403403

404+
_get_logs: Method[Callable[[FilterParams], Awaitable[List[LogReceipt]]]] = Method(
405+
RPC.eth_getLogs,
406+
mungers=[default_root_munger]
407+
)
408+
409+
async def get_logs(
410+
self,
411+
filter_params: FilterParams,
412+
) -> List[LogReceipt]:
413+
return await self._get_logs(filter_params)
414+
404415
_get_transaction_count: Method[Callable[..., Awaitable[Nonce]]] = Method(
405416
RPC.eth_getTransactionCount,
406417
mungers=[BaseEth.block_id_munger],

0 commit comments

Comments
 (0)