What are same-chain swaps?
Same-chain swaps allow you to exchange tokens on a single blockchain without bridging to another chain. You can swap between any supported tokens on the same network, including native tokens and ERC-20 tokens.Supported chains
You can perform same-chain swaps on any blockchain supported by deBridge, including:- Ethereum and EVM-compatible chains (Polygon, Arbitrum, MegaETH, etc.)
- Solana
- Other supported networks
How it works
The same-chain swap process follows these steps:- Get an estimation - Call the estimation endpoint to preview swap details including expected output amount, fees, and slippage
- Create the swap transaction - Generate a transaction request with your swap parameters
- Approve token spending (if needed) - For ERC-20 tokens on EVM chains, approve the deBridge contract to spend your tokens
- Execute the transaction - Sign and send the transaction to complete the swap
Common use cases
Stablecoin to native token
Swap USDC to ETH, MATIC, or SOL to pay for gas fees
Native token to stablecoin
Convert ETH, MATIC, or SOL to USDC for stable value
Token-to-token swaps
Exchange any supported tokens on the same chain
Portfolio rebalancing
Adjust your token holdings without cross-chain transactions
Key parameters
When creating a same-chain swap, you’ll need to specify:- chainId - The blockchain network ID (e.g.,
137for Polygon,7565164for Solana) - tokenIn - The token address you’re swapping from
- tokenInAmount - The amount to swap in the token’s smallest unit (atomic units)
- tokenOut - The token address you’re swapping to
- tokenOutRecipient - The address that will receive the output tokens
- senderAddress - The address initiating the swap
For native tokens on EVM chains, use
0x0000000000000000000000000000000000000000 as the token address.Optional parameters
You can customize your swap with these optional parameters:- slippage - Maximum acceptable slippage (default:
"auto") - srcChainPriorityLevel - Transaction priority:
"normal"or"aggressive" - referralCode - Your referral code for tracking
- affiliateFeePercent - Percentage fee for affiliates (requires
affiliateFeeRecipient) - affiliateFeeRecipient - Address to receive affiliate fees
Next steps
Get estimations
Preview swap details before executing
Execute swaps
See complete swap examples with code