diff --git a/res/metadata.scale b/res/metadata.scale index 3af1b14cabe3e2c9b3561e0ef21320d47923125d..5ca3e2273e371e7e0f42789281bf44892e42e55b 100644 Binary files a/res/metadata.scale and b/res/metadata.scale differ diff --git a/src/commands/smith.rs b/src/commands/smith.rs index bc60a5d18f2e25d395c6f626427a3498cdc52ef3..da1a75b48f11dfb26b17a54f397ca39aa3c7734c 100644 --- a/src/commands/smith.rs +++ b/src/commands/smith.rs @@ -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