QuickSwapService
Quote QuickSwap
Price QuickSwap terms without reserving a deposit address.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/quickswaps:quote' \
--header 'Accept: */*' \
--header 'Authorization: Bearer YOUR_BROKER_API_KEY' \
--header 'Content-Type: application/json' \
--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"
}
}Affiliate fees, each charged on top and credited to its affiliate vault: at most three distinct vaults.
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.
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.
Side of the swap that amount denominates.
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.
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.
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.
Source asset and network: an AssetChainVariant.zipped_asset_id from GET /v1/chain/deposit-withdraw/config. The end user deposits this asset on this network.
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.
valueToken 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.
36Unsigned 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.
valueToken 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.
36End 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.
2025-01-01T00:00:00ZAFFILIATE only: public sub-account ID of the affiliate vault credited with the fee; zero for every other kind.
7563897446546Unsigned 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.
valueToken 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.
36Rate of a trading fee in basis points of what the leg receives; zero for a network fee.
1Fee component.
SERVICEAsset 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).
100Unified 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.
100Unsigned 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.
valueToken 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.
36Unsigned 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.
valueToken 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.
36Unsigned 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.
valueToken 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.
36Guaranteed 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.
valueWhen the quote was priced.
2025-01-01T00:00:00Z| 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. |