From 99bcf7272fd40788d968935f27647c223c85f370 Mon Sep 17 00:00:00 2001 From: bochaco Date: Wed, 31 Jan 2024 16:58:53 -0300 Subject: [PATCH] docs(cli): minor changes to cli comments --- sn_cli/src/subcommands/mod.rs | 5 ++++- sn_cli/src/subcommands/wallet/wo_wallet.rs | 3 +-- sn_transfers/src/transfers/transfer.rs | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sn_cli/src/subcommands/mod.rs b/sn_cli/src/subcommands/mod.rs index 26f08ff46c..a6c87aaf7e 100644 --- a/sn_cli/src/subcommands/mod.rs +++ b/sn_cli/src/subcommands/mod.rs @@ -15,10 +15,13 @@ use clap::Subcommand; #[derive(Subcommand, Debug)] pub(super) enum SubCmd { #[clap(name = "wallet", subcommand)] - /// Commands for wallet management + /// Commands for a hot-wallet management. + /// A hot-wallet holds the secret key, thus it can be used for signing transfers/transactions. Wallet(wallet::hot_wallet::WalletCmds), #[clap(name = "wowallet", subcommand)] /// Commands for watch-only wallet management + /// A watch-only wallet holds only the public key, thus it cannot be used for signing + /// transfers/transactions, but only to query balances and broadcast offline signed transactions. WatchOnlyWallet(wallet::wo_wallet::WatchOnlyWalletCmds), #[clap(name = "files", subcommand)] /// Commands for file management diff --git a/sn_cli/src/subcommands/wallet/wo_wallet.rs b/sn_cli/src/subcommands/wallet/wo_wallet.rs index bafbd1f963..851974f892 100644 --- a/sn_cli/src/subcommands/wallet/wo_wallet.rs +++ b/sn_cli/src/subcommands/wallet/wo_wallet.rs @@ -82,9 +82,8 @@ pub enum WatchOnlyWalletCmds { #[clap(name = "to")] to: String, }, - /// Broadcast a transaction that was signed offline. + /// This command will create the cash note for the recipient and broadcast it to the network. /// - /// This command will create the cash note for the recipient. /// This cash note can then be shared with the recipient, who can then /// use the 'deposit' command to use/claim the funds. Broadcast { diff --git a/sn_transfers/src/transfers/transfer.rs b/sn_transfers/src/transfers/transfer.rs index 4fe6eaae50..c0a2673d67 100644 --- a/sn_transfers/src/transfers/transfer.rs +++ b/sn_transfers/src/transfers/transfer.rs @@ -57,10 +57,10 @@ impl Transfer { /// Creates a Transfer from the given cash_note /// This Transfer can be sent safely to the recipients as all data in it is encrypted /// The recipients can then decrypt the data and use it to verify and reconstruct the CashNote - pub fn transfer_from_cash_note(cash_note: &CashNote) -> Result { + pub fn transfer_from_cash_note(cash_note: &CashNote) -> Result { let recipient = cash_note.main_pubkey; let u = CashNoteRedemption::from_cash_note(cash_note)?; - let t = Transfer::create(vec![u], recipient) + let t = Self::create(vec![u], recipient) .map_err(|_| Error::CashNoteRedemptionEncryptionFailed)?; Ok(t) } @@ -68,7 +68,7 @@ impl Transfer { /// This function is used to create a Network Royalties Transfer from a CashNote /// can be done offline, and sent to the recipient. /// Note that this type of transfer is not encrypted - pub(crate) fn royalties_transfer_from_cash_note(cash_note: &CashNote) -> Result { + pub(crate) fn royalties_transfer_from_cash_note(cash_note: &CashNote) -> Result { let cnr = CashNoteRedemption::from_cash_note(cash_note)?; Ok(Self::NetworkRoyalties(vec![cnr])) } @@ -108,7 +108,7 @@ impl Transfer { pub fn from_hex(hex: &str) -> Result { let mut bytes = hex::decode(hex).map_err(|_| Error::TransferDeserializationFailed)?; bytes.reverse(); - let transfer: Transfer = + let transfer: Self = rmp_serde::from_slice(&bytes).map_err(|_| Error::TransferDeserializationFailed)?; Ok(transfer) }