Skip to content

Commit

Permalink
fix: ledger path from env var not using extension
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Jun 30, 2024
1 parent b4eea71 commit dca7d91
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{path::PathBuf, str::FromStr};

use anyhow::Result;
use async_trait::async_trait;
Expand All @@ -9,7 +9,7 @@ use starknet::{
signers::{DerivationPath, LedgerSigner, LocalWallet, Signer, SigningKey, VerifyingKey},
};

use crate::hd_path::DerivationPathParser;
use crate::hd_path::{DerivationPathParser, Eip2645Path};

#[derive(Debug)]
pub enum AnySigner {
Expand Down Expand Up @@ -164,7 +164,9 @@ impl SignerArgs {
let ledger_path = match self.ledger_path {
Some(value) => Some(DerivationPathValue::FromCommandLine(value)),
None => match std::env::var("STARKNET_LEDGER_PATH") {
Ok(value) => Some(DerivationPathValue::FromEnvVar(value.parse()?)),
Ok(value) => Some(DerivationPathValue::FromEnvVar(
Eip2645Path::from_str(&value)?.into(),
)),
Err(_) => None,
},
};
Expand Down

0 comments on commit dca7d91

Please sign in to comment.