@@ -30,6 +30,7 @@ import {MosaicNonce} from '../../../src/model/mosaic/MosaicNonce';
3030import { MosaicSupplyChangeAction } from '../../../src/model/mosaic/MosaicSupplyChangeAction' ;
3131import { NetworkCurrencyMosaic } from '../../../src/model/mosaic/NetworkCurrencyMosaic' ;
3232import { AggregateTransaction } from '../../../src/model/transaction/AggregateTransaction' ;
33+ import { AggregateTransactionCosignature } from '../../../src/model/transaction/AggregateTransactionCosignature' ;
3334import { CosignatoryModificationAction } from '../../../src/model/transaction/CosignatoryModificationAction' ;
3435import { CosignatureSignedTransaction } from '../../../src/model/transaction/CosignatureSignedTransaction' ;
3536import { CosignatureTransaction } from '../../../src/model/transaction/CosignatureTransaction' ;
@@ -547,6 +548,35 @@ describe('AggregateTransaction', () => {
547548 expect ( aggregateTransaction . innerTransactions . length ) . to . be . equal ( 2 ) ;
548549 } ) ;
549550
551+ it ( 'Should be able to add cosignatures to current aggregate tx' , ( ) => {
552+ const transferTx1 = TransferTransaction . create ( Deadline . create ( ) ,
553+ account . address ,
554+ [ ] ,
555+ PlainMessage . create ( 'a to b' ) ,
556+ NetworkType . MIJIN_TEST ) ;
557+ let aggregateTransaction = AggregateTransaction . createComplete (
558+ Deadline . create ( ) ,
559+ [ transferTx1 . toAggregate ( account . publicAccount ) ] ,
560+ NetworkType . MIJIN_TEST ,
561+ [ ] ,
562+ ) ;
563+
564+ expect ( aggregateTransaction . type ) . to . be . equal ( TransactionType . AGGREGATE_COMPLETE ) ;
565+ expect ( aggregateTransaction . cosignatures . length ) . to . be . equal ( 0 ) ;
566+
567+ // add cosignature after creation
568+ const signedTransaction = aggregateTransaction . signWith ( account , generationHash ) ;
569+ const cosignature = new AggregateTransactionCosignature (
570+ signedTransaction . payload ,
571+ PublicAccount . createFromPublicKey ( signedTransaction . signerPublicKey , NetworkType . MIJIN_TEST ) ,
572+ ) ;
573+
574+ aggregateTransaction = aggregateTransaction . addCosignatures ( [ cosignature ] ) ;
575+
576+ expect ( aggregateTransaction . type ) . to . be . equal ( TransactionType . AGGREGATE_COMPLETE ) ;
577+ expect ( aggregateTransaction . cosignatures . length ) . to . be . equal ( 1 ) ;
578+ } ) ;
579+
550580 describe ( 'size' , ( ) => {
551581 it ( 'should return 282 for AggregateTransaction byte size with TransferTransaction with 1 mosaic and message NEM' , ( ) => {
552582 const transaction = TransferTransaction . create (
0 commit comments