Build and execute token swap transactions
fromAmount parameter accepts:
1, 0.5 - Exact amount"auto" - Entire wallet balance"50%", "25%" - Percentage of balanceplatformFee (lamports) and platformFeeUI (SOL)| 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 |
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 <= 10010
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'
^[a-zA-Z0-9]+:[0-9]+(\.[0-9]+)?$"arsc4jbDnzaqcCLByyGo7fg7S2SmcFsWUzQuDtLZh2y:0.1"
Custom tip for Jito or similar services in format 'WALLET_ADDRESS:SOL_AMOUNT'
^[a-zA-Z0-9]+:[0-9]+(\.[0-9]+)?$Fee application type. 'deduct' option is only used when the from address is SOL
add, deduct Disable multi-hop swaps