Skip to main content

Module test_utils

Module test_utils 

Source
Expand description

Mock swap route support for validation environments.

Devnet builds of the program (--features devnet) hardcode the mock swap aggregator as their SWAP_PROGRAM in place of Jupiter. These helpers build the mock’s route data and account list, shared by the LiteSVM test-suite and the CLI when cranking devnet rounds. Not for mainnet use.

Constants§

MOCK_POOL_AUTHORITY_SEED
Seed for the mock swap program’s pool authority PDA.
MOCK_SWAP_PROGRAM_ID
Mock swap aggregator program (must match the program’s declare_id! and the devnet SWAP_PROGRAM constant).

Functions§

get_mock_pool_authority
The mock swap program’s pool authority PDA (owner of its liquidity ATAs).
get_mock_swap_data
Instruction data for the mock swap program: it moves exactly amount_in USD into the pool and pays exactly amount_out BTC from it.
get_mock_swap_route_accounts
The mock swap program’s account list (order matches its MockSwap struct) for a USD -> BTC swap out of source_authority’s ATAs. source_authority is passed as a non-signer at the transaction level (it is a PDA) — the relaying satrush instruction marks it a signer for the CPI and signs via invoke_signed.