kobe_btc/lib.rs
1//! Bitcoin wallet utilities for Kobe CLI.
2//!
3//! Provides Bitcoin address derivation from a unified [`kobe_core::Wallet`].
4//!
5//! # Features
6//!
7//! - `std` (default): Enable standard library support
8//! - `alloc`: Enable heap allocation without full std (for `no_std` environments)
9//! - `rand`: Enable random key generation for `StandardWallet`
10//!
11//! # Usage
12//!
13//! ```
14//! use kobe_core::Wallet;
15//! use kobe_btc::{Deriver, Network, AddressType};
16//!
17//! // Create a wallet from kobe-core
18//! let wallet = Wallet::generate(12, None).unwrap();
19//!
20//! // Derive Bitcoin addresses from the wallet
21//! let deriver = Deriver::new(&wallet, Network::Mainnet).unwrap();
22//! let addr = deriver.derive(AddressType::P2wpkh, 0, false, 0).unwrap();
23//! println!("Address: {}", addr.address);
24//! ```
25
26#![cfg_attr(not(feature = "std"), no_std)]
27
28#[cfg(feature = "alloc")]
29extern crate alloc;
30
31#[cfg(feature = "alloc")]
32mod address;
33#[cfg(feature = "alloc")]
34mod deriver;
35mod error;
36mod network;
37#[cfg(feature = "alloc")]
38mod standard_wallet;
39mod types;
40
41#[cfg(feature = "alloc")]
42pub use deriver::{DerivedAddress, Deriver};
43pub use error::Error;
44pub use network::{Network, ParseNetworkError};
45#[cfg(feature = "alloc")]
46pub use standard_wallet::StandardWallet;
47#[cfg(feature = "alloc")]
48pub use types::DerivationPath;
49pub use types::{AddressType, ParseAddressTypeError};
50
51/// A convenient Result type alias for kobe-btc operations.
52pub type Result<T> = core::result::Result<T, Error>;