# Quote a swap order on any pool

`POST /dex/pools/{poolNft}/orders/swap/check` · Lithos client API · Lithos Dex

Source: https://lithosprotocol.org/docs/api/check-ld-pool-swap-order

What a swap order selling `tokenIn` would fill at against the pool now, for either kind of pool. `tokenIn` is `ERG` or one of the pool's tokens.

## Parameters

| Name | In | Type | Required | Description |

|---|---|---|---|---|

| `poolNft` | path | string | yes | The pool's NFT id, 64 hex characters |

## Request body

`LDPoolSwapRequest`, application/json.

- `tokenIn` (string, required): ERG, or one of the pool's tokens
- `amountIn` (string, required): Base units sold
- `executorFee` (string): nanoERG the filler keeps. Omitted, from lithosdex.orders.
- `maxMinerFee` (string): Most of the executor fee a broadcast fill may pay as a network fee. Below executorFee.

## Responses

### 200: The quote

`LDPoolSwapQuote`

- `poolNFT` (string, required)
- `tokenIn` (string, required)
- `tokenOut` (string, required): ERG, or the pool's other token
- `amountIn` (string, required)
- `amountOut` (string, required): What the pool gives for amountIn
- `minAmountIn` (string): The least input that still buys amountOut. Anything above it buys nothing more, which matters for a token whose single unit is worth a lot. Absent when nothing comes out.
- `netOutput` (string, required): What the owner receives
- `executable` (boolean, required): Whether the pool can fill this at all
- `executorFee` (string, required)
- `maxMinerFee` (string, required)
- `totalErgRequired` (string, required): nanoERG the order box holds
- `tokensRequired` (LDTokenAmount[], required): Tokens the order box holds
  - `tokenId` (string, required)
  - `amount` (string, required): Raw token units. Decimal string.
- `ergReturned` (string, required): nanoERG returned beside the fill
- `networkFee` (string, required): The placement's own fee
- `priceImpact` (number · double): How far the fill falls short of the pool's price before it, fees included, as a fraction
- `protocolFee` (string): Of tokenIn, set aside for the pool's providers
- `ammFee` (string): Of tokenIn, the curve's own fee, which stays in the reserves

### 400: The request is malformed, or names a token the pool does not hold.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 404: No LithosDex pool with that NFT, or no live provision with that id.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 503: The pool index is still building, or the node could not be read. Retry.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### default: Error

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X POST "http://localhost:9000/dex/pools/{poolNft}/orders/swap/check" \
  -H "Content-Type: application/json" \
  -d '{ "tokenIn": "ERG", "amountIn": "1000000000", "executorFee": "string", "maxMinerFee": "string" }'
```

## Example response

```json
{
  "poolNFT": "string",
  "tokenIn": "string",
  "tokenOut": "string",
  "amountIn": "string",
  "amountOut": "string",
  "minAmountIn": "string",
  "netOutput": "string",
  "executable": true,
  "executorFee": "string",
  "maxMinerFee": "string",
  "totalErgRequired": "string",
  "tokensRequired": [
    {
      "tokenId": "86e272f770aa4ef48ad7e6d6dbe98b5069edd8383a403a8edb3ceed8a3d5cea3",
      "amount": "152000000"
    }
  ],
  "ergReturned": "string",
  "networkFee": "string",
  "priceImpact": 0,
  "protocolFee": "string",
  "ammFee": "string"
}
```
