mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 04:31:02 +00:00
Filter one or multiple events by type from an EventSubscription (#461)
* Split events.rs into multiple files and start work on FilterEvents * First pass filtering event(s) * Tweak event examples to show filter_events * cargo clippy + fmt * consistify and tidy * cargo fmt * Tweak a couple of comments * Expose phase and block_hash of filtered events, too * cargo fmt * expose FilteredEventDetails * Add docs * cargo clippy * remove FilterEvents knowledge of EventSubscription so it's easier to unit test * unit test filter_events * tweak an integration test to use filter_events * cargo fmt * cargo clippy * Tweak a comment Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
@@ -514,9 +514,9 @@ impl<'client, T: Config, Evs: Decode> TransactionEvents<'client, T, Evs> {
|
||||
/// Iterate through the transaction events using metadata to dynamically decode and skip
|
||||
/// them, and return the first event found which decodes to the provided `Ev` type.
|
||||
///
|
||||
/// This works in the same way that [`events::Events::find_first_event()`] does, with the
|
||||
/// This works in the same way that [`events::Events::find_first()`] does, with the
|
||||
/// exception that it ignores events not related to the submitted extrinsic.
|
||||
pub fn find_first_event<Ev: crate::Event>(&self) -> Result<Option<Ev>, BasicError> {
|
||||
pub fn find_first<Ev: crate::Event>(&self) -> Result<Option<Ev>, BasicError> {
|
||||
self.find::<Ev>().next().transpose()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user