PerpsClient.placeTwapOrder / PerpsClient.cancelTwapOrder. The registered provider plugin authorizes both flows with its SDK-managed credential; the user’s wallet is not prompted.
The examples on this page use Hyperliquid (
provider: 'hyperliquid'). Replace the provider value with any supported provider from getProviders(). Each provider documents its own extras and duration bounds on its own trading page — see Hyperliquid, Lighter, and Ondo.placeTwapOrder
Returns:
ExecuteActionResponse with results[] array. A Submitted or Accepted result carries twapId — the provider-native identifier for the placed TWAP parent. A venue refusal does not throw; it arrives as a Failed result with error and an optional errorCode, which has no twapId. See Execution reports and Error Handling.
market, side, size, durationSeconds, and reduceOnly are the provider-independent core. The remaining fields are extras: a provider only honours the ones it advertises on its placeTwapOrder action’s params descriptors (GET /providers), and ignores extras it does not declare. See each provider’s trading page for which extras it supports and its own duration bounds.cancelTwapOrder
placeTwapOrder:
Returns:
ExecuteActionResponse with results[] array.
On Lighter, a placement result’s
twapId is String(client_order_index), the client order index the backend issued for the placement. It is not the parent’s order index, which Lighter assigns asynchronously. Once assigned, read the TWAP parent from getOrders (filter with isTwapOrder) and pass its orderId as twapId; that is the id cancelTwapOrder expects.Orders with type: OrderType.TWAP, plus durationSeconds and startedAt. Their child orders carry the parent’s id in parentOrderId.
API Reference: POST /createAction · /executeAction