Skip to content

Commit

Permalink
fixes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Mar 19, 2024
1 parent b4f0211 commit a9f2176
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct InitParameters {
#[arg(short, long, value_name = "URL", env = "NODE_URL", default_value = DEFAULT_NODE_URL)]
pub node_url: String,
/// Set the BIP path. If not provided a bip path has to be provided interactively on first launch.
/// The expected format is: `<coin_type>/<account_index>/<address_index>/<change>`.
/// The expected format is: `<coin_type>/<account_index>/<change_address>/<address_index>`.
#[arg(short, long, value_parser = parse_bip_path)]
pub bip_path: Option<Bip44>,
/// Set the Bech32-encoded wallet address.
Expand Down Expand Up @@ -412,7 +412,7 @@ pub async fn init_command(

let mut alias = init_params.alias;
if alias.is_none() {
if get_decision("Do you want to set an alias of the new wallet?")? {
if get_decision("Do you want to set an alias for the new wallet?")? {
alias.replace(get_alias("Set wallet alias").await?);
}
}
Expand Down
10 changes: 6 additions & 4 deletions cli/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub async fn get_alias(prompt: &str) -> Result<String, Error> {
loop {
let input = Input::<String>::new().with_prompt(prompt).interact_text()?;
if input.is_empty() || !input.is_ascii() {
println_log_error!("Invalid input, please choose a non-empty alias consisting of ASCII characters.");
println_log_error!("Invalid input, please enter a valid alias (non-empty, ASCII).");
} else {
return Ok(input);
}
Expand All @@ -66,7 +66,7 @@ pub async fn get_address(prompt: &str) -> Result<Bech32Address, Error> {
loop {
let input = Input::<String>::new().with_prompt(prompt).interact_text()?;
if input.is_empty() || !input.is_ascii() {
println_log_error!("Invalid input, please choose a non-empty address consisting of ASCII characters.");
println_log_error!("Invalid input, please enter a valid Bech32 address.");
} else {
return Ok(Bech32Address::from_str(&input)?);
}
Expand All @@ -77,9 +77,11 @@ pub async fn get_bip_path(prompt: &str) -> Result<Bip44, Error> {
loop {
let input = Input::<String>::new().with_prompt(prompt).interact_text()?;
if input.is_empty() || !input.is_ascii() {
println_log_error!("Invalid input, please choose a non-empty address consisting of ASCII characters.");
println_log_error!(
"Invalid input, please enter a valid bip path (<coin_type>/<account_index>/<change_address>/<address_index>."
);
} else {
return Ok(parse_bip_path(&input).expect("todo"));
return Ok(parse_bip_path(&input)?);
}
}
}
Expand Down

0 comments on commit a9f2176

Please sign in to comment.