ZeroXTradingApi

open class ZeroXTradingApi(host: String, apiKey: String, requests: PortalRequests)

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.

apiKey

The API key used for authentication.

requests

An instance of PortalRequests to handle HTTP requests.

Constructors

Link copied to clipboard
constructor(host: String, apiKey: String, requests: PortalRequests)

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.