dig_wallet/
lib.rs

1//! # Dig Wallet Rust
2//!
3//! A comprehensive Rust wallet implementation for Chia blockchain with full DataLayer-Driver integration.
4//!
5//! ## Features
6//!
7//! - **Complete Wallet Management**: Create, import, and manage multiple wallets
8//! - **Cryptographic Operations**: BIP39 mnemonics, BLS signatures, key derivation
9//! - **Blockchain Integration**: Connect to Chia peers, select coins, check spendability
10//! - **Secure Storage**: AES-256-GCM encrypted keyring storage
11//! - **Address Handling**: Bech32m encoding/decoding for XCH addresses
12//!
13//! ## Quick Start
14//!
15//! ```rust,no_run
16//! use dig_wallet::{Wallet, WalletError};
17//!
18//! #[tokio::main]
19//! async fn main() -> Result<(), WalletError> {
20//!     // Create or load a wallet
21//!     let wallet = Wallet::load(Some("my_wallet".to_string()), true).await?;
22//!     
23//!     // Get wallet address
24//!     let address = wallet.get_owner_public_key().await?;
25//!     println!("Wallet address: {}", address);
26//!     
27//!     Ok(())
28//! }
29//! ```
30//!
31//! ## Peer Connection
32//!
33//! ```rust,no_run
34//! use dig_wallet::Wallet;
35//!
36//! #[tokio::main]
37//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
38//!     // Connect to a random mainnet peer
39//!     let peer = Wallet::connect_mainnet_peer().await?;
40//!     
41//!     // Use peer for blockchain operations
42//!     let wallet = Wallet::load(Some("my_wallet".to_string()), true).await?;
43//!     let coins = wallet.select_unspent_coins(&peer, 1000000, 1000, vec![]).await?;
44//!     
45//!     Ok(())
46//! }
47//! ```
48
49pub mod error;
50pub mod file_cache;
51pub mod wallet;
52
53// Core exports
54pub use error::WalletError;
55pub use file_cache::{FileCache, ReservedCoinCache};
56pub use wallet::Wallet;
57
58// Re-export commonly used types from DataLayer-Driver
59pub use datalayer_driver::{
60    Bytes32, Coin, CoinSpend, NetworkType, Peer, PublicKey, SecretKey, Signature,
61};
62
63// Version information
64pub const VERSION: &str = env!("CARGO_PKG_VERSION");