Swap
API List
1. Get Available Chains and Recommended Tokens
Use the /swap/topTokens
API to get all supported chains and the recommended tokens for each chain.
API Details: Top tokens
Main Features:
Get all supported blockchain networks
Recommended token lists for each chain
Includes detailed token information (price, decimals, address, etc.)
Usage Example:
2. Search Tokens
Use the /swap/tokens
API to search for tokens based on chain ID and address prefix or name.
API Details: Tokens
Main Features:
Filter tokens by chain ID
Search by name or address prefix
Limit the number of returned results
Usage Example:
3. Get Transaction Quote and Build Transaction
Use the /swap/quote
API to get a quote for token exchange, and use the returned steps
array to build transactions.
API Details: Quote
Main Features:
Get exchange rates between two tokens
Support for same-chain and cross-chain transactions
Return complete steps needed for transactions (approval, swap)
Provide fee details and slippage information
Usage Example:
Integration Flow
Integration Steps Summary
Initialization
Get available chains and recommended tokens via
/swap/topTokens
Display them to users for selection
Token Selection
Users can select tokens from the recommended list
Or search for specific tokens using the
/swap/tokens
API
Transaction Quote
Use
/swap/quote
to get transaction quotesDisplay fees, exchange rates, and other information to users
Execute Transaction
Execute transactions based on the
quote.steps[]
arrayTypically includes approval (approve) and exchange (swap) steps
Choose the appropriate transaction building method based on the chain (EVM chain or Solana)
Notes
All amount parameters should use string format to avoid precision loss
Check user wallet balance before transactions
It's recommended to display slippage and fee information in the UI
Cross-chain transactions may require longer processing time
Last updated
Was this helpful?