Skip to content

Commit

Permalink
declare validate
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Jan 10, 2025
1 parent e136dd2 commit 02ae7ac
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions crates/test-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use entropy_client::{
bounded_collections::bounded_vec::BoundedVec,
pallet_programs::pallet::ProgramInfo,
pallet_registry::pallet::{ProgramInstance, RegisteredInfo},
pallet_staking::{ValidatorPrefs},
pallet_staking_extension::pallet::JoiningServerInfo,
},
EntropyConfig,
},
Expand Down Expand Up @@ -215,6 +217,12 @@ enum CliCommand {
},
/// Declares intention to validate
DeclareValidate {
/// Threshold account
tss_account: String,
/// X25519 public key
x25519_public_key: String,
/// Endpoint to change to (ex. "127.0.0.1:3001")
endpoint: String,
/// The mnemonic for the signer which will trigger the call.
#[arg(short, long)]
mnemonic_option: Option<String>,
Expand Down Expand Up @@ -600,13 +608,18 @@ pub async fn run_command(
Ok("Session Keys updates".to_string())
}
},
CliCommand::DeclareValidate { mnemonic_option } => {
CliCommand::DeclareValidate { tss_account, x25519_public_key, endpoint, mnemonic_option } => {
let signer = handle_mnemonic(mnemonic_option)?;
cli.log(format!("Account being used for session keys: {}", signer.public()));

// let result_event =
// declare_validate(&api, &rpc, signer).await?;
// cli.log(format!("Event result: {:?}", result_event));
let tss_account = SubxtAccountId32::from_str(&tss_account)?;
let x25519_public_key = hex::decode(x25519_public_key)?
.try_into()
.map_err(|_| anyhow!("X25519 pub key needs to be 32 bytes"))?;
let joining_server_info =
JoiningServerInfo { tss_account, x25519_public_key, endpoint };
let result_event =
declare_validate(&api, &rpc, signer , joining_server_info, ValidatorPrefs::default(), vec![]).await?;
cli.log(format!("Event result: {:?}", result_event));

if cli.json {
Ok("{}".to_string())
Expand Down

0 comments on commit 02ae7ac

Please sign in to comment.