Skip to main content

Derive

Trait Derive 

Source
pub trait Derive {
    type Error: Debug + Display + From<Error>;

    // Required methods
    fn derive(&self, index: u32) -> Result<DerivedAccount, Self::Error>;
    fn derive_path(&self, path: &str) -> Result<DerivedAccount, Self::Error>;
}
Expand description

Unified derivation trait implemented by all chain derivers.

Provides a consistent API for deriving accounts regardless of the underlying chain. Each chain crate (kobe-evm, kobe-btc, etc.) implements this trait on its Deriver type.

Batch derivation is provided by the blanket DeriveExt trait.

§Example

use kobe::{Derive, DeriveExt};

fn derive_first_account(d: &impl Derive) -> kobe::DerivedAccount {
    d.derive(0).unwrap()
}

Required Associated Types§

Source

type Error: Debug + Display + From<Error>

The error type returned by derivation operations.

Required Methods§

Source

fn derive(&self, index: u32) -> Result<DerivedAccount, Self::Error>

Derive an account at the given index using the chain’s default path.

Source

fn derive_path(&self, path: &str) -> Result<DerivedAccount, Self::Error>

Derive an account at a custom path string.

Implementors§