Usage
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
fromToken | string | Yes | Address or symbol of the input token |
toToken | string | Yes | Address or symbol of the output token |
inputAmount | number | Yes | Amount of the input token to swap |
slippage | number | No | Maximum allowable slippage (e.g., 0.01 for 1%) |
Example Prompts
Natural Language Prompts
LangChain Tool Prompts
Example Implementation
Implementation Details
- Uses 7k Protocol for best prices
- Dynamic compute unit limits
- Auto-calculated priority fees
- 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
Response Format
Related Functions
- get_holding: Check token balances
- transfer: Transfer token.