@@ -14,7 +14,9 @@ use sncast::helpers::constants::{
1414} ;
1515use sncast:: helpers:: ledger:: { DerivationPathParser , SncastLedgerTransport } ;
1616use sncast:: response:: ui:: UI ;
17- use speculos:: { AutomationAction , AutomationCondition , AutomationRule , Button , SpeculosClient } ;
17+ use speculos_client:: {
18+ AutomationAction , AutomationCondition , AutomationRule , Button , DeviceModel , SpeculosClient ,
19+ } ;
1820use starknet_rust:: accounts:: { AccountFactory , ArgentAccountFactory , OpenZeppelinAccountFactory } ;
1921use starknet_rust:: core:: types:: { BlockId , BlockTag } ;
2022use starknet_rust:: providers:: Provider ;
@@ -28,7 +30,6 @@ use url::Url;
2830mod account;
2931mod basic;
3032mod network;
31- pub ( crate ) mod speculos;
3233
3334pub ( crate ) const OZ_LEDGER_PATH : & str = "m//starknet'/sncast'/0'/0'/0" ;
3435pub ( crate ) const READY_LEDGER_PATH : & str = "m//starknet'/sncast'/0'/1'/0" ;
@@ -45,19 +46,21 @@ pub(crate) const LEDGER_PUBLIC_KEY: &str =
4546pub ( crate ) const LEDGER_ACCOUNT_NAME : & str = "my_ledger" ;
4647
4748pub ( crate ) fn setup_speculos ( port : u16 ) -> ( Arc < SpeculosClient > , String ) {
48- let client = Arc :: new ( SpeculosClient :: new ( port, APP_PATH ) . unwrap ( ) ) ;
49+ let client = Arc :: new ( SpeculosClient :: new ( DeviceModel :: Nanox , port, APP_PATH ) . unwrap ( ) ) ;
4950 let url = format ! ( "http://127.0.0.1:{port}" ) ;
5051 ( client, url)
5152}
5253
53- /// Sets automation rules and, when `ENABLE_BLIND_SIGN` is among them, presses RIGHT so the
54- /// blind-sign flow advances immediately.
54+ /// Sets automation rules and, when `ENABLE_BLIND_SIGN` is among them, presses RIGHT to
55+ /// navigate from the home screen to "App settings" so the rule triggers immediately.
5556pub ( crate ) async fn set_automation (
5657 client : & SpeculosClient ,
57- rules : & [ speculos :: AutomationRule < ' static > ] ,
58+ rules : & [ speculos_client :: AutomationRule < ' static > ] ,
5859) {
5960 client. automation ( rules) . await . unwrap ( ) ;
60- let needs_blind_sign = rules. iter ( ) . any ( |r| r == & automation:: ENABLE_BLIND_SIGN ) ;
61+ let needs_blind_sign = rules
62+ . iter ( )
63+ . any ( |r| r. text . as_deref ( ) == Some ( "App settings" ) ) ;
6164 if needs_blind_sign {
6265 client. click_button ( Button :: Right ) . await . unwrap ( ) ;
6366 }
0 commit comments