Place a swap order
/dex/orders/swapapi_keyLock amountIn in an order that any miner can fill for executorFee. It fills only if the owner receives at least minOutput, measured against the pool when it executes, and waits otherwise. Cancel it with POST /dex/orders/{boxId}/cancel.
Request body
LDSwapOrderExecuteRequest · application/jsonamountInstringrequiredTotal handed to the pool, pool fees included. The executor fee is separate. Decimal string.
ergInbooleanrequiredminOutputstringrequiredLeast the owner receives: tokens when selling ERG, or nanoERG after
executorFeewhen selling the token. Checked against the pool when the order fills. Required and must be positive. Decimal string.executorFeestringnanoERG paid to whoever fills the order. Omit for the client's default. Decimal string.
maxMinerFeestringMost nanoERG a fill may pay as a miner fee, out of
executorFee. Must be belowexecutorFee. Omit for the client's default. Decimal string.
Responses
200The placement transaction and the order it createdLDOrderPlacementResult▶
outcomestringrequiredNode submission outcome; uncertain retains the known transaction ID and input ownership.
one ofacceptedrejecteduncertaintxIdstringrequired▶
orderLDOrderrequiredAn outstanding LithosDex order owned by this wallet. Which term fields are present depends on
type.boxIdstringrequiredOrder box id. Pass it to
POST /dex/orders/{boxId}/cancel.typestringrequiredone ofSWAPDEPOSITREDEEMstatusstringrequiredPENDING: the placement is unconfirmed. OPEN: placed and waiting for a fill. FILLING: an unconfirmed transaction fills it. CANCELLING: an unconfirmed transaction cancels it. Only PENDING and OPEN orders can be cancelled.
one ofPENDINGOPENFILLINGCANCELLINGplacementTxIdstringrequiredTransaction that created the order box
placedHeightinteger · int32Height the placement confirmed at. Absent while it is unconfirmed.
spendingTxIdstringThe unconfirmed transaction filling or cancelling the order. Present when FILLING or CANCELLING.
ownerstringrequiredAddress that receives the fill, and the only key that can cancel
valuestringrequirednanoERG held by the order box. Decimal string.
executorFeestringrequirednanoERG the order pays whoever fills it. Decimal string.
maxMinerFeestringrequiredMost nanoERG a fill may pay as a miner fee, out of
executorFee. Decimal string.ergInbooleanSWAP only. True when selling ERG for the token.
amountInstringSWAP only. nanoERG or raw token units sold into the pool. Decimal string.
minOutputstringSWAP only. Least the owner receives: tokens when selling ERG, or nanoERG after
executorFeewhen selling the token. Decimal string.amountXstringDEPOSIT only. Most nanoERG offered to the reserves. Decimal string.
amountYstringDEPOSIT only. Raw token units offered. Decimal string.
minSharesstringDEPOSIT only. Fewest shares the order accepts. Decimal string.
ownerNFTstringREDEEM only. Ownership NFT of the provision the order closes.
provisionBoxIdstringREDEEM only. Current box of that provision. Absent when it cannot be found.
fillableNowbooleanrequiredWhether the order would fill against the current pool. False when the pool cannot meet the order's minimum or refuses it; the order waits until that changes or it is cancelled. Always true while
FILLINGand false whileCANCELLING.
claimedXstringREDEEM only. Settled ERG fees the placement claimed. Decimal string.
claimedYstringREDEEM only. Token side of
claimedX. Decimal string.
400Malformed body, a non-positive `amountIn` or `minOutput`, or a `maxMinerFee` not below `executorFee`. ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
422The wallet cannot cover the order.ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
503Node or wallet unavailable. Retry.ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
defaultErrorApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description