Skip to content

Commit 40bc7ff

Browse files
authored
Merge pull request #1953 from mintlayer/prettify_wallet_cli_help
Prettify wallet-cli help; require mnemonic during wallet recovery
2 parents 632f15a + 3eef874 commit 40bc7ff

22 files changed

Lines changed: 725 additions & 287 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ utxo = { path = "utxo" }
126126

127127
[workspace.package]
128128
edition = "2021"
129-
rust-version = "1.85"
129+
rust-version = "1.88"
130130
version = "1.0.2"
131131
license = "MIT"
132132

node-gui/backend/src/backend_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ use wallet_rpc_client::handles_client::WalletRpcHandlesClient;
4545
use wallet_rpc_lib::{types::HardwareWalletType, EventStream, WalletRpc, WalletService};
4646
use wallet_types::{
4747
scan_blockchain::ScanBlockchain, wallet_type::WalletType, with_locked::WithLocked,
48+
ImportOrCreate,
4849
};
4950

5051
use super::{
@@ -60,7 +61,6 @@ use super::{
6061
p2p_event_handler::P2pEventHandler,
6162
parse_address, parse_coin_amount,
6263
wallet_events::GuiWalletEvents,
63-
ImportOrCreate,
6464
};
6565

6666
const TRANSACTION_LIST_PAGE_COUNT: usize = 10;

node-gui/backend/src/lib.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
pub mod error;
1717
pub mod messages;
1818

19+
mod account_id;
1920
mod backend_impl;
2021
mod chainstate_event_handler;
2122
mod p2p_event_handler;
2223
mod wallet_events;
2324

24-
mod account_id;
25-
use wallet_types::scan_blockchain::ScanBlockchain;
26-
2725
use std::fmt::Debug;
2826
use std::sync::Arc;
2927

@@ -54,21 +52,6 @@ pub enum InitNetwork {
5452
Regtest,
5553
}
5654

57-
#[derive(Debug, Clone, Copy)]
58-
pub enum ImportOrCreate {
59-
Import,
60-
Create,
61-
}
62-
63-
impl ImportOrCreate {
64-
pub fn should_scan_blockchain(&self) -> ScanBlockchain {
65-
match self {
66-
Self::Create => ScanBlockchain::SkipScanning,
67-
Self::Import => ScanBlockchain::ScanNoWait,
68-
}
69-
}
70-
}
71-
7255
#[derive(Debug, Clone, Copy)]
7356
pub enum WalletMode {
7457
Cold,

node-gui/backend/src/messages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ use wallet::account::transaction_list::TransactionList;
3535
use wallet_cli_commands::ConsoleCommand;
3636
use wallet_controller::types::{Balances, WalletExtraInfo, WalletTypeArgs};
3737
use wallet_rpc_lib::types::PoolInfo;
38-
use wallet_types::wallet_type::WalletType;
38+
use wallet_types::{wallet_type::WalletType, ImportOrCreate};
3939

40-
use super::{AccountId, BackendError, ImportOrCreate};
40+
use super::{AccountId, BackendError};
4141

4242
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
4343
pub struct WalletId(u64);

node-gui/src/main_window/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ use node_gui_backend::{
3030
BackendEvent, BackendRequest, EncryptionAction, SignedTransactionWrapper, TransactionInfo,
3131
WalletId, WalletInfo,
3232
},
33-
BackendSender, ImportOrCreate, InitializedNode,
33+
BackendSender, InitializedNode,
3434
};
3535
use p2p::{net::types::services::Services, types::peer_id::PeerId, P2pEvent};
3636
use rfd::AsyncFileDialog;
3737
use wallet_cli_commands::ConsoleCommand;
3838
use wallet_controller::types::WalletTypeArgs;
39-
use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType};
39+
use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType, ImportOrCreate};
4040

4141
#[cfg(feature = "trezor")]
4242
use crate::widgets::create_hw_wallet::hw_wallet_create_dialog;

node-gui/src/widgets/create_hw_wallet.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use iced::{
2222
Element, Length, Theme,
2323
};
2424
use iced_aw::Card;
25-
use node_gui_backend::ImportOrCreate;
25+
26+
use wallet_types::ImportOrCreate;
2627

2728
pub struct CreateHwWalletDialog<Message> {
2829
on_import: Box<dyn Fn() -> Message>,

wallet/types/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ use common::{
4444
primitives::Amount,
4545
};
4646

47+
use crate::scan_blockchain::ScanBlockchain;
48+
4749
#[derive(Debug, Clone, PartialEq, Eq)]
4850
pub struct SignedTxWithFees {
4951
pub tx: SignedTransaction,
@@ -55,3 +57,18 @@ impl SignedTxWithFees {
5557
self.tx.transaction()
5658
}
5759
}
60+
61+
#[derive(Debug, Clone, Copy)]
62+
pub enum ImportOrCreate {
63+
Import,
64+
Create,
65+
}
66+
67+
impl ImportOrCreate {
68+
pub fn should_scan_blockchain(&self) -> ScanBlockchain {
69+
match self {
70+
Self::Create => ScanBlockchain::SkipScanning,
71+
Self::Import => ScanBlockchain::ScanNoWait,
72+
}
73+
}
74+
}

wallet/wallet-cli-commands/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ wallet-rpc-client = { path = "../wallet-rpc-client" }
3131
clap = { workspace = true, features = ["derive"] }
3232
async-trait.workspace = true
3333
crossterm.workspace = true
34+
derive_more.workspace = true
3435
directories.workspace = true
3536
dyn-clone.workspace = true
3637
humantime.workspace = true
3738
hex.workspace = true
3839
itertools.workspace = true
40+
lazy_static.workspace = true
41+
regex.workspace = true
3942
reedline = { workspace = true, features = ["external_printer"] }
4043
serde = { workspace = true, features = ["derive"] }
4144
serde_json.workspace = true
@@ -57,6 +60,7 @@ subsystem = { path = "../../subsystem" }
5760
test-utils = { path = "../../test-utils" }
5861
wallet-test-node = { path = "../wallet-test-node" }
5962

63+
jsonrpsee.workspace = true
6064
rstest.workspace = true
6165

6266
[features]

wallet/wallet-cli-commands/src/command_handler/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,9 @@ where
846846
}
847847
}
848848

849-
WalletCommand::GetBlock { hash } => {
850-
let hash = self.wallet().await?.node_block(hash).await?;
851-
match hash {
849+
WalletCommand::GetBlock { id } => {
850+
let block = self.wallet().await?.node_block(id).await?;
851+
match block {
852852
Some(block) => Ok(ConsoleCommand::Print(block)),
853853
None => Ok(ConsoleCommand::Print("Not found".to_owned())),
854854
}

0 commit comments

Comments
 (0)