@0xmonaco/types 1.1.2 → 1.1.5-prerelease.de852e2

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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/analytics/builders.d.ts +120 -0
  3. package/dist/analytics/builders.js +11 -0
  4. package/dist/analytics/index.d.ts +131 -0
  5. package/dist/analytics/index.js +22 -0
  6. package/dist/analytics/wallets.d.ts +193 -0
  7. package/dist/analytics/wallets.js +16 -0
  8. package/dist/applications/requests.d.ts +5 -5
  9. package/dist/buildercodes/index.d.ts +13 -11
  10. package/dist/buildercodes/responses.d.ts +1 -0
  11. package/dist/buildercodes/responses.js +10 -0
  12. package/dist/fees/responses.js +2 -2
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +2 -0
  15. package/dist/margin-accounts/index.d.ts +7 -2
  16. package/dist/market/index.d.ts +51 -2
  17. package/dist/profile/index.d.ts +25 -2
  18. package/dist/rfq/index.d.ts +44 -0
  19. package/dist/rfq/index.js +10 -0
  20. package/dist/rfq/responses.d.ts +276 -0
  21. package/dist/rfq/responses.js +182 -0
  22. package/dist/sdk/index.d.ts +25 -2
  23. package/dist/trading/index.d.ts +19 -4
  24. package/dist/trading/orders.d.ts +12 -1
  25. package/dist/trading/responses.d.ts +27 -2
  26. package/dist/validation/index.d.ts +1 -0
  27. package/dist/validation/index.js +1 -0
  28. package/dist/validation/margin-accounts.d.ts +2 -2
  29. package/dist/validation/margin-accounts.js +5 -5
  30. package/dist/validation/market.d.ts +7 -0
  31. package/dist/validation/market.js +4 -0
  32. package/dist/validation/rfq.d.ts +109 -0
  33. package/dist/validation/rfq.js +120 -0
  34. package/dist/validation/trading.d.ts +24 -0
  35. package/dist/validation/trading.js +55 -42
  36. package/dist/websocket/base.d.ts +47 -11
  37. package/dist/websocket/client.d.ts +51 -4
  38. package/dist/websocket/depth.d.ts +142 -0
  39. package/dist/websocket/depth.js +13 -0
  40. package/dist/websocket/events/index.d.ts +2 -0
  41. package/dist/websocket/events/index.js +2 -0
  42. package/dist/websocket/events/orderbook-events.d.ts +41 -1
  43. package/dist/websocket/events/rfq-events.d.ts +116 -0
  44. package/dist/websocket/events/rfq-events.js +15 -0
  45. package/dist/websocket/events/rfq-trade-events.d.ts +28 -0
  46. package/dist/websocket/events/rfq-trade-events.js +6 -0
  47. package/dist/websocket/events/trade-events.d.ts +53 -0
  48. package/dist/websocket/index.d.ts +1 -0
  49. package/dist/websocket/index.js +1 -0
  50. package/dist/websocket/snapshots.d.ts +23 -1
  51. package/dist/wire/operations.d.ts +1 -1
  52. package/dist/wire/operations.js +28 -0
  53. package/dist/wire/schema.d.ts +5372 -2040
  54. package/package.json +2 -2
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Market-data depth and BBO types (0XM-3551).
3
+ *
4
+ * The `depth:<tradingPairId>:<SPOT|MARGIN>` and `bbo:<tradingPairId>:<SPOT|MARGIN>`
5
+ * WebSocket channels carry the market-data service's sequenced book: a
6
+ * subscribe-time snapshot, then live frames linked by `bookSeq` /
7
+ * `prevBookSeq`. The SDK's `ws.depth` and `ws.bbo` helpers keep the local
8
+ * state for you; the frame shapes are exported for callers that need them.
9
+ *
10
+ * Sequence numbers are durable-log positions (u64). They are surfaced as
11
+ * decimal strings, since a u64 can exceed `Number.MAX_SAFE_INTEGER`; compare
12
+ * them with `BigInt`.
13
+ */
14
+ import type { TradingMode } from "../trading";
15
+ /** One price level, with its absolute (not incremental) values. */
16
+ export interface DepthLevel {
17
+ /** Price, a decimal string. */
18
+ price: string;
19
+ /** Resting quantity at this price, a decimal string. */
20
+ quantity: string;
21
+ /** Number of resting orders at this price. */
22
+ orderCount: number;
23
+ }
24
+ /**
25
+ * The `depth` channel's subscribe-time snapshot: up to 1000 levels per side,
26
+ * best first, exact as of `bookSeq`.
27
+ */
28
+ export interface DepthSnapshot {
29
+ tradingPairId: string;
30
+ tradingMode: TradingMode | (string & {});
31
+ /** The durable-log sequence the snapshot is exact as of (u64, decimal string). */
32
+ bookSeq: string;
33
+ bids: DepthLevel[];
34
+ asks: DepthLevel[];
35
+ /** Every bid level is in `bids`; when false, levels below the last one are unknown. */
36
+ bidsComplete: boolean;
37
+ /** Every ask level is in `asks`; when false, levels above the last one are unknown. */
38
+ asksComplete: boolean;
39
+ }
40
+ /**
41
+ * A live `depth` frame: only the levels that changed since `prevBookSeq`,
42
+ * each with its absolute value at `bookSeq`. A quantity of `"0"` (order
43
+ * count 0) removes the level.
44
+ */
45
+ export interface DepthDelta {
46
+ tradingPairId: string;
47
+ tradingMode: TradingMode | (string & {});
48
+ /** The durable-log sequence of the last change this frame includes. */
49
+ bookSeq: string;
50
+ /** The `bookSeq` this frame continues from. */
51
+ prevBookSeq: string;
52
+ /** The durable-log timestamp of the step at `bookSeq`, in milliseconds. */
53
+ timestampMs: number;
54
+ bids: DepthLevel[];
55
+ asks: DepthLevel[];
56
+ /** Set while the publisher lags the durable log. */
57
+ stale: boolean;
58
+ }
59
+ /** The local book `ws.depth` maintains and hands to its listener. */
60
+ export interface DepthBook {
61
+ tradingPairId: string;
62
+ tradingMode: TradingMode | (string & {});
63
+ /** The sequence the book is current as of (u64, decimal string). */
64
+ bookSeq: string;
65
+ /** Bids, best (highest) first. */
66
+ bids: DepthLevel[];
67
+ /** Asks, best (lowest) first. */
68
+ asks: DepthLevel[];
69
+ /**
70
+ * Every bid level is known. When false, the book holds only levels at or
71
+ * above the snapshot's deepest bid: a level below it that a removal would
72
+ * promote stays unknown until the next snapshot.
73
+ */
74
+ bidsComplete: boolean;
75
+ /** Every ask level is known (see `bidsComplete`). */
76
+ asksComplete: boolean;
77
+ /** The latest applied frame was published while the service lagged. */
78
+ stale: boolean;
79
+ /** Durable-log time of the latest applied frame; absent right after a snapshot. */
80
+ timestampMs?: number;
81
+ }
82
+ /** The `bbo` channel's subscribe-time snapshot. An empty side is `null`. */
83
+ export interface BboSnapshot {
84
+ tradingPairId: string;
85
+ tradingMode: TradingMode | (string & {});
86
+ bookSeq: string;
87
+ bestBid: string | null;
88
+ /** Quantity resting at `bestBid`. */
89
+ bidQty: string | null;
90
+ bestAsk: string | null;
91
+ /** Quantity resting at `bestAsk`. */
92
+ askQty: string | null;
93
+ }
94
+ /** A live `bbo` frame. */
95
+ export interface BboEvent extends BboSnapshot {
96
+ prevBookSeq: string;
97
+ timestampMs: number;
98
+ stale: boolean;
99
+ }
100
+ /** The top of book `ws.bbo` maintains and hands to its listener. */
101
+ export interface Bbo extends BboSnapshot {
102
+ /** The latest applied frame was published while the service lagged. */
103
+ stale: boolean;
104
+ /** Durable-log time of the latest applied frame; absent right after a snapshot. */
105
+ timestampMs?: number;
106
+ }
107
+ /** Why a local book was discarded and is being rebuilt from a new snapshot. */
108
+ export type LocalBookResyncReason =
109
+ /** A frame did not link to the book (a lost frame), or could not be read. */
110
+ "gap"
111
+ /**
112
+ * The server could not serve a snapshot (`SNAPSHOT_UNAVAILABLE`; it retries
113
+ * and sends one when the book heals), or the one it sent could not be read.
114
+ */
115
+ | "snapshot_unavailable"
116
+ /**
117
+ * A side whose snapshot was incomplete has thinned below half its snapshot
118
+ * depth: the levels beyond its boundary are unknown, so a fresh snapshot is
119
+ * taken.
120
+ */
121
+ | "truncated"
122
+ /** The connection dropped; the book is rebuilt from the snapshot the reconnect brings. */
123
+ | "disconnected";
124
+ /** A channel-level error the server sent for a `depth` / `bbo` subscription. */
125
+ export interface LocalBookError {
126
+ /** The server's error code, e.g. `INVALID_SUBSCRIPTION`. */
127
+ code: string;
128
+ message: string;
129
+ }
130
+ /** Options for `ws.depth` and `ws.bbo`. */
131
+ export interface LocalBookOptions {
132
+ /**
133
+ * Called when the local state is discarded to be rebuilt; the listener is
134
+ * called again once the new snapshot arrives.
135
+ */
136
+ onResync?: (reason: LocalBookResyncReason) => void;
137
+ /**
138
+ * Called when the server rejects the subscription with an error other than
139
+ * `SNAPSHOT_UNAVAILABLE` (which is retried): the book will not arrive.
140
+ */
141
+ onError?: (error: LocalBookError) => void;
142
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Market-data depth and BBO types (0XM-3551).
3
+ *
4
+ * The `depth:<tradingPairId>:<SPOT|MARGIN>` and `bbo:<tradingPairId>:<SPOT|MARGIN>`
5
+ * WebSocket channels carry the market-data service's sequenced book: a
6
+ * subscribe-time snapshot, then live frames linked by `bookSeq` /
7
+ * `prevBookSeq`. The SDK's `ws.depth` and `ws.bbo` helpers keep the local
8
+ * state for you; the frame shapes are exported for callers that need them.
9
+ *
10
+ * Sequence numbers are durable-log positions (u64). They are surfaced as
11
+ * decimal strings, since a u64 can exceed `Number.MAX_SAFE_INTEGER`; compare
12
+ * them with `BigInt`.
13
+ */
@@ -12,5 +12,7 @@ export * from "./orderbook-events";
12
12
  export * from "./orders-events";
13
13
  export * from "./position-events";
14
14
  export * from "./position-valuation-events";
15
+ export * from "./rfq-events";
16
+ export * from "./rfq-trade-events";
15
17
  export * from "./trade-events";
16
18
  export * from "./twap-order-events";
@@ -12,5 +12,7 @@ export * from "./orderbook-events";
12
12
  export * from "./orders-events";
13
13
  export * from "./position-events";
14
14
  export * from "./position-valuation-events";
15
+ export * from "./rfq-events";
16
+ export * from "./rfq-trade-events";
15
17
  export * from "./trade-events";
16
18
  export * from "./twap-order-events";
@@ -67,6 +67,46 @@ export interface OrderbookEvent {
67
67
  quoteDecimals: number;
68
68
  /** Event timestamp */
69
69
  timestamp: string;
70
- /** Sequence number for ordering */
70
+ /**
71
+ * Sequence number for ordering. Under the default engine source it is the
72
+ * matching engine's own frame counter; when the server renders the channel
73
+ * from market-data's book (`WS_ORDERBOOK_SOURCE=market_data`) it equals
74
+ * `bookSeq`. The two are different number spaces: do not compare a value
75
+ * from one source with a value from the other (a reconnect or deploy can
76
+ * switch sources). For exact comparison under the market-data source use
77
+ * `bookSeq`, a u64 decimal string.
78
+ */
71
79
  sequence: number;
80
+ /**
81
+ * Durable-log sequence this book is exact as of, as a decimal string
82
+ * (a u64 can exceed `Number.MAX_SAFE_INTEGER`; compare with `BigInt`).
83
+ *
84
+ * Present on a REST snapshot of more than 100 levels: a point-in-time
85
+ * read and staleness check, not a base for applying depth deltas (the REST
86
+ * snapshot may come from a different market-data replica than the stream;
87
+ * for a live local book use `sdk.ws.depth`, which hands off from the
88
+ * `depth` channel's own snapshot). A side that came back with as many
89
+ * levels as requested may hold more.
90
+ *
91
+ * Also present on every `orderbook` WebSocket frame and snapshot row when
92
+ * the server renders the channel from market-data's book
93
+ * (`WS_ORDERBOOK_SOURCE=market_data`): the same watermark the `depth`
94
+ * channel carries, identical on every server. Each such frame restates the
95
+ * book, so per subscription (one channel string: pair, mode, magnitude and
96
+ * quotation) a frame whose `bookSeq` is not past the last one applied to it
97
+ * can be ignored. The watermark is the book's, shared by every magnitude
98
+ * and quotation of it: a newly subscribed variant starts from its own
99
+ * snapshot even when its `bookSeq` equals another variant's.
100
+ */
101
+ bookSeq?: string;
102
+ /**
103
+ * On an `orderbook` WebSocket frame rendered from market-data's book
104
+ * (`WS_ORDERBOOK_SOURCE=market_data`): the `bookSeq` of the previous frame
105
+ * this server rendered for the book, `"0"` before the first, as a decimal
106
+ * string. A `prevBookSeq` at or below the `bookSeq` you hold means no
107
+ * rendered state was skipped. Informational only: every frame restates the
108
+ * whole book, so nothing needs to be re-requested when it is higher.
109
+ * Absent under the engine source and on REST snapshots.
110
+ */
111
+ prevBookSeq?: string;
72
112
  }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * RFQ WebSocket Event Types
3
+ *
4
+ * Pushes on the authenticated `rfq` channel (RFQ-05): new RFQs to quote as a
5
+ * maker, and the RFQs your account is party to. Every frame's `data` is one
6
+ * push, tagged on the wire by `type`.
7
+ *
8
+ * Unlike the other channels the wire keys are camelCase already, so these
9
+ * types carry them as sent, with one rename: the wire's `type` tag is
10
+ * `eventType` here, the discriminator every other channel's events use.
11
+ * Decimals are exact strings; versions,
12
+ * sequences, fee rates and `*Ms` times are numbers (times are Unix
13
+ * milliseconds). A push is a notification, not authority: if you miss one,
14
+ * read the RFQ's authoritative status (`getRfq`).
15
+ */
16
+ import type { RfqProduct, RfqSide } from "../../validation/rfq";
17
+ /** The side a maker quotes: `BID` buys from the taker, `ASK` sells to it. */
18
+ export type RfqQuoteSide = "BID" | "ASK";
19
+ /** The state an RFQ ended in. */
20
+ export type RfqTerminalState = "SETTLED" | "CANCELLED" | "EXPIRED" | "REJECTED";
21
+ /**
22
+ * A new RFQ you can quote, sent to every account RFQ is enabled for except the
23
+ * requester's own wallet family. It never names the requester.
24
+ */
25
+ export interface RfqRequestedEvent {
26
+ eventType: "RfqRequested";
27
+ rfqId: string;
28
+ tradingPairId: string;
29
+ product: RfqProduct | (string & {});
30
+ /** The requested base quantity; not a guaranteed fill. */
31
+ quantity: string;
32
+ /** The taker's side on a one-way request; absent on a two-way request. */
33
+ oneWaySide?: RfqSide | (string & {});
34
+ /**
35
+ * The side to quote on a one-way request, the one that fills the taker:
36
+ * `ASK` when it buys, `BID` when it sells. A quote on the other side is
37
+ * refused. Absent on a two-way request, where you may quote either or both.
38
+ */
39
+ quoteSide?: RfqQuoteSide | (string & {});
40
+ /** No new quotes after this time. */
41
+ newQuoteCutoffAtMs: number;
42
+ }
43
+ /** One side of the taker's view: the allocation that would fill the quantity. */
44
+ export interface RfqSideViewEventData {
45
+ /** All-in volume-weighted price, the taker's fee included. */
46
+ vwap: string;
47
+ availableQuantity: string;
48
+ }
49
+ /** The taker's view of the quotes. No maker identity or individual quote. */
50
+ export interface RfqViewEventData {
51
+ /** Opaque token to hand back unchanged when you accept; compare for equality only. */
52
+ viewVersion: number;
53
+ /** Makers buying: you can sell into it. */
54
+ bid?: RfqSideViewEventData;
55
+ /** Makers selling: you can buy from it. */
56
+ ask?: RfqSideViewEventData;
57
+ asOfMs: number;
58
+ /** Pushes can arrive out of order: keep the view with the highest `sequence`. */
59
+ sequence: number;
60
+ }
61
+ /** To the taker: its view moved. */
62
+ export interface RfqViewEvent {
63
+ eventType: "RfqView";
64
+ rfqId: string;
65
+ view: RfqViewEventData;
66
+ }
67
+ /** A selected maker's own part of an acceptance; never another maker's or the taker's fee. */
68
+ export interface RfqSelectionEventData {
69
+ /** Names the acceptance in your last-look response. */
70
+ acceptanceId: string;
71
+ /** The taker's side. */
72
+ takerSide: RfqSide | (string & {});
73
+ makerAccountId: string;
74
+ quoteId: string;
75
+ quoteVersion: number;
76
+ /** The quantity selected from your quote. */
77
+ quantity: string;
78
+ /** Your frozen quote terms on the side you fill. */
79
+ price: string;
80
+ capacity: string;
81
+ /** Your own tier rate in centi-bps, frozen at acceptance; negative for a rebate. */
82
+ makerFeeCbps: number;
83
+ /** Reject or improve before this time; silence executes. */
84
+ lastLookDeadlineAtMs: number;
85
+ }
86
+ /** To one selected maker: its last-look prompt. */
87
+ export interface RfqSelectedEvent {
88
+ eventType: "RfqSelected";
89
+ rfqId: string;
90
+ selection: RfqSelectionEventData;
91
+ }
92
+ /** One executed child as the taker sees it: no maker. */
93
+ export interface RfqFillEventData {
94
+ executionId: string;
95
+ price: string;
96
+ quantity: string;
97
+ fee: string;
98
+ }
99
+ /** How an RFQ ended, for its taker. */
100
+ export interface RfqOutcomeEventData {
101
+ executedQuantity: string;
102
+ unfilledQuantity: string;
103
+ /** Gross VWAP of the fills; absent when nothing filled. */
104
+ vwap?: string;
105
+ fills: RfqFillEventData[];
106
+ }
107
+ /** To the taker and every maker that quoted: the RFQ ended. */
108
+ export interface RfqOutcomeEvent {
109
+ eventType: "RfqOutcome";
110
+ rfqId: string;
111
+ state: RfqTerminalState | (string & {});
112
+ /** The taker's push only; makers get `state` alone. */
113
+ outcome?: RfqOutcomeEventData;
114
+ }
115
+ /** Any `rfq` channel push; narrow on `eventType`. */
116
+ export type RfqEvent = RfqRequestedEvent | RfqViewEvent | RfqSelectedEvent | RfqOutcomeEvent;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * RFQ WebSocket Event Types
3
+ *
4
+ * Pushes on the authenticated `rfq` channel (RFQ-05): new RFQs to quote as a
5
+ * maker, and the RFQs your account is party to. Every frame's `data` is one
6
+ * push, tagged on the wire by `type`.
7
+ *
8
+ * Unlike the other channels the wire keys are camelCase already, so these
9
+ * types carry them as sent, with one rename: the wire's `type` tag is
10
+ * `eventType` here, the discriminator every other channel's events use.
11
+ * Decimals are exact strings; versions,
12
+ * sequences, fee rates and `*Ms` times are numbers (times are Unix
13
+ * milliseconds). A push is a notification, not authority: if you miss one,
14
+ * read the RFQ's authoritative status (`getRfq`).
15
+ */
@@ -0,0 +1,28 @@
1
+ /**
2
+ * RFQ Trade WebSocket Event Types
3
+ *
4
+ * Public, anonymised prints of RFQ block fills on `rfq_trades:<pair>`
5
+ * (RFQ-23). RFQ fills never print on the order-book `trades` channel.
6
+ */
7
+ import type { TradingMode } from "../../trading";
8
+ /** The public facts of one RFQ fill: no account, counterparty, quote or RFQ id. */
9
+ export interface RfqTradeEventData {
10
+ /** Deduplicates redeliveries */
11
+ executionId: string;
12
+ /** Execution price, exact decimal string */
13
+ price: string;
14
+ /** Executed base quantity, exact decimal string */
15
+ quantity: string;
16
+ /** When the fill executed (ISO 8601) */
17
+ executedAt: string;
18
+ /** When the print was published (ISO 8601) */
19
+ publishedAt: string;
20
+ }
21
+ /** One RFQ block print. */
22
+ export interface RfqTradeEvent {
23
+ /** Trading pair ID (UUID) */
24
+ tradingPairId: string;
25
+ /** Trading mode (SPOT or MARGIN) */
26
+ tradingMode: TradingMode | (string & {});
27
+ data: RfqTradeEventData;
28
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * RFQ Trade WebSocket Event Types
3
+ *
4
+ * Public, anonymised prints of RFQ block fills on `rfq_trades:<pair>`
5
+ * (RFQ-23). RFQ fills never print on the order-book `trades` channel.
6
+ */
@@ -18,6 +18,28 @@ export interface TradeEventData {
18
18
  makerSide: OrderSide | (string & {});
19
19
  /** Timestamp when the trade was executed (ISO 8601) */
20
20
  executedAt: string;
21
+ /**
22
+ * How the trade executed: CLOB (on the order book) or RFQ (a request-for-quote
23
+ * block fill). Set on REST trade reads; the WebSocket `trades` channel carries
24
+ * order-book trades only.
25
+ */
26
+ executionSource?: "CLOB" | "RFQ" | (string & {});
27
+ /** Maker wallet address. Set on REST trade reads; WebSocket frames omit it. */
28
+ makerAddress?: string;
29
+ /** Taker wallet address. Set on REST trade reads; WebSocket frames omit it. */
30
+ takerAddress?: string;
31
+ /**
32
+ * Monaco's taker fee, in raw quote-asset units (the asset's smallest unit),
33
+ * excluding the frontend's builder fee. Set on REST trade reads when recorded.
34
+ */
35
+ takerFeeRaw?: string;
36
+ /**
37
+ * Executed notional, in raw quote-asset units (the asset's smallest unit).
38
+ * Set on REST trade reads when recorded.
39
+ */
40
+ quoteVolumeRaw?: string;
41
+ /** Application (frontend) that placed the taker order; trade volume and fees are attributed to it. REST trade reads only. */
42
+ takerApplicationId?: string;
21
43
  }
22
44
  /**
23
45
  * Trade event emitted when a trade is executed
@@ -31,4 +53,35 @@ export interface TradeEvent {
31
53
  tradingMode: TradingMode | (string & {});
32
54
  /** Trade execution data */
33
55
  data: TradeEventData;
56
+ /**
57
+ * The trade's position in its pair's chain: the durable-log sequence of the
58
+ * step that executed it. Present only when the server sources trades from
59
+ * market-data (`WS_TRADES_SOURCE=market_data`); absent otherwise.
60
+ */
61
+ seq?: number;
62
+ /** The trade's index among its step's fills; with `seq`, the trade's key. Same presence as `seq`. */
63
+ matchIndex?: number;
64
+ /** `seq` of the previous trade on the pair; 0 when the publisher knows none. Same presence as `seq`. */
65
+ prevSeq?: number;
66
+ /** `matchIndex` of the previous trade on the pair; `null` when the publisher knows none. Same presence as `seq`. */
67
+ prevMatchIndex?: number | null;
68
+ }
69
+ /**
70
+ * A sequenced trade `ws.trades` received that did not link to the last trade
71
+ * it delivered (or the snapshot cursor). The server forwards only linking
72
+ * trades, so this means a frame was lost or unreadable on the client; the
73
+ * trade is still delivered and the chain continues from it.
74
+ */
75
+ export interface TradeGap {
76
+ tradingPairId: string;
77
+ /** The key of the last trade delivered, or the snapshot cursor. */
78
+ expected: {
79
+ seq: number;
80
+ matchIndex: number;
81
+ };
82
+ /** The received trade's link as sent; `null` where the frame carried none. */
83
+ received: {
84
+ prevSeq: number | null;
85
+ prevMatchIndex: number | null;
86
+ };
34
87
  }
@@ -6,5 +6,6 @@
6
6
  export * from "./base";
7
7
  export * from "./client";
8
8
  export * from "./clients/orderbook-client";
9
+ export * from "./depth";
9
10
  export * from "./events";
10
11
  export * from "./snapshots";
@@ -6,5 +6,6 @@
6
6
  export * from "./base";
7
7
  export * from "./client";
8
8
  export * from "./clients/orderbook-client";
9
+ export * from "./depth";
9
10
  export * from "./events";
10
11
  export * from "./snapshots";
@@ -51,7 +51,29 @@ import type { OrderOrigin } from "./events/orders-events";
51
51
  * already holds a second subscriber's callback waits for the next reconnect;
52
52
  * see `MonacoWebSocket` for the full rule.
53
53
  */
54
- export type SnapshotHandler<T> = (items: T[]) => void;
54
+ export type SnapshotHandler<T> = (items: T[], meta?: SnapshotMeta) => void;
55
+ /**
56
+ * The trade a `trades:<pair>` snapshot is current as of: trades at or below
57
+ * this key, compared as `(seq, matchIndex)`, are already reflected, and the
58
+ * next live trade links to it exactly.
59
+ */
60
+ export interface TradeSnapshotCursor {
61
+ seq: number;
62
+ matchIndex: number;
63
+ }
64
+ /**
65
+ * What a `Snapshot` frame carries beside its rows. Today only the
66
+ * `trades:<pair>` snapshot uses it, and only when the server sources trades
67
+ * from market-data.
68
+ */
69
+ export interface SnapshotMeta {
70
+ /**
71
+ * `trades:<pair>` only: the trade the live frames continue from, or `null`
72
+ * when nothing was applied since the server seeded the pair (the first live
73
+ * trade is then the base). Absent under the default engine source.
74
+ */
75
+ cursor?: TradeSnapshotCursor | null;
76
+ }
55
77
  /**
56
78
  * One candle in an `ohlcv` channel snapshot: the live frame's candlestick
57
79
  * without `s`.
@@ -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_fee_schedule", "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_region_status", "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", "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 ["accept_rfq", "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_all_after", "cancel_conditional_order", "cancel_order", "cancel_rfq", "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_rfq", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_builder", "get_builder_series", "get_builder_totals", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_fee_schedule", "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_protocol_series", "get_protocol_totals", "get_pulse", "get_region_status", "get_rewards_balance", "get_rfq", "get_rfq_capabilities", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_sweeper_deposit_status", "get_token_custody", "get_trade_by_id", "get_trade_flow", "get_trader_code_info", "get_trader_metrics", "get_trades", "get_trading_pair_by_id", "get_treasury_net_fees", "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_wallet_summary", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_all_liquidation_events", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_builder_leaderboard", "list_buildercode_payouts", "list_builders", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_insurance_funds", "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_market_volumes", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_sweeper_deposits", "list_token_custody", "list_trades", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "list_vault_deposits", "list_vault_withdrawals", "list_wallet_leaderboard", "list_wallet_liquidations", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "request_invite_codes", "respond_rfq_last_look", "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", "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", "upsert_rfq_quote", "verify_signature", "withdraw_rfq_quote"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -11,6 +11,7 @@
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
13
  export const OPERATION_IDS = [
14
+ "accept_rfq",
14
15
  "add_follow_position_margin",
15
16
  "attach_position_tp_sl",
16
17
  "batch_cancel_all",
@@ -19,8 +20,10 @@ export const OPERATION_IDS = [
19
20
  "batch_close_all_positions",
20
21
  "batch_create_orders",
21
22
  "batch_replace_orders",
23
+ "cancel_all_after",
22
24
  "cancel_conditional_order",
23
25
  "cancel_order",
26
+ "cancel_rfq",
24
27
  "cancel_twap_order",
25
28
  "check_trader_code_availability",
26
29
  "claim_buildercode_rewards",
@@ -33,6 +36,7 @@ export const OPERATION_IDS = [
33
36
  "create_challenge",
34
37
  "create_delegated_session",
35
38
  "create_order",
39
+ "create_rfq",
36
40
  "create_sub_account",
37
41
  "create_sub_account_limit",
38
42
  "create_twap_order",
@@ -40,6 +44,9 @@ export const OPERATION_IDS = [
40
44
  "get_application_config",
41
45
  "get_application_stats",
42
46
  "get_available_collateral",
47
+ "get_builder",
48
+ "get_builder_series",
49
+ "get_builder_totals",
43
50
  "get_buildercode_payout_summary",
44
51
  "get_buildercode_rewards_balance",
45
52
  "get_buildercodes_config",
@@ -82,20 +89,26 @@ export const OPERATION_IDS = [
82
89
  "get_position",
83
90
  "get_position_pnl_history",
84
91
  "get_position_risk",
92
+ "get_protocol_series",
93
+ "get_protocol_totals",
85
94
  "get_pulse",
86
95
  "get_region_status",
87
96
  "get_rewards_balance",
97
+ "get_rfq",
98
+ "get_rfq_capabilities",
88
99
  "get_screener",
89
100
  "get_self_trade_prevention_default",
90
101
  "get_sub_account_limits",
91
102
  "get_sweeper_chains",
92
103
  "get_sweeper_deposit_status",
104
+ "get_token_custody",
93
105
  "get_trade_by_id",
94
106
  "get_trade_flow",
95
107
  "get_trader_code_info",
96
108
  "get_trader_metrics",
97
109
  "get_trades",
98
110
  "get_trading_pair_by_id",
111
+ "get_treasury_net_fees",
99
112
  "get_twap_order",
100
113
  "get_twap_order_tca",
101
114
  "get_user_balance_by_asset",
@@ -103,22 +116,27 @@ export const OPERATION_IDS = [
103
116
  "get_user_movements",
104
117
  "get_user_profile",
105
118
  "get_user_trades",
119
+ "get_wallet_summary",
106
120
  "get_withdrawal",
107
121
  "health_check",
108
122
  "initiate_withdrawal",
109
123
  "list_all_funding_history",
124
+ "list_all_liquidation_events",
110
125
  "list_application_balances",
111
126
  "list_application_movements",
112
127
  "list_application_orders",
113
128
  "list_application_users",
114
129
  "list_builder_fee_changes",
130
+ "list_builder_leaderboard",
115
131
  "list_buildercode_payouts",
132
+ "list_builders",
116
133
  "list_conditional_orders",
117
134
  "list_delegated_agent_owners",
118
135
  "list_delegated_agents",
119
136
  "list_follow_leader_positions",
120
137
  "list_funding_history",
121
138
  "list_funding_payments",
139
+ "list_insurance_funds",
122
140
  "list_invite_codes",
123
141
  "list_lead_trader_closed_trades",
124
142
  "list_lead_trader_open_positions",
@@ -126,6 +144,7 @@ export const OPERATION_IDS = [
126
144
  "list_liquidation_events",
127
145
  "list_managed_market_assignments",
128
146
  "list_margin_accounts",
147
+ "list_market_volumes",
129
148
  "list_my_followers",
130
149
  "list_my_follows",
131
150
  "list_pending_withdrawals",
@@ -133,9 +152,15 @@ export const OPERATION_IDS = [
133
152
  "list_positions",
134
153
  "list_sub_accounts_with_balances",
135
154
  "list_sweeper_deposits",
155
+ "list_token_custody",
156
+ "list_trades",
136
157
  "list_trading_pairs",
137
158
  "list_twap_order_slices",
138
159
  "list_twap_orders",
160
+ "list_vault_deposits",
161
+ "list_vault_withdrawals",
162
+ "list_wallet_leaderboard",
163
+ "list_wallet_liquidations",
139
164
  "mint_tokens",
140
165
  "preview_follow",
141
166
  "refresh_managed_market_quotes",
@@ -143,6 +168,7 @@ export const OPERATION_IDS = [
143
168
  "register_deposit_address",
144
169
  "replace_order",
145
170
  "request_invite_codes",
171
+ "respond_rfq_last_look",
146
172
  "revoke_delegated_agent",
147
173
  "revoke_session",
148
174
  "set_builder_fee",
@@ -166,5 +192,7 @@ export const OPERATION_IDS = [
166
192
  "upsert_delegated_agent",
167
193
  "upsert_follow",
168
194
  "upsert_lead_trader",
195
+ "upsert_rfq_quote",
169
196
  "verify_signature",
197
+ "withdraw_rfq_quote",
170
198
  ];