Skip to main content

kobe_sol/
lib.rs

1//! Solana wallet utilities for Kobe CLI.
2//!
3//! Provides Solana 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_sol::Deriver;
16//!
17//! // Create a wallet from mnemonic
18//! let wallet = Wallet::from_mnemonic(
19//!     "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
20//!     None
21//! ).unwrap();
22//!
23//! // Derive Solana addresses from the wallet
24//! let deriver = Deriver::new(&wallet);
25//! let addr = deriver.derive(0).unwrap();
26//! println!("Address: {}", addr.address);
27//! ```
28
29#![cfg_attr(not(feature = "std"), no_std)]
30
31#[cfg(feature = "alloc")]
32extern crate alloc;
33
34#[cfg(feature = "alloc")]
35mod derivation_style;
36#[cfg(feature = "alloc")]
37mod deriver;
38mod error;
39#[cfg(feature = "alloc")]
40mod slip10;
41#[cfg(feature = "alloc")]
42mod standard_wallet;
43
44#[cfg(feature = "alloc")]
45pub use derivation_style::{DerivationStyle, ParseDerivationStyleError};
46#[cfg(feature = "alloc")]
47pub use deriver::{DerivedAddress, Deriver};
48pub use error::Error;
49#[cfg(feature = "alloc")]
50pub use standard_wallet::StandardWallet;
51
52/// A convenient Result type alias for kobe-sol operations.
53pub type Result<T> = core::result::Result<T, Error>;