titanAction.swap.
Configure the policy
Use a loadedvault, connection, and manager Keypair. This example permits swaps between mainnet USDC and wrapped SOL. Read each mint account’s program owner to support SPL Token and Token-2022 correctly:
policyConfig using Configure policies. V3 is the default. With allowedMints, the policy restricts both swap endpoints to the Squads vault’s canonical associated token accounts for the selected mint/program pairs. Omitting allowedMints removes that endpoint restriction; an empty list is rejected.
Prepare the gateway and token accounts
Obtain a gateway base URL and JWT from Titan. SetTITAN_GATEWAY_URL and TITAN_GATEWAY_JWT in your server environment. The client sends the JWT in an Authorization: Bearer header by default.
Create and fund the input ATA owned by vault.state.squadsVault. The transaction builder can prepare the output ATA and supported token tracking. For the sync path below, create both canonical ATAs, register both tokens with Configure assets and prices, and configure their price paths to the vault’s accounting denomination. Refresh AUM and reload the vault before constructing the swap.
Titan V3 places the Squads vault in both inner payer and user signer slots. Your manager wallet pays the outer transaction fee. Keep sufficient SOL in the Squads vault for any inner costs.
Quote and execute a swap
This sells1_000_000 atomic units of mainnet USDC, or 1 USDC, with a 50-basis-point slippage limit. ownerPda is the Squads vault, not the Exponent strategy-vault address.
quote: it includes instruction, inputMint, outputMint, titanSwapVersion, payer, and addressLookupTableAddresses. The V3 action needs this metadata to validate its accounts. The vault route accepts instruction bundles; serialized-transaction-only routes are unsupported.
Choose one execution path. Keep the Titan swap alone in its addActions call or sync bundle. Quotes expire quickly, so build and submit promptly; request a new quote if the route expires before submission.
- Transaction builder
- Sync helpers
build() returns an execution plan with ordered transactionSets, including instructions, additional signers, and lookup table addresses. The builder prepares supported setup and refreshes; send() simulates and submits the sequence in order.