derivation-path

Crates.ioderivation-path
lib.rsderivation-path
version0.2.0
sourcesrc
created_at2020-06-16 15:39:40.794864
updated_at2022-02-16 16:57:16.871083
descriptionSimple struct for dealing with BIP32/44/49 derivation paths
homepagehttps://github.com/jpopesculian/derivation-path
repositoryhttps://github.com/jpopesculian/derivation-path
max_upload_size
id254556
size28,199
Julian Popescu (jpopesculian)

documentation

https://docs.rs/derivation-path/

README

derivation-path

A simple struct for dealing with derivation paths as defined by BIP32, BIP44 and BIP49 of the Bitcoin protocol. This crate provides interfaces for dealing with hardened vs normal child indexes, as well as display and parsing derivation paths from strings

Example

let path = DerivationPath::bip44(0, 1, 0, 1).unwrap();
assert_eq!(&path.to_string(), "m/44'/0'/1'/0/1");
assert_eq!(path.path()[2], ChildIndex::Hardened(1));

let path: DerivationPath = "m/49'/0'/0'/1/0".parse().unwrap();
assert_eq!(path.path()[4], ChildIndex::Normal(0));
assert_eq!(path.path_type(), DerivationPathType::BIP49);

License: MIT OR Apache-2.0

Commit count: 7

cargo fmt