Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix events subscription from other phases #306

Closed
wants to merge 207 commits into from

Conversation

paulormart
Copy link
Contributor

With this change System events like staking::events::EraPaid, session::events::NewSession, grandpa::events::NewAuthorities can be subscribed, otherwise they are currently being skipped using the pseudo code below:

let client = self.client();
let sub = client.rpc().subscribe_finalized_events().await?;
let decoder = client.events_decoder();
let mut sub = EventSubscription::<DefaultConfig>::new(sub, &decoder);
sub.filter_event::<node_runtime::staking::events::EraPaid>();
while let Some(result) = sub.next().await {
    if let Ok(raw) = result {
        match node_runtime::staking::events::EraPaid::decode(&mut &raw.data[..]) {
            Ok(event) => info!("Successfully decoded event {:?}", event),
            Err(e) => error!("Error decoding event {:?}", e),
        }
    }
}

@paulormart
Copy link
Contributor Author

reference to pull request #294

@sander2
Copy link
Contributor

sander2 commented Nov 2, 2021

This is a duplicate of #283, but this will definitely be good to merge into the open PR

@paulormart paulormart changed the base branch from aj-metadata-vnext to master November 3, 2021 15:54
@paulormart
Copy link
Contributor Author

@ascjones master branch targeted

@ascjones
Copy link
Contributor

ascjones commented Nov 5, 2021

Closing as duplicate of #283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants