@0xmonaco/types 1.0.66 → 1.0.69
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.
- package/dist/buildercodes/index.d.ts +4 -4
- package/dist/buildercodes/index.js +1 -1
- package/dist/buildercodes/responses.d.ts +45 -1
- package/dist/buildercodes/responses.js +25 -1
- package/dist/faucet/index.d.ts +3 -2
- package/dist/market/index.d.ts +8 -0
- package/dist/positions/index.d.ts +15 -12
- package/dist/profile/index.d.ts +14 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/trading/index.d.ts +2 -0
- package/dist/trading/orders.d.ts +6 -0
- package/dist/trading/responses.d.ts +89 -22
- package/dist/validation/trading.d.ts +2 -0
- package/dist/validation/trading.js +34 -4
- package/dist/websocket/base.d.ts +5 -3
- package/dist/websocket/events/conditional-order-events.d.ts +41 -14
- package/dist/websocket/events/orders-events.d.ts +74 -18
- package/dist/websocket/snapshots.d.ts +8 -1
- package/dist/whitelist/index.d.ts +5 -16
- package/dist/whitelist/index.js +2 -8
- package/dist/wire/schema.d.ts +200 -60
- 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;
|
|
@@ -117,27 +141,30 @@ export interface ConditionalOrderEventData {
|
|
|
117
141
|
* snapshot builds the same shape with `"snapshot"` instead.
|
|
118
142
|
*/
|
|
119
143
|
reason: string;
|
|
144
|
+
/**
|
|
145
|
+
* When the conditional order was created (ISO 8601): the same string REST
|
|
146
|
+
* returns as `createdAt` for this id, on live updates and snapshot rows
|
|
147
|
+
* alike. Always present from current servers; optional so a frame from an
|
|
148
|
+
* older deployment during a rolling release still parses. Wire: `created_at`.
|
|
149
|
+
*/
|
|
150
|
+
createdAt?: string;
|
|
120
151
|
updatedAt: string;
|
|
121
152
|
/**
|
|
122
153
|
* Opaque, compare-only revision counter for this conditional order's state —
|
|
123
154
|
* the sequencer step that wrote it (0XM-2440). A strictly higher value is
|
|
124
155
|
* strictly newer state for that conditional order.
|
|
125
156
|
*
|
|
126
|
-
* Present on
|
|
127
|
-
* snapshot frame
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* So seed conditional state from the snapshot and REST, comparing with
|
|
134
|
-
* `snapshot.version >= local.version`, and apply live events as state without
|
|
135
|
-
* ranking them. `>=` rather than `>`: one sequencer step can write several
|
|
136
|
-
* conditional rows (a trigger writes the triggered row and cancels its OCO
|
|
137
|
-
* 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.
|
|
138
163
|
*
|
|
139
164
|
* Absent means unknown — a row last written before the field existed — never
|
|
140
|
-
* zero
|
|
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`.
|
|
141
168
|
*/
|
|
142
169
|
version?: number;
|
|
143
170
|
}
|
|
@@ -150,6 +150,17 @@ export interface CommonOrderEventData {
|
|
|
150
150
|
* Wire: `self_trade_prevention_mode`.
|
|
151
151
|
*/
|
|
152
152
|
selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
|
|
153
|
+
/**
|
|
154
|
+
* The TWAP parent of a child order: the same id REST `getOrder` returns as
|
|
155
|
+
* `parentOrderId`, so a subscriber can group a TWAP's children from the
|
|
156
|
+
* socket alone. Carried on every frame of a TWAP child: its `OrderPlaced`
|
|
157
|
+
* acknowledgement, taker fills and remainder cancels, maker fills,
|
|
158
|
+
* cancellation and expiry frames, and its `orders` snapshot row. Omitted
|
|
159
|
+
* for an order that is not a TWAP child, and by servers predating the
|
|
160
|
+
* field.
|
|
161
|
+
* Wire: `parent_order_id`.
|
|
162
|
+
*/
|
|
163
|
+
parentOrderId?: string;
|
|
153
164
|
}
|
|
154
165
|
/**
|
|
155
166
|
* OrderPlaced event - emitted when a new order is placed
|
|
@@ -197,10 +208,11 @@ export interface OrderMatchedEvent extends OrderEvent {
|
|
|
197
208
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
198
209
|
remainingQuantityRaw: string;
|
|
199
210
|
/**
|
|
200
|
-
*
|
|
201
|
-
* units (negative = maker rebate)
|
|
202
|
-
*
|
|
203
|
-
*
|
|
211
|
+
* Total fee for the fills this event covers, in normalized decimal QUOTE
|
|
212
|
+
* units (negative = maker rebate): `monacoFee + builderFee`. For a taker
|
|
213
|
+
* this is Monaco's taker fee plus the frontend's builder fee, the same
|
|
214
|
+
* total as the order echo's `totalTakerFees`; for a maker it is the maker
|
|
215
|
+
* fee. Wire: `fee`.
|
|
204
216
|
*/
|
|
205
217
|
fee: string;
|
|
206
218
|
/**
|
|
@@ -210,6 +222,22 @@ export interface OrderMatchedEvent extends OrderEvent {
|
|
|
210
222
|
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
211
223
|
*/
|
|
212
224
|
feeRaw: string;
|
|
225
|
+
/**
|
|
226
|
+
* Monaco's component of `fee`, in normalized decimal QUOTE units. Optional
|
|
227
|
+
* because a server older than this field omits it. Wire: `monaco_fee`.
|
|
228
|
+
*/
|
|
229
|
+
monacoFee?: string;
|
|
230
|
+
/** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
|
|
231
|
+
monacoFeeRaw?: string;
|
|
232
|
+
/**
|
|
233
|
+
* The frontend's builder fee component of `fee`, in normalized decimal
|
|
234
|
+
* QUOTE units. Always `"0"` for a maker: builder fees are charged to
|
|
235
|
+
* takers only. Optional because a server older than this field omits it.
|
|
236
|
+
* Wire: `builder_fee`.
|
|
237
|
+
*/
|
|
238
|
+
builderFee?: string;
|
|
239
|
+
/** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
|
|
240
|
+
builderFeeRaw?: string;
|
|
213
241
|
/** Execution timestamp of the first trade this event covers (ISO 8601). `null` when it covers none. */
|
|
214
242
|
executedAt: string | null;
|
|
215
243
|
/** Reference price used for slippage calculation. `null` when unset. */
|
|
@@ -289,14 +317,16 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
289
317
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
290
318
|
remainingQuantityRaw?: string;
|
|
291
319
|
/**
|
|
292
|
-
*
|
|
293
|
-
* units (negative = maker rebate)
|
|
294
|
-
* taker and maker carry the same field. A
|
|
295
|
-
* trade it covers; a maker event is one
|
|
320
|
+
* Total fee for the fills this event covers, in normalized decimal QUOTE
|
|
321
|
+
* units (negative = maker rebate): `monacoFee + builderFee`. The wire
|
|
322
|
+
* field is `fee`, not `makerFee`; taker and maker carry the same field. A
|
|
323
|
+
* taker event aggregates every trade it covers; a maker event is one
|
|
324
|
+
* trade.
|
|
296
325
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* held the raw integer value now exposed as
|
|
326
|
+
* For a taker this is Monaco's taker fee plus the frontend's builder fee,
|
|
327
|
+
* the same total as the order echo's `totalTakerFees`; for a maker it is
|
|
328
|
+
* the maker fee. It previously held the raw integer value now exposed as
|
|
329
|
+
* `feeRaw`, and before that Monaco's fee alone.
|
|
300
330
|
*/
|
|
301
331
|
fee?: string;
|
|
302
332
|
/**
|
|
@@ -306,6 +336,18 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
306
336
|
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
307
337
|
*/
|
|
308
338
|
feeRaw?: string;
|
|
339
|
+
/** Monaco's component of `fee`, in normalized decimal QUOTE units. Wire: `monaco_fee`. */
|
|
340
|
+
monacoFee?: string;
|
|
341
|
+
/** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
|
|
342
|
+
monacoFeeRaw?: string;
|
|
343
|
+
/**
|
|
344
|
+
* The frontend's builder fee component of `fee`, in normalized decimal
|
|
345
|
+
* QUOTE units. Always `"0"` for a maker: builder fees are charged to
|
|
346
|
+
* takers only. Wire: `builder_fee`.
|
|
347
|
+
*/
|
|
348
|
+
builderFee?: string;
|
|
349
|
+
/** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
|
|
350
|
+
builderFeeRaw?: string;
|
|
309
351
|
/** Trade execution timestamp (maker orders only) */
|
|
310
352
|
executedAt?: string;
|
|
311
353
|
/** Role of the order in the trade (taker or maker) */
|
|
@@ -369,14 +411,16 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
369
411
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
370
412
|
remainingQuantityRaw?: string;
|
|
371
413
|
/**
|
|
372
|
-
*
|
|
373
|
-
* units (negative = maker rebate)
|
|
374
|
-
* taker and maker carry the same field. A
|
|
375
|
-
* trade it covers; a maker event is one
|
|
414
|
+
* Total fee for the fills this event covers, in normalized decimal QUOTE
|
|
415
|
+
* units (negative = maker rebate): `monacoFee + builderFee`. The wire
|
|
416
|
+
* field is `fee`, not `makerFee`; taker and maker carry the same field. A
|
|
417
|
+
* taker event aggregates every trade it covers; a maker event is one
|
|
418
|
+
* trade.
|
|
376
419
|
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
* held the raw integer value now exposed as
|
|
420
|
+
* For a taker this is Monaco's taker fee plus the frontend's builder fee,
|
|
421
|
+
* the same total as the order echo's `totalTakerFees`; for a maker it is
|
|
422
|
+
* the maker fee. It previously held the raw integer value now exposed as
|
|
423
|
+
* `feeRaw`, and before that Monaco's fee alone.
|
|
380
424
|
*/
|
|
381
425
|
fee?: string;
|
|
382
426
|
/**
|
|
@@ -386,6 +430,18 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
386
430
|
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
387
431
|
*/
|
|
388
432
|
feeRaw?: string;
|
|
433
|
+
/** Monaco's component of `fee`, in normalized decimal QUOTE units. Wire: `monaco_fee`. */
|
|
434
|
+
monacoFee?: string;
|
|
435
|
+
/** `monacoFee` in RAW quote-unit precision. Wire: `monaco_fee_raw`. */
|
|
436
|
+
monacoFeeRaw?: string;
|
|
437
|
+
/**
|
|
438
|
+
* The frontend's builder fee component of `fee`, in normalized decimal
|
|
439
|
+
* QUOTE units. Always `"0"` for a maker: builder fees are charged to
|
|
440
|
+
* takers only. Wire: `builder_fee`.
|
|
441
|
+
*/
|
|
442
|
+
builderFee?: string;
|
|
443
|
+
/** `builderFee` in RAW quote-unit precision. Wire: `builder_fee_raw`. */
|
|
444
|
+
builderFeeRaw?: string;
|
|
389
445
|
/** Trade execution timestamp (maker orders only) */
|
|
390
446
|
executedAt?: string;
|
|
391
447
|
/** Role of the order in the trade (taker or maker) */
|
|
@@ -53,7 +53,8 @@ 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
|
-
* `
|
|
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
|
|
@@ -130,6 +131,12 @@ export interface OrderSnapshotItem {
|
|
|
130
131
|
* never the resolved wallet or platform default.
|
|
131
132
|
*/
|
|
132
133
|
selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
|
|
134
|
+
/**
|
|
135
|
+
* The TWAP parent of a child order: the same id REST `getOrder` returns as
|
|
136
|
+
* `parentOrderId`. Omitted — not `null` — for an order that is not a TWAP
|
|
137
|
+
* child, matching the live event payload. Wire: `parent_order_id`.
|
|
138
|
+
*/
|
|
139
|
+
parentOrderId?: string;
|
|
133
140
|
/**
|
|
134
141
|
* Sequencer step this order's state was last written by — the SAME counter
|
|
135
142
|
* the live order events and the REST endpoints carry (0XM-2440).
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
}
|
package/dist/whitelist/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
*/
|