The Python SDK supports indexing pending data to implement optimistic updates in your application.
Adding support for pending blocks to your application is easy, simply specify
finality equal to
If you're using the
Indexer abstraction, implement the
method. This method is called every time the stream receives pending data.
The chain-aware storage provided by the Python SDK will handle data invalidation for you:
- On every new pending data, it invalidates all data from the previously handled pending block.
- On new data blocks, it invalidates any pending data.
- Add an attribute to documents to track wether the document was inserted in an accepted block or in a pending block. Use this information to clearly display data in your application.