token from authentication and the orderId returned when you created the order (the same value as id in order history).
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:On a trailing stop loss, update
trailingBps (50–9000) to change the trail distance. You cannot set triggerPriceUsd on a trailing order (400 "Cannot set trigger price on trailing stop loss order"), convert a static order to trailing or back (400 "Cannot convert to trailing stop loss order"), or set a trailingBps whose new band would fire immediately (400 "Trailing order would immediately trigger").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.
