Zero XTrading Api
API class specifically for ZeroX Trading integration functionality.
This class handles all ZeroX-related API calls including getting sources, quotes, and price information for token swaps.
Parameters
host
The base URL of the API server.
credentials
Supplies the bearer token sent with each request.
requests
An instance of PortalRequests to handle HTTP requests.
Functions
Link copied to clipboard
open suspend fun getPrice(request: ZeroXPriceRequest, zeroXApiKey: String? = null): Result<ZeroXPriceResponse>
Retrieves a price quote without transaction data.
Link copied to clipboard
open suspend fun getQuote(request: ZeroXQuoteRequest, zeroXApiKey: String? = null): Result<ZeroXQuoteResponse>
Retrieves a swap quote with transaction data.
Link copied to clipboard
open suspend fun getSources(chainId: String, zeroXApiKey: String? = null): Result<ZeroXSourcesResponse>
Retrieves available swap sources for a chain.