Skip to main content

What is a route path?

The route field in a quote describes the optimized path the API selected between the input and the output, as an array of hops or actions.

J
Written by Javier Diaz

The route field in a quote describes the optimized path the API selected between the input and the output — the hops or actions Enso chose to get from tokenIn to tokenOut.

Definition

A route path is not the unsigned transaction itself. It is the explanation of how the transaction will get the expected output: each step’s action, protocol, tokens, and, for a bridge, the chains involved.

How it works

  • After a quote, read the route array to show the user what will happen before they sign.

  • A hop can be a swap, deposit, redeem, bridge, or another selected action.

  • For a cross-chain quote, a hop where action is bridge includes the selected protocol and the source and destination chain IDs.

  • The execution fields you submit remain tx.to, tx.data, and tx.value. Do not rebuild the path yourself from the hop list.

How Enso does this

Route returns a route array along with tx, amountOut, and gas. Bundle can include route-style information for routed segments when bundled actions include routing. See DeFi and Swap Routing. To see which bridge was selected, read the bridge hop’s protocol field rather than hardcoding a provider.

FAQ

Is the route path guaranteed after I receive it?

The path is the one simulated for that quote. Rebuild a new quote if the quote expires or market conditions change, instead of editing tx.

Can I force a specific hop?

The Route API selects the path. If you must specify the actions yourself, use the Bundle API.

Related articles

  • What is tokenIn and tokenOut?

  • How do I show a quote before the user signs?

  • How do I tell which bridge a Route response selected?

  • What is a hop in bridge status?

  • Route API vs Bundle API: which should I use?

Sources

Did this answer your question?