Skip to content

Simplify and Streamify EventSubscription #413

@jsdw

Description

@jsdw

I reckon we could improve/simplify the EventSubscription struct. Some thoughts:

  • Impl Stream (and so the StreamExt methods), so that the filtering logic can be (mostly?) moved out of this struct.
  • Remove filtering on events from a specific block (if needed, add a separate method to obtain events from a single block which potentially returns the same event stream as we'd get here; this method could be reused in the transaction.rs stuff too if it existed).
  • Remove filtering of events from a specific extrinsic (we get this now via the API in transaction.rs, and ideally it would be easy to manually filter the Stream for such events).
  • Remove filtering of events by pallet/event index; make it easy to do so via the Stream.
  • Update transfer_subscribe example to subscribe to events separately from making any transaction, and show off filtering and such. If needed, make transactions etc in a separate thread just to produce the desired events. (why? we shouldn't use this to get events for the current transaction as we have a proper API for that; but that's what the example seems to do).
  • Possibly add other examples.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions