[−][src]Struct hdpath::AccountHDPath
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]
purpose: Purpose,
coin_type: u32,
account: u32
) -> Result<AccountHDPath, (String, u32)>
pub fn address_at(
&self,
change: u32,
index: u32
) -> Result<StandardHDPath, (String, u32)>
[src]
&self,
change: u32,
index: u32
) -> Result<StandardHDPath, (String, u32)>
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]
fn clone(&self) -> AccountHDPath
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<AccountHDPath> for AccountHDPath
[src]
fn eq(&self, other: &AccountHDPath) -> bool
[src]
fn ne(&self, other: &AccountHDPath) -> bool
[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.
fn try_from(value: &str) -> Result<Self, Self::Error>
[src]
impl TryFrom<CustomHDPath> for AccountHDPath
[src]
Auto Trait Implementations
impl RefUnwindSafe for AccountHDPath
impl Send for AccountHDPath
impl Sync for AccountHDPath
impl Unpin for AccountHDPath
impl UnwindSafe for AccountHDPath
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,