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

add distance evaluation request

parent 56ebb044
No related branches found
No related tags found
1 merge request!15update to runtime 800
...@@ -2,14 +2,24 @@ use crate::*; ...@@ -2,14 +2,24 @@ use crate::*;
/// request distance evaluation /// request distance evaluation
pub async fn request_distance_evaluation(data: &Data) -> Result<(), subxt::Error> { 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, data,
&runtime::tx().distance().request_distance_evaluation(), &runtime::tx().distance().request_distance_evaluation(),
) )
.await?; .await
if data.args.no_wait { }
return Ok(());
} /// request distance evaluation for someone else (must be unvalidated)
let _ = track_progress(progress).await?; pub async fn request_distance_evaluation_for(data: &Data, target: IdtyId) -> Result<(), subxt::Error> {
Ok(()) 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
} }
...@@ -34,9 +34,8 @@ pub enum Subcommand { ...@@ -34,9 +34,8 @@ pub enum Subcommand {
/// Request distance evaluation /// Request distance evaluation
/// make sure that it's ok otherwise currency is slashed /// make sure that it's ok otherwise currency is slashed
RequestDistanceEvaluation, RequestDistanceEvaluation,
/// Renew membership /// Request distance evaluation for unvalidated identity
/// When membership comes to and end, it should be renewed for the identity to stay member RequestDistanceEvaluationFor { target: IdtyId },
RenewMembership,
/// Certify an identity /// Certify an identity
Certify { target: IdtyId }, Certify { target: IdtyId },
/// Revoke an identity immediately /// Revoke an identity immediately
...@@ -94,8 +93,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE ...@@ -94,8 +93,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
Subcommand::RequestDistanceEvaluation => { Subcommand::RequestDistanceEvaluation => {
commands::distance::request_distance_evaluation(&data).await?; commands::distance::request_distance_evaluation(&data).await?;
} }
Subcommand::RenewMembership => { Subcommand::RequestDistanceEvaluationFor {target} => {
renew_membership(&data).await?; commands::distance::request_distance_evaluation_for(&data, target).await?;
} }
Subcommand::Certify { target } => { Subcommand::Certify { target } => {
data = data.fetch_idty_index().await?; data = data.fetch_idty_index().await?;
...@@ -276,17 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er ...@@ -276,17 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er
.await .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 /// generate revokation document and submit it immediately
pub async fn revoke_identity(data: &Data) -> Result<(), subxt::Error> { pub async fn revoke_identity(data: &Data) -> Result<(), subxt::Error> {
......
...@@ -55,9 +55,9 @@ impl DisplayEvent for runtime::identity::events::IdtyChangedOwnerKey { ...@@ -55,9 +55,9 @@ impl DisplayEvent for runtime::identity::events::IdtyChangedOwnerKey {
format!("identity changed owner key {:?}", self) 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 { fn display(&self, _data: &Data) -> String {
format!("membership renewed {:?}", self) format!("evaluation requested {:?}", self)
} }
} }
impl DisplayEvent for runtime::identity::events::IdtyRemoved { impl DisplayEvent for runtime::identity::events::IdtyRemoved {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment