Skip to main content

Derive

Trait Derive 

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

    // 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_primitives::{Derive, DeriveExt, DerivedAccount};

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

Required Associated Types§

Source

type Error: Debug + Display + From<DeriveError>

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.

§Errors

Returns an error if key derivation or address encoding fails.

Source

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

Derive an account at a custom path string.

§Errors

Returns an error if the path is invalid or derivation fails.

Implementors§