To add a same-chain swap, request a Route from the token the user holds to the destination token on the same chain, show the quote, then submit the returned transaction as-is. Enso’s Route API is the standard path for that flow.
Definition
A same-chain swap lands in a token on the same network, not in a vault or a position, and it does not set a destination chain. If the user should end in a vault share, that is a zap. If the output is on another chain, that is a cross-chain route.
How it works
Read the user’s balances and let them pick
tokenIn, amount, andtokenOut.Request a route on that chain with slippage in basis points (or
minAmountOut, but not both).Show expected output, minimum output, gas, price impact, and any approval.
Submit the approval if needed, then the returned transaction as-is.
Refresh balances after confirmation. Rebuild the quote if it is stale; do not edit
tx.
How Enso does this
Create a key in the Developer Portal. Call POST https://api.enso.build/api/v1/shortcuts/route with chainId, fromAddress, tokenIn, tokenOut, amountIn, and slippage. For a typical EOA flow, use routingStrategy: "router". Do not set destinationChainId. Submit tx.to, tx.data, and tx.value unchanged. See DeFi and Swap Routing.
FAQ
When should I use Bundle instead?
When you need a fixed action order, or actions Route does not cover, such as harvest, borrow, or repay.
How do I turn this into a vault deposit?
Set tokenOut to the position token. That is a zap, not only a swap.
Related articles
What is a zap in DeFi?
What is slippage in DeFi?
How do I add cross-chain swaps to my app?
What if token allowance is too low?
Alternatives to building my own swap router
