Swap with Trails
Trails enables cross-chain token swapping in one click, from any wallet. Users exchange tokens without manually bridging assets or interacting with multiple DEXs — available via the widget or API. Traditional cross-chain swapping requires token approvals, manual bridging, finding DEXs on each chain, and paying gas on each network. Trails optimizes the UX across all liquidity sources and chains in a single user confirmation.Use cases
- Cross-chain token swaps (ETH on Mainnet → USDC on Base)
- Same-chain token exchanges with optimal routing
- Portfolio rebalancing across chains
- Converting between stablecoins with minimal slippage
Examples
Simple swap — user picks everything
Pre-configured cross-chain swap
Custom bridge provider
Headless swap with useQuote
For custom UI implementations, use theuseQuote hook directly:
This example pulls
walletClient and address from wagmi hooks. Since 0xtrails@0.16.0, wagmi is opt-in — install @0xtrails/adapter-wagmi and configure wagmiAdapter to keep using wagmi alongside Trails. See SDK Hooks.Next steps
- Swap mode configuration — complete configuration options
- useQuote hook — programmatic control
- Quote providers — CCTP, Relay, SushiSwap, and more
- Theming — customize appearance
- SDK configuration — full widget configuration