Skip to content
Snippets Groups Projects
Commit 10ced110 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

add smith membership claim

parent 5d268ba1
No related branches found
No related tags found
1 merge request!9add smith and membership commands
No preview for this file type
......@@ -14,6 +14,8 @@ pub enum Subcommand {
Request { endpoint: String },
/// Emit a smith certification
Cert { to: u32 },
/// Claim smith membership
Claim,
/// go online
GoOnline,
/// go offline
......@@ -41,7 +43,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
let mut data = data.build_client().await?;
match command {
Subcommand::Request { endpoint } => {
dbg!(request_smith_membership(&data, endpoint).await)?;
request_smith_membership(&data, endpoint).await?;
}
Subcommand::Claim => {
claim_smith_membership(&data).await?;
}
Subcommand::GoOnline => {
go_online(&data).await?;
......@@ -182,6 +187,29 @@ pub async fn go_online(data: &Data) -> Result<(), GcliError> {
Ok(())
}
/// submit go_offline
pub async fn claim_smith_membership(data: &Data) -> Result<(), subxt::Error> {
let progress = data
.client()
.tx()
.sign_and_submit_then_watch(
&runtime::tx().smith_membership().claim_membership(),
&PairSigner::new(data.keypair()),
BaseExtrinsicParamsBuilder::new(),
)
.await?;
if data.args.no_wait {
return Ok(());
}
let events = track_progress(progress).await?;
if let Some(e) = events.find_first::<runtime::smith_membership::events::MembershipAcquired>()? {
println!("{e:?}");
}
Ok(())
}
/// submit go_offline
pub async fn go_offline(data: &Data) -> Result<(), subxt::Error> {
let progress = data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment