Skip to content
Open
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
1 change: 0 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ flags:
wallet:
paths:
- key-wallet/src/
- key-wallet-manager/src/
ffi:
paths:
- dash-spv-ffi/src/
Expand Down
1 change: 0 additions & 1 deletion .github/ci-groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ groups:

wallet:
- key-wallet
- key-wallet-manager

ffi:
- dash-spv-ffi
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["dash", "hashes", "internals", "fuzz", "rpc-client", "rpc-json", "rpc-integration-test", "key-wallet", "key-wallet-ffi", "key-wallet-manager", "dash-spv", "dash-spv-ffi"]
members = ["dash", "hashes", "internals", "fuzz", "rpc-client", "rpc-json", "rpc-integration-test", "key-wallet", "key-wallet-ffi", "dash-spv", "dash-spv-ffi"]
resolver = "2"

[workspace.package]
Expand Down
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
|-------|--------|----------|
| core | dashcore, dashcore_hashes, dashcore-private | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=core)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=core) |
| spv | dash-spv | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=spv)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=spv) |
| wallet | key-wallet, key-wallet-manager | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=wallet)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=wallet) |
| wallet | key-wallet | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=wallet)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=wallet) |
| ffi | dash-spv-ffi, key-wallet-ffi | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=ffi)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=ffi) |
| rpc | dashcore-rpc, dashcore-rpc-json | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=rpc)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=rpc) |

Expand All @@ -46,7 +46,7 @@ Supports (or should support)
* Pay-to-contract support as in Appendix A of the [Blockstream sidechains whitepaper](https://www.blockstream.com/sidechains.pdf)
* JSONRPC interaction with Dash Core
* FFI bindings for C/Swift integration (dash-spv-ffi, key-wallet-ffi)
* [High-level wallet management](key-wallet-manager/README.md) with transaction building and UTXO management
* High-level wallet management with transaction building and UTXO management

# Known limitations

Expand Down Expand Up @@ -98,13 +98,10 @@ See `client/examples/` for more usage examples.

This library provides comprehensive wallet functionality through multiple components:

* **key-wallet**: Low-level cryptographic primitives for HD wallets, mnemonic generation, and key derivation
* **[key-wallet-manager](key-wallet-manager/README.md)**: High-level wallet management with transaction building, UTXO tracking, and coin selection
* **key-wallet**: Low-level cryptographic primitives for HD wallets, mnemonic generation, and key derivation; and high-level wallet management with transaction building, UTXO tracking, and coin selection
* **key-wallet-ffi**: C/Swift FFI bindings for mobile integration
* **dash-spv**: SPV (Simplified Payment Verification) client implementation

For most applications, start with [key-wallet-manager](key-wallet-manager/README.md) which provides a complete, easy-to-use interface for wallet operations.

# Supported Dash Core Versions
The following versions are officially supported:
* 0.18.x
Expand All @@ -122,10 +119,6 @@ This workspace compiles on Rust 1.89 or newer. Crates use mixed editions (2021 a

Documentation can be found on [dashcore.readme.io/docs](https://dashcore.readme.io/docs).

## Component Documentation

* **[key-wallet-manager](key-wallet-manager/README.md)** - High-level wallet management guide

# Contributing

Contributions are generally welcome. If you intend to make larger changes please
Expand Down
1 change: 0 additions & 1 deletion dash-spv-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tracing = "0.1"
key-wallet-ffi = { path = "../key-wallet-ffi" }
# Still need these for SPV client internals (not for FFI types)
key-wallet = { path = "../key-wallet" }
key-wallet-manager = { path = "../key-wallet-manager" }
rand = "0.8"
clap = { version = "4.5", features = ["derive"] }

Expand Down
5 changes: 2 additions & 3 deletions dash-spv-ffi/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use crate::{dash_spv_ffi_sync_progress_destroy, FFISyncProgress};
use dashcore::hashes::Hash;
use key_wallet::manager::WalletEvent;
use std::ffi::CString;
use std::os::raw::{c_char, c_void};

Expand Down Expand Up @@ -619,9 +620,7 @@ impl FFIClientErrorCallback {

impl FFIWalletEventCallbacks {
/// Dispatch a WalletEvent to the appropriate callback.
pub fn dispatch(&self, event: &key_wallet_manager::WalletEvent) {
use key_wallet_manager::WalletEvent;

pub fn dispatch(&self, event: &WalletEvent) {
match event {
WalletEvent::TransactionReceived {
wallet_id,
Expand Down
6 changes: 2 additions & 4 deletions dash-spv-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ where

/// FFI wrapper around `DashSpvClient`.
type InnerClient = DashSpvClient<
key_wallet_manager::wallet_manager::WalletManager<
key_wallet::wallet::managed_wallet_info::ManagedWalletInfo,
>,
key_wallet::manager::WalletManager<key_wallet::wallet::managed_wallet_info::ManagedWalletInfo>,
dash_spv::network::PeerNetworkManager,
DiskStorageManager,
>;
Expand Down Expand Up @@ -166,7 +164,7 @@ pub unsafe extern "C" fn dash_spv_ffi_client_new(
// Construct concrete implementations for generics
let network = dash_spv::network::PeerNetworkManager::new(&client_config).await;
let storage = DiskStorageManager::new(&client_config).await;
let wallet = key_wallet_manager::wallet_manager::WalletManager::<
let wallet = key_wallet::manager::WalletManager::<
key_wallet::wallet::managed_wallet_info::ManagedWalletInfo,
>::new(client_config.network);
let wallet = std::sync::Arc::new(tokio::sync::RwLock::new(wallet));
Expand Down
2 changes: 1 addition & 1 deletion dash-spv-ffi/tests/test_wallet_manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(test)]
mod tests {
use dash_spv_ffi::*;
use key_wallet::manager::WalletManager;
use key_wallet::wallet::initialization::WalletAccountCreationOptions;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet_ffi::{
Expand All @@ -10,7 +11,6 @@ mod tests {
},
FFIError, FFINetwork, FFIWalletManager,
};
use key_wallet_manager::wallet_manager::WalletManager;
use std::ffi::{CStr, CString};
use tempfile::TempDir;

Expand Down
3 changes: 1 addition & 2 deletions dash-spv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ rust-version = "1.89"
dashcore = { path = "../dash", features = ["std", "serde", "core-block-hash-use-x11", "message_verification", "bls", "quorum_validation"] }
dashcore_hashes = { path = "../hashes" }
key-wallet = { path = "../key-wallet" }
key-wallet-manager = { path = "../key-wallet-manager" }

# BLS signatures
blsful = { git = "https://github.com/dashpay/agora-blsful", rev = "0c34a7a488a0bd1c9a9a2196e793b303ad35c900" }
Expand Down Expand Up @@ -64,7 +63,7 @@ log = "0.4"
[dev-dependencies]
dash-spv = { path = ".", features = ["test-utils"] }
dashcore = { path = "../dash", features = ["test-utils"] }
key-wallet-manager = { path = "../key-wallet-manager", features = ["test-utils"] }
key-wallet = { path = "../key-wallet", features = ["test-utils"] }
criterion = { version = "0.8.1", features = ["async_tokio"] }
tempfile = "3.0"
tokio-test = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/examples/filter_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use dash_spv::network::PeerNetworkManager;
use dash_spv::storage::DiskStorageManager;
use dash_spv::{init_console_logging, ClientConfig, DashSpvClient, LevelFilter};
use dashcore::Address;
use key_wallet::manager::WalletManager;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet_manager::wallet_manager::WalletManager;
use std::str::FromStr;
use std::sync::Arc;
use tokio::sync::RwLock;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/examples/simple_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use dash_spv::storage::DiskStorageManager;
use dash_spv::{init_console_logging, ClientConfig, DashSpvClient, LevelFilter};
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;

use key_wallet_manager::wallet_manager::WalletManager;
use key_wallet::manager::WalletManager;
use std::sync::Arc;
use tokio::sync::RwLock;
use tokio_util::sync::CancellationToken;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/examples/spv_with_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use dash_spv::network::PeerNetworkManager;
use dash_spv::storage::DiskStorageManager;
use dash_spv::{ClientConfig, DashSpvClient, LevelFilter};
use key_wallet::manager::WalletManager;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet_manager::wallet_manager::WalletManager;
use std::sync::Arc;
use tokio::sync::RwLock;
use tokio_util::sync::CancellationToken;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::storage::{
};
use crate::sync::SyncCoordinator;
use crate::types::MempoolState;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

pub(super) type PersistentSyncCoordinator<W> = SyncCoordinator<
PersistentBlockHeaderStorage,
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tokio::sync::watch;
use crate::network::{NetworkEvent, NetworkManager};
use crate::storage::StorageManager;
use crate::sync::{SyncEvent, SyncProgress};
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;
use tokio::sync::broadcast;

use super::DashSpvClient;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::sync::{
use crate::types::MempoolState;
use dashcore::sml::masternode_list_engine::MasternodeListEngine;
use dashcore_hashes::Hash;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

impl<W: WalletInterface, N: NetworkManager, S: StorageManager> DashSpvClient<W, N, S> {
/// Create a new SPV client with the given configuration, network, storage, and wallet.
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::error::Result;
use crate::mempool_filter::MempoolFilter;
use crate::network::NetworkManager;
use crate::storage::StorageManager;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

use super::DashSpvClient;

Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ mod tests {
use crate::storage::DiskStorageManager;
use crate::{test_utils::MockNetworkManager, types::UnconfirmedTransaction};
use dashcore::{Address, Amount, Transaction, TxOut};
use key_wallet::manager::WalletManager;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet_manager::wallet_manager::WalletManager;
use std::sync::Arc;
use tempfile::TempDir;
use tokio::sync::RwLock;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use dashcore::sml::llmq_type::LLMQType;
use dashcore::sml::masternode_list_engine::MasternodeListEngine;
use dashcore::sml::quorum_entry::qualified_quorum_entry::QualifiedQuorumEntry;
use dashcore::QuorumHash;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;
use std::sync::Arc;
use tokio::sync::RwLock;

Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/sync_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::error::Result;
use crate::network::NetworkManager;
use crate::storage::StorageManager;
use crate::sync::SyncProgress;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;
use std::time::Duration;
use tokio_util::sync::CancellationToken;

Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/client/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::error::{Result, SpvError};
use crate::network::NetworkManager;
use crate::storage::StorageManager;
use dashcore::network::message::NetworkMessage;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

use super::DashSpvClient;

Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! use dash_spv::storage::DiskStorageManager;
//! use dashcore::Network;
//! use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
//! use key_wallet_manager::wallet_manager::WalletManager;
//! use key_wallet::manager::WalletManager;
//! use std::sync::Arc;
//! use tokio::sync::RwLock;
//! use tokio_util::sync::CancellationToken;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::sync::Arc;

use clap::{Arg, Command};
use dash_spv::{ClientConfig, DashSpvClient, LevelFilter, Network};
use key_wallet::manager::WalletManager;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet_manager::wallet_manager::WalletManager;
use tokio_util::sync::CancellationToken;

#[tokio::main]
Expand Down
6 changes: 3 additions & 3 deletions dash-spv/src/sync/blocks/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::error::SyncResult;
use crate::network::RequestSender;
use crate::storage::{BlockHeaderStorage, BlockStorage};
use crate::sync::{BlocksProgress, SyncEvent, SyncManager, SyncState};
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

/// Blocks manager for downloading and processing matching blocks.
///
Expand Down Expand Up @@ -164,8 +164,8 @@ mod tests {
};
use crate::sync::{ManagerIdentifier, SyncEvent, SyncManagerProgress};
use crate::test_utils::MockNetworkManager;
use key_wallet_manager::test_utils::MockWallet;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use key_wallet::test_utils::MockWallet;
use std::collections::BTreeSet;

type TestBlocksManager =
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/blocks/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::network::RequestSender;
use crate::sync::download_coordinator::{DownloadConfig, DownloadCoordinator};
use dashcore::blockdata::block::Block;
use dashcore::BlockHash;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;

/// Maximum number of concurrent block downloads.
const MAX_CONCURRENT_BLOCK_DOWNLOADS: usize = 20;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/blocks/sync_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::types::HashedBlock;
use crate::SyncError;
use async_trait::async_trait;
use dashcore::network::message::NetworkMessage;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

#[async_trait]
impl<H: BlockHeaderStorage, B: BlockStorage, W: WalletInterface + 'static> SyncManager
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::sync::ManagerIdentifier;
use dashcore::ephemerealdata::chain_lock::ChainLock;
use dashcore::ephemerealdata::instant_lock::InstantLock;
use dashcore::{Address, BlockHash};
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use std::collections::BTreeSet;

/// Events that managers can emit and subscribe to.
Expand Down
4 changes: 2 additions & 2 deletions dash-spv/src/sync/filters/batch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dashcore::bip158::BlockFilter;
use dashcore::Address;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use std::collections::{HashMap, HashSet};

/// A completed batch of compact block filters ready for verification.
Expand Down Expand Up @@ -134,7 +134,7 @@ mod tests {
use crate::sync::filters::batch::FiltersBatch;
use dashcore::bip158::BlockFilter;
use dashcore::Header;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use std::collections::{BTreeSet, HashMap};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/filters/batch_tracker.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dashcore::bip158::BlockFilter;
use dashcore::BlockHash;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use std::collections::{HashMap, HashSet};

/// Tracks individual filters within a batch.
Expand Down
6 changes: 3 additions & 3 deletions dash-spv/src/sync/filters/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::validation::{FilterValidationInput, FilterValidator, Validator};

use crate::sync::progress::ProgressPercentage;
use dashcore::hash_types::FilterHeader;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet_manager::wallet_manager::{check_compact_filters_for_addresses, FilterMatchKey};
use key_wallet::manager::WalletInterface;
use key_wallet::manager::{check_compact_filters_for_addresses, FilterMatchKey};
use tokio::sync::RwLock;

/// Batch size for processing filters.
Expand Down Expand Up @@ -771,7 +771,7 @@ mod tests {
PersistentFilterStorage, StorageManager,
};
use crate::sync::{ManagerIdentifier, SyncManagerProgress};
use key_wallet_manager::test_utils::MockWallet;
use key_wallet::test_utils::MockWallet;
use tokio::sync::mpsc::unbounded_channel;

type TestFiltersManager = FiltersManager<
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/filters/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ mod tests {
use dashcore::block::Header;
use dashcore::network::message::NetworkMessage;
use dashcore_hashes::Hash;
use key_wallet_manager::wallet_manager::FilterMatchKey;
use key_wallet::manager::FilterMatchKey;
use std::time::Duration;
use tempfile::TempDir;
use tokio::sync::mpsc::unbounded_channel;
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/filters/sync_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::sync::{
};
use async_trait::async_trait;
use dashcore::network::message::NetworkMessage;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

#[async_trait]
impl<
Expand Down
2 changes: 1 addition & 1 deletion dash-spv/src/sync/sync_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::sync::{
SyncManagerProgress, SyncManagerTaskContext, SyncProgress,
};
use crate::SyncError;
use key_wallet_manager::wallet_interface::WalletInterface;
use key_wallet::manager::WalletInterface;

const TASK_JOIN_TIMEOUT: Duration = Duration::from_secs(5);
const DEFAULT_SYNC_EVENT_CAPACITY: usize = 10000;
Expand Down
Loading
Loading