66 PartySignature ,
77 PreparedTxnParsedInfo ,
88 TransactionBroadcastData ,
9+ TransferAcknowledge ,
910 TxData ,
1011} from '../iface' ;
1112import utils from '../utils' ;
@@ -14,6 +15,7 @@ import { DUMMY_HASH, HASHING_SCHEME_VERSION, SIGNATURE_ALGORITHM_SPEC, SIGNATURE
1415export class Transaction extends BaseTransaction {
1516 private _prepareCommand : CantonPrepareCommandResponse ;
1617 private _signerFingerprint : string ;
18+ private _acknowledgeData : TransferAcknowledge ;
1719
1820 constructor ( coinConfig : Readonly < CoinConfig > ) {
1921 super ( coinConfig ) ;
@@ -31,6 +33,10 @@ export class Transaction extends BaseTransaction {
3133 this . _type = transactionType ;
3234 }
3335
36+ set acknowledgeData ( data : TransferAcknowledge ) {
37+ this . _acknowledgeData = data ;
38+ }
39+
3440 get id ( ) : string {
3541 if ( ! this . _id ) {
3642 throw new InvalidTransactionError ( 'transaction is is not set' ) ;
@@ -59,9 +65,13 @@ export class Transaction extends BaseTransaction {
5965 throw new InvalidTransactionError ( 'Transaction type is not set' ) ;
6066 }
6167 if ( this . _type === TransactionType . TransferAcknowledge ) {
68+ if ( ! this . _acknowledgeData ) {
69+ throw new InvalidTransactionError ( 'AcknowledgeData is not set' ) ;
70+ }
6271 const minData : TransactionBroadcastData = {
6372 txType : TransactionType [ this . _type ] ,
6473 submissionId : this . id ,
74+ acknowledgeData : this . _acknowledgeData ,
6575 } ;
6676 return Buffer . from ( JSON . stringify ( minData ) ) . toString ( 'base64' ) ;
6777 }
@@ -119,6 +129,10 @@ export class Transaction extends BaseTransaction {
119129 receiver : '' ,
120130 } ;
121131 if ( this . _type === TransactionType . TransferAcknowledge ) {
132+ if ( ! this . _acknowledgeData ) {
133+ throw new InvalidTransactionError ( 'AcknowledgeData is not set' ) ;
134+ }
135+ result . acknowledgeData = this . _acknowledgeData ;
122136 return result ;
123137 }
124138 if ( ! this . _prepareCommand || ! this . _prepareCommand . preparedTransaction ) {
@@ -159,6 +173,10 @@ export class Transaction extends BaseTransaction {
159173 this . signerFingerprint = decoded . partySignatures . signatures [ 0 ] . party . split ( '::' ) [ 1 ] ;
160174 this . signatures = decoded . partySignatures . signatures [ 0 ] . signatures [ 0 ] . signature ;
161175 }
176+ } else {
177+ if ( decoded . acknowledgeData ) {
178+ this . acknowledgeData = decoded . acknowledgeData ;
179+ }
162180 }
163181 } catch ( e ) {
164182 throw new InvalidTransactionError ( 'Unable to parse raw transaction data' ) ;
0 commit comments