Skip to content

Commit

Permalink
fix printed messages with wallet new, wallet list, wallet export (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrestisAlpos authored Feb 17, 2025
1 parent 37353e8 commit 554d297
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ipc/cli/src/commands/wallet/balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ impl CommandLineHandler for WalletBalances {
pub(crate) struct WalletBalancesArgs {
#[arg(long, help = "The subnet to list wallets from")]
pub subnet: String,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
4 changes: 2 additions & 2 deletions ipc/cli/src/commands/wallet/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl CommandLineHandler for WalletSetDefault {
pub(crate) struct WalletSetDefaultArgs {
#[arg(long, help = "Address of the key to default")]
pub address: String,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}

Expand Down Expand Up @@ -88,6 +88,6 @@ impl CommandLineHandler for WalletGetDefault {
#[derive(Debug, Args)]
#[command(about = "Set default wallet")]
pub(crate) struct WalletGetDefaultArgs {
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
4 changes: 2 additions & 2 deletions ipc/cli/src/commands/wallet/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub(crate) struct WalletExportArgs {
help = "Optional parameter that outputs the address key into the file specified"
)]
pub output: Option<String>,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
#[arg(
long,
Expand Down Expand Up @@ -202,6 +202,6 @@ impl CommandLineHandler for WalletPublicKey {
pub(crate) struct WalletPublicKeyArgs {
#[arg(long, help = "Address of the key to export")]
pub address: String,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
2 changes: 1 addition & 1 deletion ipc/cli/src/commands/wallet/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl CommandLineHandler for WalletImport {
.args(&["path", "private_key"]),
))]
pub(crate) struct WalletImportArgs {
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
#[arg(
long,
Expand Down
4 changes: 2 additions & 2 deletions ipc/cli/src/commands/wallet/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl CommandLineHandler for WalletList {
let wallet = provider.btc_wallet()?;
let addresses = wallet.read().unwrap().list()?;
for address in addresses.iter() {
print!("Address: {}", address);
println!("Address: {}", address);

let key_info = wallet.read().unwrap().get(address)?.unwrap();
let sk = libsecp256k1::SecretKey::parse_slice(key_info.private_key())?;
Expand All @@ -82,6 +82,6 @@ impl CommandLineHandler for WalletList {
#[derive(Debug, Args)]
#[command(about = "List addresses and pubkeys in the wallet")]
pub(crate) struct WalletListArgs {
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
10 changes: 6 additions & 4 deletions ipc/cli/src/commands/wallet/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ impl CommandLineHandler for WalletNew {
let wallet_type = WalletType::from_str(&arguments.wallet_type)?;
match wallet_type {
WalletType::Evm => {
println!("{:?}", provider.new_evm_key()?.to_string());
let new_key = provider.new_evm_key()?;
println!("Created IPC wallet with address: {new_key}");
}
WalletType::Fvm => {
let tp = WalletKeyType::from_str(
Expand All @@ -37,7 +38,8 @@ impl CommandLineHandler for WalletNew {
println!("{:?}", provider.new_fvm_key(tp)?)
}
WalletType::Btc => {
println!("{:?}", provider.new_btc_key()?)
let new_key = provider.new_btc_key()?;
println!("Created IPC wallet with address: {new_key}");
}
};

Expand All @@ -46,13 +48,13 @@ impl CommandLineHandler for WalletNew {
}

#[derive(Debug, Args)]
#[command(about = "Create new wallet in subnet")]
#[command(about = "Create new IPC wallet")]
pub(crate) struct WalletNewArgs {
#[arg(
long,
help = "The fvm key type of the wallet (secp256k1, bls, secp256k1-ledger), only for fvm wallet type"
)]
pub key_type: Option<String>,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
2 changes: 1 addition & 1 deletion ipc/cli/src/commands/wallet/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ impl CommandLineHandler for WalletRemove {
pub(crate) struct WalletRemoveArgs {
#[arg(long, help = "Address of the key to remove")]
pub address: String,
#[arg(long, help = "The type of the wallet, i.e. fvm, evm")]
#[arg(long, help = "The type of the wallet, i.e. fvm, evm, btc")]
pub wallet_type: String,
}
2 changes: 1 addition & 1 deletion ipc/wallet/src/evm/persistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl<T: Clone + Eq + Hash + TryFrom<KeyInfo> + Default + ToString> PersistentKey
Ok(p) => p,
Err(e) => {
return if e.kind() == ErrorKind::NotFound {
log::info!("key store does not exist, initialized to empty key store");
log::trace!("key store does not exist, initialized to empty key store");
Ok(Self {
memory: MemoryKeyStore {
data: Default::default(),
Expand Down

0 comments on commit 554d297

Please sign in to comment.