Overview
The swap endpoint builds token swap transactions on Solana. You receive a serialized transaction that you sign and broadcast using your wallet.Supported Platforms
- Pump.fun - Launch platform tokens
- PumpSwap - Pump.fun liquidity pools
- Orca - Concentrated liquidity
- Meteora - Dynamic pools
- Moonshot - New launches
- Raydium - V4 AMM, CPMM, Launchpad
- Jupiter - Aggregated routing
SDK Examples
Key Parameters
Amount Formats
ThefromAmount
parameter accepts:
- Numeric:
1
,0.5
- Exact amount - Auto:
"auto"
- Entire wallet balance - Percentage:
"50%"
,"25%"
- Percentage of balance
Priority Fees
Custom Fees
Add your own fees for monetization:Examples
Swap with Auto Amount
Swap with Percentage
Swap with Custom Fee
Response Structure
Platform Fees
Standard fee: 0.5% of transaction value- Deducted from output
- Shown in
platformFee
(lamports) andplatformFeeUI
(SOL) - Volume discounts available
Common Errors
Error | Solution |
---|---|
Invalid token address | Verify addresses are valid |
Invalid amount | Use number, “auto”, or percentage |
Invalid slippage | Set between 0-100 |
Token has no pools | Token may be delisted |
Insufficient liquidity | Try smaller amount |
Next Steps
Query Parameters
The base token address
"So11111111111111111111111111111111111111112"
The quote token address
"4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"
The amount of the base token to swap. Accepts numeric value, 'auto' for full wallet balance, or percentage like '50%'
1
Maximum acceptable slippage percentage or 'auto' for dynamic slippage (Beta)
0 <= x <= 100
10
Public key of the wallet sending the transaction
"arsc4jbDnzaqcCLByyGo7fg7S2SmcFsWUzQuDtLZh2y"
Amount in SOL to increase transaction priority or 'auto'
0.000005
Priority level when priorityFee is set to 'auto'
min
, low
, medium
, high
, veryHigh
, unsafeMax
Transaction version
v0
, legacy
Custom fee for your users in format 'WALLET_ADDRESS:PERCENTAGE'
"arsc4jbDnzaqcCLByyGo7fg7S2SmcFsWUzQuDtLZh2y:0.1"
Custom tip for Jito or similar services in format 'WALLET_ADDRESS:SOL_AMOUNT'
Fee application type. 'deduct' option is only used when the from address is SOL
add
, deduct
Disable multi-hop swaps