get Sources
Retrieves available swap sources for a chain.
This method fetches the list of available swap sources (e.g., Uniswap, Sushiswap, Curve) for the specified chain. The ZeroX API key can be configured in two ways:
Portal Dashboard (Recommended): Configure your ZeroX API key in the Portal Dashboard. The SDK will use it automatically when
zeroXApiKeyisnull.Per-Request Override: Provide the API key in the
zeroXApiKeyparameter to override the Dashboard configuration for this specific request.
Return
A Result containing ZeroXSourcesResponse with available swap sources as an array of source names (e.g., "Uniswap", "Sushiswap", "Curve"). The response can be accessed via result.getOrNull()?.data?.rawResponse?.sources.
Parameters
The chain ID in the format "eip155:{chainId}" (e.g., "eip155:1" for Ethereum mainnet, "eip155:137" for Polygon).
Optional ZeroX API key to override the one configured in Portal Dashboard.
If
null: The SDK will use the API key configured in the Portal Dashboard.If provided: This API key will be used for this request, overriding the Dashboard configuration.
The API key is used to authenticate requests to the ZeroX API service and is included in the request body.
Throws
if the URL cannot be constructed, or network/decoding errors if the request fails.