@@ -9,34 +9,34 @@ import {
99 SystemProgram ,
1010 TransactionInstruction ,
1111} from "@solana/web3.js" ;
12+ import { TokenRouter } from "@wormhole-foundation/example-liquidity-layer-definitions" ;
1213import { ChainId , encoding , toChain , toChainId } from "@wormhole-foundation/sdk-base" ;
13- import { UniversalAddress , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
14+ import { toUniversal } from "@wormhole-foundation/sdk-definitions" ;
1415import { deserializePostMessage } from "@wormhole-foundation/sdk-solana-core" ;
1516import { expect } from "chai" ;
1617import { CctpTokenBurnMessage } from "../src/cctp" ;
1718import { LiquidityLayerDeposit , LiquidityLayerMessage , uint64ToBN } from "../src/common" ;
19+ import { SolanaTokenRouter , SolanaTokenRouterContracts } from "../src/protocol" ;
1820import {
1921 CircleAttester ,
2022 DEFAULT_ADDRESSES ,
2123 ETHEREUM_USDC_ADDRESS ,
2224 LOCALHOST ,
23- MOCK_GUARDIANS ,
2425 OWNER_ASSISTANT_KEYPAIR ,
2526 OWNER_KEYPAIR ,
2627 PAYER_KEYPAIR ,
2728 REGISTERED_TOKEN_ROUTERS ,
2829 USDC_MINT_ADDRESS ,
30+ createLiquidityLayerVaa ,
2931 expectIxErr ,
3032 expectIxOk ,
3133 expectTxsErr ,
3234 expectTxsOk ,
3335 getSdkSigner ,
34- postLiquidityLayerVaa ,
36+ postLiquidityLayerVaav2 ,
3537 toUniversalAddress ,
3638} from "../src/testing" ;
3739import { Custodian , PreparedOrder , TokenRouterProgram } from "../src/tokenRouter" ;
38- import { SolanaTokenRouter , SolanaTokenRouterContracts } from "../src/protocol" ;
39- import { TokenRouter } from "@wormhole-foundation/example-liquidity-layer-definitions" ;
4040
4141const SOLANA_CHAIN_ID = toChainId ( "Solana" ) ;
4242
@@ -1176,15 +1176,20 @@ describe("Token Router", function () {
11761176 } ) ,
11771177 } ) ;
11781178
1179- const vaa = await postLiquidityLayerVaa (
1179+ const mockInvalidVaa = await createLiquidityLayerVaa (
11801180 connection ,
1181- payer ,
1182- MOCK_GUARDIANS ,
11831181 foreignEndpointAddress ,
11841182 wormholeSequence ++ ,
11851183 message ,
11861184 { sourceChain : "Polygon" } ,
11871185 ) ;
1186+
1187+ const { address : vaa } = await postLiquidityLayerVaav2 (
1188+ payerSigner ,
1189+ tokenRouter . matchingEngine ,
1190+ mockInvalidVaa ,
1191+ ) ;
1192+
11881193 const ix = await tokenRouter . redeemCctpFillIx (
11891194 {
11901195 payer : payer . publicKey ,
@@ -1250,14 +1255,19 @@ describe("Token Router", function () {
12501255 } ) ,
12511256 } ) ;
12521257
1253- const vaa = await postLiquidityLayerVaa (
1258+ const mockInvalidVaa = await createLiquidityLayerVaa (
12541259 connection ,
1255- payer ,
1256- MOCK_GUARDIANS ,
12571260 new Array ( 32 ) . fill ( 0 ) , // emitter address
12581261 wormholeSequence ++ ,
12591262 message ,
12601263 ) ;
1264+
1265+ const { address : vaa } = await postLiquidityLayerVaav2 (
1266+ payerSigner ,
1267+ tokenRouter . matchingEngine ,
1268+ mockInvalidVaa ,
1269+ ) ;
1270+
12611271 const ix = await tokenRouter . redeemCctpFillIx (
12621272 {
12631273 payer : payer . publicKey ,
@@ -1321,14 +1331,19 @@ describe("Token Router", function () {
13211331 const encodedMessage = message . encode ( ) ;
13221332 encodedMessage [ 147 ] = 69 ;
13231333
1324- const vaa = await postLiquidityLayerVaa (
1334+ const mockInvalidVaa = await createLiquidityLayerVaa (
13251335 connection ,
1326- payer ,
1327- MOCK_GUARDIANS ,
13281336 foreignEndpointAddress ,
13291337 wormholeSequence ++ ,
13301338 encodedMessage ,
13311339 ) ;
1340+
1341+ const { address : vaa } = await postLiquidityLayerVaav2 (
1342+ payerSigner ,
1343+ tokenRouter . matchingEngine ,
1344+ mockInvalidVaa ,
1345+ ) ;
1346+
13321347 const ix = await tokenRouter . redeemCctpFillIx (
13331348 {
13341349 payer : payer . publicKey ,
@@ -1388,23 +1403,22 @@ describe("Token Router", function () {
13881403 } ) ,
13891404 } ) ;
13901405
1391- const vaa = await postLiquidityLayerVaa (
1406+ const mockInvalidVaa = await createLiquidityLayerVaa (
13921407 connection ,
1393- payer ,
1394- MOCK_GUARDIANS ,
13951408 foreignEndpointAddress ,
13961409 wormholeSequence ++ ,
13971410 message ,
13981411 ) ;
1412+
1413+ const { address : vaa } = await postLiquidityLayerVaav2 (
1414+ payerSigner ,
1415+ tokenRouter . matchingEngine ,
1416+ mockInvalidVaa ,
1417+ ) ;
1418+
13991419 const ix = await tokenRouter . redeemCctpFillIx (
1400- {
1401- payer : payer . publicKey ,
1402- vaa,
1403- } ,
1404- {
1405- encodedCctpMessage,
1406- cctpAttestation,
1407- } ,
1420+ { payer : payer . publicKey , vaa } ,
1421+ { encodedCctpMessage, cctpAttestation } ,
14081422 ) ;
14091423
14101424 const { value : lookupTableAccount } = await connection . getAddressLookupTable (
@@ -1465,14 +1479,18 @@ describe("Token Router", function () {
14651479 } ) ,
14661480 } ) ;
14671481
1468- const vaa = await postLiquidityLayerVaa (
1482+ const mockInvalidVaa = await createLiquidityLayerVaa (
14691483 connection ,
1470- payer ,
1471- MOCK_GUARDIANS ,
14721484 foreignEndpointAddress ,
14731485 wormholeSequence ++ ,
14741486 message ,
14751487 ) ;
1488+ const { address : vaa } = await postLiquidityLayerVaav2 (
1489+ payerSigner ,
1490+ tokenRouter . matchingEngine ,
1491+ mockInvalidVaa ,
1492+ ) ;
1493+
14761494 const ix = await tokenRouter . redeemCctpFillIx (
14771495 {
14781496 payer : payer . publicKey ,
0 commit comments