API
The xSwap API provides developers with access to crucial functionalities within the xSwap platform, facilitating seamless integration with external applications and services.
API Endpoints
Swap Operations
1. Get Swap Route
Calculates the optimal route for swapping tokens.Query Parameters:
token0 (Address): Address of the initial token
token1 (Address): Address of the target token
amount_in (Integer): Amount of input token (must be > 0)
Responses:
200: Successfully returns route information
404: Path not found
2. Get Swap Execution Info
Retrieves detailed swap execution information including estimated outputs.Query Parameters:
token0 (Address): First token address
token1 (Address): Second token address
amount_in (Integer): Input amount (must be > 0)
to (Address): Recipient address
slippage (Float, optional): Slippage percentage (0-1, default: 0.05)
deadline (Integer, optional): Transaction deadline
Responces:
data: Swap execution calldata as a string.
transferAddress: Target address for token transfer.
transferValue: Value of the transfer.
approvalAddress: Address for approval if needed.
estimateTransferSeconds: Estimated time for completion in seconds.
estimateAmount: Expected amount from the swap.
hopsCount: Number of intermediary hops in the swap.
fee: Detailed information on fees.
Overview Operations
3. Get Liquidity Pairs
Retrieves all token pairs with optional filtering.Query Parameters:
filter_by_token (Array, optional): Filter by token address or symbol
filter_by_pair (Array, optional): Filter by pair address
blacklist (Boolean, optional): Include blacklisted pairs (default: false)
4. Get Available Tokens
Retrieves all available tokens.Query Parameters:
filter_by_token (Array, optional): Filter by token address
blacklist (Boolean, optional): Include blacklisted tokens (default: false)
5. Get Token Price
Get the USD price of a token.Query Parameters:
address (Address): Token address
Last updated