@@ -4,6 +4,7 @@ import TransportNodeHid, {
44} from '@ledgerhq/hw-transport-node-hid-noevents' ;
55import AppAda , { utils } from '@cardano-foundation/ledgerjs-hw-app-cardano' ;
66import TrezorConnect , {
7+ CardanoPublicKey ,
78 DEVICE ,
89 DEVICE_EVENT ,
910 Features ,
@@ -32,7 +33,6 @@ import { HardwareWalletChannels } from './createHardwareWalletIPCChannels';
3233import { Device } from './hardwareWallets/ledger/deviceDetection/types' ;
3334import { DeviceDetectionPayload } from './hardwareWallets/ledger/deviceDetection/deviceDetection' ;
3435import { initTrezorConnect , reinitTrezorConnect } from '../trezor/connection' ;
35- import { getTrezorDeviceFeatures } from './hardwareWallets/trezor/getTrezorDeviceFeatures' ;
3636
3737type ListenerType = {
3838 unsubscribe : ( ...args : Array < any > ) => any ;
@@ -154,9 +154,6 @@ class EventObserver {
154154 }
155155}
156156
157- const wait = ( ms : number ) : Promise < void > =>
158- new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
159-
160157export const handleHardwareWalletRequests = async (
161158 mainWindow : BrowserWindow ,
162159 {
@@ -288,9 +285,13 @@ export const handleHardwareWalletRequests = async (
288285 if ( isTrezor ) {
289286 logger . info ( '[HW-DEBUG] getHardwareWalletTransportChannel::TREZOR ' ) ;
290287
291- deviceFeatures = await getTrezorDeviceFeatures ( ) ;
292-
293288 try {
289+ deviceFeatures = await TrezorConnect . getFeatures ( {
290+ device : {
291+ path : devicePath ,
292+ } ,
293+ } ) ;
294+
294295 logger . info ( '[TREZOR-CONNECT] Called TrezorConnect.getFeatures()' ) ;
295296
296297 if ( deviceFeatures && deviceFeatures . success ) {
@@ -465,9 +466,6 @@ export const handleHardwareWalletRequests = async (
465466 }
466467 } ) ;
467468 deriveAddressChannel . onRequest ( async ( params ) => {
468- await reinitTrezorConnect ( ) ;
469- resetTrezorListeners ( ) ;
470-
471469 const {
472470 addressType,
473471 spendingPathStr,
@@ -768,8 +766,7 @@ export const handleHardwareWalletRequests = async (
768766 resetTrezorListeners ( ) ;
769767
770768 logger . info ( '[TREZOR-CONNECT] Calling TrezorConnect.getFeatures()' ) ;
771-
772- const deviceFeatures = await getTrezorDeviceFeatures ( ) ;
769+ const deviceFeatures = await TrezorConnect . getFeatures ( ) ;
773770
774771 if ( deviceFeatures . success ) {
775772 logger . info (
@@ -883,13 +880,6 @@ export const handleHardwareWalletRequests = async (
883880
884881 resetTrezorActionChannel . onRequest ( async ( ) => {
885882 logger . info ( '[TREZOR-CONNECT] Called TrezorConnect.cancel()' ) ;
886-
887- try {
888- TrezorConnect . cancel ( ) ;
889- } catch ( error ) {
890- logger . warn (
891- '[TREZOR-CONNECT] Failed to cancel the operation:' + error . error
892- ) ;
893- }
883+ TrezorConnect . cancel ( 'Method_Cancel' ) ;
894884 } ) ;
895885} ;
0 commit comments