Skip to main content

Orders

Orders use the same relayer-only signing model as other writes. The session key signs an EIP-712 order; the API accepts it as an intent; and the relayer submits execution when its conditions are met. Direct wallet broadcasting is not currently supported, including for market orders.

Order types

direction is 0 or 1. closeMode: 0 closes qWad; closeMode: 1 closes the entire position. Amounts and prices use protocol integer units. Use a 32-byte zero ocoGroup when the order is not part of an OCO pair.

Prepare and submit

The signer address is the default trader and sessionKey. You may provide another trader when the connected signer is its authorized session key. The SDK generates a nonce and five-minute deadline unless supplied. With a chain reader, preparation validates the unused nonce, active session, authorized market, spend and size bounds, collateral and Permit2 funding, and—when closing—the live position identity. Preparation fails before signing when the current on-chain state cannot satisfy the order.

Intent lifecycle

The submission result includes orderHash, state, duplicate, statusUrl, the canonical order, get(), and wait(). A repeated submission with the prepared order’s stable idempotency key can return duplicate: true; this is success, not a second order. wait() uses the same bounded HTTP polling controls as action receipts. It stops on filled, rejected, cancelled, cancelled_by_oco, expired, or failed. Realtime events improve responsiveness but are not the source of lifecycle correctness.

Cancellation

Prepare cancellation with the accepted order hash and the exact canonical order:
The order’s session key must sign the cancellation. Its prepared payload also keeps a stable nonce, deadline, signature, and idempotency key across retries. Cancellation is best effort. It can stop an outstanding limit, stop-loss, or take-profit intent, but cannot reverse an order that has already executed or won the execution race. An OCO execution may also terminate its sibling as cancelled_by_oco.
Last modified on July 23, 2026