Prerequisites
Signing withdrawal transactions requires@solana/web3.js:
Update an Order
Modify the trigger price or slippage of an existing order without cancelling and recreating it.Update Fields by Order Type
Single:Cancel an Order
Cancellation is a two-step process. The first step returns a withdrawal transaction that moves funds from the vault back to your wallet. You sign and submit it in the second step.Step 1: Initiate Cancellation
This immediately moves the order fromopen to ready_to_cancel. The order will no longer be filled, even if step 2 has not yet completed. This prevents a race condition where the order could still execute while you are signing the withdrawal transaction.
Step 2: Sign and Confirm
Sign the withdrawal transaction and submit it to complete the cancellation.cancelRequestId. The order remains in ready_to_cancel state until the withdrawal confirms.
Expired Order Withdrawal
If an order expires before execution, the funds remain in the vault. To retrieve them, use the same two-step cancel flow: initiate cancellation on the expired order, sign the withdrawal transaction, and confirm. The order transitions throughready_to_cancel and then to cancelled once the withdrawal confirms on-chain.
Error Handling
| Status | Meaning |
|---|---|
400 | Invalid order ID, order not in a cancellable state, or validation error |
401 | Invalid API key, or JWT expired/invalid |
403 | Order belongs to a different wallet |
404 | Order not found |
