Get multiple swap quotes based on send amount
Retrieves multiple swap quotes from available LPs based on the amount of source tokens you want to send. This endpoint queries active LP orders and calculates how much of the destination token you will receive for the specified amount of source tokens. Returns an array of quotes, each containing the expected receive amount (amountTo) and optionally the LP address. This is useful when you know exactly how much you want to send and need to compare different LP rates to see which offers the best return. The quotes are typically sorted by the best rate (highest amountTo for the same amountFrom).
Query Parameters
The source token contract address. This is the L2 contract address (C1 contract) for the token you want to send in the swap.
The destination token contract address. This is the L2 contract address (C2 contract) for the token you want to receive in the swap.
The amount of source tokens you want to send. This is specified in the smallest unit of the source token (e.g., satoshis for BTC, wei for ETH). The endpoint will calculate how much of the destination token you will receive for this amount.
Backend URL. Default is https://api-cloud.coinweb.io/wallet. This URL is used to query available LPs orders and calculate swap quotes.
uriOptional filter to get quotes only from a specific LP. If provided, only quotes from this LP will be returned. The LP is identified by their address (hex string without 0x prefix).
The type of the source token blockchain. Used to determine the blockchain type for the source token (e.g., "btc", "eth", "usdc"). If not provided, the system may attempt to infer it from the contract address.
"eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"The type of the destination token blockchain. Used to determine the blockchain type for the destination token (e.g., "btc", "eth", "usdc"). If not provided, the system may attempt to infer it from the contract address.
"eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"Whether to include additional data in the response. If true, the response will include additional data for the swap.
falseResponse Body
curl -X GET "https://cwap-api-dev.coinhq.store/pactswap_cm/getSwapQuotesByAmountFrom?from=0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85&to=0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85&amountFrom=0&backendUrl=https%3A%2F%2Fapi-cloud.coinweb.io%2Fwallet&lp=020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876&fromType=eth&toType=eth&withAdditionalData=false&excludeC1OrdersIds=0x123"[
{
"amountTo": 50000000,
"lp": "020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876",
"usdAmounts": {
"from": 100,
"to": 100
},
"additionalData": {
"allC2Orders": [
"string"
],
"c1Order": "string",
"c2Order": "string"
}
}
]Was this documentation helpful? Any suggestions?
Last updated on