[Ethereum] Possible to get event logs from a specific pending transaction

pending-transactionsweb3.pyweb3js

So I'm using web3 py filtering and it looks like I can listen for event logs using a filter, but I don't know which transactions in the pending pool produced the logs. Similarly, I can use getTransactionReceipt to get the event logs from a completed transaction, but it doesn't seem I can combine the two and get event logs of a pending transaction (it says transaction not found when I try). Is there any way to do this?

Best Answer

You can manually parse logs from the getTransactionReceipt() result JSON.

You can use internal web3._utils.events._get_event_data to parse raw topics to event logs.

However I do not have an example how to write it together.

Related Topic