@@ -9,6 +9,7 @@ import { CantonTransferAcceptRejectRequest } from '../../../../src/lib/iface';
99import {
1010 CantonTokenAcceptPrepareResponse ,
1111 CBTCTokenAcceptancePrepareResponse ,
12+ USDCxTokenAcceptancePrepareResponse ,
1213 TransferAcceptance ,
1314 TransferAcceptancePrepareResponse ,
1415} from '../../../resources' ;
@@ -72,6 +73,30 @@ describe('Transfer Acceptance Builder', () => {
7273 assert . equal ( txData . token , 'canton:cbtc' ) ;
7374 } ) ;
7475
76+ it ( 'should get the transfer acceptance request object for usdcx token' , function ( ) {
77+ const txBuilder = new TransferAcceptanceBuilder ( coins . get ( 'tcanton' ) ) ;
78+ const transferAcceptanceTx = new Transaction ( coins . get ( 'tcanton' ) ) ;
79+ txBuilder . initBuilder ( transferAcceptanceTx ) ;
80+ txBuilder . setTransaction ( USDCxTokenAcceptancePrepareResponse ) ;
81+ const commandId = '3935a06d-3b03-41be-99a5-95b2ecaabf7d' ;
82+ const partyId = '1220d::1220dc555fb89a30ab098ffb28b8cf1532053076a736bf6ed3b3c7da6fb4d710b4aa' ;
83+ const { contractId } = TransferAcceptance ;
84+ txBuilder . commandId ( commandId ) . contractId ( contractId ) . actAs ( partyId ) ;
85+ const requestObj : CantonTransferAcceptRejectRequest = txBuilder . toRequestObject ( ) ;
86+ const txData = txBuilder . transaction . toJson ( ) ;
87+ should . exist ( requestObj ) ;
88+ assert . equal ( requestObj . commandId , commandId ) ;
89+ assert . equal ( requestObj . contractId , contractId ) ;
90+ assert . equal ( requestObj . actAs . length , 1 ) ;
91+ const actAs = requestObj . actAs [ 0 ] ;
92+ assert . equal ( actAs , partyId ) ;
93+ should . exist ( txData ) ;
94+ assert . equal ( txData . sender , '12201::1220175583b704cbb493393c1dbe17b9909ee4cf55ef345e8147cd6900c5768f861d' ) ;
95+ assert . equal ( txData . receiver , partyId ) ;
96+ assert . equal ( txData . amount , '10000000000' ) ;
97+ assert . equal ( txData . token , 'canton:usdcx' ) ;
98+ } ) ;
99+
75100 it ( 'should validate raw transaction' , function ( ) {
76101 const txBuilder = new TransferAcceptanceBuilder ( coins . get ( 'tcanton' ) ) ;
77102 const transferAcceptanceTx = new Transaction ( coins . get ( 'tcanton' ) ) ;
0 commit comments