Skip to content

Commit 0dd6a91

Browse files
committed
Merge branch 'task/g112_sign_with_cosignatories' of github.com:rg911/nem2-sdk-typescript-javascript into task/g112_sign_with_cosignatories
2 parents beb76fc + 1d6edec commit 0dd6a91

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/model/transaction/AggregateTransaction.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,26 @@ export class AggregateTransaction extends Transaction {
173173
this.type, this.networkType);
174174
}
175175

176+
/**
177+
* @internal
178+
* Sign transaction with cosignatories collected from cosigned transactions and creating a new SignedTransaction
179+
* For off chain Aggregated Complete Transaction co-signing.
180+
* @param initiatorAccount - Initiator account
181+
* @param {CosignatureSignedTransaction[]} cosignatureSignedTransactions - Array of cosigned transaction
182+
* @param generationHash - Network generation hash hex
183+
* @return {SignedTransaction}
184+
*/
185+
public signTransactionGivenSignatures(initiatorAccount: Account,
186+
cosignatureSignedTransactions: CosignatureSignedTransaction[],
187+
generationHash: string) {
188+
const aggregateTransaction = this.buildTransaction();
189+
const signedTransactionRaw = aggregateTransaction.signTransactionGivenSignatures(initiatorAccount,
190+
cosignatureSignedTransactions,
191+
generationHash);
192+
return new SignedTransaction(signedTransactionRaw.payload, signedTransactionRaw.hash, initiatorAccount.publicKey,
193+
this.type, this.networkType);
194+
}
195+
176196
/**
177197
* Check if account has signed transaction
178198
* @param publicAccount - Signer public account

test/model/transaction/CosignatureTransaction.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ describe('CosignatureTransaction', () => {
129129
expect(signedTx.signer).to.be.equal('C2F93346E27CE6AD1A9F8F5E3066F8326593A406BDF357ACB041E2F9AB402EFE');
130130
expect(signedTx.signer).to.be.equal(account.publicKey);
131131
});
132-
});
132+
});

0 commit comments

Comments
 (0)