Get the best swap and bridge quotes using the DZap SDK
getTradeQuotes
.
buildTradeTransaction
.
getTradeQuotes
function expects a TradeQuotesRequest
object, which specifies a desired trade and includes all the information needed to calculate the most efficient routes.
Parameter | Type | Required | Description |
---|---|---|---|
integratorId | string | yes | Your unique integrator identifier (e.g. “dzap”) |
fromChain | number | yes | The ID of the source chain (e.g., Ethereum mainnet is 1) |
data | TradeQuotesRequestData[] | yes | Array of trade request data objects |
account | string | no | User’s wallet address for the trade (optional) |
filter | QuoteFilter | no | Filter type for quote results (default is “all”) |
allowedSources | string[] | no | List of allowed providers for the trade (optional) |
Parameter | Type | Required | Description |
---|---|---|---|
amount | string | yes | The amount to be transferred from the source chain, specified in the smallest unit of the token |
srcToken | string | yes | The contract address of the token on the source chain |
destToken | string | yes | The contract address of the token on the destination chain |
toChain | number | yes | The ID of the destination chain |
slippage | number | yes | The slippage tolerance as a percentage (e.g., 1 for 1%) |
all
- Returns all available quotes. This is the default option and provides the fastest response time.best
- Return only the best quotefastest
- Return the fastest execution time quote (for bridge operations)Parameter | Type | Required | Description |
---|---|---|---|
timingStrategy | TimingStrategy | no | Fine-tune quote optimization timing behavior |
disablePricing | boolean | no | Skip pricing calculations for faster response times |
timingStrategy
parameter allows fine-grained control over how the SDK optimizes quote collection:
Property | Type | Default | Description |
---|---|---|---|
minWaitTimeMs | number | 1000 | Minimum wait time before returning results. Sets the floor for how long the SDK will wait before returning quotes, ensuring adequate time for providers to respond. Useful when you want to guarantee a minimum collection time for better quote diversity. |
Property | Type | Default | Description |
---|---|---|---|
maxWaitTimeMs | number | 5000 | Maximum wait time for quote optimization. Sets the ceiling for quote collection time. The SDK will stop waiting for additional quotes after this duration, even if more providers might respond. Helps balance quote quality with response time requirements. |
Property | Type | Default | Description |
---|---|---|---|
subsequentDelayMs | number | 500 | Delay between subsequent quote requests. Controls the interval between batched quote requests to providers. Lower values may overwhelm providers, while higher values may slow down quote collection. Optimize based on provider response patterns. |
Property | Type | Default | Description |
---|---|---|---|
preferredResultCount | number | 3 | Target number of quote results to collect. The SDK will attempt to gather this many quotes before potentially stopping early (if within timing constraints). Higher values provide more options but may increase response time. |
Property | Type | Default | Description |
---|---|---|---|
disablePricing | boolean | false | Skip pricing calculations for faster response times. When enabled, the SDK will skip detailed price impact calculations and USD value conversions, significantly reducing response time. Ideal for high-frequency applications where speed is prioritized over detailed pricing data. |
pair
- Unique identifier for the trade pair (e.g., 42161_0xaf88d065e77c8cC2239327C5EDb3A432268e5831_8453_0x42000000000000000000000000000000000000006
). Can be generated using getTokensPairKey
.recommendedSource
- The provider ID of the recommended routequoteRates
- Object containing detailed quotes for each providertokensWithoutPrice
- Tokens that don’t have price data available