Usage
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
outputMint | PublicKey | Yes | Target token mint address |
inputAmount | number | Yes | Amount to swap |
inputMint | PublicKey | No | Source token mint (defaults to SOL) |
slippageBps | number | No | Slippage tolerance in basis points (default: 300) |
Example Prompts
Natural Language Prompts
LangChain Tool Prompts
Example Implementation
Implementation Details
- Uses Jupiter Exchange for best prices
- Automatic SOL wrapping/unwrapping
- Dynamic compute unit limits
- Auto-calculated priority fees
- Optional referral integration
- Direct route optimization
Error Handling
Best Practices
-
Slippage Management
- Use appropriate slippage for token
- Consider market volatility
- Monitor price impact
- Handle failed transactions
-
Amount Calculation
- Account for token decimals
- Check minimum amounts
- Consider fees
- Verify available balance
-
Error Handling
- Implement retries
- Monitor transaction status
- Handle timeouts
- Verify swap results
-
Performance
- Use direct routes when possible
- Set appropriate compute limits
- Monitor network conditions
- Consider priority fees
Common Token Addresses
- SOL:
So11111111111111111111111111111111111111112
- USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- USDT:
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
- BONK:
DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
- jitoSOL:
J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn
Response Format
Related Functions
getBalance
: Check token balancesfetchPrice
: Get token pricesgetTokenData
: Get token informationtransfer
: Transfer tokens