Skip to content
Snippets Groups Projects
Commit 0ca459d2 authored by David Salami's avatar David Salami Committed by GitHub
Browse files

Update event variants (#4262)


* update event variants

* fmt

* fixes

* update substrate

Co-authored-by: default avatarthiolliere <gui.thiolliere@gmail.com>
parent 59e90a77
Branches
No related merge requests found
This diff is collapsed.
......@@ -149,7 +149,7 @@ where
events
.iter()
.filter_map(|event| match event.event {
Event::Democracy(democracy::Event::PreimageNoted(ref proposal_hash, _, _)) =>
Event::Democracy(democracy::Event::PreimageNoted { ref proposal_hash, .. }) =>
Some(proposal_hash.clone()),
_ => None,
})
......@@ -181,8 +181,12 @@ where
let (index, hash): (u32, H256) = events
.iter()
.filter_map(|event| match event.event {
Event::Council(CouncilCollectiveEvent::Proposed(_, index, ref hash, _)) =>
Some((index, hash.clone())),
Event::Council(CouncilCollectiveEvent::Proposed {
account: _,
proposal_index,
ref proposal_hash,
threshold: _,
}) => Some((proposal_index, proposal_hash.clone())),
_ => None,
})
.next()
......@@ -212,12 +216,16 @@ where
.events()
.into_iter()
.filter(|event| match event.event {
Event::Council(CouncilCollectiveEvent::Closed(_hash, _, _)) if hash == _hash =>
Event::Council(CouncilCollectiveEvent::Closed { proposal_hash, yes: _, no: _ })
if hash == proposal_hash =>
true,
Event::Council(CouncilCollectiveEvent::Approved(_hash)) if hash == _hash => true,
Event::Council(CouncilCollectiveEvent::Executed(_hash, Ok(())))
if hash == _hash =>
Event::Council(CouncilCollectiveEvent::Approved { proposal_hash })
if hash == proposal_hash =>
true,
Event::Council(CouncilCollectiveEvent::Executed {
proposal_hash,
result: Ok(()),
}) if hash == proposal_hash => true,
_ => false,
})
.collect::<Vec<_>>();
......@@ -253,12 +261,12 @@ where
let (index, hash) = events
.iter()
.filter_map(|event| match event.event {
Event::TechnicalCommittee(TechnicalCollectiveEvent::Proposed(
_,
index,
ref hash,
_,
)) => Some((index, hash.clone())),
Event::TechnicalCommittee(TechnicalCollectiveEvent::Proposed {
account: _,
proposal_index,
ref proposal_hash,
threshold: _,
}) => Some((proposal_index, proposal_hash.clone())),
_ => None,
})
.next()
......@@ -289,15 +297,17 @@ where
.events()
.into_iter()
.filter(|event| match event.event {
Event::TechnicalCommittee(TechnicalCollectiveEvent::Closed(_hash, _, _))
if hash == _hash =>
true,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Approved(_hash))
if hash == _hash =>
true,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Executed(_hash, Ok(())))
if hash == _hash =>
true,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Closed {
proposal_hash: _hash,
..
}) if hash == _hash => true,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Approved {
proposal_hash: _hash,
}) if hash == _hash => true,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Executed {
proposal_hash: _hash,
result: Ok(()),
}) if hash == _hash => true,
_ => false,
})
.collect::<Vec<_>>();
......@@ -316,7 +326,7 @@ where
.events()
.into_iter()
.filter_map(|event| match event.event {
Event::Democracy(democracy::Event::Started(index, _)) => Some(index),
Event::Democracy(democracy::Event::Started { ref_index: index, .. }) => Some(index),
_ => None,
})
.next()
......@@ -344,11 +354,14 @@ where
.events()
.into_iter()
.filter(|event| match event.event {
Event::Democracy(democracy::Event::Passed(_index)) if _index == ref_index => true,
Event::Democracy(democracy::Event::PreimageUsed(_hash, _, _))
Event::Democracy(democracy::Event::Passed { ref_index: _index })
if _index == ref_index =>
true,
Event::Democracy(democracy::Event::PreimageUsed { proposal_hash: _hash, .. })
if _hash == proposal_hash =>
true,
Event::Democracy(democracy::Event::Executed(_index, Ok(()))) if _index == ref_index =>
Event::Democracy(democracy::Event::Executed { ref_index: _index, result: Ok(()) })
if _index == ref_index =>
true,
_ => false,
})
......
......@@ -85,7 +85,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.events()
.into_iter()
.filter(|event| match event.event {
Event::Balances(balances::Event::Transfer(_, _, _)) => true,
Event::Balances(balances::Event::Transfer { .. }) => true,
_ => false,
})
.collect::<Vec<_>>();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment