pub fn handle(home: &Home, root: Option<PathBuf>) -> Result<()> {
    if !home.get_shuffle_path().is_dir() {
        return Err(anyhow!(
            "A node hasn't been created yet! Run shuffle node first"
        ));
    }

    if home.get_latest_path().exists() {
        let wants_another_key = confirm_user_decision(home);
        if wants_another_key {
            let time = duration_since_epoch();
            let archive_dir = home.create_archive_dir(time)?;
            home.archive_old_key(&archive_dir)?;
            home.archive_old_address(&archive_dir)?;
        } else {
            return Ok(());
        }
    }

    let config = NodeConfig::load(&home.get_validator_config_path()).with_context(|| {
        format!(
            "Failed to load NodeConfig from file: {:?}",
            home.get_validator_config_path()
        )
    })?;
    let json_rpc_url = format!("http://0.0.0.0:{}", config.json_rpc.address.port());
    println!("Connecting to {}...", json_rpc_url);
    let client = BlockingClient::new(json_rpc_url);
    if root.is_some() {
        home.save_root_key(
            root.ok_or_else(|| anyhow::anyhow!("Invalid root key path"))?
                .as_path(),
        )?;
    }
    let mut treasury_account = get_treasury_account(&client, home.get_root_key_path());

    create_local_accounts(home, client, &mut treasury_account)
}
// Creates new account from randomly generated private/public key pair.
Creates new account from randomly generated private/public key pair.
Creates new account from randomly generated private / public key pair .
pub fn handle(home: &Home, root: Option<PathBuf>) -> Result<()> {
    if !home.get_shuffle_path().is_dir() {
        return Err(anyhow!(
            "A node hasn't been created yet! Run shuffle node first"
        ));
    }
    if home.get_latest_path().exists() {
        let wants_another_key = confirm_user_decision(home);
        if wants_another_key {
            let time = duration_since_epoch();
            let archive_dir = home.create_archive_dir(time)?;
            home.archive_old_key(&archive_dir)?;
            home.archive_old_address(&archive_dir)?;
        } else {
            return Ok(());
        }
    }
    let config = NodeConfig::load(&home.get_validator_config_path()).with_context(|| {
        format!(
            "Failed to load NodeConfig from file: {:?}",
            home.get_validator_config_path()
        )
    })?;
    let json_rpc_url = format!("http://0.0.0.0:{}", config.json_rpc.address.port());
    println!("Connecting to {}...", json_rpc_url);
    let client = BlockingClient::new(json_rpc_url);
    if root.is_some() {
        home.save_root_key(
            root.ok_or_else(|| anyhow::anyhow!("Invalid root key path"))?
                .as_path(),
        )?;
    }
    let mut treasury_account = get_treasury_account(&client, home.get_root_key_path());
    create_local_accounts(home, client, &mut treasury_account)
}
pub fn handle ( home : & Home , root : Option < PathBuf > ) -> Result < ( ) > { if ! home . get_shuffle_path ( ) . is_dir ( ) { return Err ( anyhow ! ( " " ) ) ; } if home . get_latest_path ( ) . exists ( ) { let wants_another_key = confirm_user_decision ( home ) ; if wants_another_key { let time = duration_since_epoch ( ) ; let archive_dir = home . create_archive_dir ( time ) ? ; home . archive_old_key ( & archive_dir ) ? ; home . archive_old_address ( & archive_dir ) ? ; } else { return Ok ( ( ) ) ; } } let config = NodeConfig :: load ( & home . get_validator_config_path ( ) ) . with_context ( | | { format ! ( " " home get_validator_config_path ( ) ) } ) ? ; let json_rpc_url = format ! ( " " config json_rpc address port ( ) ) ; println ! ( " " json_rpc_url ) ; let client = BlockingClient :: new ( json_rpc_url ) ; if root . is_some ( ) { home . save_root_key ( root . ok_or_else ( | | anyhow :: anyhow ! ( " " ) ) ? . as_path ( ) , ) ? ; } let mut treasury_account = get_treasury_account ( & client , home . get_root_key_path ( ) ) ; create_local_accounts ( home , client , & mut treasury_account ) }
Creates new account from randomly generated private/public key pair.
Creates new account from randomly generated private / public key pair .
home
&Home
root
Option<PathBuf>
home
&Home
root
Option<PathBuf>