polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 114 forks source link

Filter the event in blocks #155

Closed kernel1983 closed 2 years ago

kernel1983 commented 2 years ago

Does py-substrate-interface support filter the event with the block range? Or does it depends on the substrate?

In web3.py we can do

f = contract.events.MyEvent.createFilter(fromBlock='0x0')
for i in w3.eth.get_logs(f.filter_params):
    print(i)

But in py-substrate-interface I can only check the blocks one by one.

arjanz commented 2 years ago

py-substrate-interface is limited by what the RPC of a Substrate node can provide, and filtering events is not possible. You will need a third party indexing service, I believe Subscan provides one.