Skip to content

Commit

Permalink
feat: support more cointypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Sep 5, 2024
1 parent fe729ce commit 509b968
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rust-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ overflow-checks = false

[package.metadata.ledger]
name = "IOTA"
path = ["44'/4218'"]
# Testnet, IOTA, Shimmer
path = ["44'/1'", "44'/4218'", "44'/4219'"]
curve = ["ed25519"]
flags = "0"

Expand Down
6 changes: 5 additions & 1 deletion rust-app/src/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ pub type BipParserImplT =
pub const BIP_PATH_PARSER: BipParserImplT = SubInterp(DefaultInterp);

// Need a path of length 5, as make_bip32_path panics with smaller paths
pub const BIP32_TESTNET_PREFIX: [u32; 5] =
ledger_device_sdk::ecc::make_bip32_path(b"m/44'/1'/123'/0'/0'");
pub const BIP32_IOTA_PREFIX: [u32; 5] =
ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4218'/123'/0'/0'");
pub const BIP32_SMR_PREFIX: [u32; 5] =
ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4219'/123'/0'/0'");

fn is_bip_prefix_valid(path: &[u32]) -> bool {
path.starts_with(&BIP32_IOTA_PREFIX[0..2]) || path.starts_with(&BIP32_SMR_PREFIX[0..2])
path.starts_with(&BIP32_TESTNET_PREFIX[0..2])
|| path.starts_with(&BIP32_IOTA_PREFIX[0..2])
|| path.starts_with(&BIP32_SMR_PREFIX[0..2])
}

pub async fn get_address_apdu(io: HostIO, prompt: bool) {
Expand Down

0 comments on commit 509b968

Please sign in to comment.