Skip to content

Commit

Permalink
Enable Nova Protocol on Ledger Nano App (iotaledger#2026)
Browse files Browse the repository at this point in the history
* cargo fmt

* Cargo.toml

* fmt

* renamed Protocols to Protocol and moved position of parameter

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
shufps and thibault-martinez authored Feb 19, 2024
1 parent 9a6ba79 commit 60ab6cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ futures = { version = "0.3.30", default-features = false, features = [
"thread-pool",
], optional = true }
instant = { version = "0.1.12", default-features = false, optional = true }
iota-ledger-nano = { version = "1.0.3", default-features = false, optional = true }
iota-ledger-nano = { version = "1.0.4-alpha.3", default-features = false, features = ["nova"], optional = true }
iota_stronghold = { version = "2.0.0", default-features = false, optional = true }
log = { version = "0.4.20", default-features = false, optional = true }
once_cell = { version = "1.19.0", default-features = false, optional = true }
Expand Down
11 changes: 6 additions & 5 deletions sdk/src/client/secret/ledger_nano.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ use crypto::{
},
};
use iota_ledger_nano::{
api::errors::APIError, get_app_config, get_buffer_size, get_ledger, get_opened_app, LedgerBIP32Index,
Packable as LedgerNanoPackable, TransportTypes,
api::{constants::Protocol, errors::APIError},
get_app_config, get_buffer_size, get_ledger, get_opened_app, LedgerBIP32Index, Packable as LedgerNanoPackable,
TransportTypes,
};
use packable::{error::UnexpectedEOF, unpacker::SliceUnpacker, Packable, PackableExt};
use tokio::sync::Mutex;
Expand Down Expand Up @@ -159,7 +160,7 @@ impl SecretManage for LedgerSecretManager {
let lock = self.mutex.lock().await;

// get ledger
let ledger = get_ledger(coin_type, bip32_account, self.is_simulator).map_err(Error::from)?;
let ledger = get_ledger(Protocol::Nova, coin_type, bip32_account, self.is_simulator).map_err(Error::from)?;
if ledger.is_debug_app() {
ledger
.set_non_interactive_mode(self.non_interactive)
Expand Down Expand Up @@ -206,7 +207,7 @@ impl SecretManage for LedgerSecretManager {
// Lock the mutex to prevent multiple simultaneous requests to a ledger.
let lock = self.mutex.lock().await;

let ledger = get_ledger(coin_type, account_index, self.is_simulator).map_err(Error::from)?;
let ledger = get_ledger(Protocol::Nova, coin_type, account_index, self.is_simulator).map_err(Error::from)?;
if ledger.is_debug_app() {
ledger
.set_non_interactive_mode(self.non_interactive)
Expand Down Expand Up @@ -287,7 +288,7 @@ impl SecretManage for LedgerSecretManager {
// lock the mutex to prevent multiple simultaneous requests to a ledger
let lock = self.mutex.lock().await;

let ledger = get_ledger(coin_type, bip32_account, self.is_simulator).map_err(Error::from)?;
let ledger = get_ledger(Protocol::Nova, coin_type, bip32_account, self.is_simulator).map_err(Error::from)?;
if ledger.is_debug_app() {
ledger
.set_non_interactive_mode(self.non_interactive)
Expand Down

0 comments on commit 60ab6cf

Please sign in to comment.