Skip to main content

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:
OCO:
OTOCO:

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 from open 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.
Response:

Step 2: Sign and Confirm

Sign the withdrawal transaction and submit it to complete the cancellation.
If step 2 fails (the transaction doesn’t land), you can retry by calling the confirm endpoint again with the same 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 through ready_to_cancel and then to cancelled once the withdrawal confirms on-chain.

Error Handling