@@ -17,7 +17,7 @@ import {
1717 SlowOrderResponse ,
1818} from "@wormhole-foundation/example-liquidity-layer-definitions" ;
1919import { Chain , ChainId , encoding , toChain , toChainId } from "@wormhole-foundation/sdk-base" ;
20- import { CircleBridge , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
20+ import { CircleBridge , VAA , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
2121import { SolanaAddress } from "@wormhole-foundation/sdk-solana" ;
2222import { deserializePostMessage } from "@wormhole-foundation/sdk-solana-core" ;
2323import { expect } from "chai" ;
@@ -290,7 +290,6 @@ describe("Matching Engine", function () {
290290 ownerAssistant . publicKey ,
291291 feeRecipient ,
292292 { ...auctionParams , duration : 0 } ,
293- USDC_MINT_ADDRESS ,
294293 ) ;
295294 await expectTxsErr ( payerSigner , txs , "Error Code: ZeroDuration" ) ;
296295 } ) ;
@@ -301,7 +300,6 @@ describe("Matching Engine", function () {
301300 ownerAssistant . publicKey ,
302301 feeRecipient ,
303302 { ...auctionParams , gracePeriod : 0 } ,
304- USDC_MINT_ADDRESS ,
305303 ) ;
306304 await expectTxsErr ( payerSigner , txs , "Error Code: ZeroGracePeriod" ) ;
307305 } ) ;
@@ -312,7 +310,6 @@ describe("Matching Engine", function () {
312310 ownerAssistant . publicKey ,
313311 feeRecipient ,
314312 { ...auctionParams , penaltyPeriod : 0 } ,
315- USDC_MINT_ADDRESS ,
316313 ) ;
317314 await expectTxsErr ( payerSigner , txs , "Error Code: ZeroPenaltyPeriod" ) ;
318315 } ) ;
@@ -323,7 +320,6 @@ describe("Matching Engine", function () {
323320 ownerAssistant . publicKey ,
324321 feeRecipient ,
325322 { ...auctionParams , userPenaltyRewardBps : 1_000_001 } ,
326- USDC_MINT_ADDRESS ,
327323 ) ;
328324 await expectTxsErr ( payerSigner , txs , "Error Code: UserPenaltyRewardBpsTooLarge" ) ;
329325 } ) ;
@@ -334,7 +330,6 @@ describe("Matching Engine", function () {
334330 ownerAssistant . publicKey ,
335331 feeRecipient ,
336332 { ...auctionParams , initialPenaltyBps : 1_000_001 } ,
337- USDC_MINT_ADDRESS ,
338333 ) ;
339334 await expectTxsErr ( payerSigner , txs , "Error Code: InitialPenaltyBpsTooLarge" ) ;
340335 } ) ;
@@ -345,7 +340,6 @@ describe("Matching Engine", function () {
345340 ownerAssistant . publicKey ,
346341 feeRecipient ,
347342 { ...auctionParams , minOfferDeltaBps : 1_000_001 } ,
348- USDC_MINT_ADDRESS ,
349343 ) ;
350344 await expectTxsErr ( payerSigner , txs , "Error Code: MinOfferDeltaBpsTooLarge" ) ;
351345 } ) ;
@@ -356,7 +350,6 @@ describe("Matching Engine", function () {
356350 ownerAssistant . publicKey ,
357351 feeRecipient ,
358352 { ...auctionParams , securityDepositBase : uint64ToBN ( 0 ) } ,
359- USDC_MINT_ADDRESS ,
360353 ) ;
361354 await expectTxsErr ( payerSigner , txs , "Error Code: ZeroSecurityDepositBase" ) ;
362355 } ) ;
@@ -367,7 +360,6 @@ describe("Matching Engine", function () {
367360 ownerAssistant . publicKey ,
368361 feeRecipient ,
369362 { ...auctionParams , securityDepositBps : 1_000_001 } ,
370- USDC_MINT_ADDRESS ,
371363 ) ;
372364 await expectTxsErr ( payerSigner , txs , "Error Code: SecurityDepositBpsTooLarge" ) ;
373365 } ) ;
@@ -378,7 +370,6 @@ describe("Matching Engine", function () {
378370 ownerAssistant . publicKey ,
379371 feeRecipient ,
380372 auctionParams ,
381- USDC_MINT_ADDRESS ,
382373 ) ;
383374 await expectTxsOk ( payerSigner , txs ) ;
384375
@@ -409,7 +400,6 @@ describe("Matching Engine", function () {
409400 ownerAssistant . publicKey ,
410401 feeRecipient ,
411402 auctionParams ,
412- USDC_MINT_ADDRESS ,
413403 ) ;
414404 await expectTxsErr (
415405 payerSigner ,
@@ -3543,67 +3533,46 @@ describe("Matching Engine", function () {
35433533 } ) ;
35443534
35453535 const result = await placeInitialOfferCctpForTest (
3546- {
3547- payer : playerTwo . publicKey ,
3548- fastVaa : fast . vaa ,
3549- } ,
3536+ { payer : playerTwo . publicKey , fastVaa : fast . vaa } ,
35503537 {
35513538 signers : [ playerTwoSigner ] ,
35523539 finalized : false ,
35533540 fastMarketOrder : baseFastOrder ,
35543541 } ,
35553542 ) ;
3556- const { fastVaa , auction , auctionDataBefore : initialData } = result ! ;
3543+ const { auctionDataBefore : initialData } = result ! ;
35573544
35583545 const { duration, gracePeriod } = await engine . fetchAuctionParameters ( ) ;
35593546 await waitUntilSlot (
35603547 connection ,
35613548 initialData . info ! . startSlot . addn ( duration + gracePeriod - 1 ) . toNumber ( ) ,
35623549 ) ;
35633550
3564- const { value : lookupTableAccount } = await connection . getAddressLookupTable (
3565- lookupTableAddress ,
3566- ) ;
3567-
3568- const tx = await engine . executeFastOrderTx (
3569- { payer : playerTwo . publicKey , fastVaa, auction } ,
3570- [ playerTwo ] ,
3571- {
3572- feeMicroLamports : 10 ,
3573- computeUnits : 300_000 ,
3574- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3575- } ,
3576- { commitment : "confirmed" } ,
3551+ const txs = engine . executeFastOrder (
3552+ playerTwo . publicKey ,
3553+ fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
35773554 ) ;
35783555
3579- const computeIx = ComputeBudgetProgram . setComputeUnitLimit ( {
3580- units : 300_000 ,
3581- } ) ;
3556+ await expectTxsOkDetails ( playerTwoSigner , txs , connection ) ;
35823557
3583- await expectIxOkDetails ( connection , [ computeIx , ...tx . ixs ] , [ playerTwo ] , {
3584- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3585- } ) ;
3558+ const { encodedCctpMessage, cctpAttestation } = finalized ! . cctp ;
3559+ const [ cctpMessage ] = CircleBridge . deserialize ( encodedCctpMessage ) ;
35863560
3587- const tx2 = await engine . settleAuctionCompleteTx (
3588- {
3589- executor : playerTwo . publicKey ,
3590- auction,
3591- fastVaa,
3592- finalizedVaa : finalized ! . vaa ,
3593- bestOfferToken : initialData . info ! . bestOfferToken ,
3594- } ,
3595- finalized ! . cctp ,
3596- [ playerTwo ] ,
3561+ const { value : lookupTableAccount } = await connection . getAddressLookupTable (
3562+ lookupTableAddress ,
3563+ ) ;
3564+ const tx2 = engine . settleOrder (
3565+ playerTwo . publicKey ,
3566+ fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
3567+ finalized ! . vaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
35973568 {
3598- feeMicroLamports : 10 ,
3599- computeUnits : 300_000 ,
3600- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3569+ message : cctpMessage ,
3570+ attestation : cctpAttestation . toString ( "hex" ) ,
36013571 } ,
3602- { commitment : "confirmed" } ,
3572+ [ lookupTableAccount ! ] ,
36033573 ) ;
3604- await expectIxOkDetails ( connection , [ computeIx , ...tx2 . ixs ] , [ playerTwo ] , {
3605- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3606- } ) ;
3574+
3575+ await expectTxsOkDetails ( playerTwoSigner , tx2 , connection ) ;
36073576 } ) ;
36083577 } ) ;
36093578
@@ -4172,13 +4141,13 @@ describe("Matching Engine", function () {
41724141 }
41734142 : await observeCctpOrderVaas ( excludedForTestOpts ) ;
41744143
4175- let fastMarketOrderVAA ;
4144+ let fastMarketOrderVAA : VAA < "Uint8Array" > | VAA < "FastTransfer:FastMarketOrder" > ;
41764145 try {
41774146 fastMarketOrderVAA = fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ;
41784147 args . offerPrice ??= fastMarketOrderVAA . payload . maxFee ;
41794148 } catch ( e ) {
41804149 // Ignore if parsing failed, this will be a VAA<"Uint8Array">
4181- fastMarketOrderVAA = fast . vaaAccount . vaa ( ) ;
4150+ fastMarketOrderVAA = fast . vaaAccount . vaa ( "Uint8Array" ) ;
41824151 }
41834152
41844153 if ( args . offerPrice === undefined ) {
@@ -4188,7 +4157,7 @@ describe("Matching Engine", function () {
41884157 // Place the initial offer.
41894158 const txs = engine . placeInitialOffer (
41904159 accounts . payer ,
4191- // @ts -ignore -- may still be a Uint8array payload for testing invalid VAA
4160+ // @ts -expect-error -- may still be a Uint8array payload for testing invalid VAA
41924161 fastMarketOrderVAA ,
41934162 args . offerPrice ,
41944163 args . totalDeposit ,
0 commit comments