Cross-chain Route Widget
A React component and web app for cross-chain routing of DeFi positions and tokens.
The Cross-chain Route Widget lets you add cross-chain token routing feature to your app. Under the hood, it uses the Enso API to find the best route, and bridge the tokens to the destination chain via Stargate.
Highly customizable, the widget allows you to configure various parameters, including:
- Source and destination chains: configure specific source and destination chains for the routing process.
- input and output tokens: allow free choice or restrict to specific tokens for specialized use cases.
- The output project: destination project for the output token for building protocol-specific flows.
Cross-chain Widget
Try it out!
Cross-chain Widget
Source code
Integrate
Integrate cross-chain routing widget in your app
How it Works
After selecting the input token on the source chain, and the output token on the destination chain, the widget will show the best route for the tokens before you sign and send the transaction.

Integrate
Follow these steps to integrate the Cross-Chain Route Widget into your React application.
Install your project
Install the package:
Import and use the component
Import the component and use it in your app. To get your API key, visit the Developer portal.
The widget must be used within a WagmiConfig
provider.
If you’re using the widget in a Next.js app, make sure to use the dynamic
import with ssr: false
to avoid server-side rendering issues:
Props & Configuration
Here are the available props for the widget:
Parameter | Description | Required |
---|---|---|
apiKey | Your Enso API key | Yes |
tokenIn | The input token address (you can use to pin the input token) | No |
tokenOut | The output token address (you can use to pin the output token) | No |
chainId | The starting position’s chain ID (required with token addresses) | Yes* |
destinationChainId | The destination chain ID (you can use to pin the destination chain) | No |
themeConfig | Theme settings | No |
enableShare | Enable route sharing functionality copy with button | No |
obligateSelection | Force token selection | No |
indicateRoute | Show swap route path | No |
showRoute | Show the route | No |
showRouteDetails | Show route details | No |
*Required when using token addresses
Next Steps
From here, you can explore the API and the widget further:
Updated