Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ utxo = { path = "utxo" }

[workspace.package]
edition = "2021"
rust-version = "1.85"
rust-version = "1.88"
version = "1.0.2"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion node-gui/backend/src/backend_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use wallet_rpc_client::handles_client::WalletRpcHandlesClient;
use wallet_rpc_lib::{types::HardwareWalletType, EventStream, WalletRpc, WalletService};
use wallet_types::{
scan_blockchain::ScanBlockchain, wallet_type::WalletType, with_locked::WithLocked,
ImportOrCreate,
};

use super::{
Expand All @@ -60,7 +61,6 @@ use super::{
p2p_event_handler::P2pEventHandler,
parse_address, parse_coin_amount,
wallet_events::GuiWalletEvents,
ImportOrCreate,
};

const TRANSACTION_LIST_PAGE_COUNT: usize = 10;
Expand Down
19 changes: 1 addition & 18 deletions node-gui/backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
pub mod error;
pub mod messages;

mod account_id;
mod backend_impl;
mod chainstate_event_handler;
mod p2p_event_handler;
mod wallet_events;

mod account_id;
use wallet_types::scan_blockchain::ScanBlockchain;

use std::fmt::Debug;
use std::sync::Arc;

Expand Down Expand Up @@ -54,21 +52,6 @@ pub enum InitNetwork {
Regtest,
}

#[derive(Debug, Clone, Copy)]
pub enum ImportOrCreate {
Import,
Create,
}

impl ImportOrCreate {
pub fn should_scan_blockchain(&self) -> ScanBlockchain {
match self {
Self::Create => ScanBlockchain::SkipScanning,
Self::Import => ScanBlockchain::ScanNoWait,
}
}
}

#[derive(Debug, Clone, Copy)]
pub enum WalletMode {
Cold,
Expand Down
4 changes: 2 additions & 2 deletions node-gui/backend/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ use wallet::account::transaction_list::TransactionList;
use wallet_cli_commands::ConsoleCommand;
use wallet_controller::types::{Balances, WalletExtraInfo, WalletTypeArgs};
use wallet_rpc_lib::types::PoolInfo;
use wallet_types::wallet_type::WalletType;
use wallet_types::{wallet_type::WalletType, ImportOrCreate};

use super::{AccountId, BackendError, ImportOrCreate};
use super::{AccountId, BackendError};

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct WalletId(u64);
Expand Down
4 changes: 2 additions & 2 deletions node-gui/src/main_window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use node_gui_backend::{
BackendEvent, BackendRequest, EncryptionAction, SignedTransactionWrapper, TransactionInfo,
WalletId, WalletInfo,
},
BackendSender, ImportOrCreate, InitializedNode,
BackendSender, InitializedNode,
};
use p2p::{net::types::services::Services, types::peer_id::PeerId, P2pEvent};
use rfd::AsyncFileDialog;
use wallet_cli_commands::ConsoleCommand;
use wallet_controller::types::WalletTypeArgs;
use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType};
use wallet_types::{seed_phrase::StoreSeedPhrase, wallet_type::WalletType, ImportOrCreate};

#[cfg(feature = "trezor")]
use crate::widgets::create_hw_wallet::hw_wallet_create_dialog;
Expand Down
3 changes: 2 additions & 1 deletion node-gui/src/widgets/create_hw_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use iced::{
Element, Length, Theme,
};
use iced_aw::Card;
use node_gui_backend::ImportOrCreate;

use wallet_types::ImportOrCreate;

pub struct CreateHwWalletDialog<Message> {
on_import: Box<dyn Fn() -> Message>,
Expand Down
17 changes: 17 additions & 0 deletions wallet/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ use common::{
primitives::Amount,
};

use crate::scan_blockchain::ScanBlockchain;

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SignedTxWithFees {
pub tx: SignedTransaction,
Expand All @@ -55,3 +57,18 @@ impl SignedTxWithFees {
self.tx.transaction()
}
}

#[derive(Debug, Clone, Copy)]
pub enum ImportOrCreate {
Import,
Create,
}

impl ImportOrCreate {
pub fn should_scan_blockchain(&self) -> ScanBlockchain {
match self {
Self::Create => ScanBlockchain::SkipScanning,
Self::Import => ScanBlockchain::ScanNoWait,
}
}
}
4 changes: 4 additions & 0 deletions wallet/wallet-cli-commands/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ wallet-rpc-client = { path = "../wallet-rpc-client" }
clap = { workspace = true, features = ["derive"] }
async-trait.workspace = true
crossterm.workspace = true
derive_more.workspace = true
directories.workspace = true
dyn-clone.workspace = true
humantime.workspace = true
hex.workspace = true
itertools.workspace = true
lazy_static.workspace = true
regex.workspace = true
reedline = { workspace = true, features = ["external_printer"] }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
Expand All @@ -57,6 +60,7 @@ subsystem = { path = "../../subsystem" }
test-utils = { path = "../../test-utils" }
wallet-test-node = { path = "../wallet-test-node" }

jsonrpsee.workspace = true
rstest.workspace = true

[features]
Expand Down
6 changes: 3 additions & 3 deletions wallet/wallet-cli-commands/src/command_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,9 @@ where
}
}

WalletCommand::GetBlock { hash } => {
let hash = self.wallet().await?.node_block(hash).await?;
match hash {
WalletCommand::GetBlock { id } => {
let block = self.wallet().await?.node_block(id).await?;
match block {
Some(block) => Ok(ConsoleCommand::Print(block)),
None => Ok(ConsoleCommand::Print("Not found".to_owned())),
}
Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet-cli-commands/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use wallet_controller::types::GenericCurrencyTransferToTxOutputConversionError;
use wallet_rpc_client::{handles_client::WalletRpcHandlesClientError, rpc_client::WalletRpcError};
use wallet_rpc_lib::RpcError;

#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, derive_more::Debug)]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: the standard Debug macro requires N to implement Debug as well, so basically it never works. derive_more::Debug is more clever and puts no requirements on N.

pub enum WalletCliCommandError<N: NodeInterface> {
#[error("Invalid quoting")]
InvalidQuoting,
Expand Down
Loading
Loading