#[derive(Clone, Copy)]
pub struct CosmosDerivationPath {
pub purpose: u16,
pub coin_type: u16,
pub account: u16,
pub change: u16,
pub address_index: u16,
}
impl From<CosmosDerivationPath> for String {
fn from(path: CosmosDerivationPath) -> Self {
format!(
"m/{}'/{}'/{}'/{}/{}",
path.purpose, path.coin_type, path.account, path.change, path.address_index
)
}
}
impl Default for CosmosDerivationPath {
fn default() -> Self {
Self::new()
}
}
const KEPLR_PURPOSE: u16 = 44;
const COSMOS_TYPE: u16 = 118;
impl CosmosDerivationPath {
pub fn new() -> Self {
Self {
purpose: KEPLR_PURPOSE,
coin_type: COSMOS_TYPE,
account: 0,
change: 0,
address_index: 0,
}
}
}