[][src]Struct hdpath::AccountHDPath

pub struct AccountHDPath { /* fields omitted */ }

Account-only HD Path for BIP-44, BIP-49, BIP-84 and similar.

It's not supposed to be used to derive actual addresses, but only to build other path based on this

Represents m/purpose'/coin_type'/account'/x/x, like m/44'/0'/0'/x/x.

Create new

use hdpath::{AccountHDPath, Purpose};

//creates path m/84'/0'/0'/0/0
let hd_account = AccountHDPath::new(Purpose::Witness, 0, 0);

Parse string

use hdpath::{AccountHDPath, Purpose};

//creates path m/84'/0'/0'/0/0
let hd_account = AccountHDPath::from_str("m/84'/0'/0'").unwrap();

Create actial path

use hdpath::{AccountHDPath, Purpose, StandardHDPath};

let hd_account = AccountHDPath::from_str("m/84'/0'/0'").unwrap();
// gives hd path m/84'/0'/0'/0/4
let hd_path: StandardHDPath = hd_account.address_at(0, 4).unwrap();

Implementations

impl AccountHDPath[src]

pub fn new(purpose: Purpose, coin_type: u32, account: u32) -> AccountHDPath[src]

pub fn try_new(
    purpose: Purpose,
    coin_type: u32,
    account: u32
) -> Result<AccountHDPath, (String, u32)>
[src]

pub fn address_at(
    &self,
    change: u32,
    index: u32
) -> Result<StandardHDPath, (String, u32)>
[src]

Derive path to an address withing this account path

let hd_account = AccountHDPath::try_from("m/84'/0'/0'").unwrap();
// gives hd path m/84'/0'/0'/0/4
let hd_path: StandardHDPath = hd_account.address_at(0, 4).unwrap();

Return error (field_name, invalid_value) if the field has an incorrect value. It may happed if change or index are in hardened space.

pub fn purpose(&self) -> &Purpose[src]

pub fn coin_type(&self) -> u32[src]

pub fn account(&self) -> u32[src]

Trait Implementations

impl Clone for AccountHDPath[src]

impl Debug for AccountHDPath[src]

impl Eq for AccountHDPath[src]

impl FromStr for AccountHDPath[src]

type Err = Error

The associated error which can be returned from parsing.

impl PartialEq<AccountHDPath> for AccountHDPath[src]

impl StructuralEq for AccountHDPath[src]

impl StructuralPartialEq for AccountHDPath[src]

impl ToString for AccountHDPath[src]

impl<'_> TryFrom<&'_ str> for AccountHDPath[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<CustomHDPath> for AccountHDPath[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.