POST /v1/quote

Returns the per-DEX prices and the best route for a given swap. This is a read-only call — it doesn’t commit to anything on-chain.

Request body

FieldTypeDescription
assetInstring, required"TON" for native TON, or the bounceable jetton master address.
assetOutstring, requiredSame format as assetIn.
amountInstring, requiredAmount to swap, in smallest units. For TON: nanoton (multiply by 10⁹). For a jetton: in its decimals.
slippageBpsnumber, optionalMax slippage tolerance in basis points (1 bps = 0.01%). Default is 100 (1%).

Example

bash
curl -X POST https://chop.ag/api/v1/quote \
  -H 'content-type: application/json' \
  -d '{
    "assetIn":  "TON",
    "assetOut": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
    "amountIn": "100000000000000",
    "slippageBps": 50
  }'

Response (200)

json
{
  "quotes": [
    {
      "dex": "dedust",
      "amountIn":    "100000000000000",
      "amountOut":   "150613077627",
      "gasEstimate": "250000000"
    },
    {
      "dex": "stonfi",
      "amountIn":    "100000000000000",
      "amountOut":   "220173423257",
      "gasEstimate": "215000000"
    }
  ],
  "bestRoute": {
    "assetIn":  { "type": "native" },
    "assetOut": { "type": "jetton", "master": "EQCxE6mU…sDs" },
    "amountIn":     "100000000000000",
    "expectedOut":  "221837214190",
    "minAmountOut": "219618842047",
    "totalGas":     "465000000",
    "legs": [
      {
        "dex": "stonfi",
        "amountIn":     "90000000000000",
        "expectedOut":  "199497395781",
        "minAmountOut": "197502421823",
        "messageCount": 0
      },
      {
        "dex": "dedust",
        "amountIn":     "10000000000000",
        "expectedOut":  "22339818409",
        "minAmountOut": "22116420224",
        "messageCount": 0
      }
    ]
  }
}

Response fields

quotes[]

One entry per DEX that returned a price. Useful for showing a breakdown UI.

bestRoute

The route the aggregator chose. May be one or more legs:

  • 1 leg: a single-DEX swap. The dex field tells you which one.
  • 2+ legs: an order split across DEXs. All legs are broadcast in one signed wallet transaction (how the splitter decides).

amountIn, expectedOut, minAmountOut, and totalGas are all strings of smallest units. totalGas is in nanoton.

messageCount in the response is always 0 for /quote; the actual messages are filled in by /v1/tx.

Errors

If no DEX could quote (pool doesn’t exist, amount too small, etc.), bestRoute is null and quotes is empty.

Bad inputs (malformed address, negative amount) return 400 with { "error": "..." }.