aboutsummaryrefslogtreecommitdiff
path: root/src/hdk
diff options
context:
space:
mode:
Diffstat (limited to 'src/hdk')
-rw-r--r--src/hdk/path.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/hdk/path.rs b/src/hdk/path.rs
index 0d05110..333381c 100644
--- a/src/hdk/path.rs
+++ b/src/hdk/path.rs
@@ -13,7 +13,12 @@ pub struct Path {
}
impl Path {
- /// Returns an iterator
+ /// Creates the default Ethereum HD path for the specified account index.
+ pub fn for_index(index: usize) -> Self {
+ format!("m/44'/60'/0'/0/{index}").parse().unwrap()
+ }
+
+ /// Returns an iterator over the path components.
pub fn components(&self) -> impl Iterator<Item = Component> + '_ {
self.components.iter().copied()
}