import type { MarketDisplay, OpenOrder, Order, TriggerOrder } from '@lifi/perps-types'; import { OrderType } from '@lifi/perps-types'; import type { LtOrder } from '../types/index.js'; /** * Map a raw Lighter order status to a short English sentence describing * *why* the order ended in a terminal non-FILLED state. Non-terminal * statuses, plain `filled`, and unknown values return `undefined`. * @public */ export declare const mapStatusReason: (status: string) => string | undefined; /** * True for order types Lighter exposes as TP/SL legs. Mirrors the * Hyperliquid helper of the same name so the backend can split a raw * Lighter order list into the same `openOrders` / `triggerOrders` * buckets the SDK declares on `OrdersResponse`. * @public */ export declare const isTriggerType: (type: OrderType) => boolean; /** * Decide whether a raw Lighter order belongs in the cross-provider * `triggerOrders` bucket. Single source of truth for both the REST * `getOrders` path and the `account_all_orders` WS handler. * * Authoritative signals, in order: * 1. `trigger_status` — Lighter's own enum. `'ready' | 'mark-price' | * 'parent-order'` all mean "this order has trigger semantics" (TP/SL * waiting on price, or a TP/SL leg of a parent placeOrder). `'twap'` * is intentionally excluded — TWAP child orders are scheduled resting * limits, not TP/SL triggers. `'na'` is "regular order". * 2. `trigger_price > 0` — catches cases where `trigger_status` * momentarily lags during state transitions (e.g. right after an OCO * sibling cancels). * 3. `type` — final fallback via the mapped `OrderType`. * @public */ export declare const isTriggerOrder: (raw: LtOrder) => boolean; /** * Map a raw Lighter trigger order (stop/take-profit, market or limit) to * the generic `TriggerOrder` shape. For market variants the `limitPrice` * field is omitted; for limit variants `order.price` is the limit and * `order.trigger_price` is the activation level. * @public */ export declare const mapTriggerOrder: (order: LtOrder, market: MarketDisplay) => TriggerOrder; /** * Map a raw Lighter order to the generic OpenOrder type. * @param market - Backend-resolved market identity for `order.market_index`. * @public */ export declare const mapOrder: (order: LtOrder, market: MarketDisplay) => OpenOrder; /** * Walk a flat list of raw Lighter orders and bucket each into the * `OpenOrder` / `TriggerOrder` arrays the cross-provider `OrdersResponse` * declares, plus a `terminated` list of orderIds whose status has reached * a terminal state (filled / cancelled / rejected / expired) — consumers * applying WS deltas evict those from the cached buckets. REST callers * see `terminated: []` because `accountActiveOrders` returns active only. * An order whose market the resolver does not know is skipped. * @public */ export declare const classifyAndMapOrders: (orders: LtOrder[], resolveMarket: (marketIndex: number) => MarketDisplay | undefined) => { openOrders: OpenOrder[]; triggerOrders: TriggerOrder[]; terminated: string[]; }; /** * Map a raw Lighter order to the rich Order type — adds status, time-in-force * and remaining/filled sizes on top of the OpenOrder fields. * @public */ export declare const mapOrderDetail: (order: LtOrder, market: MarketDisplay) => Order; //# sourceMappingURL=mapOrder.d.ts.map