@@ -4,6 +4,7 @@ import TransportNodeHid, {
4
4
} from '@ledgerhq/hw-transport-node-hid-noevents' ;
5
5
import AppAda , { utils } from '@cardano-foundation/ledgerjs-hw-app-cardano' ;
6
6
import TrezorConnect , {
7
+ CardanoPublicKey ,
7
8
DEVICE ,
8
9
DEVICE_EVENT ,
9
10
Features ,
@@ -32,7 +33,6 @@ import { HardwareWalletChannels } from './createHardwareWalletIPCChannels';
32
33
import { Device } from './hardwareWallets/ledger/deviceDetection/types' ;
33
34
import { DeviceDetectionPayload } from './hardwareWallets/ledger/deviceDetection/deviceDetection' ;
34
35
import { initTrezorConnect , reinitTrezorConnect } from '../trezor/connection' ;
35
- import { getTrezorDeviceFeatures } from './hardwareWallets/trezor/getTrezorDeviceFeatures' ;
36
36
37
37
type ListenerType = {
38
38
unsubscribe : ( ...args : Array < any > ) => any ;
@@ -154,9 +154,6 @@ class EventObserver {
154
154
}
155
155
}
156
156
157
- const wait = ( ms : number ) : Promise < void > =>
158
- new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
159
-
160
157
export const handleHardwareWalletRequests = async (
161
158
mainWindow : BrowserWindow ,
162
159
{
@@ -288,9 +285,13 @@ export const handleHardwareWalletRequests = async (
288
285
if ( isTrezor ) {
289
286
logger . info ( '[HW-DEBUG] getHardwareWalletTransportChannel::TREZOR ' ) ;
290
287
291
- deviceFeatures = await getTrezorDeviceFeatures ( ) ;
292
-
293
288
try {
289
+ deviceFeatures = await TrezorConnect . getFeatures ( {
290
+ device : {
291
+ path : devicePath ,
292
+ } ,
293
+ } ) ;
294
+
294
295
logger . info ( '[TREZOR-CONNECT] Called TrezorConnect.getFeatures()' ) ;
295
296
296
297
if ( deviceFeatures && deviceFeatures . success ) {
@@ -465,9 +466,6 @@ export const handleHardwareWalletRequests = async (
465
466
}
466
467
} ) ;
467
468
deriveAddressChannel . onRequest ( async ( params ) => {
468
- await reinitTrezorConnect ( ) ;
469
- resetTrezorListeners ( ) ;
470
-
471
469
const {
472
470
addressType,
473
471
spendingPathStr,
@@ -768,8 +766,7 @@ export const handleHardwareWalletRequests = async (
768
766
resetTrezorListeners ( ) ;
769
767
770
768
logger . info ( '[TREZOR-CONNECT] Calling TrezorConnect.getFeatures()' ) ;
771
-
772
- const deviceFeatures = await getTrezorDeviceFeatures ( ) ;
769
+ const deviceFeatures = await TrezorConnect . getFeatures ( ) ;
773
770
774
771
if ( deviceFeatures . success ) {
775
772
logger . info (
@@ -883,13 +880,6 @@ export const handleHardwareWalletRequests = async (
883
880
884
881
resetTrezorActionChannel . onRequest ( async ( ) => {
885
882
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' ) ;
894
884
} ) ;
895
885
} ;
0 commit comments