Skip to content
Snippets Groups Projects

update to runtime 800

Merged Hugo Trentesaux requested to merge hugo-dev into master
2 unresolved threads
2 files
+ 58
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 43
2
@@ -56,6 +56,12 @@ pub enum Subcommand {
},
/// List online authorities
ShowOnline,
/// Invite identity to become smith
Invite{target: IdtyId},
/// Accept invitation
Accept,
/// Certify smith
Certify{target: IdtyId},
}
/// handle smith commands
@@ -81,13 +87,21 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
set_session_keys(&data, session_keys).await?;
}
Subcommand::ShowExpire { blocks, sessions } => {
data = data.build_client().await?.build_indexer().await?;
data = data.build_indexer().await?;
commands::expire::monitor_expirations(&data, blocks, sessions).await?
}
Subcommand::ShowOnline => {
data = data.build_client().await?;
online(&data).await?
}
Subcommand::Invite { target } => {
invite_smith(&data, target).await?
}
Subcommand::Accept => {
accept_invitation(&data).await?
}
Subcommand::Certify { target } => {
certify_smith(&data, target).await?
}
};
Ok(())
@@ -254,3 +268,30 @@ pub async fn online(data: &Data) -> Result<(), anyhow::Error> {
Ok(())
}
/// invite identity to join smith
pub async fn invite_smith(data: &Data, target: IdtyId) -> Result<(), subxt::Error> {
submit_call_and_look_event::<
runtime::smith_members::events::InvitationSent,
Payload<runtime::smith_members::calls::types::InviteSmith>,
>(data, &runtime::tx().smith_members().invite_smith(target))
.await
}
/// accept invitation
pub async fn accept_invitation(data: &Data) -> Result<(), subxt::Error> {
submit_call_and_look_event::<
runtime::smith_members::events::InvitationAccepted,
Payload<runtime::smith_members::calls::types::AcceptInvitation>,
>(data, &runtime::tx().smith_members().accept_invitation())
.await
}
/// invite identity to join smith
pub async fn certify_smith(data: &Data, target: IdtyId) -> Result<(), subxt::Error> {
submit_call_and_look_event::<
runtime::smith_members::events::CertificationReceived,
Payload<runtime::smith_members::calls::types::CertifySmith>,
>(data, &runtime::tx().smith_members().certify_smith(target))
.await
}
Loading