This guide demonstrates how to perform a complete cross-chain swap between two EVM-compatible chains. We’ll walk through swapping USDT on Polygon to BNB on Binance Smart Chain.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/1inch/cross-chain-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
EVM to EVM swaps are the most common type of cross-chain swap. The process involves:- Setting up the SDK with your credentials
- Getting a quote for the swap
- Generating secrets for the atomic swap
- Creating and submitting the order
- Monitoring and submitting secrets as escrows are deployed
- Tracking the order until completion
Complete Example
Initialize the SDK
Set up the SDK with your authentication key and blockchain provider:
The
blockchainProvider is only required for order creation. If you only need to query quotes or order status, you can omit it.Get a Quote
Request a quote for your desired swap. This example swaps 10 USDT from Polygon to BNB on Binance:
Use
0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee as the token address for native assets like ETH, BNB, MATIC, etc.Generate Secrets
Generate cryptographic secrets for the atomic swap. The number of secrets depends on the preset:
Submit the Order
Submit the order to the 1inch network:
Before submitting the order, ensure your wallet has sufficient allowance for the source token to the Limit Order Protocol contract on the source chain.
Full Working Example
Order Presets
The SDK offers different presets that balance speed, cost, and reliability:- fast: Optimized for speed with higher fees
- medium: Balanced speed and cost (recommended)
- slow: Lower fees but takes longer
quote.recommendedPreset to let the SDK choose the best preset for your swap.
Next Steps
- Learn about native asset swaps for handling native tokens like ETH, BNB, AVAX
- Explore integrator fees to monetize your integration
- Understand order tracking for advanced monitoring