mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 21:51:06 +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:
@@ -100,13 +100,13 @@ impl ContractsTestContext {
|
||||
.await?;
|
||||
|
||||
let code_stored = events
|
||||
.find_first_event::<events::CodeStored>()?
|
||||
.find_first::<events::CodeStored>()?
|
||||
.ok_or_else(|| Error::Other("Failed to find a CodeStored event".into()))?;
|
||||
let instantiated = events
|
||||
.find_first_event::<events::Instantiated>()?
|
||||
.find_first::<events::Instantiated>()?
|
||||
.ok_or_else(|| Error::Other("Failed to find a Instantiated event".into()))?;
|
||||
let _extrinsic_success = events
|
||||
.find_first_event::<system::events::ExtrinsicSuccess>()?
|
||||
.find_first::<system::events::ExtrinsicSuccess>()?
|
||||
.ok_or_else(|| {
|
||||
Error::Other("Failed to find a ExtrinsicSuccess event".into())
|
||||
})?;
|
||||
@@ -141,7 +141,7 @@ impl ContractsTestContext {
|
||||
|
||||
log::info!("Instantiate result: {:?}", result);
|
||||
let instantiated = result
|
||||
.find_first_event::<events::Instantiated>()?
|
||||
.find_first::<events::Instantiated>()?
|
||||
.ok_or_else(|| Error::Other("Failed to find a Instantiated event".into()))?;
|
||||
|
||||
Ok(instantiated.contract)
|
||||
|
||||
Reference in New Issue
Block a user