A full integration test that tests the swap functionality and can optionally send transactions.
- Create a
.envfile in theexamples/directory:
cd examples
touch .env- Edit
examples/.envwith your credentials:
TITAN_AUTH_TOKEN=your-auth-token
TITAN_BASE_URL=https://api.titan.exchange
USER_PUBKEY=your-wallet-address
PRIVATE_KEY=your-base58-encoded-private-key
RPC_URL=https://api.mainnet-beta.solana.com
TITAN_SEND_TX=falseNote: The .env file must be located in the examples/ directory.
From the workspace root:
# Test without sending transaction
cargo run --package titan-swap-test
# Test with release build
cargo run --release --package titan-swap-test
# Test and send transaction (WARNING: uses real funds!)
# Set TITAN_SEND_TX=true in examples/.envTITAN_AUTH_TOKEN(required): Your Titan API authentication tokenTITAN_BASE_URL(optional): Base URL for the API (defaults to production if not set)USER_PUBKEY(required): Your wallet public key (base58 encoded)PRIVATE_KEY(required): Your wallet private key (base58 encoded)RPC_URL(optional): Solana RPC endpoint (defaults tohttps://api.mainnet-beta.solana.com)TITAN_SEND_TX(optional): Set totrueto actually send the transaction (defaults tofalse)
The example will output:
- Quote information (SOL amount, USDC amount, slippage, route steps)
- Swap details (number of instructions, compute unit limit, address lookup tables)
- Transaction signature and explorer link (if
TITAN_SEND_TX=true)