# Quote a redeem order

`POST /dex/orders/redeem/check` · Lithos client API · Lithos Dex

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

Quote an order closing a provision. `claimableX` / `claimableY` are claimed by the transaction placing the order. `unflushedX` / `unflushedY`, and any fees earned while the order waits, are lost when it fills.

## Request body

`LDRedeemOrderRequest`, application/json.

- `provisionBoxId` (string, required)
- `executorFee` (string): nanoERG paid to whoever fills the order, out of the ERG it releases. A fill broadcast to the mempool pays its miner fee out of this. Miners skip orders paying less than they accept. Omit for the client's default. Decimal string. 
- `maxMinerFee` (string): Most nanoERG a fill may pay as a miner fee, out of `executorFee`. Must be below `executorFee`. Omit for the client's default. Decimal string. 

## Responses

### 200: Quote for the requested redeem order

`LDRedeemOrderQuote`

- `shares` (string, required): LP shares the order would close. Decimal string.
- `amountX` (string, required): nanoERG share of the reserves at the current pool. Decimal string.
- `amountY` (string, required): Raw token units share of the reserves at the current pool. Decimal string.
- `provisionValue` (string, required): nanoERG held by the provision box, returned with the fill. Decimal string.
- `receivedX` (string, required): nanoERG paid to the owner if the order fills against the current pool: `amountX`, `provisionValue` and `totalErgRequired`, less `executorFee`. Decimal string. 
- `claimableX` (string, required): Settled ERG fees claimed by the transaction placing the order. Decimal string.
- `claimableY` (string, required): Token side of `claimableX`. Decimal string.
- `unflushedX` (string, required): ERG fees earned but not yet flushed. They cannot be claimed at placement and are **lost** when the order fills. Decimal string. 
- `unflushedY` (string, required): Token side of `unflushedX`. Decimal string.
- `withinMinSupply` (boolean, required): False when closing this provision would take supply under the contract's minimum. Such an order is refused. 
- `executorFee` (string, required): The executor fee applied, the request's or the client's default. Decimal string.
- `maxMinerFee` (string, required): The miner fee cap applied. Decimal string.
- `totalErgRequired` (string, required): nanoERG locked in the order box beside the `ownerNFT`, returned with the fill. Decimal string.
- `networkFee` (string, required): nanoERG paid to place the order. Decimal string.

### 400: Malformed body, or a `maxMinerFee` not below `executorFee`.

`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 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

### 409: The provision moved. Re-read to find its current box id.

`LDStateChangedResponse`

- `error` (integer, required)
- `reason` (string, required)
- `detail` (string, required): What moved, and what it moved to
- `poolBoxId` (string): Current pool box id
- `vaultBoxId` (string): Current vault box id
- `provisionBoxId` (string): Current provision box id

### 503: Node unavailable. 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/orders/redeem/check" \
  -H "Content-Type: application/json" \
  -d '{ "provisionBoxId": "ce00d6e0f4fd3390c0519bb0d24824e1e6b06978163f4845a7cf2c1c7d8f1b65", "executorFee": "3000000", "maxMinerFee": "1000000" }'
```

## Example response

```json
{
  "shares": "12500000000",
  "amountX": "53125000000",
  "amountY": "1605000000",
  "provisionValue": "600000000",
  "receivedX": "53723000000",
  "claimableX": "253000000",
  "claimableY": "7690000",
  "unflushedX": "39750000",
  "unflushedY": "1210000",
  "withinMinSupply": true,
  "executorFee": "3000000",
  "maxMinerFee": "1000000",
  "totalErgRequired": "1000000",
  "networkFee": "2000000"
}
```
