Execute a swap
/dex/swapapi_keySign and submit a swap that spends the pool directly. minOutput is required and rejects the trade if the pool has moved against you; send expectedPoolBoxId from the quote to get a 409 instead of a re-quote. POST /dex/orders/swap places the same swap as an order.
Request body
LDSwapExecuteRequest · application/jsonamountInstringrequiredTotal handed to the pool, fees included. Decimal string.
ergInbooleanrequiredminOutputstringrequiredFloor below which the swap must be rejected. Required, and must not be negative — a negative floor is no floor. Decimal string.
expectedPoolBoxIdstringPool box the quote was made against. Returns 409 instead of re-quoting if it moved.
Responses
200Result of the swap transactionLDSwapResult▶
outcomestringrequiredNode submission outcome; uncertain retains the known transaction ID and input ownership.
one ofacceptedrejecteduncertainamountOutstringrequiredAmount received. Decimal string.
txIdstringrequired
400Malformed body, a non-positive `amountIn`, or a negative `minOutput`.ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
409The pool moved. Re-read and quote again.LDStateChangedResponse▶
errorintegerrequiredreasonstringrequireddetailstringrequiredWhat moved, and what it moved to
poolBoxIdstringCurrent pool box id
vaultBoxIdstringCurrent vault box id
provisionBoxIdstringCurrent provision box id
422The pool cannot fill this swap, or the wallet cannot cover it.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