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 @@ -92,12 +92,14 @@ const multiSigWitnessPaths: BIP32Path[] = [
92
92
93
93
const isMultiSig = ( tx : Omit < Trezor . CardanoSignTransaction , 'signingMode' > ) : boolean => {
94
94
const allThirdPartyInputs = ! tx . inputs . some ( ( input ) => input . path ) ;
95
+ const allThirdRequiredSigner = ! tx . requiredSigners ?. some ( ( signer ) => signer . keyPath ) ;
95
96
// Trezor doesn't allow change outputs to address controlled by your keys and instead you have to use script address for change out
96
97
const allThirdPartyOutputs = ! tx . outputs . some ( ( out ) => 'addressParameters' in out ) ;
97
98
98
99
return (
99
100
allThirdPartyInputs &&
100
101
allThirdPartyOutputs &&
102
+ allThirdRequiredSigner &&
101
103
! tx . collateralInputs &&
102
104
! tx . collateralReturn &&
103
105
! tx . totalCollateral &&
@@ -325,7 +327,9 @@ export class TrezorKeyAgent extends KeyAgentBase {
325
327
const signedData = result . payload ;
326
328
327
329
if ( ! areStringsEqualInConstantTime ( signedData . hash , hash ) ) {
328
- throw new errors . HwMappingError ( 'Trezor computed a different transaction id' ) ;
330
+ throw new errors . HwMappingError (
331
+ `Trezor computed a different transaction id: ${ signedData . hash } than expected: ${ hash } `
332
+ ) ;
329
333
}
330
334
331
335
return new Map < Crypto . Ed25519PublicKeyHex , Crypto . Ed25519SignatureHex > (
@@ -340,7 +344,7 @@ export class TrezorKeyAgent extends KeyAgentBase {
340
344
)
341
345
) ;
342
346
} catch ( error : any ) {
343
- if ( error . innerError . code === 'Failure_ActionCancelled' ) {
347
+ if ( error . innerError ? .code === 'Failure_ActionCancelled' ) {
344
348
throw new errors . AuthenticationError ( 'Transaction signing aborted' , error ) ;
345
349
}
346
350
throw transportTypedError ( error ) ;
Original file line number Diff line number Diff line change @@ -125,6 +125,14 @@ describe('TrezorKeyAgent', () => {
125
125
expect ( signingMode ) . toEqual ( Trezor . PROTO . CardanoTxSigningMode . ORDINARY_TRANSACTION ) ;
126
126
} ) ;
127
127
128
+ it ( 'can detect ordinary transaction signing mode when we own a required signer' , async ( ) => {
129
+ const signingMode = TrezorKeyAgent . matchSigningMode ( {
130
+ ...validMultisigTx ,
131
+ requiredSigners : [ { keyPath : knownAddressKeyPath } ]
132
+ } ) ;
133
+ expect ( signingMode ) . toEqual ( Trezor . PROTO . CardanoTxSigningMode . ORDINARY_TRANSACTION ) ;
134
+ } ) ;
135
+
128
136
it ( 'can detect pool registrations signing mode' , async ( ) => {
129
137
const signingMode = TrezorKeyAgent . matchSigningMode ( {
130
138
...simpleTx ,
You can’t perform that action at this time.
0 commit comments