Swap directly on any pool
/dex/pools/{poolNft}/swapapi_keySpends the pool now rather than placing an order, refused when it returns less than minOutput. Gated like a swap order: a pool that can be drained takes none, and an unverified one needs acknowledgeUnverified. A miner batching orders may replace an unconfirmed direct spend in its own block, after which it has to be sent again.
Path parameters
poolNftstringrequiredThe pool's NFT id, 64 hex characters
Request body
LDPoolDirectSwapRequest · application/jsontokenInstringrequiredThe token sold:
ERGor the pool's token on an ERG/token pool, either token on a token/token poolamountInstringrequiredminOutputstringrequiredThe least of the other side to accept, checked against the pool box this spends. Must be positive.
expectedPoolBoxIdstringThe pool box the quote was read from. A pool that has moved since answers 409.
acknowledgeUnverifiedbooleanRequired on a pool the verified list does not name.
Responses
200The transaction sentLDPoolDirectResult▶
A direct spend sent. For a swap amountX is what was sold and amountY what came back; for a deposit and a redemption, X and Y in pool order.
outcomestringrequiredtxIdstringrequiredpoolNFTstringrequiredkindstringrequiredone ofSWAPDEPOSITREDEEMamountXstringrequiredamountYstringrequiredsharesstringownerNFTstringprovisionBoxIdstring
400The request is malformed, names a token the pool does not hold, or leaves out an acknowledgement it needs.ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
403Missing or wrong api_keyApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
404No LithosDex pool with that NFT, or no live provision with that id.ApiError▶
errorintegerrequiredError code
reasonstringrequiredError message explaining the reason of the error
detailstringrequirednullableDetailed error description
409The pool or provision moved since the quote, or another LithosDex mutation is running. Re-quote and resend.LDStateChangedResponse▶
errorintegerrequiredreasonstringrequireddetailstringrequiredWhat moved, and what it moved to
poolBoxIdstringCurrent pool box id
vaultBoxIdstringCurrent vault box id
provisionBoxIdstringCurrent provision box id
422The pool can be drained, the pool cannot fill this at its depth or above the floor, 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