@@ -100,6 +100,23 @@ def __init__(self, path: str, password: Optional[str] = None, expert: bool = Fal
100
100
device .open_path (path .encode ())
101
101
self .device = ColdcardDevice (dev = device )
102
102
103
+ self ._is_edge = None
104
+
105
+ @property
106
+ def is_edge (self ):
107
+ """
108
+ Cached property, no need to ask device more than once
109
+ :return: bool
110
+ """
111
+ if self ._is_edge is None :
112
+ try :
113
+ self ._is_edge = self .device .is_edge ()
114
+ except :
115
+ # silent fail, normal firmware is implied
116
+ pass
117
+
118
+ return self ._is_edge
119
+
103
120
@coldcard_exception
104
121
def get_pubkey_at_path (self , path : str ) -> ExtendedKey :
105
122
self .device .check_mitm ()
@@ -132,14 +149,15 @@ def sign_tx(self, tx: PSBT) -> PSBT:
132
149
133
150
# For multisigs, we may need to do multiple passes if we appear in an input multiple times
134
151
passes = 1
135
- for psbt_in in tx .inputs :
136
- our_keys = 0
137
- for key in psbt_in .hd_keypaths .keys ():
138
- keypath = psbt_in .hd_keypaths [key ]
139
- if keypath .fingerprint == master_fp and key not in psbt_in .partial_sigs :
140
- our_keys += 1
141
- if our_keys > passes :
142
- passes = our_keys
152
+ if not self .is_edge :
153
+ for psbt_in in tx .inputs :
154
+ our_keys = 0
155
+ for key in psbt_in .hd_keypaths .keys ():
156
+ keypath = psbt_in .hd_keypaths [key ]
157
+ if keypath .fingerprint == master_fp and key not in psbt_in .partial_sigs :
158
+ our_keys += 1
159
+ if our_keys > passes :
160
+ passes = our_keys
143
161
144
162
for _ in range (passes ):
145
163
# Get psbt in hex and then make binary
@@ -392,11 +410,10 @@ def toggle_passphrase(self) -> bool:
392
410
393
411
def can_sign_taproot (self ) -> bool :
394
412
"""
395
- The Coldard does not support Taproot yet.
396
-
397
- :returns: False, always
413
+ Only COLDCARD EDGE support taproot.
414
+ :returns: Whether Taproot is supported
398
415
"""
399
- return False
416
+ return self . is_edge
400
417
401
418
402
419
def enumerate (password : Optional [str ] = None , expert : bool = False , chain : Chain = Chain .MAIN , allow_emulators : bool = True ) -> List [Dict [str , Any ]]:
@@ -422,6 +439,9 @@ def enumerate(password: Optional[str] = None, expert: bool = False, chain: Chain
422
439
with handle_errors (common_err_msgs ["enumerate" ], d_data ):
423
440
try :
424
441
client = ColdcardClient (path )
442
+ if client .is_edge :
443
+ d_data ['label' ] = 'edge'
444
+ d_data ['model' ] = 'edge_' + d_data ['model' ]
425
445
d_data ['fingerprint' ] = client .get_master_fingerprint ().hex ()
426
446
except RuntimeError as e :
427
447
# Skip the simulator if it's not there
0 commit comments