diff --git a/src/commands/distance.rs b/src/commands/distance.rs index fb80955a3d812a333cd75a9176b03d759e9e136e..ba13b09123052e488a666ca0a2ece33227d1d443 100644 --- a/src/commands/distance.rs +++ b/src/commands/distance.rs @@ -2,14 +2,24 @@ use crate::*; /// request distance evaluation pub async fn request_distance_evaluation(data: &Data) -> Result<(), subxt::Error> { - let progress = submit_call( + submit_call_and_look_event::< + runtime::distance::events::EvaluationRequested, + Payload<runtime::distance::calls::types::RequestDistanceEvaluation>, + >( data, &runtime::tx().distance().request_distance_evaluation(), ) - .await?; - if data.args.no_wait { - return Ok(()); - } - let _ = track_progress(progress).await?; - Ok(()) + .await +} + +/// request distance evaluation for someone else (must be unvalidated) +pub async fn request_distance_evaluation_for(data: &Data, target: IdtyId) -> Result<(), subxt::Error> { + submit_call_and_look_event::< + runtime::distance::events::EvaluationRequested, + Payload<runtime::distance::calls::types::RequestDistanceEvaluationFor>, + >( + data, + &runtime::tx().distance().request_distance_evaluation_for(target), + ) + .await } diff --git a/src/commands/identity.rs b/src/commands/identity.rs index 9543c5744ff407d6a541da184cf2a1bad374b0dd..ccf51a7bb8dbce566f4503a89d05c239fb744f4f 100644 --- a/src/commands/identity.rs +++ b/src/commands/identity.rs @@ -34,9 +34,8 @@ pub enum Subcommand { /// Request distance evaluation /// make sure that it's ok otherwise currency is slashed RequestDistanceEvaluation, - /// Renew membership - /// When membership comes to and end, it should be renewed for the identity to stay member - RenewMembership, + /// Request distance evaluation for unvalidated identity + RequestDistanceEvaluationFor { target: IdtyId }, /// Certify an identity Certify { target: IdtyId }, /// Revoke an identity immediately @@ -94,8 +93,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE Subcommand::RequestDistanceEvaluation => { commands::distance::request_distance_evaluation(&data).await?; } - Subcommand::RenewMembership => { - renew_membership(&data).await?; + Subcommand::RequestDistanceEvaluationFor {target} => { + commands::distance::request_distance_evaluation_for(&data, target).await?; } Subcommand::Certify { target } => { data = data.fetch_idty_index().await?; @@ -276,17 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er .await } -/// renew membership -pub async fn renew_membership(data: &Data) -> Result<(), subxt::Error> { - submit_call_and_look_event::< - runtime::membership::events::MembershipRenewed, - Payload<runtime::distance::calls::types::RequestDistanceEvaluation>, - >( - data, - &runtime::tx().distance().request_distance_evaluation(), - ) - .await -} /// generate revokation document and submit it immediately pub async fn revoke_identity(data: &Data) -> Result<(), subxt::Error> { diff --git a/src/display.rs b/src/display.rs index bcfb3e9153ba421c5ba7ce3d0bf24696a55da52a..dfffcc09176c180b4aa3ea9edf843cbdf0f2f926 100644 --- a/src/display.rs +++ b/src/display.rs @@ -55,9 +55,9 @@ impl DisplayEvent for runtime::identity::events::IdtyChangedOwnerKey { format!("identity changed owner key {:?}", self) } } -impl DisplayEvent for runtime::membership::events::MembershipRenewed { +impl DisplayEvent for runtime::distance::events::EvaluationRequested { fn display(&self, _data: &Data) -> String { - format!("membership renewed {:?}", self) + format!("evaluation requested {:?}", self) } } impl DisplayEvent for runtime::identity::events::IdtyRemoved {