Skip to main content
Track an async order with the /order-status endpoint (a sync response has nothing to track). Poll GET /order-status with the signature of the transaction that opened the order and the lastValidBlockHeight from the order response, until the status is terminal: expired, failed, or closed. At pendingClose nothing more can fill, and keep polling until it is closed.
1

Set Up

Imports, env config, response types, and the opening signature and lastValidBlockHeight of the order.
2

Poll the Order Status Endpoint with Backoff

Poll GET /order-status with exponential backoff until the status is terminal.
3

Handle Each Terminal Status

Handle each terminal status: expired, failed, and closed.
4

Total the Fills and Reverts

Total the fills and reverts of a closed order and classify the outcome.