How It Works
The intent flow:- Accepts input positions - Multiple source tokens with amounts
- Defines target positions - Desired output tokens with weights (must sum to 1.0)
- Automatic routing - Finds optimal paths for rebalancing
- Handles everything - Swaps, bridges, and multi-step conversions
Parameters
When using/instructions/intent in your composeFlows array:
| Parameter | Type | Required | Description |
|---|---|---|---|
slippage | number | Yes | Slippage tolerance (0-1, e.g., 0.01 = 1%) |
inputPositions | array | Yes | Source tokens with amounts (≥1) |
targetPositions | array | Yes | Target tokens with weights (≥1, weights sum to 1.0) |
Input Position Structure
Target Position Structure
Complete Workflow Examples
- Portfolio Rebalancing
- Multi-Input Rebalancing
- Complex Multi-Chain
Split USDC into multiple tokens
Returned Data Structure
The quote response includes details for each target position:Intent vs Direct Instructions
The Supertransaction API offers two approaches:| Approach | Use Case | Control Level |
|---|---|---|
| Intent-based (this endpoint) | Express desired outcome, system determines execution | High-level abstraction |
Direct instructions (/instructions/build) | Explicitly specify each step | Full control over execution |
- Finding optimal routes
- Handling protocol interactions
- Managing cross-chain complexity
- Optimizing for gas efficiency
Best Practices
Ensure Weights Sum to 1.0
Ensure Weights Sum to 1.0
All target position weights must sum to exactly 1.0:
Consider Slippage for Multi-Position Operations
Consider Slippage for Multi-Position Operations
Use higher slippage for complex rebalancing:
Validate Output Amounts
Validate Output Amounts
Check each position’s output in returnedData:
Use for Portfolio Management
Use for Portfolio Management
Intent is perfect for:
- Rebalancing portfolios to target allocations
- Converting multiple small positions into fewer tokens
- Distributing one token across multiple chains
- DCA (dollar-cost averaging) strategies
Troubleshooting
Weights don't sum to 1.0
Weights don't sum to 1.0
Ensure all weights add up to exactly 1.0:
No route found for some positions
No route found for some positions
If routing fails:
- Check token liquidity on source and target chains
- Verify token addresses are correct
- Try adjusting weights to reduce complexity
- Increase slippage tolerance
Output amounts lower than expected
Output amounts lower than expected
If outputs are too low:
- Review each position’s route in
returnedData - Check if bridge fees are higher than expected
- Consider splitting into separate operations
- Verify market prices are as expected