@@ -354,10 +354,44 @@ impl Backend {
354354
355355 ( wallet_data, accounts_info, best_block)
356356 }
357+ #[ cfg( feature = "ledger" ) ]
358+ ( WalletType :: Ledger , ColdHotNodeController :: Hot ( controller) ) => {
359+ let handles_client = WalletHandlesClient :: new (
360+ controller. chainstate . clone ( ) ,
361+ controller. mempool . clone ( ) ,
362+ controller. block_prod . clone ( ) ,
363+ controller. p2p . clone ( ) ,
364+ )
365+ . await
366+ . map_err ( |e| BackendError :: WalletError ( e. to_string ( ) ) ) ?;
367+
368+ let ( wallet_rpc, command_handler, best_block, accounts_info, accounts_data) = self
369+ . create_wallet (
370+ handles_client,
371+ file_path. clone ( ) ,
372+ wallet_args,
373+ import,
374+ wallet_events,
375+ )
376+ . await ?;
377+
378+ let wallet_data = WalletData {
379+ controller : GuiHotColdController :: Hot ( wallet_rpc, command_handler) ,
380+ accounts : accounts_data,
381+ best_block,
382+ updated : false ,
383+ } ;
384+
385+ ( wallet_data, accounts_info, best_block)
386+ }
357387 #[ cfg( feature = "trezor" ) ]
358388 ( WalletType :: Trezor , ColdHotNodeController :: Cold ) => {
359389 return Err ( BackendError :: ColdTrezorNotSupported )
360390 }
391+ #[ cfg( feature = "ledger" ) ]
392+ ( WalletType :: Ledger , ColdHotNodeController :: Cold ) => {
393+ return Err ( BackendError :: ColdTrezorNotSupported )
394+ }
361395 ( WalletType :: Hot , ColdHotNodeController :: Cold ) => {
362396 return Err ( BackendError :: HotNotSupported )
363397 }
@@ -593,10 +627,50 @@ impl Backend {
593627
594628 ( wallet_data, accounts_info, best_block, encryption_state)
595629 }
630+ #[ cfg( feature = "ledger" ) ]
631+ ( WalletType :: Ledger , ColdHotNodeController :: Hot ( controller) ) => {
632+ let handles_client = WalletHandlesClient :: new (
633+ controller. chainstate . clone ( ) ,
634+ controller. mempool . clone ( ) ,
635+ controller. block_prod . clone ( ) ,
636+ controller. p2p . clone ( ) ,
637+ )
638+ . await
639+ . map_err ( |e| BackendError :: WalletError ( e. to_string ( ) ) ) ?;
640+
641+ let (
642+ wallet_rpc,
643+ command_handler,
644+ encryption_state,
645+ best_block,
646+ accounts_info,
647+ accounts_data,
648+ ) = self
649+ . open_wallet (
650+ handles_client,
651+ file_path. clone ( ) ,
652+ wallet_events,
653+ Some ( HardwareWalletType :: Ledger ) ,
654+ )
655+ . await ?;
656+
657+ let wallet_data = WalletData {
658+ controller : GuiHotColdController :: Hot ( wallet_rpc, command_handler) ,
659+ accounts : accounts_data,
660+ best_block,
661+ updated : false ,
662+ } ;
663+
664+ ( wallet_data, accounts_info, best_block, encryption_state)
665+ }
596666 #[ cfg( feature = "trezor" ) ]
597667 ( WalletType :: Trezor , ColdHotNodeController :: Cold ) => {
598668 return Err ( BackendError :: ColdTrezorNotSupported )
599669 }
670+ #[ cfg( feature = "ledger" ) ]
671+ ( WalletType :: Ledger , ColdHotNodeController :: Cold ) => {
672+ return Err ( BackendError :: ColdTrezorNotSupported )
673+ }
600674 ( WalletType :: Hot , ColdHotNodeController :: Cold ) => {
601675 return Err ( BackendError :: HotNotSupported )
602676 }
0 commit comments