Chain Abstraction Token Swapping
Trails enables seamless token swapping across multiple blockchain networks, allowing users to exchange tokens without manually bridging assets or dealing with multiple DEXs.Enhanced Swapping Experience
Traditional cross-chain swapping requires users to:- Approve any ERC20 tokens
- Bridge tokens to the target chain
- Find and interact with DEXs on multiple networks
- Pay gas fees on each chain
- Wait for bridge confirmations
Examples
Simple Cross-Chain Token Swap
The most basic swap implementation using the dedicated swap mode:Swap with Custom Theme
Customize the appearance to match your brand:Advanced Swap with Custom Quote Provider
Use a specific quote provider for swaps:Using the useQuote Hook
For more control over the swap process, use theuseQuote
hook directly:
Swap Modes Comparison
Mode | Use Case | User Input | Best For |
---|---|---|---|
swap | Open-ended swapping | User selects both tokens and amounts | DEX-like interfaces, trading apps |
pay | Exact output payment | User pays exact amount specified | E-commerce, bill payments |
fund | Deposit/top-up | User chooses amount to send | Wallet funding, account top-ups |
Integration Benefits for Swaps with Trails
- Unified Liquidity: Access tokens across all supported chains in one transaction
- High Performance Balance Retrieval: A high-performant indexer is natively integrated to query the entirety of a user’s balance for smooth UX and price retrieval
- Reduced Complexity: Eliminate manual bridging and multi-step swaps (Approval and Transfer)
- Customized Branding: Brand or theme the widget however you’d like to be native to your protocol or application
- Seamless UX: Automatic routing finds optimal swap paths for low slippage for improved UX
- Gasless Options: Support for gasless transactions to reduce friction
- Real-time Quotes: Live pricing and route optimization
- Cross-chain Native: Built from the ground up for multi-chain operations
Supported Quote Providers
- Auto: Automatically selects the best provider
- LiFi: Cross-chain liquidity aggregation
- Custom: Integrate your own quote provider