Guide
Overview
OpenOcean Gasless Swap lets users trade tokens without paying gas fees - OpenOcean covers the transaction costs. This function supports batch gasless transactions to minimize on-chain expenses and leverages the Permit2 authorization mechanism for enhanced security and seamless signature approvals.
Supported Chains
const gaslessChain = [
'arbitrum', 'bsc', 'sonic', 'base', 'sei',
'eth', 'hyperevm', 'avax', 'uni'
]API Endpoints
1. Get Swap Quote
Endpoint: GET /v4/gasless/{chainId}/quote
Parameters:
inTokenAddress: Input token addressoutTokenAddress: Output token addressamountDecimals: Input amount (in smallest unit)slippage: Slippage percentage (0-100)gasPrice: Gas priceaccount: User wallet address
2. Execute Gasless Swap
Endpoint: POST /v4/gasless/{chainId}/swap
Request Body:
3. Query Transaction Status
Endpoint: GET /v4/gasless/{chainId}/order?orderHash={orderHash}
Permit2 Signature Process
1. Get Permit2 Contract Address
2. Create Permit2 Signature
Complete Transaction Flow
1. Pre-flight Checks
2. Get Quote
3. Token Approval
4. Execute Swap
5. Poll Status
Error Handling
Wallet not connected
Chain not supported for gasless
User rejected signature
Transaction failed
Timeout handling
Dependencies
Important Notes
Only supports specific chains
Non-native tokens require approval
Signatures valid for 30 minutes
Set reasonable slippage
Handle errors properly
Poll transaction status
Last updated