@@ -3561,14 +3561,18 @@ describe("Matching Engine", function () {
3561
3561
const { value : lookupTableAccount } = await connection . getAddressLookupTable (
3562
3562
lookupTableAddress ,
3563
3563
) ;
3564
- const tx2 = engine . settleOrder (
3565
- playerTwo . publicKey ,
3566
- fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
3567
- finalized ! . vaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
3568
- {
3564
+
3565
+ const response = {
3566
+ vaa : finalized ! . vaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
3567
+ cctp : {
3569
3568
message : cctpMessage ,
3570
3569
attestation : cctpAttestation . toString ( "hex" ) ,
3571
3570
} ,
3571
+ } ;
3572
+ const tx2 = engine . settleOrder (
3573
+ playerTwo . publicKey ,
3574
+ fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
3575
+ response ,
3572
3576
[ lookupTableAccount ! ] ,
3573
3577
) ;
3574
3578
@@ -4406,8 +4410,10 @@ describe("Matching Engine", function () {
4406
4410
const txs = engine . prepareOrderResponse (
4407
4411
accounts . payer ,
4408
4412
fastVaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
4409
- finalizedVaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
4410
- { message : cctpMessage , attestation : cctpAttestation } ,
4413
+ {
4414
+ vaa : finalizedVaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
4415
+ cctp : { message : cctpMessage , attestation : cctpAttestation } ,
4416
+ } ,
4411
4417
[ lookupTableAccount ! ] ,
4412
4418
) ;
4413
4419
@@ -4524,12 +4530,13 @@ describe("Matching Engine", function () {
4524
4530
throw new Error ( "preparedInSameTransaction not implemented" ) ;
4525
4531
}
4526
4532
4527
- const { fastVaa, finalizedVaa, preparedOrderResponse } = await ( async ( ) => {
4533
+ const { fastVaa, finalizedVaa, preparedOrderResponse, args } = await ( async ( ) => {
4528
4534
if ( accounts . preparedOrderResponse !== undefined ) {
4529
4535
return {
4530
4536
fastVaa : null ,
4531
4537
finalizedVaa : null ,
4532
4538
preparedOrderResponse : accounts . preparedOrderResponse ,
4539
+ args : opts . args ,
4533
4540
} ;
4534
4541
} else {
4535
4542
const result = await prepareOrderResponseCctpForTest (
@@ -4550,13 +4557,12 @@ describe("Matching Engine", function () {
4550
4557
4551
4558
const executor = accounts . executor ?? playerOne . publicKey ;
4552
4559
4553
- const ix = await engine . settleAuctionCompleteIx ( {
4554
- ...accounts ,
4555
- executor,
4556
- preparedOrderResponse,
4557
- } ) ;
4558
-
4559
4560
if ( errorMsg !== null ) {
4561
+ const ix = await engine . settleAuctionCompleteIx ( {
4562
+ ...accounts ,
4563
+ executor,
4564
+ preparedOrderResponse,
4565
+ } ) ;
4560
4566
return expectIxErr ( connection , [ ix ] , unwrapSigners ( signers ) , errorMsg ) ;
4561
4567
}
4562
4568
@@ -4607,9 +4613,12 @@ describe("Matching Engine", function () {
4607
4613
. getAccountInfo ( preparedCustodyToken )
4608
4614
. then ( ( info ) => info ! . lamports ) ;
4609
4615
4616
+ const finalizedVaaAccount = await VaaAccount . fetch ( connection , finalizedVaa ) ;
4617
+
4610
4618
const txs = engine . settleOrder (
4611
4619
executor ,
4612
4620
fastVaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
4621
+ { vaa : finalizedVaaAccount . vaa ( "FastTransfer:CctpDeposit" ) } ,
4613
4622
) ;
4614
4623
4615
4624
const signer = executorIsPreparer ? prepareSigners [ 0 ] : payerSigner ;
@@ -4629,7 +4638,6 @@ describe("Matching Engine", function () {
4629
4638
bestOfferToken ,
4630
4639
) ;
4631
4640
4632
- const finalizedVaaAccount = await VaaAccount . fetch ( connection , finalizedVaa ) ;
4633
4641
const { deposit } = LiquidityLayerMessage . decode ( finalizedVaaAccount . payload ( ) ) ;
4634
4642
const { baseFee } = deposit ! . message . payload ! as SlowOrderResponse ;
4635
4643
@@ -4692,12 +4700,13 @@ describe("Matching Engine", function () {
4692
4700
throw new Error ( "preparedInSameTransaction not implemented" ) ;
4693
4701
}
4694
4702
4695
- const { fastVaa, finalizedVaa, preparedOrderResponse } = await ( async ( ) => {
4703
+ const { fastVaa, finalizedVaa, preparedOrderResponse, args } = await ( async ( ) => {
4696
4704
if ( accounts . fastVaa !== undefined && accounts . preparedOrderResponse !== undefined ) {
4697
4705
return {
4698
4706
fastVaa : accounts . fastVaa ,
4699
4707
finalizedVaa : null ,
4700
4708
preparedOrderResponse : accounts . preparedOrderResponse ,
4709
+ args : opts . args ,
4701
4710
} ;
4702
4711
} else {
4703
4712
const result = await prepareOrderResponseCctpForTest (
@@ -4713,6 +4722,7 @@ describe("Matching Engine", function () {
4713
4722
finalizedVaa : result ! . finalizedVaa ,
4714
4723
preparedOrderResponse :
4715
4724
accounts . preparedOrderResponse ?? result ! . preparedOrderResponse ,
4725
+ args : result ! . args ?? opts . args ,
4716
4726
} ;
4717
4727
}
4718
4728
} ) ( ) ;
@@ -4721,14 +4731,21 @@ describe("Matching Engine", function () {
4721
4731
const { fastMarketOrder } = LiquidityLayerMessage . decode ( fastVaaAccount . payload ( ) ) ;
4722
4732
expect ( fastMarketOrder ) . is . not . undefined ;
4723
4733
4724
- let finalizedVaaAccount = finalizedVaa
4725
- ? await VaaAccount . fetch ( connection , finalizedVaa )
4734
+ const cctp = args
4735
+ ? {
4736
+ message : CircleBridge . deserialize ( args ! . encodedCctpMessage ! ) [ 0 ] ,
4737
+ attestation : encoding . hex . encode ( args ! . cctpAttestation , true ) ,
4738
+ }
4726
4739
: undefined ;
4727
4740
4741
+ const finalizedVaaAccount = await VaaAccount . fetch ( connection , finalizedVaa ! ) ;
4728
4742
const txs = engine . settleOrder (
4729
4743
accounts . payer ,
4730
4744
fastVaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
4731
- finalizedVaaAccount ?. vaa ( "FastTransfer:CctpDeposit" ) ,
4745
+ {
4746
+ vaa : finalizedVaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
4747
+ cctp,
4748
+ } ,
4732
4749
) ;
4733
4750
4734
4751
if ( errorMsg !== null ) {
0 commit comments