pub struct Deriver<'a> { /* private fields */ }Expand description
Solana address deriver from a unified wallet seed.
This deriver takes a seed from kobe::Wallet and derives
Solana addresses following BIP44/SLIP-0010 standards.
§Example
use kobe::Wallet;
use kobe_sol::Deriver;
let wallet = Wallet::generate(12, None).unwrap();
let deriver = Deriver::new(&wallet);
let addr = deriver.derive(0).unwrap();
println!("Address: {}", addr.address);
// With specific derivation style
use kobe_sol::DerivationStyle;
let addr = deriver.derive_with(DerivationStyle::LedgerLive, 0).unwrap();Implementations§
Source§impl<'a> Deriver<'a>
impl<'a> Deriver<'a>
Sourcepub fn derive_with(
&self,
style: DerivationStyle,
index: u32,
) -> Result<DerivedAddress, Error>
pub fn derive_with( &self, style: DerivationStyle, index: u32, ) -> Result<DerivedAddress, Error>
Derive a Solana address with a specific derivation style.
This method supports different wallet path formats:
- Standard (Phantom/Backpack):
m/44'/501'/index'/0' - Trust:
m/44'/501'/index' - Ledger Live:
m/44'/501'/index'/0'/0' - Legacy:
m/44'/501'/0'/index'
§Arguments
style- The derivation style to useindex- The address/account index
§Errors
Returns an error if derivation fails.
Sourcepub fn derive_many(
&self,
start: u32,
count: u32,
) -> Result<Vec<DerivedAddress>, Error>
pub fn derive_many( &self, start: u32, count: u32, ) -> Result<Vec<DerivedAddress>, Error>
Sourcepub fn derive_many_with(
&self,
style: DerivationStyle,
start: u32,
count: u32,
) -> Result<Vec<DerivedAddress>, Error>
pub fn derive_many_with( &self, style: DerivationStyle, start: u32, count: u32, ) -> Result<Vec<DerivedAddress>, Error>
Sourcepub fn derive_path(&self, path: &str) -> Result<DerivedAddress, Error>
pub fn derive_path(&self, path: &str) -> Result<DerivedAddress, Error>
Derive an address at a custom derivation path.
This is the lowest-level derivation method, allowing full control over the derivation path.
Note: Ed25519 (Solana) only supports hardened derivation. All path components will be treated as hardened.
§Arguments
path- SLIP-0010 derivation path (e.g.,m/44'/501'/0'/0')
§Errors
Returns an error if derivation fails.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Deriver<'a>
impl<'a> RefUnwindSafe for Deriver<'a>
impl<'a> Send for Deriver<'a>
impl<'a> Sync for Deriver<'a>
impl<'a> Unpin for Deriver<'a>
impl<'a> UnwindSafe for Deriver<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more