kobe_eth/lib.rs
1//! Ethereum wallet utilities for Kobe CLI.
2//!
3//! Provides Ethereum 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_eth::{Deriver, DerivationStyle};
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 Ethereum addresses from the wallet
24//! let deriver = Deriver::new(&wallet);
25//! let addr = deriver.derive(0, false, 0).unwrap();
26//! println!("Address: {}", addr.address);
27//!
28//! // Derive using Ledger Live style
29//! let addr = deriver.derive_with_style(DerivationStyle::LedgerLive, 0).unwrap();
30//! println!("Ledger Live Address: {}", addr.address);
31//! ```
32
33#![cfg_attr(not(feature = "std"), no_std)]
34
35#[cfg(feature = "alloc")]
36extern crate alloc;
37
38#[cfg(feature = "alloc")]
39mod address;
40#[cfg(feature = "alloc")]
41mod derivation_style;
42#[cfg(feature = "alloc")]
43mod deriver;
44mod error;
45#[cfg(feature = "alloc")]
46mod standard_wallet;
47
48#[cfg(feature = "alloc")]
49pub use derivation_style::{DerivationStyle, ParseDerivationStyleError};
50#[cfg(feature = "alloc")]
51pub use deriver::{DerivedAddress, Deriver};
52pub use error::Error;
53#[cfg(feature = "alloc")]
54pub use standard_wallet::StandardWallet;
55
56/// A convenient Result type alias for kobe-eth operations.
57pub type Result<T> = core::result::Result<T, Error>;