File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,14 @@ const multiSigWitnessPaths: BIP32Path[] = [
76
76
77
77
const isMultiSig = ( tx : Omit < Trezor . CardanoSignTransaction , 'signingMode' > ) : boolean => {
78
78
const allThirdPartyInputs = ! tx . inputs . some ( ( input ) => input . path ) ;
79
+ const allThirdRequiredSigner = ! tx . requiredSigners ?. some ( ( signer ) => signer . keyPath ) ;
79
80
// Trezor doesn't allow change outputs to address controlled by your keys and instead you have to use script address for change out
80
81
const allThirdPartyOutputs = ! tx . outputs . some ( ( out ) => 'addressParameters' in out ) ;
81
82
82
83
return (
83
84
allThirdPartyInputs &&
84
85
allThirdPartyOutputs &&
86
+ allThirdRequiredSigner &&
85
87
! tx . collateralInputs &&
86
88
! tx . collateralReturn &&
87
89
! tx . totalCollateral &&
@@ -291,7 +293,9 @@ export class TrezorKeyAgent extends KeyAgentBase {
291
293
const signedData = result . payload ;
292
294
293
295
if ( ! areStringsEqualInConstantTime ( signedData . hash , hash ) ) {
294
- throw new errors . HwMappingError ( 'Trezor computed a different transaction id' ) ;
296
+ throw new errors . HwMappingError (
297
+ `Trezor computed a different transaction id: ${ signedData . hash } than expected: ${ hash } `
298
+ ) ;
295
299
}
296
300
297
301
return new Map < Crypto . Ed25519PublicKeyHex , Crypto . Ed25519SignatureHex > (
@@ -306,7 +310,7 @@ export class TrezorKeyAgent extends KeyAgentBase {
306
310
)
307
311
) ;
308
312
} catch ( error : any ) {
309
- if ( error . innerError . code === 'Failure_ActionCancelled' ) {
313
+ if ( error . innerError ? .code === 'Failure_ActionCancelled' ) {
310
314
throw new errors . AuthenticationError ( 'Transaction signing aborted' , error ) ;
311
315
}
312
316
throw transportTypedError ( error ) ;
Original file line number Diff line number Diff line change @@ -121,6 +121,14 @@ describe('TrezorKeyAgent', () => {
121
121
expect ( signingMode ) . toEqual ( Trezor . PROTO . CardanoTxSigningMode . ORDINARY_TRANSACTION ) ;
122
122
} ) ;
123
123
124
+ it ( 'can detect ordinary transaction signing mode when we own a required signer' , async ( ) => {
125
+ const signingMode = TrezorKeyAgent . matchSigningMode ( {
126
+ ...validMultisigTx ,
127
+ requiredSigners : [ { keyPath : knownAddressKeyPath } ]
128
+ } ) ;
129
+ expect ( signingMode ) . toEqual ( Trezor . PROTO . CardanoTxSigningMode . ORDINARY_TRANSACTION ) ;
130
+ } ) ;
131
+
124
132
it ( 'can detect pool registrations signing mode' , async ( ) => {
125
133
const signingMode = TrezorKeyAgent . matchSigningMode ( {
126
134
...simpleTx ,
You can’t perform that action at this time.
0 commit comments