swap.quickswap.v1.QuickSwapService
QuoteQuickSwap
QuoteQuickSwap prices terms without creating a QuickSwap or reserving a deposit address. The quote states whether the route needs a refund address. Errors: - INVALID_ARGUMENT: malformed request, AMOUNT_OUT_OF_RANGE, DECIMALS_MISMATCH or FEES_INVALID. - FAILED_PRECONDITION: ROUTE_UNSUPPORTED, PROTECTION_UNACHIEVABLE or AFFILIATE_VAULT_UNKNOWN. - UNAVAILABLE: QUOTE_UNAVAILABLE; retry later. - PERMISSION_DENIED: BROKER_DISABLED. - RESOURCE_EXHAUSTED: BROKER_LIMIT, the quote request rate of the key. - UNAUTHENTICATED: missing or invalid broker API key.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/swap.quickswap.v1.QuickSwapService/QuoteQuickSwap' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"affiliates": [
{
"accountId": "7563897446546",
"bps": 1
}
],
"brokerBps": 1,
"terms": {
"amount": {
"baseUnits": "value",
"decimals": 36
},
"basis": "SOURCE_AMOUNT",
"destinationZippedAssetId": 100,
"execution": {
"market": {}
},
"protection": {
"maxSlippageBps": 1
},
"sourceZippedAssetId": 100
}
}'Responses
{
"quote": {
"depositAmount": {
"baseUnits": "value",
"decimals": 36
},
"expectedAmountOut": {
"baseUnits": "value",
"decimals": 36
},
"expiresAt": "2025-01-01T00:00:00Z",
"fees": [
{
"accountId": "7563897446546",
"amount": {
"baseUnits": "value",
"decimals": 36
},
"bps": 1,
"kind": "SERVICE",
"zippedAssetId": 100
}
],
"intermediateAssetId": 100,
"maxDepositAmount": {
"baseUnits": "value",
"decimals": 36
},
"minAmountOut": {
"baseUnits": "value",
"decimals": 36
},
"minDepositAmount": {
"baseUnits": "value",
"decimals": 36
},
"minRate": "value",
"quotedAt": "2025-01-01T00:00:00Z"
}
}swap.quickswap.v1.QuoteQuickSwapRequestswap.quickswap.v1.QuoteQuickSwapResponseSource asset and network: an AssetChainVariant.zipped_asset_id from GET /v1/chain/deposit-withdraw/config. The end user deposits this asset on this network.
Destination asset and network: an AssetChainVariant.zipped_asset_id from GET /v1/chain/deposit-withdraw/config. The end user receives this asset on this network.
Side of the swap that amount denominates.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Maximum shortfall from the quoted expected output in basis points (1 bp = 0.01%), from 1 to 1000. Converted at creation into the quote's min_amount_out and min_rate.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Execute immediately.
Total execution duration in milliseconds, from 60000 (1 minute) to 86400000 (24 hours). The duration starts when execution starts, not when the QuickSwap is created.
Interval between slices in milliseconds, from 10000 (10 seconds) up to duration_ms. The slice count is duration_ms / slice_interval_ms, rounded up.
Broker fee in basis points of what each leg receives, charged on top of the service fee and credited to the broker's default vault; 0 for none. broker_bps and the affiliates' bps total at most 300. Fees outside these rules fail with FEES_INVALID.
Affiliate fees, each charged on top and credited to its affiliate vault: at most three distinct vaults.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Guaranteed minimum execution rate: destination display units per source display unit, as a decimal string with at most 18 fractional digits, rounded up when quoted. Guarantee: for the source amount converted all the way to the destination asset, the destination output before the withdrawal network fee is at least that amount × min_rate, rounded down to destination token units. On a two-leg route, the source amount converted is the first leg's input in proportion to the intermediate funds the second leg converted. Source that is not traded is returned to return_address, and intermediate funds that the second leg does not convert are refunded in the intermediate asset to refund_address; those parts are outside the destination guarantee. The amount delivered is the output less the actual withdrawal network fee, which can differ from the quote.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Unified asset ID of the intermediate asset of a two-leg route (for example USDT for BTC to SOL): the AssetConfig.ledger_id from GET /v1/chain/deposit-withdraw/config. Zero for a direct route or a bridge. When non-zero, CreateQuickSwap requires a refund address for that asset. The route is fixed at creation.
Fee component.
Asset and network the fee is charged in, as a zipped_asset_id. Zero for a trading fee of the first leg of a two-leg route, which is charged in the intermediate asset (intermediate_asset_id).
Unsigned integer amount in the token's smallest unit (for example satoshis or wei), as a decimal string without sign, exponent, separators or leading zeros; at most 78 digits.
Token decimals: the display amount is base_units / 10^decimals. Required in requests, where it must equal AssetChainVariant.source_decimals (the token's on-chain decimals) in GET /v1/chain/deposit-withdraw/config of the asset the amount is in: the source asset for a SOURCE_AMOUNT amount; the destination asset for a DESTINATION_AMOUNT amount and for Protection.min_amount_out.
Rate of a trading fee in basis points of what the leg receives; zero for a network fee.
AFFILIATE only: public sub-account ID of the affiliate vault credited with the fee; zero for every other kind.
When the quote was priced.
End of the short quote validity, typically seconds to minutes after quoted_at. Display the quote until expires_at. CreateQuickSwap prices the terms again and never fails because a quote expired. After it the price fields are stale; the protection of a created QuickSwap still applies. Independent of the funding window and the execution deadline.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |