TWAP orders

Quote, submit and track TWAP orders made of Dutch-auction slices.

POST /api/v1/twap/submit

Creates numSlices DutchAuctionSwapV2 intents. Slice k starts at chain time start + k·intervalSec. Up to 48 slices.

Parameter In Type Required Description
creatorAddress body string yes Maker cashaddr for payouts and refunds.
tokenIn body string yes 0x for BCH, or a category.
tokenOut body string yes 0x for BCH, or a category.
totalAmountIn body string yes Split evenly across slices.
numSlices body number no 1–48. Default 4.
intervalSec body number no Seconds between slice starts, ≥ 60. Default 600.
minAmountOutPerSlice body string yes Each slice's endBuyAmount (price protection).
startAmountOutPerSlice body string no Each slice's startBuyAmount. Defaults to the minimum.
sliceWindowSec body number no How long each slice stays fillable, in chain time. Default max(intervalSec, 3600); at least 1800 (400 otherwise), because chain time moves a block at a time.
frontendPkh body string no Applied to every slice.
userSurplusShareBps body number no Applied to every slice.

Other endpoints

Endpoint Purpose
POST /api/v1/twap/quote { tokenIn, tokenOut, totalAmountIn, numSlices?, intervalSec?, maxPricePerUnit? } → per-slice estimate
GET /api/v1/twap/:orderId Order summary with per-slice status. While slices wait for their funds it repeats their funding list
GET /api/v1/twap/address/:address Orders for a maker
GET /api/v1/twap/active All running orders
POST /api/v1/twap/:orderId/cancel Returns the automatic refund schedule (no early exit)

Order status is derived from the slices: AWAITING_FUNDING, RUNNING, COMPLETED, PARTIALLY_FILLED or REFUNDED.