I query all events, and decode the event a known type, but maybe some write them cause error, how to parse the event
pub fn decode_event(data: &str) -> Result<String> {
let mut vec = Vec::from_hex(data)?;
let events = Vec::<EventRecord<Event, H256>>::decode(&mut vec.as_slice())?;
...
Event::frame_system(fs) => {
m_event.module = "System".to_string();
match *fs {
frame_system::RawEvent::<node_runtime::AccountId>::ExtrinsicSuccess(d) => {
m_event.event = "ExtrinsicSuccess".to_string();
}
_ => {
println!("dddd:{:?}",fs);
}
}
}
}
there is a build error:
match *fs {
--- this expression has type `frame_system::RawEvent<sp_core::crypto::AccountId32>`
frame_system::RawEvent::<node_runtime::AccountId>::ExtrinsicSuccess(d) => {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `frame_system::RawEvent`, found a different enum `frame_system::RawEvent`
= note: expected enum `frame_system::RawEvent<sp_core::crypto::AccountId32>` (enum `frame_system::RawEvent`)
found enum `frame_system::RawEvent<sp_core::crypto::AccountId32>` (enum `frame_system::RawEvent`)
= note: perhaps two different versions of crate `frame_system` are being used?
Blockquote
cargo tree -i frame_system
will tell you why you are pulling in a crate. Ideally you should only be pulling in one version of the crate.