70
70
71
71
72
72
# Get the client for the device
73
- def get_client (device_type : str , device_path : str , password : str = "" , expert : bool = False , chain : Chain = Chain .MAIN ) -> Optional [HardwareWalletClient ]:
73
+ def get_client (device_type : str , device_path : str , password : str = "" , expert : bool = False , chain : Chain = Chain .MAIN , model : str = "" ) -> Optional [HardwareWalletClient ]:
74
74
"""
75
75
Returns a HardwareWalletClient for the given device type at the device path
76
76
@@ -95,7 +95,7 @@ def get_client(device_type: str, device_path: str, password: str = "", expert: b
95
95
if client :
96
96
client .close ()
97
97
raise UnknownDeviceError ('Unknown device type specified' )
98
-
98
+ client . model = model
99
99
return client
100
100
101
101
# Get a list of all available hardware wallets
@@ -150,7 +150,7 @@ def find_device(
150
150
try :
151
151
assert isinstance (d ["type" ], str )
152
152
assert isinstance (d ["path" ], str )
153
- client = get_client (d ['type' ], d ['path' ], password , expert , chain )
153
+ client = get_client (d ['type' ], d ['path' ], password , expert , chain , d [ 'model' ] )
154
154
if client is None :
155
155
raise Exception ()
156
156
@@ -405,10 +405,12 @@ def getdescriptors(
405
405
master_fpr = client .get_master_fingerprint ()
406
406
407
407
result = {}
408
+ support_addr_types = [AddressType .LEGACY , AddressType .SH_WIT ] if client .model == "ledger_nano_x" \
409
+ else [AddressType .LEGACY , AddressType .WIT , AddressType .SH_WIT ]
408
410
409
411
for internal in [False , True ]:
410
412
descriptors = []
411
- for addr_type in ( AddressType . LEGACY , AddressType . SH_WIT , AddressType . WIT ) :
413
+ for addr_type in support_addr_types :
412
414
try :
413
415
desc = getdescriptor (client , master_fpr = master_fpr , internal = internal , addr_type = addr_type , account = account )
414
416
except UnavailableActionError :
0 commit comments