File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,10 @@ const baseCip30WalletApi = (
469
469
) ;
470
470
}
471
471
472
- const cbor = Serialization . TransactionWitnessSet . fromCore ( { signatures } ) . toCbor ( ) ;
472
+ const ownSignatures = new Map (
473
+ [ ...signatures . entries ( ) ] . filter ( ( [ pubKey ] ) => ! coreTx . witness . signatures . has ( pubKey ) )
474
+ ) ;
475
+ const cbor = Serialization . TransactionWitnessSet . fromCore ( { signatures : ownSignatures } ) . toCbor ( ) ;
473
476
return Promise . resolve ( cbor ) ;
474
477
} catch ( error ) {
475
478
if ( error instanceof TxSignError ) {
Original file line number Diff line number Diff line change @@ -512,9 +512,19 @@ describe('cip30', () => {
512
512
hexTx = Serialization . Transaction . fromCore ( finalizedTx ) . toCbor ( ) ;
513
513
} ) ;
514
514
515
- it ( 'resolves with TransactionWitnessSet' , async ( ) => {
516
- const cip30witnessSet = await api . signTx ( context , hexTx ) ;
517
- expect ( ( ) => Serialization . TransactionWitnessSet . fromCbor ( HexBlob ( cip30witnessSet ) ) ) . not . toThrow ( ) ;
515
+ it ( 'resolves own signatures with TransactionWitnessSet' , async ( ) => {
516
+ const cip30witnessSetCbor = await api . signTx ( context , hexTx ) ;
517
+ const cip30witnessSet = Serialization . TransactionWitnessSet . fromCbor ( HexBlob ( cip30witnessSetCbor ) ) ;
518
+ const resolvedSignedByKeys = cip30witnessSet
519
+ . vkeys ( ) !
520
+ . toCore ( )
521
+ . map ( ( [ pubKey ] ) => pubKey ) ;
522
+ const preExistingSignatures = finalizedTx . witness . signatures . entries ( ) ;
523
+
524
+ expect ( resolvedSignedByKeys . length ) . toBeGreaterThan ( 0 ) ;
525
+ for ( const [ preExistingKey ] of preExistingSignatures ) {
526
+ expect ( resolvedSignedByKeys ) . not . toContain ( preExistingKey ) ;
527
+ }
518
528
} ) ;
519
529
520
530
it ( 'passes through sender from dapp connector context' , async ( ) => {
You can’t perform that action at this time.
0 commit comments