@0xmonaco/types 1.0.67 → 1.0.70

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 (42) hide show
  1. package/dist/buildercodes/index.d.ts +4 -4
  2. package/dist/buildercodes/index.js +1 -1
  3. package/dist/buildercodes/responses.d.ts +45 -1
  4. package/dist/buildercodes/responses.js +25 -1
  5. package/dist/copy-trading/index.d.ts +95 -0
  6. package/dist/copy-trading/index.js +8 -0
  7. package/dist/copy-trading/responses.d.ts +373 -0
  8. package/dist/copy-trading/responses.js +268 -0
  9. package/dist/delegated-agents/index.d.ts +7 -0
  10. package/dist/faucet/index.d.ts +3 -2
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/margin-accounts/index.d.ts +18 -0
  14. package/dist/portfolio/index.d.ts +12 -0
  15. package/dist/positions/index.d.ts +8 -2
  16. package/dist/profile/index.d.ts +44 -41
  17. package/dist/sdk/index.d.ts +4 -1
  18. package/dist/trading/orders.d.ts +6 -0
  19. package/dist/trading/responses.d.ts +10 -57
  20. package/dist/validation/copy-trading.d.ts +113 -0
  21. package/dist/validation/copy-trading.js +141 -0
  22. package/dist/validation/index.d.ts +1 -0
  23. package/dist/validation/index.js +1 -0
  24. package/dist/validation/positions.d.ts +1 -1
  25. package/dist/validation/profile.d.ts +1 -1
  26. package/dist/validation/profile.js +8 -16
  27. package/dist/validation/trading.d.ts +4 -5
  28. package/dist/validation/trading.js +25 -50
  29. package/dist/websocket/client.d.ts +9 -1
  30. package/dist/websocket/events/conditional-order-events.d.ts +34 -14
  31. package/dist/websocket/events/copy-events.d.ts +133 -0
  32. package/dist/websocket/events/copy-events.js +17 -0
  33. package/dist/websocket/events/index.d.ts +1 -0
  34. package/dist/websocket/events/index.js +1 -0
  35. package/dist/websocket/events/orders-events.d.ts +125 -18
  36. package/dist/websocket/snapshots.d.ts +32 -3
  37. package/dist/whitelist/index.d.ts +5 -16
  38. package/dist/whitelist/index.js +2 -8
  39. package/dist/wire/operations.d.ts +1 -1
  40. package/dist/wire/operations.js +13 -0
  41. package/dist/wire/schema.d.ts +1851 -320
  42. package/package.json +2 -2
@@ -8,12 +8,32 @@ import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalO
8
8
  * alias is documentation and a narrowing aid only. Match on it with a default
9
9
  * branch; see `ConditionalOrderEventData.reason`.
10
10
  *
11
+ * Every transition of a conditional order sends exactly one update:
12
+ *
13
+ * - `created`: the order was placed (`ACTIVE`, or `PENDING_PARENT` while it
14
+ * waits on an entry order).
15
+ * - `activated`: a `PENDING_PARENT` order went `ACTIVE` when its entry order
16
+ * filled as a resting maker.
17
+ * - `triggered`: the trigger fired and placed its close; `state` is
18
+ * `TRIGGERED` and `triggeredOrderId` / `triggeredAt` name that close.
19
+ * - `oco_cancelled`: cancelled because its linked sibling triggered.
20
+ * - `parent_cancelled`: a `PENDING_PARENT` order cancelled because its entry
21
+ * order was cancelled, expired, replaced away or swept.
22
+ * - `position_closed`: cancelled because its position closed.
23
+ * - `cancelled`: any other cancel — a user cancel, a new full-close order
24
+ * superseding it, or a trailing stop refused because its position already
25
+ * has one (`failureReason` says so).
26
+ * - `reparented`: a `PENDING_PARENT` order moved onto the entry order's
27
+ * replacement; `parentOrderId` names the replacement, `state` is unchanged.
28
+ * - `failed`: the trigger fired but its close could not be placed.
29
+ * - `expired`: the trigger found its position no longer open.
30
+ *
11
31
  * A `TRAILING_STOP` row adds two: `armed` when tracking begins (its
12
32
  * `activationPrice` was reached, or immediately when none was set) and
13
33
  * `ratcheted` on every move of its trigger, carrying the new `triggerPrice`
14
34
  * and the `watermarkPrice` it was derived from (0XM-2827).
15
35
  */
16
- export type ConditionalOrderEventReason = "created" | "activated" | "cancelled" | "parent_cancelled" | "triggered" | "failed" | "oco_cancelled" | "armed" | "ratcheted";
36
+ export type ConditionalOrderEventReason = "created" | "activated" | "cancelled" | "parent_cancelled" | "position_closed" | "reparented" | "triggered" | "failed" | "expired" | "oco_cancelled" | "armed" | "ratcheted";
17
37
  /**
18
38
  * A conditional (TP/SL) order's current state.
19
39
  *
@@ -81,6 +101,10 @@ export interface ConditionalOrderEventData {
81
101
  */
82
102
  timeInForce?: TimeInForce | (string & {});
83
103
  state: ConditionalOrderState | (string & {});
104
+ /**
105
+ * The close order the trigger placed. Set from the `triggered` update on,
106
+ * together with `triggeredAt`. Wire: `triggered_order_id`.
107
+ */
84
108
  triggeredOrderId?: string;
85
109
  triggeredAt?: string;
86
110
  activatedAt?: string;
@@ -130,21 +154,17 @@ export interface ConditionalOrderEventData {
130
154
  * the sequencer step that wrote it (0XM-2440). A strictly higher value is
131
155
  * strictly newer state for that conditional order.
132
156
  *
133
- * Present on REST reads and on the subscribe-time `conditional_orders`
134
- * snapshot frame. **Absent on live conditional events**, by design: those are
135
- * emitted from a model captured before the sequencer acted, so the only value
136
- * available there is the one the row held *before* the change being
137
- * announced — a client merging on `>=` would let a snapshot read at that
138
- * version win the tie and undo the transition.
139
- *
140
- * So seed conditional state from the snapshot and REST, comparing with
141
- * `snapshot.version >= local.version`, and apply live events as state without
142
- * ranking them. `>=` rather than `>`: one sequencer step can write several
143
- * conditional rows (a trigger writes the triggered row and cancels its OCO
144
- * sibling), so equal means "same step", not identical state.
157
+ * Present on live updates, on the subscribe-time `conditional_orders`
158
+ * snapshot frame and on REST reads, always the version of the row the
159
+ * update describes. When both sides carry one, merge with `incoming.version
160
+ * >= local.version`: `>=` rather than `>`, because one step can write several
161
+ * conditional rows at one version (a trigger writes the triggered row and
162
+ * cancels its OCO sibling), so equal means "same step", not identical state.
145
163
  *
146
164
  * Absent means unknown — a row last written before the field existed — never
147
- * zero. Wire: `version`.
165
+ * zero, so never compare it numerically (`42 >= undefined` is false). A
166
+ * versioned row supersedes an unversioned one; between two unversioned rows,
167
+ * compare `updatedAt`. Wire: `version`.
148
168
  */
149
169
  version?: number;
150
170
  }
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Copy trading WebSocket event types (owner-private `copy` channel, 0XM-2848).
3
+ *
4
+ * The channel streams to the FOLLOWER: every change to one of your copy
5
+ * relationships (follows), and every leader fill a relationship could not
6
+ * mirror. A leader receives nothing on this channel.
7
+ *
8
+ * Field names mirror the backend payloads (snake_case on the wire, camelCased
9
+ * by the client). The SDK parser normalizes explicit `null` values to absent,
10
+ * so nullable wire fields are optional here.
11
+ *
12
+ * **The value unions below are the values the server sends today, not a
13
+ * runtime guarantee**, which is why each value field is typed
14
+ * `Union | (string & {})`: `@0xmonaco/core` validates no value field, so an
15
+ * unrecognized status, policy or reason arrives as-is rather than dropping the
16
+ * update (0XM-2628). `switch` over one with a `default` branch.
17
+ */
18
+ /** Lifecycle status of a copy relationship (follow). */
19
+ export type CopyRelationshipStatus = "ACTIVE" | "CLOSE_ONLY" | "STOPPED";
20
+ /** How a follow picks the margin mode of each copied position. */
21
+ export type CopyMarginModePolicy = "FOLLOW" | "CROSS" | "ISOLATED";
22
+ /** How a follow sizes each copied order. */
23
+ export type CopySizingMode = "PROPORTIONAL" | "FIXED_MARGIN";
24
+ /** How a follow picks the leverage of each copied order. */
25
+ export type CopyLeverageMode = "FOLLOW" | "FIXED";
26
+ /** Why a follow stopped. */
27
+ export type CopyStopReason = "FOLLOWER" | "STOP_LOSS" | "SKIP_LIMIT" | "ADMIN" | "LEADER_SUSPENDED";
28
+ /**
29
+ * Why a leader fill was not mirrored. Only `INSUFFICIENT_MARGIN` advances the
30
+ * relationship's `consecutiveSkips` streak.
31
+ */
32
+ export type CopySkipReason = "INSUFFICIENT_MARGIN" | "BELOW_MIN" | "LEVERAGE_MISMATCH" | "MARKET_STATE" | "LEADER_EQUITY" | "NO_LIQUIDITY";
33
+ /**
34
+ * Why a relationship frame was sent. `snapshot` marks a subscribe-time
35
+ * baseline row; every other value names the change that produced a live
36
+ * frame.
37
+ */
38
+ export type CopyRelationshipChange = "created" | "updated" | "close_only" | "stopped" | "skip_recorded" | "reactivated" | "snapshot";
39
+ /**
40
+ * A copy relationship's full state after one sequencer step: the
41
+ * `copy_relationship_update` payload, and (with `change: "snapshot"`) each
42
+ * subscribe-time snapshot row. Every frame carries the whole row, so it
43
+ * supersedes the previous one for the same `relationshipId`; compare
44
+ * `version` to order frames for one relationship.
45
+ */
46
+ export interface CopyRelationshipEventData {
47
+ /** The follow's id — the same value as `Follow.followId` over REST */
48
+ relationshipId: string;
49
+ /** The leader's wallet address (lowercase hex) */
50
+ leaderWallet: string;
51
+ status: CopyRelationshipStatus | (string & {});
52
+ marginModePolicy: CopyMarginModePolicy | (string & {});
53
+ /** The copy account: the follow's cross risk bucket in your margin account */
54
+ copyRiskBucketId: string;
55
+ sizingMode: CopySizingMode | (string & {});
56
+ /** Margin per leader order in quote units, for `FIXED_MARGIN` */
57
+ sizingParam?: string;
58
+ leverageMode: CopyLeverageMode | (string & {});
59
+ /** Leverage for every copy, for `FIXED` */
60
+ fixedLeverage?: string;
61
+ /** Collateral allocated to the follow, in quote units */
62
+ allocation: string;
63
+ /** Copy stop-loss as a fraction of the allocation; absent when none */
64
+ slPct?: string;
65
+ /** Whether the follow copied the leader's open positions at creation */
66
+ copyExisting: boolean;
67
+ /** Markets mirrored; empty means every market the leader trades */
68
+ tradingPairIds: string[];
69
+ /**
70
+ * The relationship's realized PnL net of fees since `startedAt`, in quote
71
+ * units — the profit-share basis. This is NOT the copy risk bucket's
72
+ * balance: that bucket's `realizedPnl` is its cash balance, which also moves
73
+ * on transfers with no trade.
74
+ */
75
+ cumNetRealized: string;
76
+ /** High-water mark of `cumNetRealized` — the profit-share basis, not a balance */
77
+ hwm: string;
78
+ /** Consecutive mirrors skipped for insufficient margin */
79
+ consecutiveSkips: number;
80
+ /** When the follow started (RFC 3339) */
81
+ startedAt: string;
82
+ /** When the follow stopped (RFC 3339); absent while live */
83
+ stoppedAt?: string;
84
+ /** Why the follow stopped; absent while live */
85
+ stopReason?: CopyStopReason | (string & {});
86
+ /** Why this frame was sent */
87
+ change: CopyRelationshipChange | (string & {});
88
+ /**
89
+ * Durable-log sequence of the entry that produced this state; higher is
90
+ * newer for one relationship. Absent when unknown.
91
+ */
92
+ version?: number;
93
+ }
94
+ /**
95
+ * One leader fill a relationship did NOT mirror: the `copy_skip` payload.
96
+ * Events only; the subscribe-time snapshot carries no skips.
97
+ */
98
+ export interface CopySkipEventData {
99
+ /** The follow's id */
100
+ relationshipId: string;
101
+ /** The leader's wallet address (lowercase hex) */
102
+ leaderWallet: string;
103
+ /** The leader's trade that was not mirrored */
104
+ leaderTradeId: string;
105
+ /** The leader's order behind that trade */
106
+ leaderOrderId: string;
107
+ tradingPairId: string;
108
+ reason: CopySkipReason | (string & {});
109
+ /** The copy size the sizing step asked for before the skip, in base units */
110
+ requestedQuantity: string;
111
+ /** The relationship's streak after this skip */
112
+ consecutiveSkips: number;
113
+ /** Optional human-readable diagnostics */
114
+ detail?: string;
115
+ /** Durable-log sequence of the entry that recorded the skip, when known */
116
+ version?: number;
117
+ }
118
+ /** A `copy_relationship_update` frame. */
119
+ export interface CopyRelationshipEvent {
120
+ eventType: "copy_relationship_update";
121
+ /** The follower (you) */
122
+ userId: string;
123
+ data: CopyRelationshipEventData;
124
+ }
125
+ /** A `copy_skip` frame. */
126
+ export interface CopySkipEvent {
127
+ eventType: "copy_skip";
128
+ /** The follower (you) */
129
+ userId: string;
130
+ data: CopySkipEventData;
131
+ }
132
+ /** Any `copy` channel frame; narrow on `eventType`. */
133
+ export type CopyEvent = CopyRelationshipEvent | CopySkipEvent;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copy trading WebSocket event types (owner-private `copy` channel, 0XM-2848).
3
+ *
4
+ * The channel streams to the FOLLOWER: every change to one of your copy
5
+ * relationships (follows), and every leader fill a relationship could not
6
+ * mirror. A leader receives nothing on this channel.
7
+ *
8
+ * Field names mirror the backend payloads (snake_case on the wire, camelCased
9
+ * by the client). The SDK parser normalizes explicit `null` values to absent,
10
+ * so nullable wire fields are optional here.
11
+ *
12
+ * **The value unions below are the values the server sends today, not a
13
+ * runtime guarantee**, which is why each value field is typed
14
+ * `Union | (string & {})`: `@0xmonaco/core` validates no value field, so an
15
+ * unrecognized status, policy or reason arrives as-is rather than dropping the
16
+ * update (0XM-2628). `switch` over one with a `default` branch.
17
+ */
@@ -1,6 +1,7 @@
1
1
  export * from "./account-events";
2
2
  export * from "./balance-events";
3
3
  export * from "./conditional-order-events";
4
+ export * from "./copy-events";
4
5
  export * from "./instrument-events";
5
6
  export * from "./liquidation-events";
6
7
  export * from "./market-stats-events";
@@ -1,6 +1,7 @@
1
1
  export * from "./account-events";
2
2
  export * from "./balance-events";
3
3
  export * from "./conditional-order-events";
4
+ export * from "./copy-events";
4
5
  export * from "./instrument-events";
5
6
  export * from "./liquidation-events";
6
7
  export * from "./market-stats-events";
@@ -150,7 +150,53 @@ export interface CommonOrderEventData {
150
150
  * Wire: `self_trade_prevention_mode`.
151
151
  */
152
152
  selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
153
+ /**
154
+ * What placed the order (0XM-2848): `"USER"`, `"LIQUIDATION"`, `"SYSTEM"`,
155
+ * `"ADL"` or `"COPY"` (a copy trading order the engine placed for one of
156
+ * your follows).
157
+ *
158
+ * Absent means **not reported**, never `"USER"`: the key is omitted until
159
+ * the event's producer fills it, and `"USER"` is sent explicitly once it
160
+ * does. Widened past {@link OrderOrigin} because the parser passes an
161
+ * unrecognized value through rather than dropping the frame.
162
+ * Wire: `origin`.
163
+ */
164
+ origin?: OrderOrigin | (string & {});
165
+ /**
166
+ * The follow (copy relationship) a `"COPY"` order was placed for — the same
167
+ * id as `Follow.followId` and the `copy` channel's `relationshipId`.
168
+ * Omitted on every other order. Wire: `copy_relationship_id`.
169
+ */
170
+ copyRelationshipId?: string;
171
+ /**
172
+ * The TWAP parent of a child order: the same id REST `getOrder` returns as
173
+ * `parentOrderId`, so a subscriber can group a TWAP's children from the
174
+ * socket alone. Carried on every frame of a TWAP child: its `OrderPlaced`
175
+ * acknowledgement, taker fills and remainder cancels, maker fills,
176
+ * cancellation and expiry frames, and its `orders` snapshot row. Omitted
177
+ * for an order that is not a TWAP child, and by servers predating the
178
+ * field.
179
+ * Wire: `parent_order_id`.
180
+ */
181
+ parentOrderId?: string;
182
+ /**
183
+ * The margin position this order is bound to: the same id REST `getOrder`
184
+ * returns as `positionId`. A margin order placed while its margin account
185
+ * (cross) or risk bucket (isolated) already holds an open position in the
186
+ * pair is bound when it is admitted, so a resting close or reduce-only order
187
+ * names its position before it fills; otherwise its first fill binds it.
188
+ * Carried on the `OrderPlaced` acknowledgement, taker and maker fills,
189
+ * remainder cancels, and the resting order's cancel, partial-cancel and
190
+ * expiry frames. Omitted while the order is unbound, always for spot, and by
191
+ * servers predating the field. Wire: `position_id`.
192
+ */
193
+ positionId?: string;
153
194
  }
195
+ /**
196
+ * What placed an order, as carried on order events' `origin` (0XM-2848).
197
+ * The values the server sends today; see {@link CommonOrderEventData.origin}.
198
+ */
199
+ export type OrderOrigin = "USER" | "LIQUIDATION" | "SYSTEM" | "ADL" | "COPY";
154
200
  /**
155
201
  * OrderPlaced event - emitted when a new order is placed
156
202
  */
@@ -159,6 +205,22 @@ export interface OrderPlacedEvent extends OrderEvent {
159
205
  data: CommonOrderEventData & {
160
206
  /** Order status */
161
207
  status: OrderStatus | (string & {});
208
+ /**
209
+ * Margin account backing a margin order (UUID), as REST reports it.
210
+ * Omitted for spot. Wire: `margin_account_id`.
211
+ */
212
+ marginAccountId?: string;
213
+ /**
214
+ * Requested leverage of a margin order (decimal string). Omitted for spot
215
+ * and for a margin order placed without one. Wire: `leverage`.
216
+ */
217
+ leverage?: string;
218
+ /**
219
+ * Whether the margin order can only reduce exposure. Present on every
220
+ * margin order, `false` included, like REST's `reduceOnly`; omitted for
221
+ * spot. Wire: `reduce_only`.
222
+ */
223
+ reduceOnly?: boolean;
162
224
  };
163
225
  }
164
226
  /**
@@ -197,10 +259,11 @@ export interface OrderMatchedEvent extends OrderEvent {
197
259
  /** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
198
260
  remainingQuantityRaw: string;
199
261
  /**
200
- * Monaco fee for the fills this event covers, in normalized decimal QUOTE
201
- * units (negative = maker rebate). Excludes the application taker fee, so
202
- * it is smaller than the order echo's `totalTakerFees` for an application
203
- * that charges one, and equal to it for one that does not. Wire: `fee`.
262
+ * Total fee for the fills this event covers, in normalized decimal QUOTE
263
+ * units (negative = maker rebate): `monacoFee + builderFee`. For a taker
264
+ * this is Monaco's taker fee plus the frontend's builder fee, the same
265
+ * total as the order echo's `totalTakerFees`; for a maker it is the maker
266
+ * fee. Wire: `fee`.
204
267
  */
205
268
  fee: string;
206
269
  /**
@@ -210,6 +273,22 @@ export interface OrderMatchedEvent extends OrderEvent {
210
273
  * 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
211
274
  */
212
275
  feeRaw: string;
276
+ /**
277
+ * Monaco's component of `fee`, in normalized decimal QUOTE units. Optional
278
+ * because a server older than this field omits it. Wire: `monaco_fee`.
279
+ */
280
+ monacoFee?: string;
281
+ /** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
282
+ monacoFeeRaw?: string;
283
+ /**
284
+ * The frontend's builder fee component of `fee`, in normalized decimal
285
+ * QUOTE units. Always `"0"` for a maker: builder fees are charged to
286
+ * takers only. Optional because a server older than this field omits it.
287
+ * Wire: `builder_fee`.
288
+ */
289
+ builderFee?: string;
290
+ /** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
291
+ builderFeeRaw?: string;
213
292
  /** Execution timestamp of the first trade this event covers (ISO 8601). `null` when it covers none. */
214
293
  executedAt: string | null;
215
294
  /** Reference price used for slippage calculation. `null` when unset. */
@@ -289,14 +368,16 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
289
368
  /** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
290
369
  remainingQuantityRaw?: string;
291
370
  /**
292
- * Monaco fee for the fills this event covers, in normalized decimal QUOTE
293
- * units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
294
- * taker and maker carry the same field. A taker event aggregates every
295
- * trade it covers; a maker event is one trade.
371
+ * Total fee for the fills this event covers, in normalized decimal QUOTE
372
+ * units (negative = maker rebate): `monacoFee + builderFee`. The wire
373
+ * field is `fee`, not `makerFee`; taker and maker carry the same field. A
374
+ * taker event aggregates every trade it covers; a maker event is one
375
+ * trade.
296
376
  *
297
- * Excludes the application taker fee, so it is NOT the order echo's
298
- * `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
299
- * held the raw integer value now exposed as `feeRaw`.
377
+ * For a taker this is Monaco's taker fee plus the frontend's builder fee,
378
+ * the same total as the order echo's `totalTakerFees`; for a maker it is
379
+ * the maker fee. It previously held the raw integer value now exposed as
380
+ * `feeRaw`, and before that Monaco's fee alone.
300
381
  */
301
382
  fee?: string;
302
383
  /**
@@ -306,6 +387,18 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
306
387
  * 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
307
388
  */
308
389
  feeRaw?: string;
390
+ /** Monaco's component of `fee`, in normalized decimal QUOTE units. Wire: `monaco_fee`. */
391
+ monacoFee?: string;
392
+ /** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
393
+ monacoFeeRaw?: string;
394
+ /**
395
+ * The frontend's builder fee component of `fee`, in normalized decimal
396
+ * QUOTE units. Always `"0"` for a maker: builder fees are charged to
397
+ * takers only. Wire: `builder_fee`.
398
+ */
399
+ builderFee?: string;
400
+ /** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
401
+ builderFeeRaw?: string;
309
402
  /** Trade execution timestamp (maker orders only) */
310
403
  executedAt?: string;
311
404
  /** Role of the order in the trade (taker or maker) */
@@ -369,14 +462,16 @@ export interface OrderFilledEvent extends OrderEvent {
369
462
  /** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
370
463
  remainingQuantityRaw?: string;
371
464
  /**
372
- * Monaco fee for the fills this event covers, in normalized decimal QUOTE
373
- * units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
374
- * taker and maker carry the same field. A taker event aggregates every
375
- * trade it covers; a maker event is one trade.
465
+ * Total fee for the fills this event covers, in normalized decimal QUOTE
466
+ * units (negative = maker rebate): `monacoFee + builderFee`. The wire
467
+ * field is `fee`, not `makerFee`; taker and maker carry the same field. A
468
+ * taker event aggregates every trade it covers; a maker event is one
469
+ * trade.
376
470
  *
377
- * Excludes the application taker fee, so it is NOT the order echo's
378
- * `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
379
- * held the raw integer value now exposed as `feeRaw`.
471
+ * For a taker this is Monaco's taker fee plus the frontend's builder fee,
472
+ * the same total as the order echo's `totalTakerFees`; for a maker it is
473
+ * the maker fee. It previously held the raw integer value now exposed as
474
+ * `feeRaw`, and before that Monaco's fee alone.
380
475
  */
381
476
  fee?: string;
382
477
  /**
@@ -386,6 +481,18 @@ export interface OrderFilledEvent extends OrderEvent {
386
481
  * 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
387
482
  */
388
483
  feeRaw?: string;
484
+ /** Monaco's component of `fee`, in normalized decimal QUOTE units. Wire: `monaco_fee`. */
485
+ monacoFee?: string;
486
+ /** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
487
+ monacoFeeRaw?: string;
488
+ /**
489
+ * The frontend's builder fee component of `fee`, in normalized decimal
490
+ * QUOTE units. Always `"0"` for a maker: builder fees are charged to
491
+ * takers only. Wire: `builder_fee`.
492
+ */
493
+ builderFee?: string;
494
+ /** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
495
+ builderFeeRaw?: string;
389
496
  /** Trade execution timestamp (maker orders only) */
390
497
  executedAt?: string;
391
498
  /** Role of the order in the trade (taker or maker) */
@@ -53,14 +53,16 @@ export type SnapshotHandler<T> = (items: T[]) => void;
53
53
  * The change-only fill metadata of an order EVENT is deliberately absent: a
54
54
  * snapshot describes resting state, not a fill, so there is no `eventType`,
55
55
  * `tradeId`, `executionPrice`, `lastFillQuantity`, `role`, `fee`, `feeRaw`,
56
- * `tradesCount` or slippage. The cumulative `filledQuantity` /
56
+ * `monacoFee`, `builderFee` (and their `Raw` twins), `tradesCount` or
57
+ * slippage. The cumulative `filledQuantity` /
57
58
  * `averageFillPrice` totals are present, because those are state.
58
59
  *
59
60
  * Nullability mirrors the wire exactly. Every optional field below is a Rust
60
61
  * `Option` serialized WITHOUT `skip_serializing_if`, so the key is always
61
62
  * present and carries `null` when unset — hence `| null` rather than `?`.
62
- * `clientOrderId`, `selfTradePreventionMode` and `version` are the fields the
63
- * server omits outright, so they are the `?`s.
63
+ * `clientOrderId`, `selfTradePreventionMode`, `parentOrderId`, `postOnly`,
64
+ * `expirationDate`, `triggerPrice`, `positionSide` and `version` are the fields
65
+ * the server omits outright, so they are the `?`s.
64
66
  *
65
67
  * The value unions are widened (`Union | (string & {})`) for the same reason
66
68
  * the order event's are: the parser hands an unrecognized value through rather
@@ -116,6 +118,27 @@ export interface OrderSnapshotItem {
116
118
  leverage: string | null;
117
119
  /** Whether the order can only reduce existing exposure */
118
120
  reduceOnly: boolean;
121
+ /**
122
+ * `true` when the order rests post-only. Omitted — never `false` — otherwise,
123
+ * matching REST's `postOnly` and the live order events. Wire: `post_only`.
124
+ */
125
+ postOnly?: boolean;
126
+ /**
127
+ * Custom GTC expiry (RFC 3339), as REST returns it. Omitted when the order
128
+ * has none. Wire: `expiration_date`.
129
+ */
130
+ expirationDate?: string;
131
+ /**
132
+ * Trigger price (decimal string) of an order a conditional placed, as REST
133
+ * returns it. Omitted otherwise. Wire: `trigger_price`.
134
+ */
135
+ triggerPrice?: string;
136
+ /**
137
+ * @deprecated REST's derived compatibility label (`"Long" | "Short"`),
138
+ * passed through; `side` is authoritative. Omitted when REST omits it.
139
+ * Wire: `position_side`.
140
+ */
141
+ positionSide?: string;
119
142
  /**
120
143
  * Client-assigned correlation handle, carried so the baseline and the live
121
144
  * events that follow it identify orders the same way. Omitted — not `null` —
@@ -130,6 +153,12 @@ export interface OrderSnapshotItem {
130
153
  * never the resolved wallet or platform default.
131
154
  */
132
155
  selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
156
+ /**
157
+ * The TWAP parent of a child order: the same id REST `getOrder` returns as
158
+ * `parentOrderId`. Omitted — not `null` — for an order that is not a TWAP
159
+ * child, matching the live event payload. Wire: `parent_order_id`.
160
+ */
161
+ parentOrderId?: string;
133
162
  /**
134
163
  * Sequencer step this order's state was last written by — the SAME counter
135
164
  * the live order events and the REST endpoints carry (0XM-2440).
@@ -1,12 +1,6 @@
1
1
  /**
2
- * Whitelist Types
3
- *
4
- * Types for the public whitelist (waitlist) application endpoint. Wire shapes
5
- * are snake_case.
6
- *
7
- * NOTE: This endpoint is **public (unauthenticated)** and creates an inactive
8
- * user pending manual approval — it is an onboarding/waitlist submission, not a
9
- * trading operation.
2
+ * Compatibility types for the retired public whitelist endpoint.
3
+ * Submissions return HTTP 403 FORBIDDEN without changing applicant data.
10
4
  */
11
5
  import type { BaseAPI } from "../api";
12
6
  /** Body for a whitelist application. */
@@ -20,7 +14,7 @@ export interface SubmitWhitelistRequest {
20
14
  /** Applicant Telegram username (5-32 chars) */
21
15
  telegramUsername?: string;
22
16
  }
23
- /** Response to a whitelist application. */
17
+ /** Legacy success response, retained for compatibility; retired submissions return HTTP 403. */
24
18
  export interface SubmitWhitelistResponse {
25
19
  /** Human-readable status message */
26
20
  message: string;
@@ -32,13 +26,8 @@ export interface SubmitWhitelistResponse {
32
26
  */
33
27
  export interface WhitelistAPI extends BaseAPI {
34
28
  /**
35
- * Submits a whitelist (waitlist) application.
36
- *
37
- * Public/unauthenticated. The server validates and de-duplicates by wallet
38
- * address and email, creating an inactive user pending approval.
39
- *
40
- * @param body - Applicant details
41
- * @returns Promise resolving to the status message and created user id
29
+ * @deprecated Public whitelist applications are closed. The server returns HTTP 403.
30
+ * @param body - Legacy applicant details; the request shape is retained for compatibility.
42
31
  */
43
32
  submit(body: SubmitWhitelistRequest): Promise<SubmitWhitelistResponse>;
44
33
  }
@@ -1,10 +1,4 @@
1
1
  /**
2
- * Whitelist Types
3
- *
4
- * Types for the public whitelist (waitlist) application endpoint. Wire shapes
5
- * are snake_case.
6
- *
7
- * NOTE: This endpoint is **public (unauthenticated)** and creates an inactive
8
- * user pending manual approval — it is an onboarding/waitlist submission, not a
9
- * trading operation.
2
+ * Compatibility types for the retired public whitelist endpoint.
3
+ * Submissions return HTTP 403 FORBIDDEN without changing applicant data.
10
4
  */
@@ -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 ["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_position", "create_challenge", "create_delegated_session", "create_order", "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_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_referral_downline", "get_my_referral_position", "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_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_managed_market_assignments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["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_position", "create_challenge", "create_delegated_session", "create_order", "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_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_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_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "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_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "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_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "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];
@@ -41,14 +41,17 @@ export const OPERATION_IDS = [
41
41
  "get_candles",
42
42
  "get_conditional_order",
43
43
  "get_faucet_info",
44
+ "get_follow",
44
45
  "get_funding_state",
45
46
  "get_index_price",
47
+ "get_lead_trader",
46
48
  "get_margin_account_movements",
47
49
  "get_margin_account_summary",
48
50
  "get_mark_price",
49
51
  "get_market_metadata",
50
52
  "get_market_stats",
51
53
  "get_my_fee_tier",
54
+ "get_my_lead_trader",
52
55
  "get_my_referral_downline",
53
56
  "get_my_referral_position",
54
57
  "get_my_trader_code",
@@ -99,10 +102,16 @@ export const OPERATION_IDS = [
99
102
  "list_conditional_orders",
100
103
  "list_delegated_agent_owners",
101
104
  "list_delegated_agents",
105
+ "list_follow_leader_positions",
102
106
  "list_funding_history",
103
107
  "list_funding_payments",
108
+ "list_lead_trader_closed_trades",
109
+ "list_lead_trader_open_positions",
110
+ "list_lead_traders",
104
111
  "list_managed_market_assignments",
105
112
  "list_margin_accounts",
113
+ "list_my_followers",
114
+ "list_my_follows",
106
115
  "list_pending_withdrawals",
107
116
  "list_position_history",
108
117
  "list_positions",
@@ -110,6 +119,7 @@ export const OPERATION_IDS = [
110
119
  "list_trading_pairs",
111
120
  "list_twap_orders",
112
121
  "mint_tokens",
122
+ "preview_follow",
113
123
  "refresh_managed_market_quotes",
114
124
  "refresh_session",
115
125
  "register_deposit_address",
@@ -122,6 +132,7 @@ export const OPERATION_IDS = [
122
132
  "simulate_order_risk",
123
133
  "simulate_parent_margin_order_risk",
124
134
  "simulate_risk_bucket_order_risk",
135
+ "stop_follow",
125
136
  "submit_whitelist",
126
137
  "transfer_collateral_from_margin_account",
127
138
  "transfer_collateral_from_parent_margin_account",
@@ -131,5 +142,7 @@ export const OPERATION_IDS = [
131
142
  "transfer_rewards",
132
143
  "update_sub_account_limit",
133
144
  "upsert_delegated_agent",
145
+ "upsert_follow",
146
+ "upsert_lead_trader",
134
147
  "verify_signature",
135
148
  ];