aboutsummaryrefslogtreecommitdiff
path: root/src/hdk
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2023-10-22 17:56:01 +0000
committerNicholas Rodrigues Lordello <[email protected]>2023-10-22 17:56:01 +0000
commit1388ce8c4c2215ed029414d71833eab4b9bc8dc2 (patch)
tree93bbd822db9f7ddcf548f65e23fdbdf39db4d136 /src/hdk
parentca758736f76d9c32d7e5df44e270bf2879a1b86c (diff)
Add Support for Genereting Mnemonic for Vanity Address
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()
}