executeSwap.
Method signature
Parameters
Chain identifier. For Solana mainnet:
"501"Source token address (SPL token or
So11111111111111111111111111111111111111112 for SOL)Destination token address (SPL token or wrapped SOL)
Amount to swap in smallest unit (lamports for SOL, base units for SPL tokens)
Solana wallet address executing the swap
Maximum acceptable slippage as a decimal (e.g.,
"0.005" for 0.5%)Either slippagePercent or autoSlippage must be provided.Enable automatic slippage calculation based on market conditionsWhen enabled,
maxAutoSlippagePercent must also be provided.Maximum slippage when using auto slippage (e.g.,
"0.05" for 5%)Required when autoSlippage is true.Compute unit price in micro-lamports for priority fees
Maximum compute units to use for the transaction
Response
ReturnsAPIResponseSingle<SolanaSwapInstructionData> containing:
Response code (
"0" for success)Response message
Swap instruction data
Example
Use cases
Custom transaction construction
Build complex transactions with additional instructions
Multi-instruction transactions
Combine swap with other Solana operations
Advanced signing
Use hardware wallets or custom signing logic
Transaction inspection
Review instructions before execution
Error handling
See also
- executeSolanaSwapInstructions - Execute instructions automatically
- Solana swaps guide - Complete Solana swap examples
- SwapParams type - Full parameter reference