Overview
EVM to EVM swaps follow a standard workflow:- Get a quote for the swap
- Generate secrets and create the order
- Submit the order to the relayer
- Monitor and share secrets as escrows are deployed
- Wait for order completion
Prerequisites
Before creating an order, ensure your wallet has sufficient allowance for the source token. The token must be approved for the Limit Order Protocol contract on the source chain.Complete Example
This example demonstrates a swap of 10 USDT from Polygon to BNB on BSC.Get a Quote
Request a quote for your desired swap. Enable estimation to get accurate pricing.The quote contains:
presets- Available execution presets (fast, medium, slow)srcChainId/dstChainId- Source and destination chain IDssrcTokenAddress/dstTokenAddress- Token addressesamount- Source token amountquoteId- Unique identifier for this quote
Generate Secrets and Hash Lock
Generate cryptographic secrets required for the atomic swap.
The number of secrets depends on the preset’s
secretsCount. Each secret will be revealed as escrows are deployed.Create the Order
Create the order with your parameters.The order is signed with your private key and includes all swap parameters.
Submit the Order
Submit the order to the 1inch relayer network.Once submitted, resolvers can see your order and begin the fulfillment process.
Error Handling
Implement proper error handling for production use:Best Practices
Verify Escrows
Always verify escrow addresses match expected values before sharing secrets.
Monitor Status
Continuously monitor order status to handle expired or refunded orders.
Handle Timeouts
Set appropriate timeouts for the monitoring loop to avoid infinite execution.
Log Events
Log all order events for debugging and tracking purposes.
Order Presets
Choose a preset based on your requirements:- Fast: Quickest execution, higher fees
- Medium: Balanced speed and fees
- Slow: Lower fees, longer execution time
quote.presets[PresetEnum.fast].
Next Steps
Order Lifecycle
Learn about order states and transitions
Integrator Fees
Add fees to your integration