api_haystack_execute_swap
Execute optimized token swaps on Algorand by finding the best routes across multiple DEXes and LST protocols, then signing and submitting atomic transaction groups.
Instructions
Execute an optimized token swap via Haystack Router — gets the best route across multiple DEXes (Tinyman V2, Pact, Folks) and LST protocols, then signs and submits the atomic transaction group using the active wallet account. This is an all-in-one tool: quote → sign → submit → confirm. All amounts are in base units (e.g., 1000000 = 1 ALGO).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fromASAID | Yes | Input asset ID (0 = ALGO, 31566704 = USDC, 312769 = USDt, etc.) | |
| toASAID | Yes | Output asset ID (0 = ALGO, 31566704 = USDC, 312769 = USDt, etc.) | |
| amount | Yes | Amount in base units (e.g., 1000000 = 1 ALGO with 6 decimals) | |
| slippage | No | Slippage tolerance percentage (e.g., 1 = 1%). Recommended: 0.5-1% stable pairs, 1-3% volatile, 3-5% low liquidity | |
| type | No | Quote type: fixed-input (specify input, default) or fixed-output (specify desired output) | fixed-input |
| note | No | Optional note to attach to the input transaction (plain text) | |
| maxGroupSize | No | Maximum transactions in atomic group (default: 16) | |
| maxDepth | No | Maximum routing hops (default: 4) | |
| network | No | Algorand network to use (default: mainnet) | |
| itemsPerPage | No | Number of items per page for paginated responses (default: 10) |