@0xmonaco/types 1.0.87 → 1.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -423,6 +423,12 @@ export interface PerpMarketConfig {
423
423
  */
424
424
  riskTiers: RiskTier[];
425
425
  updatedAt: string;
426
+ /**
427
+ * Quote notional `Q_m` that each funding premium sample walks through each
428
+ * side of the book to read the market's impact bid and impact ask. Set per
429
+ * market; markets start at `"2000"`.
430
+ */
431
+ fundingImpactNotional: string;
426
432
  }
427
433
  export interface PerpMarketSummary {
428
434
  tradingPairId: string;
@@ -605,6 +611,124 @@ export interface OpenInterest {
605
611
  openInterestNotional: string;
606
612
  updatedAt: string;
607
613
  }
614
+ /** Public account-positioning snapshot and distinct active-trader counts; responses may be cached for up to 30 seconds. */
615
+ export interface TraderMetrics {
616
+ tradingPairId: string;
617
+ quoteAssetSymbol: string;
618
+ /** Snapshot calculation time as Unix milliseconds. */
619
+ asOf: number;
620
+ /** Position split fields are suppressed when either side has fewer than five accounts. */
621
+ positionMetricsSuppressed: boolean;
622
+ longAccountCount: number | null;
623
+ shortAccountCount: number | null;
624
+ /** Account shares and ratios are rounded to six decimal places. */
625
+ longAccountShare: string | null;
626
+ shortAccountShare: string | null;
627
+ accountRatio: string | null;
628
+ activeTraderWindows: ActiveTraderWindow[];
629
+ }
630
+ /** Distinct user IDs in executed trades for one rolling window; includes liquidation and ADL system IDs. */
631
+ export interface ActiveTraderWindow {
632
+ window: "1h" | "24h" | "7d";
633
+ activeTraderCount: number | null;
634
+ takerBuyerCount: number | null;
635
+ takerSellerCount: number | null;
636
+ /** All three counts are null when any cohort in this window is below five users. */
637
+ suppressed: boolean;
638
+ }
639
+ export type TradeFlowInterval = "1m" | "5m" | "1h";
640
+ export interface GetTradeFlowParams {
641
+ interval: TradeFlowInterval;
642
+ /** Inclusive start time as Unix milliseconds. */
643
+ startTime: number;
644
+ /** Exclusive end time as Unix milliseconds. */
645
+ endTime: number;
646
+ }
647
+ export interface TradeFlowBucket {
648
+ /** UTC-aligned bucket start as Unix milliseconds. */
649
+ bucketStart: number;
650
+ takerBuyNotional: string;
651
+ takerSellNotional: string;
652
+ /** Taker buy/sell ratio rounded to six decimal places. */
653
+ buySellRatio: string | null;
654
+ netNotional: string;
655
+ cumulativeVolumeDelta: string;
656
+ tradeCount: number;
657
+ }
658
+ export interface TradeFlow {
659
+ tradingPairId: string;
660
+ quoteAssetSymbol: string;
661
+ interval: TradeFlowInterval;
662
+ /** Inclusive selected start time as Unix milliseconds. */
663
+ startTime: number;
664
+ /** Exclusive selected end time as Unix milliseconds. */
665
+ endTime: number;
666
+ /** Buckets without executed trades are omitted. */
667
+ buckets: TradeFlowBucket[];
668
+ }
669
+ export interface ListLiquidationEventsParams {
670
+ /** Inclusive event-time lower bound as Unix milliseconds. */
671
+ startTime?: number;
672
+ /** Exclusive event-time upper bound as Unix milliseconds. */
673
+ endTime?: number;
674
+ /** Requested page size, from 1 through 1000 (defaults to 50). */
675
+ pageSize?: number;
676
+ /** Opaque cursor returned by the previous page; pages continue toward older rows. */
677
+ pageToken?: string;
678
+ }
679
+ export interface LiquidationHistoryEvent {
680
+ eventId: string;
681
+ /** Event time as Unix milliseconds. */
682
+ timestamp: number;
683
+ tradingPairId: string;
684
+ wallet: string;
685
+ side: "LONG" | "SHORT";
686
+ /** Absolute position size in base-asset units. */
687
+ positionSize: string;
688
+ /** Mark price captured for this event, in quote units per base unit. */
689
+ markPrice: string;
690
+ /** Position size × event-time mark price, in quote-asset units. */
691
+ markNotional: string;
692
+ quoteAssetSymbol: string;
693
+ }
694
+ export interface ListLiquidationEventsResponse {
695
+ tradingPairId: string;
696
+ /** Events are ordered newest first. */
697
+ events: LiquidationHistoryEvent[];
698
+ pageSize: number;
699
+ nextPageToken: string;
700
+ }
701
+ export type LiquidationMetricsInterval = "1m" | "5m" | "1h";
702
+ export interface GetLiquidationMetricsParams {
703
+ interval: LiquidationMetricsInterval;
704
+ /** Inclusive range start as Unix milliseconds. */
705
+ startTime: number;
706
+ /** Exclusive range end as Unix milliseconds. */
707
+ endTime: number;
708
+ }
709
+ export interface LiquidationSideMetrics {
710
+ /** Number of stored liquidation-event rows on this side in the bucket. */
711
+ eventCount: number;
712
+ /** Sum of event position sizes in base-asset units. */
713
+ positionSize: string;
714
+ /** Sum of each row's position size × event-time mark in quote units. */
715
+ markNotional: string;
716
+ }
717
+ export interface LiquidationMetricsBucket {
718
+ /** UTC-aligned bucket start as Unix milliseconds. */
719
+ bucketStart: number;
720
+ long: LiquidationSideMetrics;
721
+ short: LiquidationSideMetrics;
722
+ }
723
+ export interface LiquidationMetrics {
724
+ tradingPairId: string;
725
+ quoteAssetSymbol: string;
726
+ interval: LiquidationMetricsInterval;
727
+ startTime: number;
728
+ endTime: number;
729
+ /** Buckets with no liquidation rows on either side are omitted. */
730
+ buckets: LiquidationMetricsBucket[];
731
+ }
608
732
  /**
609
733
  * Market API interface.
610
734
  * Provides methods for fetching market metadata and trading pair information.
@@ -682,4 +806,12 @@ export interface MarketAPI extends BaseAPI {
682
806
  */
683
807
  listAllFundingHistory(params?: ListAllFundingHistoryParams): Promise<ListAllFundingHistoryResponse>;
684
808
  getOpenInterest(tradingPairId: string): Promise<OpenInterest>;
809
+ /** Fetch current public positioning and active-trader aggregates for a perp. */
810
+ getTraderMetrics(tradingPairId: string): Promise<TraderMetrics>;
811
+ /** Fetch bounded taker buy/sell quote flow and cumulative volume delta. */
812
+ getTradeFlow(tradingPairId: string, params: GetTradeFlowParams): Promise<TradeFlow>;
813
+ /** Fetch persisted per-fill liquidation events with a stable keyset cursor. */
814
+ listLiquidationEvents(tradingPairId: string, params?: ListLiquidationEventsParams): Promise<ListLiquidationEventsResponse>;
815
+ /** Fetch bounded UTC-aligned long/short liquidation totals by side. */
816
+ getLiquidationMetrics(tradingPairId: string, params: GetLiquidationMetricsParams): Promise<LiquidationMetrics>;
685
817
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Address } from "viem";
7
7
  import type { BaseAPI } from "../api";
8
- import type { OrderSide, OrderStatus, OrderType, SelfTradePreventionMode, TimeInForce } from "../trading";
8
+ import type { OrderSide, OrderStatus, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../trading";
9
9
  /**
10
10
  * Account movement/transaction information.
11
11
  * Represents transactions/movements returned in the profile's recent_movements array.
@@ -276,31 +276,56 @@ export interface UserTrade {
276
276
  tradeId: string;
277
277
  /** Trading pair identifier (UUID) */
278
278
  tradingPairId: string;
279
+ /** Trading mode of the pair the trade executed on */
280
+ tradingMode: TradingMode;
281
+ /** Maker order identifier (UUID) */
282
+ makerOrderId: string;
283
+ /** Taker order identifier (UUID) */
284
+ takerOrderId: string;
279
285
  /** Execution price (as string to preserve precision) */
280
286
  price: string;
281
287
  /** Executed quantity (as string to preserve precision) */
282
288
  quantity: string;
283
- /** Quote volume (price * quantity, as string to preserve precision) */
284
- quoteVolume: string;
285
- /** Side of the trade */
289
+ /** `quantity` in the smallest base-token unit */
290
+ quantityRaw: string;
291
+ /** Quote volume (price * quantity, as string to preserve precision). Absent when the trade has none recorded. */
292
+ quoteVolume?: string;
293
+ /** `quoteVolume` in the smallest quote-token unit. Absent when `quoteVolume` is. */
294
+ quoteVolumeRaw?: string;
295
+ /** This user's side of the trade */
286
296
  side: OrderSide;
287
297
  /**
288
298
  * Total fee paid for this trade (as string to preserve precision). For a
289
299
  * taker this is Monaco's taker fee plus the frontend's builder fee; for a
290
300
  * maker it is the maker fee (negative for a rebate) plus the frontend's
291
- * maker add-on. Equals `monacoFee + builderFee`.
292
- */
293
- fee: string;
294
- /** Monaco's component of `fee`. Absent from servers older than this field. */
295
- monacoFee?: string;
301
+ * maker add-on. Equals `monacoFee + builderFee`. Absent when the trade has
302
+ * no fee recorded for this user's side.
303
+ */
304
+ fee?: string;
305
+ /** `fee` in the smallest quote-token unit. Absent when `fee` is. */
306
+ feeRaw?: string;
307
+ /** Token address the fee was charged in. Absent when none is recorded. */
308
+ feeToken?: string;
309
+ /** Monaco's component of `fee`. `null` when `fee` is absent; absent from servers older than this field. */
310
+ monacoFee?: string | null;
311
+ /** `monacoFee` in the smallest quote-token unit. `null` when `monacoFee` is. */
312
+ monacoFeeRaw?: string | null;
296
313
  /**
297
314
  * The frontend's builder fee component of `fee`: the builder fee for a
298
315
  * taker, the maker add-on for a maker. Absent from servers older than this
299
316
  * field.
300
317
  */
301
318
  builderFee?: string;
302
- /** Timestamp when the trade was executed (ISO string) */
303
- executedAt: string;
319
+ /** `builderFee` in the smallest quote-token unit. Absent from servers older than this field. */
320
+ builderFeeRaw?: string;
321
+ /** Settlement status. Absent when the trade has none recorded. */
322
+ settlementStatus?: "PENDING" | "SETTLED" | "FAILED";
323
+ /** On-chain settlement transaction hash. Absent until one is recorded. */
324
+ settlementTxHash?: string;
325
+ /** This user's role in the fill. A self-trade reads as `MAKER`. */
326
+ liquidityRole: "MAKER" | "TAKER";
327
+ /** Timestamp when the trade was executed (RFC 3339). Absent when none is recorded. */
328
+ executedAt?: string;
304
329
  }
305
330
  /**
306
331
  * Query parameters for getting user trades
@@ -310,6 +335,18 @@ export interface GetUserTradesParams {
310
335
  pageSize?: number;
311
336
  /** Filter by trading pair ID (UUID) */
312
337
  tradingPairId?: string;
338
+ /**
339
+ * Filter by margin account ID (UUID): only trades whose side for this user
340
+ * was placed from that account. A self-trade is read as its maker side, so
341
+ * it matches through its maker order's account.
342
+ */
343
+ marginAccountId?: string;
344
+ /**
345
+ * Filter by order ID (UUID): only trades whose side for this user was
346
+ * placed by that order. A self-trade is read as its maker side, so it
347
+ * matches its maker order only.
348
+ */
349
+ orderId?: string;
313
350
  /**
314
351
  * Pagination cursor:
315
352
  * - Omitted or empty string (`""`): start a cursor walk from the newest row
@@ -321,7 +358,7 @@ export interface GetUserTradesParams {
321
358
  * is no page-number mode: a `page` param is rejected with a
322
359
  * `ValidationError` before the request is sent (the REST endpoint itself
323
360
  * answers `400`). An unfiltered response carries a bounded `total` (see
324
- * `totalCapped`); one filtered by `tradingPairId` carries none.
361
+ * `totalCapped`); a filtered one carries none.
325
362
  */
326
363
  pageToken?: string;
327
364
  }
@@ -70,7 +70,8 @@ export interface SDKConfig {
70
70
  * client (e.g. `waitForTransactionReceipt` during vault deposits). Sei
71
71
  * produces sub-second blocks, so a value near the chain's block time
72
72
  * confirms transactions much sooner than viem's 4000ms default. Defaults to
73
- * 750ms when omitted. Must be a positive finite number when provided.
73
+ * 200ms (about half a Sei block) when omitted. Must be a positive finite number when
74
+ * provided.
74
75
  */
75
76
  pollingInterval?: number;
76
77
  /**
@@ -105,8 +105,108 @@ export interface GetSweeperChainsResponse {
105
105
  chains: SweeperChain[];
106
106
  }
107
107
  /**
108
- * Sweeper API interface. The register endpoint requires authentication;
109
- * the chain listing is public.
108
+ * Where a sweeper deposit is.
109
+ *
110
+ * - `RECEIVED` — indexed, not yet swept (a balance below the asset's minimum
111
+ * waits for a later deposit).
112
+ * - `BURNED` — swept off its source chain; for a CCTP deposit, the burn is not
113
+ * yet queued for attestation. Deposits bridged by a route other than CCTP
114
+ * stay here.
115
+ * - `ATTESTING` — waiting for Circle's attestation.
116
+ * - `ATTESTED` — attested, not yet minted on the hub.
117
+ * - `SETTLING` — minted on the hub, being swept into the exchange.
118
+ * - `DEPOSITED` — credited to the exchange.
119
+ * - `FAILED` — the sweep returned the funds to the depositor's wallet (see
120
+ * {@link SweeperDeposit.failureReason}).
121
+ *
122
+ * A deposit on the hub chain goes straight from `RECEIVED` to `DEPOSITED`.
123
+ */
124
+ export type SweeperDepositStatus = "RECEIVED" | "BURNED" | "ATTESTING" | "ATTESTED" | "SETTLING" | "DEPOSITED" | "FAILED";
125
+ /**
126
+ * One transfer into one of the caller's deposit addresses, and how far it has
127
+ * got. Amounts are raw base units of the source-chain token (decimal strings —
128
+ * they can exceed `Number.MAX_SAFE_INTEGER`); timestamps are RFC 3339 and
129
+ * record when the sweeper observed each step.
130
+ *
131
+ * Sweeps move balances rather than single transfers, so a sweep that collected
132
+ * several deposits is attributed to each of them first in, first out.
133
+ */
134
+ export interface SweeperDeposit {
135
+ /** The deposit transaction's hash, lowercase */
136
+ txHash: string;
137
+ /** EVM chain id the deposit was made on, as listed by {@link SweeperAPI.getChains} */
138
+ sourceChainId: number;
139
+ /** The source chain's CCTP domain, once the deposit's CCTP burn is known; absent for hub deposits */
140
+ sourceDomain?: number | null;
141
+ /** The address the deposit is credited to (the caller's own), lowercase */
142
+ beneficiary: string;
143
+ /** Client id of the application the deposit address was registered under */
144
+ clientId: string;
145
+ /** The ledger the deposit address asks to be credited to */
146
+ depositTarget: "SPOT" | "MARGIN";
147
+ /** The deposited token's address on the source chain, lowercase */
148
+ token: string;
149
+ /** Amount deposited, raw base units of `token` */
150
+ amountRaw: string;
151
+ /**
152
+ * Amount credited to the exchange, once `DEPOSITED`. Absent when one CCTP
153
+ * burn carried several deposits (its fee cannot be split between them).
154
+ */
155
+ creditedAmountRaw?: string | null;
156
+ /**
157
+ * `amountRaw` minus `creditedAmountRaw`: Circle's fast-lane fee for a CCTP
158
+ * deposit, `"0"` on the hub. Absent whenever `creditedAmountRaw` is.
159
+ */
160
+ feeChargedRaw?: string | null;
161
+ /** The CCTP lane the burn requested, once the burn is known; absent for hub deposits */
162
+ transferType?: "FAST" | "STANDARD" | null;
163
+ /** Where the deposit is */
164
+ status: SweeperDepositStatus;
165
+ /** Why the deposit `FAILED`: `REFUNDED` — the exchange was paused, the user is blocked, or the token is not accepted */
166
+ failureReason?: "REFUNDED" | null;
167
+ /** The source-chain transaction that swept the deposit (the CCTP burn for a remote deposit) */
168
+ sweepTx?: string | null;
169
+ /** The hub transaction that deposited the funds into the exchange (the sweep itself for a hub deposit) */
170
+ settleTx?: string | null;
171
+ /** When Circle's attestation was first seen */
172
+ attestedAt?: string | null;
173
+ /** When the deposit was seen `DEPOSITED` */
174
+ settledAt?: string | null;
175
+ /** When the deposit was seen `FAILED` */
176
+ failedAt?: string | null;
177
+ /** When the sweeper indexed the deposit */
178
+ createdAt: string;
179
+ /** When the sweeper last observed progress on the deposit */
180
+ updatedAt: string;
181
+ }
182
+ /** The caller's sweeper deposits made by one transaction. */
183
+ export interface GetSweeperDepositStatusResponse {
184
+ /**
185
+ * In chain then log order; empty until the sweeper has indexed the
186
+ * transaction (and for a transaction with no deposit of the caller's).
187
+ */
188
+ deposits: SweeperDeposit[];
189
+ }
190
+ /** Paging for {@link SweeperAPI.listDeposits}. */
191
+ export interface ListSweeperDepositsParams {
192
+ /** Deposits per page, 1 to 100 (default 20). */
193
+ pageSize?: number;
194
+ /**
195
+ * The previous response's `nextPageToken`; omit (or pass `""`) to start
196
+ * from the newest deposit.
197
+ */
198
+ pageToken?: string;
199
+ }
200
+ /** One page of the caller's sweeper deposits. */
201
+ export interface ListSweeperDepositsResponse {
202
+ /** This page, newest recorded first */
203
+ deposits: SweeperDeposit[];
204
+ /** Cursor for the next page; empty when this page is the last */
205
+ nextPageToken: string;
206
+ }
207
+ /**
208
+ * Sweeper API interface. Registration and deposit status require
209
+ * authentication; the chain listing is public.
110
210
  */
111
211
  export interface SweeperAPI extends BaseAPI {
112
212
  /**
@@ -140,4 +240,30 @@ export interface SweeperAPI extends BaseAPI {
140
240
  * changes only with operator configuration, so it is safe to cache briefly.
141
241
  */
142
242
  getChains(): Promise<GetSweeperChainsResponse>;
243
+ /**
244
+ * Where the caller's deposits made by one transaction are — look a deposit
245
+ * up by the hash of the transaction that sent funds to the caller's deposit
246
+ * address, on any supported chain, and poll until `DEPOSITED` (or
247
+ * `FAILED`).
248
+ *
249
+ * Authenticated: only deposits credited to the session's own address are
250
+ * returned. The list is empty until the sweeper has indexed the
251
+ * transaction, so an empty answer right after sending is expected.
252
+ *
253
+ * Throws on a malformed hash (before sending).
254
+ */
255
+ getDepositStatus(txHash: string): Promise<GetSweeperDepositStatusResponse>;
256
+ /**
257
+ * The caller's sweeper deposits, newest first, as the same
258
+ * {@link SweeperDeposit} entries {@link getDepositStatus} returns — a way to
259
+ * find a deposit whose transaction hash was lost. A swept CCTP deposit is
260
+ * listed once, by its source-chain transfer; a burn made straight to the
261
+ * hub deposit address is listed by its hub mint.
262
+ *
263
+ * Walk by cursor: omit `pageToken` to start, then pass each response's
264
+ * `nextPageToken` until it comes back empty. Authenticated: only the
265
+ * session's own deposits. Throws on an out-of-range `pageSize` (before
266
+ * sending).
267
+ */
268
+ listDeposits(params?: ListSweeperDepositsParams): Promise<ListSweeperDepositsResponse>;
143
269
  }
@@ -159,7 +159,7 @@ export interface Order {
159
159
  *
160
160
  * The snapshot frame alone does not close a reconnect gap: an order that
161
161
  * filled or was cancelled while the socket was down is in neither the
162
- * resting snapshot nor the stream. Recover those explicitly — `listUserTrades`
162
+ * resting snapshot nor the stream. Recover those explicitly — `getUserTrades`
163
163
  * for fills, and a targeted `getOrder` for anything local state believes is
164
164
  * resting that the snapshot no longer lists.
165
165
  *
@@ -84,6 +84,8 @@ export declare const GetUserTradesSchema: z.ZodObject<{
84
84
  page: z.ZodOptional<z.ZodNever>;
85
85
  pageSize: z.ZodOptional<z.ZodNumber>;
86
86
  tradingPairId: z.ZodOptional<z.ZodUUID>;
87
+ marginAccountId: z.ZodOptional<z.ZodUUID>;
88
+ orderId: z.ZodOptional<z.ZodUUID>;
87
89
  pageToken: z.ZodOptional<z.ZodString>;
88
90
  }, z.core.$strip>;
89
91
  /**
@@ -63,6 +63,8 @@ export const GetUserTradesSchema = z.object({
63
63
  page: z.never().optional(),
64
64
  pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
65
65
  tradingPairId: UUIDSchema.optional(),
66
+ marginAccountId: UUIDSchema.optional(),
67
+ orderId: UUIDSchema.optional(),
66
68
  pageToken: z.string().optional(),
67
69
  });
68
70
  /**
@@ -61,7 +61,7 @@ export interface WithdrawResult {
61
61
  * (proof not confirmed yet) until ready; the SDK retries on both.
62
62
  */
63
63
  export interface WithdrawalRetryOptions {
64
- /** Delay between polls, in milliseconds. Defaults to 5000. */
64
+ /** Delay between polls, in milliseconds. Defaults to 500. */
65
65
  pollIntervalMs?: number;
66
66
  /**
67
67
  * Maximum total time to wait for the proof, in milliseconds. Defaults to
@@ -57,7 +57,7 @@ import type { Interval } from "../market";
57
57
  import type { TradingMode } from "../trading";
58
58
  import type { SubscriptionChangeHandler, WebSocketStatus, WebSocketSubscriptionState } from "./base";
59
59
  import type { OrderbookQuotationMode } from "./clients/orderbook-client";
60
- import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, TradeEvent, TradeEventData, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
60
+ import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketLiquidationEvent, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, TradeEvent, TradeEventData, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
61
61
  import type { OHLCVSnapshotCandle, OrderSnapshotItem, SnapshotHandler } from "./snapshots";
62
62
  export type MessageHandler<T> = (data: T) => void;
63
63
  export interface MonacoWebSocket {
@@ -120,6 +120,13 @@ export interface MonacoWebSocket {
120
120
  positions: (handler: MessageHandler<PositionEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<PositionEventData>, onValuation?: MessageHandler<PositionValuationEvent>) => () => void;
121
121
  /** Subscribe to liquidation alerts (requires authentication); omit `tradingPairId` for all pairs */
122
122
  liquidations: (handler: MessageHandler<LiquidationEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<LiquidationEventData>) => () => void;
123
+ /**
124
+ * Subscribe to public per-fill liquidation events for one pair. Frames carry
125
+ * the persisted event ID, wallet, position side, size and event-time mark
126
+ * valuation. The stream has no snapshot; use event history to backfill after
127
+ * reconnect and deduplicate on `eventId`.
128
+ */
129
+ marketLiquidations: (tradingPairId: string, handler: MessageHandler<MarketLiquidationEvent>) => () => void;
123
130
  /** Subscribe to account-level margin health updates for the authenticated user (requires authentication) */
124
131
  account: (handler: MessageHandler<AccountEvent>, onSnapshot?: SnapshotHandler<AccountEventData>) => () => void;
125
132
  /**
@@ -4,6 +4,7 @@ export * from "./conditional-order-events";
4
4
  export * from "./copy-events";
5
5
  export * from "./instrument-events";
6
6
  export * from "./liquidation-events";
7
+ export * from "./market-liquidation-events";
7
8
  export * from "./market-stats-events";
8
9
  export * from "./movement-events";
9
10
  export * from "./ohlcv-events";
@@ -4,6 +4,7 @@ export * from "./conditional-order-events";
4
4
  export * from "./copy-events";
5
5
  export * from "./instrument-events";
6
6
  export * from "./liquidation-events";
7
+ export * from "./market-liquidation-events";
7
8
  export * from "./market-stats-events";
8
9
  export * from "./movement-events";
9
10
  export * from "./ohlcv-events";
@@ -0,0 +1,26 @@
1
+ /** Public pair-scoped liquidation events. */
2
+ export interface MarketLiquidationEventData {
3
+ /** Stable ID shared with the persisted REST liquidation row. */
4
+ eventId: string;
5
+ /** Event timestamp as Unix milliseconds. */
6
+ timestamp: number;
7
+ /** Public wallet address associated with the liquidation event. */
8
+ wallet: string;
9
+ /** Side of the liquidated position, rather than execution direction. */
10
+ side: "LONG" | "SHORT" | (string & {});
11
+ /** Absolute position size in base-asset units. */
12
+ positionSize: string;
13
+ /** Mark price captured with this event, in quote units per base unit. */
14
+ markPrice: string;
15
+ /** Position size multiplied by this event's mark price, in quote units. */
16
+ markNotional: string;
17
+ /** Quote asset used for markNotional. */
18
+ quoteAssetSymbol: string;
19
+ }
20
+ export interface MarketLiquidationEvent {
21
+ /** Fixed market-event discriminator. */
22
+ eventType: "liquidation_event";
23
+ /** Trading pair UUID. */
24
+ tradingPairId: string;
25
+ data: MarketLiquidationEventData;
26
+ }
@@ -0,0 +1 @@
1
+ /** Public pair-scoped liquidation events. */
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_invite_codes", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "request_invite_codes", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_liquidation_metrics", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_sweeper_deposit_status", "get_trade_by_id", "get_trade_flow", "get_trader_code_info", "get_trader_metrics", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_invite_codes", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_liquidation_events", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_sweeper_deposits", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "request_invite_codes", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -50,6 +50,7 @@ export const OPERATION_IDS = [
50
50
  "get_funding_state",
51
51
  "get_index_price",
52
52
  "get_lead_trader",
53
+ "get_liquidation_metrics",
53
54
  "get_margin_account_movements",
54
55
  "get_margin_account_pnl",
55
56
  "get_margin_account_summary",
@@ -86,8 +87,11 @@ export const OPERATION_IDS = [
86
87
  "get_self_trade_prevention_default",
87
88
  "get_sub_account_limits",
88
89
  "get_sweeper_chains",
90
+ "get_sweeper_deposit_status",
89
91
  "get_trade_by_id",
92
+ "get_trade_flow",
90
93
  "get_trader_code_info",
94
+ "get_trader_metrics",
91
95
  "get_trades",
92
96
  "get_trading_pair_by_id",
93
97
  "get_twap_order",
@@ -117,6 +121,7 @@ export const OPERATION_IDS = [
117
121
  "list_lead_trader_closed_trades",
118
122
  "list_lead_trader_open_positions",
119
123
  "list_lead_traders",
124
+ "list_liquidation_events",
120
125
  "list_managed_market_assignments",
121
126
  "list_margin_accounts",
122
127
  "list_my_followers",
@@ -125,6 +130,7 @@ export const OPERATION_IDS = [
125
130
  "list_position_history",
126
131
  "list_positions",
127
132
  "list_sub_accounts_with_balances",
133
+ "list_sweeper_deposits",
128
134
  "list_trading_pairs",
129
135
  "list_twap_order_slices",
130
136
  "list_twap_orders",