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:
James Wilson
2022-03-01 10:42:05 +00:00
committed by GitHub
parent 70d83feaba
commit 13347362d5
14 changed files with 1343 additions and 655 deletions
+40
View File
@@ -0,0 +1,40 @@
// Copyright 2019-2022 Parity Technologies (UK) Ltd.
// This file is part of subxt.
//
// subxt is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// subxt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
//! For working with events.
mod decoding;
mod event_subscription;
mod events_type;
mod filter_events;
pub use decoding::EventsDecodingError;
pub use event_subscription::{
subscribe,
subscribe_finalized,
EventSubscription,
};
pub use events_type::{
at,
EventDetails,
Events,
RawEventDetails,
};
pub use filter_events::{
EventFilter,
FilterEvents,
FilteredEventDetails,
};