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

add member count

parent b9a2573f
No related branches found
No related tags found
1 merge request!9add smith and membership commands
This diff is collapsed.
[toolchain]
channel = "nightly"
use crate::*;
use crate::commands::revocation::generate_revoc_doc;
use crate::runtime::runtime_types::common_runtime::entities::IdtyData;
use crate::runtime::runtime_types::pallet_identity::types::*;
use crate::runtime::runtime_types::sp_core::sr25519::Signature;
use crate::runtime::runtime_types::sp_runtime::MultiSignature;
use crate::{
commands::revocation::generate_revoc_doc,
runtime::runtime_types::{
common_runtime::entities::IdtyData, pallet_identity::types::*, sp_core::sr25519::Signature,
sp_runtime::MultiSignature,
},
};
use std::str::FromStr;
/// define identity subcommands
......@@ -36,6 +38,8 @@ pub enum Subcommand {
Revoke,
/// Generate a revocation document for the provided account
GenRevocDoc,
/// Display member count
MemberCount,
}
/// handle identity commands
......@@ -49,19 +53,13 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
ref username,
} => {
data = data.build_indexer().await?;
commands::identity::get_identity(
&data,
account_id.clone(),
identity_id,
username.clone(),
)
.await?
get_identity(&data, account_id.clone(), identity_id, username.clone()).await?
}
Subcommand::Create { target } => {
commands::identity::create_identity(&data, target).await?;
create_identity(&data, target).await?;
}
Subcommand::Confirm { name } => {
commands::identity::confirm_identity(&data, name).await?;
confirm_identity(&data, name).await?;
}
Subcommand::Certify { target } => {
data = data.fetch_idty_index().await?;
......@@ -71,12 +69,25 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
}
Subcommand::Revoke => {
data = data.fetch_idty_index().await?;
commands::identity::revoke_identity(data).await?;
revoke_identity(data).await?;
}
Subcommand::GenRevocDoc => {
data = data.fetch_idty_index().await?;
commands::revocation::print_revoc_sig(&data)
}
Subcommand::MemberCount => {
println!(
"member count: {}",
data.client()
.storage()
.fetch(
&runtime::storage().membership().counter_for_membership(),
None,
)
.await?
.unwrap()
)
}
};
Ok(())
......
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