@0xmonaco/types 1.0.57 → 1.0.58
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/profile/index.d.ts +35 -1
- package/dist/trading/index.d.ts +22 -2
- package/dist/trading/orders.d.ts +27 -1
- package/dist/trading/responses.d.ts +17 -1
- package/dist/validation/profile.d.ts +13 -0
- package/dist/validation/profile.js +9 -1
- package/dist/validation/trading.d.ts +51 -0
- package/dist/validation/trading.js +13 -0
- package/dist/websocket/events/orders-events.d.ts +38 -1
- package/dist/websocket/snapshots.d.ts +11 -3
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +2 -0
- package/dist/wire/schema.d.ts +178 -3
- package/package.json +2 -2
package/dist/profile/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Address } from "viem";
|
|
7
7
|
import type { BaseAPI } from "../api";
|
|
8
|
-
import type { OrderSide, OrderStatus, OrderType, TimeInForce } from "../trading";
|
|
8
|
+
import type { OrderSide, OrderStatus, OrderType, SelfTradePreventionMode, TimeInForce } from "../trading";
|
|
9
9
|
/**
|
|
10
10
|
* Account movement/transaction information.
|
|
11
11
|
* Represents transactions/movements returned in the profile's recent_movements array.
|
|
@@ -502,6 +502,17 @@ export interface UserProfile {
|
|
|
502
502
|
/** Additional maker fee in basis points contributed by the application (if any) */
|
|
503
503
|
applicationMakerFeeBps?: number;
|
|
504
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* The wallet's self-trade-prevention default — the mode applied when an order
|
|
507
|
+
* from this wallet family would match the family's own resting order and the
|
|
508
|
+
* order itself names no override.
|
|
509
|
+
*/
|
|
510
|
+
export interface SelfTradePreventionDefault {
|
|
511
|
+
/** The wallet's effective mode. */
|
|
512
|
+
mode: SelfTradePreventionMode;
|
|
513
|
+
/** True when this wallet has explicitly set a default; false when the platform default (`CANCEL_MAKER`) is in effect. */
|
|
514
|
+
isCustom: boolean;
|
|
515
|
+
}
|
|
505
516
|
/**
|
|
506
517
|
* Profile API interface.
|
|
507
518
|
* Provides methods for fetching and managing user profile information.
|
|
@@ -612,4 +623,27 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
612
623
|
* @throws ValidationError If pagination params or a UUID filter are invalid; this may occur before any network request.
|
|
613
624
|
*/
|
|
614
625
|
listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
|
|
626
|
+
/**
|
|
627
|
+
* Get the wallet's self-trade-prevention default.
|
|
628
|
+
*
|
|
629
|
+
* Fetches the setting from the /api/v1/accounts/self-trade-prevention endpoint.
|
|
630
|
+
* Requires a valid access token to be set. The default is wallet-scoped: it
|
|
631
|
+
* covers every application and account sharing the wallet address.
|
|
632
|
+
*
|
|
633
|
+
* @returns Promise resolving to the effective mode plus whether it was explicitly set
|
|
634
|
+
*/
|
|
635
|
+
getSelfTradePreventionDefault(): Promise<SelfTradePreventionDefault>;
|
|
636
|
+
/**
|
|
637
|
+
* Set the wallet's self-trade-prevention default.
|
|
638
|
+
*
|
|
639
|
+
* Sends a PUT to the /api/v1/accounts/self-trade-prevention endpoint. The
|
|
640
|
+
* write is sequenced through the matching engine; on success the wallet
|
|
641
|
+
* family's next order already resolves the new mode. Delegated-agent
|
|
642
|
+
* sessions cannot change it (403).
|
|
643
|
+
*
|
|
644
|
+
* @param mode - One of "CANCEL_MAKER", "CANCEL_TAKER", "CANCEL_BOTH", "SKIP"
|
|
645
|
+
* @returns Promise resolving to the setting now in force
|
|
646
|
+
* @throws ValidationError If mode is not a known token; this occurs before any network request.
|
|
647
|
+
*/
|
|
648
|
+
setSelfTradePreventionDefault(mode: SelfTradePreventionMode): Promise<SelfTradePreventionDefault>;
|
|
615
649
|
}
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api/index";
|
|
7
7
|
import type { MarginMode } from "../margin-accounts";
|
|
8
|
-
import type { Order, OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
+
import type { Order, OrderSide, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode } from "./orders";
|
|
9
9
|
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder } from "./responses";
|
|
10
10
|
/**
|
|
11
11
|
* Trading API interface.
|
|
@@ -45,6 +45,13 @@ export interface TradingAPI extends BaseAPI {
|
|
|
45
45
|
* Echoed back as `postOnly` on order detail and list reads.
|
|
46
46
|
*/
|
|
47
47
|
postOnly?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Per-order self-trade-prevention override: CANCEL_MAKER, CANCEL_TAKER,
|
|
50
|
+
* CANCEL_BOTH, or SKIP. Omitted, your wallet's configured default
|
|
51
|
+
* applies, else the platform default CANCEL_MAKER. Echoed back as
|
|
52
|
+
* `selfTradePreventionMode` on order reads.
|
|
53
|
+
*/
|
|
54
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
48
55
|
/**
|
|
49
56
|
* Client-assigned correlation handle, echoed back on order reads and
|
|
50
57
|
* order WebSocket events. At most 64 characters from [A-Za-z0-9._:-].
|
|
@@ -82,6 +89,13 @@ export interface TradingAPI extends BaseAPI {
|
|
|
82
89
|
positionSide?: PositionSide;
|
|
83
90
|
leverage?: string;
|
|
84
91
|
reduceOnly?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Per-order self-trade-prevention override: CANCEL_MAKER, CANCEL_TAKER,
|
|
94
|
+
* CANCEL_BOTH, or SKIP. Omitted, your wallet's configured default
|
|
95
|
+
* applies, else the platform default CANCEL_MAKER. Echoed back as
|
|
96
|
+
* `selfTradePreventionMode` on order reads.
|
|
97
|
+
*/
|
|
98
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
85
99
|
/**
|
|
86
100
|
* Client-assigned correlation handle, echoed back on order reads and
|
|
87
101
|
* order WebSocket events. At most 64 characters from [A-Za-z0-9._:-].
|
|
@@ -149,6 +163,12 @@ export interface TradingAPI extends BaseAPI {
|
|
|
149
163
|
quantity?: string;
|
|
150
164
|
useMasterBalance?: boolean;
|
|
151
165
|
postOnly?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Re-states the self-trade-prevention override for the replacement:
|
|
168
|
+
* nothing is inherited from the original order. Omitted, your wallet's
|
|
169
|
+
* configured default applies, else the platform default CANCEL_MAKER.
|
|
170
|
+
*/
|
|
171
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
152
172
|
/**
|
|
153
173
|
* Client-assigned correlation handle, echoed back on order reads and
|
|
154
174
|
* order WebSocket events. At most 64 characters from [A-Za-z0-9._:-].
|
|
@@ -238,6 +258,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
238
258
|
*/
|
|
239
259
|
listTwapOrders(params?: ListTwapOrdersParams): Promise<ListTwapOrdersResponse>;
|
|
240
260
|
}
|
|
241
|
-
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, ListedOrderType, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState, } from "./orders";
|
|
261
|
+
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, ListedOrderType, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState, } from "./orders";
|
|
242
262
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
243
263
|
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder, UpdatedFields, } from "./responses";
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -78,6 +78,14 @@ export interface Order {
|
|
|
78
78
|
reduceOnly?: boolean;
|
|
79
79
|
/** Whether the order was placed post-only (maker-only). Absent for orders placed before the flag was persisted. */
|
|
80
80
|
postOnly?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The per-order self-trade-prevention override REQUESTED when this order was
|
|
83
|
+
* placed or replaced. Absent when the order carried no override — including
|
|
84
|
+
* every order placed before the field was accepted on write — even though a
|
|
85
|
+
* wallet or platform default still governed its matching: this echoes the
|
|
86
|
+
* request, not the resolved default.
|
|
87
|
+
*/
|
|
88
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
81
89
|
/**
|
|
82
90
|
* Client-assigned correlation handle as stored: the value supplied on create
|
|
83
91
|
* or replace, with surrounding whitespace trimmed. Absent when the order
|
|
@@ -151,7 +159,7 @@ export interface Order {
|
|
|
151
159
|
version?: number;
|
|
152
160
|
}
|
|
153
161
|
/** Stable terminal causes for accepted orders that end as CANCELLED. */
|
|
154
|
-
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SYSTEM";
|
|
162
|
+
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SELF_TRADE_PREVENTION" | "SYSTEM";
|
|
155
163
|
/**
|
|
156
164
|
* Role of the creator or order
|
|
157
165
|
*/
|
|
@@ -225,6 +233,24 @@ export type TradingMode = "SPOT" | "MARGIN";
|
|
|
225
233
|
* `GTC` together with `expirationDate`.
|
|
226
234
|
*/
|
|
227
235
|
export type TimeInForce = "GTC" | "IOC" | "FOK" | "GTD";
|
|
236
|
+
/**
|
|
237
|
+
* Per-order self-trade-prevention override: how the engine resolves the order
|
|
238
|
+
* matching against one of your own resting orders (whole wallet family,
|
|
239
|
+
* subaccounts included; the incoming order's mode governs the step).
|
|
240
|
+
* - CANCEL_MAKER: cancel each of your resting orders encountered and keep
|
|
241
|
+
* matching (the platform default when no override or wallet default is set)
|
|
242
|
+
* - CANCEL_TAKER: fill third-party liquidity up to the first self-touch, then
|
|
243
|
+
* cancel the incoming order's remainder (zero-fill CANCELLED possible)
|
|
244
|
+
* - CANCEL_BOTH: CANCEL_TAKER plus cancelling the encountered resting orders;
|
|
245
|
+
* an FOK order with your own order in the fill path is rejected with
|
|
246
|
+
* SELF_TRADE_NOT_ALLOWED
|
|
247
|
+
* - SKIP: trade around your resting orders; a remainder that would rest
|
|
248
|
+
* crossing one of your surviving orders is cancelled instead of resting
|
|
249
|
+
*
|
|
250
|
+
* STP cancellations carry `terminalReason: "SELF_TRADE_PREVENTION"` and
|
|
251
|
+
* `stpCounterpartyOrderId` on order reads and WebSocket events.
|
|
252
|
+
*/
|
|
253
|
+
export type SelfTradePreventionMode = "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP";
|
|
228
254
|
/**
|
|
229
255
|
* Conditional TP/SL condition type.
|
|
230
256
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Response types for trading operations.
|
|
5
5
|
*/
|
|
6
6
|
import type { MarginMode } from "../margin-accounts";
|
|
7
|
-
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderType, PositionSide, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
|
|
7
|
+
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
|
|
8
8
|
/**
|
|
9
9
|
* Match result information for order execution.
|
|
10
10
|
* Contains detailed information about trades, fills, and execution quality.
|
|
@@ -375,6 +375,16 @@ export interface BatchCreateOrderParams {
|
|
|
375
375
|
* detail and list reads.
|
|
376
376
|
*/
|
|
377
377
|
postOnly?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Per-order self-trade-prevention override. An unknown value fails only this
|
|
380
|
+
* item, with a structured `error.code` of
|
|
381
|
+
* `INVALID_SELF_TRADE_PREVENTION_MODE`; an FOK item under CANCEL_BOTH with
|
|
382
|
+
* your own order in the fill path fails with `SELF_TRADE_NOT_ALLOWED`.
|
|
383
|
+
* Omitted, your wallet's configured default applies, else the platform
|
|
384
|
+
* default CANCEL_MAKER. Echoed back as `selfTradePreventionMode` on order
|
|
385
|
+
* reads.
|
|
386
|
+
*/
|
|
387
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
378
388
|
/**
|
|
379
389
|
* Client-assigned correlation handle, echoed back on order reads and on
|
|
380
390
|
* order WebSocket events. At most 64 characters from [A-Za-z0-9._:-].
|
|
@@ -405,6 +415,12 @@ export interface BatchReplaceOrderParams {
|
|
|
405
415
|
* inherited from the original order — see `TradingAPI.replaceOrder`.
|
|
406
416
|
*/
|
|
407
417
|
postOnly?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Re-states the self-trade-prevention override for the replacement
|
|
420
|
+
* (optional). Nothing is inherited from the original order; an unknown value
|
|
421
|
+
* fails only this item with `INVALID_SELF_TRADE_PREVENTION_MODE`.
|
|
422
|
+
*/
|
|
423
|
+
selfTradePreventionMode?: SelfTradePreventionMode;
|
|
408
424
|
/**
|
|
409
425
|
* Client-assigned correlation handle, echoed back on order reads and on
|
|
410
426
|
* order WebSocket events. At most 64 characters from [A-Za-z0-9._:-].
|
|
@@ -28,6 +28,19 @@ export declare const TransactionTypeSchema: z.ZodEnum<{
|
|
|
28
28
|
INTEREST: "INTEREST";
|
|
29
29
|
REWARD: "REWARD";
|
|
30
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Set Self-Trade-Prevention Default validation schema
|
|
33
|
+
*
|
|
34
|
+
* Validates the body of PUT /api/v1/accounts/self-trade-prevention.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SetSelfTradePreventionDefaultSchema: z.ZodObject<{
|
|
37
|
+
mode: z.ZodEnum<{
|
|
38
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
39
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
40
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
41
|
+
SKIP: "SKIP";
|
|
42
|
+
}>;
|
|
43
|
+
}, z.core.$strip>;
|
|
31
44
|
/**
|
|
32
45
|
* Get User Movements validation schema
|
|
33
46
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Provides clear, actionable error messages for invalid parameters.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { UUIDSchema } from "./trading.js";
|
|
8
|
+
import { SelfTradePreventionModeSchema, UUIDSchema } from "./trading.js";
|
|
9
9
|
/**
|
|
10
10
|
* Ledger entry type validation
|
|
11
11
|
*/
|
|
@@ -18,6 +18,14 @@ export const LedgerEntryTypeSchema = z.enum(["CREDIT", "DEBIT", "LOCK", "UNLOCK"
|
|
|
18
18
|
export const TransactionTypeSchema = z.enum(["DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", "REWARD"], {
|
|
19
19
|
message: 'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"',
|
|
20
20
|
});
|
|
21
|
+
/**
|
|
22
|
+
* Set Self-Trade-Prevention Default validation schema
|
|
23
|
+
*
|
|
24
|
+
* Validates the body of PUT /api/v1/accounts/self-trade-prevention.
|
|
25
|
+
*/
|
|
26
|
+
export const SetSelfTradePreventionDefaultSchema = z.object({
|
|
27
|
+
mode: SelfTradePreventionModeSchema,
|
|
28
|
+
});
|
|
21
29
|
/**
|
|
22
30
|
* Get User Movements validation schema
|
|
23
31
|
*
|
|
@@ -43,6 +43,15 @@ export declare const ConditionalTimeInForceSchema: z.ZodEnum<{
|
|
|
43
43
|
GTC: "GTC";
|
|
44
44
|
IOC: "IOC";
|
|
45
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Per-order self-trade-prevention override validation
|
|
48
|
+
*/
|
|
49
|
+
export declare const SelfTradePreventionModeSchema: z.ZodEnum<{
|
|
50
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
51
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
52
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
53
|
+
SKIP: "SKIP";
|
|
54
|
+
}>;
|
|
46
55
|
/**
|
|
47
56
|
* Order type validation
|
|
48
57
|
*/
|
|
@@ -126,6 +135,12 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
126
135
|
leverage: z.ZodOptional<z.ZodString>;
|
|
127
136
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
128
137
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
139
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
140
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
141
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
142
|
+
SKIP: "SKIP";
|
|
143
|
+
}>>;
|
|
129
144
|
takeProfit: z.ZodOptional<z.ZodObject<{
|
|
130
145
|
triggerPrice: z.ZodString;
|
|
131
146
|
orderType: z.ZodEnum<{
|
|
@@ -192,6 +207,12 @@ export declare const PlaceMarketOrderSchema: z.ZodObject<{
|
|
|
192
207
|
}>>;
|
|
193
208
|
leverage: z.ZodOptional<z.ZodString>;
|
|
194
209
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
211
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
212
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
213
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
214
|
+
SKIP: "SKIP";
|
|
215
|
+
}>>;
|
|
195
216
|
takeProfit: z.ZodOptional<z.ZodObject<{
|
|
196
217
|
triggerPrice: z.ZodString;
|
|
197
218
|
orderType: z.ZodEnum<{
|
|
@@ -248,6 +269,12 @@ export declare const ReplaceOrderSchema: z.ZodObject<{
|
|
|
248
269
|
quantity: z.ZodOptional<z.ZodString>;
|
|
249
270
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
250
271
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
273
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
274
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
275
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
276
|
+
SKIP: "SKIP";
|
|
277
|
+
}>>;
|
|
251
278
|
}, z.core.$strip>;
|
|
252
279
|
}, z.core.$strip>;
|
|
253
280
|
/**
|
|
@@ -437,6 +464,12 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
437
464
|
leverage: z.ZodOptional<z.ZodString>;
|
|
438
465
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
439
466
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
467
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
468
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
469
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
470
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
471
|
+
SKIP: "SKIP";
|
|
472
|
+
}>>;
|
|
440
473
|
}, z.core.$strip>;
|
|
441
474
|
/**
|
|
442
475
|
* Maximum items per batch create/replace/cancel request. Mirrors the server's
|
|
@@ -491,6 +524,12 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
491
524
|
leverage: z.ZodOptional<z.ZodString>;
|
|
492
525
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
493
526
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
527
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
528
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
529
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
530
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
531
|
+
SKIP: "SKIP";
|
|
532
|
+
}>>;
|
|
494
533
|
}, z.core.$strip>>;
|
|
495
534
|
}, z.core.$strip>;
|
|
496
535
|
/**
|
|
@@ -505,6 +544,12 @@ export declare const BatchReplaceOrderItemSchema: z.ZodObject<{
|
|
|
505
544
|
quantity: z.ZodOptional<z.ZodString>;
|
|
506
545
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
507
546
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
547
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
548
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
549
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
550
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
551
|
+
SKIP: "SKIP";
|
|
552
|
+
}>>;
|
|
508
553
|
}, z.core.$strip>;
|
|
509
554
|
/**
|
|
510
555
|
* Batch Replace Orders validation schema
|
|
@@ -518,5 +563,11 @@ export declare const BatchReplaceOrdersSchema: z.ZodObject<{
|
|
|
518
563
|
quantity: z.ZodOptional<z.ZodString>;
|
|
519
564
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
520
565
|
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
566
|
+
selfTradePreventionMode: z.ZodOptional<z.ZodEnum<{
|
|
567
|
+
CANCEL_MAKER: "CANCEL_MAKER";
|
|
568
|
+
CANCEL_TAKER: "CANCEL_TAKER";
|
|
569
|
+
CANCEL_BOTH: "CANCEL_BOTH";
|
|
570
|
+
SKIP: "SKIP";
|
|
571
|
+
}>>;
|
|
521
572
|
}, z.core.$strip>>;
|
|
522
573
|
}, z.core.$strip>;
|
|
@@ -36,6 +36,12 @@ export const TimeInForceSchema = z.enum(["GTC", "IOC", "FOK"], {
|
|
|
36
36
|
export const ConditionalTimeInForceSchema = z.enum(["GTC", "IOC"], {
|
|
37
37
|
message: 'Conditional order time in force must be "GTC" or "IOC"',
|
|
38
38
|
});
|
|
39
|
+
/**
|
|
40
|
+
* Per-order self-trade-prevention override validation
|
|
41
|
+
*/
|
|
42
|
+
export const SelfTradePreventionModeSchema = z.enum(["CANCEL_MAKER", "CANCEL_TAKER", "CANCEL_BOTH", "SKIP"], {
|
|
43
|
+
message: 'Self-trade prevention mode must be "CANCEL_MAKER", "CANCEL_TAKER", "CANCEL_BOTH", or "SKIP"',
|
|
44
|
+
});
|
|
39
45
|
/**
|
|
40
46
|
* Order type validation
|
|
41
47
|
*/
|
|
@@ -153,6 +159,7 @@ export const PlaceLimitOrderSchema = z
|
|
|
153
159
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
154
160
|
reduceOnly: z.boolean().optional(),
|
|
155
161
|
postOnly: z.boolean().optional(),
|
|
162
|
+
selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
|
|
156
163
|
takeProfit: ParentTpSlLegSchema.optional(),
|
|
157
164
|
stopLoss: ParentTpSlLegSchema.optional(),
|
|
158
165
|
})
|
|
@@ -231,6 +238,7 @@ export const PlaceMarketOrderSchema = z
|
|
|
231
238
|
positionSide: PositionSideSchema.optional(),
|
|
232
239
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
233
240
|
reduceOnly: z.boolean().optional(),
|
|
241
|
+
selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
|
|
234
242
|
takeProfit: ParentTpSlLegSchema.optional(),
|
|
235
243
|
stopLoss: ParentTpSlLegSchema.optional(),
|
|
236
244
|
})
|
|
@@ -316,6 +324,8 @@ export const ReplaceOrderSchema = z.object({
|
|
|
316
324
|
// replaceable fields — the server validates postOnly against the
|
|
317
325
|
// persisted original order, which this client-side schema cannot see.
|
|
318
326
|
postOnly: z.boolean().optional(),
|
|
327
|
+
// Re-stated per replace, never inherited from the original order.
|
|
328
|
+
selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
|
|
319
329
|
}),
|
|
320
330
|
});
|
|
321
331
|
/**
|
|
@@ -530,6 +540,7 @@ export const BatchCreateOrderItemSchema = z
|
|
|
530
540
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
531
541
|
reduceOnly: z.boolean().optional(),
|
|
532
542
|
postOnly: z.boolean().optional(),
|
|
543
|
+
selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
|
|
533
544
|
})
|
|
534
545
|
.refine((data) => data.orderType !== "LIMIT" || data.price !== undefined, {
|
|
535
546
|
message: "Price is required for LIMIT orders",
|
|
@@ -624,6 +635,8 @@ export const BatchReplaceOrderItemSchema = z
|
|
|
624
635
|
// replaceable fields — the server validates postOnly against the
|
|
625
636
|
// persisted original order, which this client-side schema cannot see.
|
|
626
637
|
postOnly: z.boolean().optional(),
|
|
638
|
+
// Re-stated per replace, never inherited from the original order.
|
|
639
|
+
selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
|
|
627
640
|
})
|
|
628
641
|
.refine((data) => data.price !== undefined || data.quantity !== undefined, {
|
|
629
642
|
message: "At least one of price or quantity must be provided",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* TypeScript types for order websocket events matching the Rust backend definitions.
|
|
5
5
|
* Each event type has specific data fields based on the event context.
|
|
6
6
|
*/
|
|
7
|
-
import type { OrderRole, OrderSide, OrderStatus, OrderTerminalReason, OrderType, TimeInForce, TradingMode } from "../../trading";
|
|
7
|
+
import type { OrderRole, OrderSide, OrderStatus, OrderTerminalReason, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../../trading";
|
|
8
8
|
import type { RawEventMessage } from "../base";
|
|
9
9
|
/**
|
|
10
10
|
* Order event types
|
|
@@ -137,6 +137,19 @@ export interface CommonOrderEventData {
|
|
|
137
137
|
* Wire: `post_only`.
|
|
138
138
|
*/
|
|
139
139
|
postOnly?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The self-trade-prevention override REQUESTED on the order
|
|
142
|
+
* (`"CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP"`), echoed so a
|
|
143
|
+
* subscriber can confirm what was accepted without a round trip to
|
|
144
|
+
* `getOrder`. Carried on the `OrderPlaced` acknowledgement, taker fills and
|
|
145
|
+
* remainder cancels, maker fills (the maker's OWN requested mode), the
|
|
146
|
+
* resting order's lifecycle frames, and the `orders` snapshot frame. Omitted
|
|
147
|
+
* when the order carried none — including every order that merely matched
|
|
148
|
+
* under a wallet or platform default, and every event emitted by a server
|
|
149
|
+
* predating the field: this echoes the request, never the resolved default.
|
|
150
|
+
* Wire: `self_trade_prevention_mode`.
|
|
151
|
+
*/
|
|
152
|
+
selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
|
|
140
153
|
}
|
|
141
154
|
/**
|
|
142
155
|
* OrderPlaced event - emitted when a new order is placed
|
|
@@ -389,6 +402,21 @@ export interface OrderCancelledEvent extends OrderEvent {
|
|
|
389
402
|
reason?: string;
|
|
390
403
|
/** Stable machine-readable cancellation cause */
|
|
391
404
|
terminalReason?: OrderTerminalReason | (string & {});
|
|
405
|
+
/**
|
|
406
|
+
* The counterparty order behind a self-trade-prevention cancellation: for
|
|
407
|
+
* a resting order cancelled because an order of the same owner arrived
|
|
408
|
+
* against it, the arriving order's id; for an arriving order whose
|
|
409
|
+
* remainder was cancelled instead, the owner's resting order it would
|
|
410
|
+
* have matched. The same audit back-pointer Bybit publishes as
|
|
411
|
+
* `smpOrderId`.
|
|
412
|
+
*
|
|
413
|
+
* Present ONLY when `terminalReason` is `SELF_TRADE_PREVENTION`, so
|
|
414
|
+
* presence is the whole signal. Absent means this was not an STP
|
|
415
|
+
* cancellation — or the event predates the field, including every event
|
|
416
|
+
* until the STP modes ship, since nothing emits it yet. Wire:
|
|
417
|
+
* `stp_counterparty_order_id`.
|
|
418
|
+
*/
|
|
419
|
+
stpCounterpartyOrderId?: string;
|
|
392
420
|
/**
|
|
393
421
|
* Cumulative order fill at cancellation, mirroring `filledQuantity` on the
|
|
394
422
|
* taker/maker fill events so consumers read one field across every order
|
|
@@ -481,6 +509,15 @@ export interface OrderPartiallyCancelledEvent extends OrderEvent {
|
|
|
481
509
|
remainingQuantityRaw: string;
|
|
482
510
|
/** Caller-supplied cancel reason; explicit `null` when none was given */
|
|
483
511
|
reason: string | null;
|
|
512
|
+
/**
|
|
513
|
+
* Reserved: the counterparty order behind a self-trade-prevention
|
|
514
|
+
* REDUCTION. No shipped STP mode reduces a resting order — the four modes
|
|
515
|
+
* cancel in full, and DECREMENT/TRANSFER are out of scope — so nothing
|
|
516
|
+
* emits this today; the field exists so a future reducing mode needs no
|
|
517
|
+
* wire change. Same contract as `OrderCancelledEvent`'s field when it is
|
|
518
|
+
* present. Wire: `stp_counterparty_order_id`.
|
|
519
|
+
*/
|
|
520
|
+
stpCounterpartyOrderId?: string;
|
|
484
521
|
/** When the reduction happened (RFC3339 `Z`). Wire: `reduced_at`. */
|
|
485
522
|
reducedAt: string;
|
|
486
523
|
};
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* frame, so its callback is never invoked. That is a silent no-op, never an
|
|
25
25
|
* error.
|
|
26
26
|
*/
|
|
27
|
-
import type { OrderSide, OrderType, TimeInForce, TradingMode } from "../trading";
|
|
27
|
+
import type { OrderSide, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../trading";
|
|
28
28
|
/**
|
|
29
29
|
* Receives one channel's complete subscribe-time state.
|
|
30
30
|
*
|
|
@@ -59,8 +59,8 @@ export type SnapshotHandler<T> = (items: T[]) => void;
|
|
|
59
59
|
* Nullability mirrors the wire exactly. Every optional field below is a Rust
|
|
60
60
|
* `Option` serialized WITHOUT `skip_serializing_if`, so the key is always
|
|
61
61
|
* present and carries `null` when unset — hence `| null` rather than `?`.
|
|
62
|
-
* `clientOrderId`
|
|
63
|
-
*
|
|
62
|
+
* `clientOrderId`, `selfTradePreventionMode` and `version` are the fields the
|
|
63
|
+
* server omits outright, so they are the `?`s.
|
|
64
64
|
*
|
|
65
65
|
* The value unions are widened (`Union | (string & {})`) for the same reason
|
|
66
66
|
* the order event's are: the parser hands an unrecognized value through rather
|
|
@@ -122,6 +122,14 @@ export interface OrderSnapshotItem {
|
|
|
122
122
|
* when the order carried none, matching the live event payload.
|
|
123
123
|
*/
|
|
124
124
|
clientOrderId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* The self-trade-prevention override REQUESTED on the order
|
|
127
|
+
* (`"CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP"`), carried for
|
|
128
|
+
* the `clientOrderId` reason above. Omitted — not `null` — when the order
|
|
129
|
+
* carried none, matching the live event payload: this echoes the request,
|
|
130
|
+
* never the resolved wallet or platform default.
|
|
131
|
+
*/
|
|
132
|
+
selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
|
|
125
133
|
/**
|
|
126
134
|
* Sequencer step this order's state was last written by — the SAME counter
|
|
127
135
|
* the live order events and the REST endpoints carry (0XM-2440).
|
|
@@ -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", "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_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_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_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_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "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_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "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", "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_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_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_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "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_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"];
|
|
14
14
|
/** Union of every OpenAPI operationId in the spec. */
|
|
15
15
|
export type OperationId = (typeof OPERATION_IDS)[number];
|
package/dist/wire/operations.js
CHANGED
|
@@ -66,6 +66,7 @@ export const OPERATION_IDS = [
|
|
|
66
66
|
"get_pulse",
|
|
67
67
|
"get_rewards_balance",
|
|
68
68
|
"get_screener",
|
|
69
|
+
"get_self_trade_prevention_default",
|
|
69
70
|
"get_sub_account_limits",
|
|
70
71
|
"get_sweeper_chains",
|
|
71
72
|
"get_trade_by_id",
|
|
@@ -105,6 +106,7 @@ export const OPERATION_IDS = [
|
|
|
105
106
|
"replace_order",
|
|
106
107
|
"revoke_delegated_agent",
|
|
107
108
|
"revoke_session",
|
|
109
|
+
"set_self_trade_prevention_default",
|
|
108
110
|
"set_trader_code",
|
|
109
111
|
"simulate_fees",
|
|
110
112
|
"simulate_order_risk",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -267,6 +267,46 @@ export interface paths {
|
|
|
267
267
|
patch?: never;
|
|
268
268
|
trace?: never;
|
|
269
269
|
};
|
|
270
|
+
"/api/v1/accounts/self-trade-prevention": {
|
|
271
|
+
parameters: {
|
|
272
|
+
query?: never;
|
|
273
|
+
header?: never;
|
|
274
|
+
path?: never;
|
|
275
|
+
cookie?: never;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Get your self-trade-prevention default
|
|
279
|
+
* @description Get your self-trade-prevention default.
|
|
280
|
+
*
|
|
281
|
+
* Return the authenticated wallet's self-trade-prevention default — the mode
|
|
282
|
+
* applied when an order from this wallet family (every account sharing the
|
|
283
|
+
* wallet address, across applications) would match against the family's own
|
|
284
|
+
* resting order and the order itself names no override. `is_custom` is true
|
|
285
|
+
* when the wallet has explicitly set a default; false means the platform
|
|
286
|
+
* default (`CANCEL_MAKER`) is in effect.
|
|
287
|
+
*/
|
|
288
|
+
get: operations["get_self_trade_prevention_default"];
|
|
289
|
+
/**
|
|
290
|
+
* Set your self-trade-prevention default
|
|
291
|
+
* @description Set your self-trade-prevention default.
|
|
292
|
+
*
|
|
293
|
+
* Set the authenticated wallet's self-trade-prevention default to one of
|
|
294
|
+
* `CANCEL_MAKER`, `CANCEL_TAKER`, `CANCEL_BOTH`, or `SKIP` (input is
|
|
295
|
+
* case-insensitive; responses always carry these spellings). The default is
|
|
296
|
+
* wallet-scoped — it covers every application and account sharing the wallet
|
|
297
|
+
* address — and a per-order mode always overrides it. The write is sequenced
|
|
298
|
+
* through the matching engine; on success the next order from the wallet
|
|
299
|
+
* family already resolves the new mode. Delegated-agent sessions cannot
|
|
300
|
+
* change it.
|
|
301
|
+
*/
|
|
302
|
+
put: operations["set_self_trade_prevention_default"];
|
|
303
|
+
post?: never;
|
|
304
|
+
delete?: never;
|
|
305
|
+
options?: never;
|
|
306
|
+
head?: never;
|
|
307
|
+
patch?: never;
|
|
308
|
+
trace?: never;
|
|
309
|
+
};
|
|
270
310
|
"/api/v1/accounts/sub-accounts": {
|
|
271
311
|
parameters: {
|
|
272
312
|
query?: never;
|
|
@@ -2869,6 +2909,12 @@ export interface components {
|
|
|
2869
2909
|
clientOrderId?: string | null;
|
|
2870
2910
|
/** @description Optional submission identity, distinct from clientOrderId. Use 1-64 characters from [A-Za-z0-9._:-], without whitespace. Scoped to your authenticated user/subaccount and application, shared by create and batch-create items. Retrying the same key and normalized order payload within 24 hours of the original acceptance returns the original committed submission result, even after a fill or cancellation, without executing again. A full response cache does not prevent new keyed submissions: durable responses may be evicted while exact key history remains retained. If response capacity is protected by pending durability or persistence, a new key is refused with ORDER_SUBMISSION_CAPACITY_EXCEEDED. A retry whose original response cannot currently be retrieved returns ORDER_SUBMISSION_UNAVAILABLE and never executes again. Both are HTTP 503 / gRPC UNAVAILABLE, or per-item errors in batches. Retry the same key and payload; for previously accepted keys, stay within 24 hours of the original acceptance. A capacity refusal does not accept or reserve a new key. Different payload returns IDEMPOTENCY_KEY_CONFLICT (HTTP 409 / gRPC ALREADY_EXISTS; per-item error in batches). Validation failures before acceptance do not reserve the key. The window does not extend on retries; after it expires the key may execute a new order, so never retry an unresolved submission after 24 hours. Generate a fresh key for each intended new order and retain it across transport retries. Without a key, a timeout or 5xx leaves the outcome unknown and must not be blindly retried. */
|
|
2871
2911
|
idempotencyKey?: string | null;
|
|
2912
|
+
/**
|
|
2913
|
+
* @description Per-order self-trade-prevention override: how the engine resolves this order matching against one of your own resting orders (your whole wallet family, subaccounts included; the incoming order's mode governs the step and resting orders' modes are never consulted). CANCEL_MAKER cancels each of your resting orders encountered and keeps matching. CANCEL_TAKER fills third-party liquidity up to the first self-touch, then cancels the incoming order's remainder — a zero-fill CANCELLED outcome is possible. CANCEL_BOTH additionally cancels the encountered resting orders. SKIP trades around your resting orders; a remainder that would rest crossing one of your surviving orders is cancelled instead of resting. Omitted, your wallet's configured default applies, else the platform default CANCEL_MAKER. STP cancellations carry terminalReason SELF_TRADE_PREVENTION and stpCounterpartyOrderId on reads and WebSocket events. With time_in_force FOK: CANCEL_MAKER cancels your makers first and then fills or kills; CANCEL_TAKER and SKIP cancel the whole order when self is in the fill path; CANCEL_BOTH fails only this item with a per-item SELF_TRADE_NOT_ALLOWED error — the batch itself still returns 2xx / OK. An unknown value likewise fails only this item, with error.code INVALID_SELF_TRADE_PREVENTION_MODE. The requested value is echoed back as selfTradePreventionMode on order reads, absent when omitted here.
|
|
2914
|
+
* @example CANCEL_TAKER
|
|
2915
|
+
* @enum {string|null}
|
|
2916
|
+
*/
|
|
2917
|
+
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
2872
2918
|
};
|
|
2873
2919
|
BatchCreateOrdersRequest: {
|
|
2874
2920
|
orders: components["schemas"]["BatchCreateOrderItem"][];
|
|
@@ -2948,6 +2994,12 @@ export interface components {
|
|
|
2948
2994
|
* @example quote-btc-1130-a
|
|
2949
2995
|
*/
|
|
2950
2996
|
clientOrderId?: string | null;
|
|
2997
|
+
/**
|
|
2998
|
+
* @description Per-order self-trade-prevention override for the replacement: CANCEL_MAKER, CANCEL_TAKER, CANCEL_BOTH, or SKIP (see the create-order field for the full semantics). A replacement is a new order with a new id, so it carries its own value and inherits nothing from the original — restate it to keep the override. Omitted, your wallet's configured default applies, else the platform default CANCEL_MAKER. An unknown value fails only this item, with error.code INVALID_SELF_TRADE_PREVENTION_MODE. The requested value is echoed back as selfTradePreventionMode on order reads, absent when omitted here.
|
|
2999
|
+
* @example CANCEL_TAKER
|
|
3000
|
+
* @enum {string|null}
|
|
3001
|
+
*/
|
|
3002
|
+
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
2951
3003
|
};
|
|
2952
3004
|
BatchReplaceOrdersRequest: {
|
|
2953
3005
|
orders: components["schemas"]["BatchReplaceOrderItem"][];
|
|
@@ -3383,6 +3435,12 @@ export interface components {
|
|
|
3383
3435
|
clientOrderId?: string | null;
|
|
3384
3436
|
/** @description Optional submission identity, distinct from clientOrderId. Use 1-64 characters from [A-Za-z0-9._:-], without whitespace. Scoped to your authenticated user/subaccount and application, shared by create and batch-create items. Retrying the same key and normalized order payload within 24 hours of the original acceptance returns the original committed submission result, even after a fill or cancellation, without executing again. A full response cache does not prevent new keyed submissions: durable responses may be evicted while exact key history remains retained. If response capacity is protected by pending durability or persistence, a new key is refused with ORDER_SUBMISSION_CAPACITY_EXCEEDED. A retry whose original response cannot currently be retrieved returns ORDER_SUBMISSION_UNAVAILABLE and never executes again. Both are HTTP 503 / gRPC UNAVAILABLE, or per-item errors in batches. Retry the same key and payload; for previously accepted keys, stay within 24 hours of the original acceptance. A capacity refusal does not accept or reserve a new key. Different payload returns IDEMPOTENCY_KEY_CONFLICT (HTTP 409 / gRPC ALREADY_EXISTS; per-item error in batches). Validation failures before acceptance do not reserve the key. The window does not extend on retries; after it expires the key may execute a new order, so never retry an unresolved submission after 24 hours. Generate a fresh key for each intended new order and retain it across transport retries. Without a key, a timeout or 5xx leaves the outcome unknown and must not be blindly retried. */
|
|
3385
3437
|
idempotencyKey?: string | null;
|
|
3438
|
+
/**
|
|
3439
|
+
* @description Per-order self-trade-prevention override: how the engine resolves this order matching against one of your own resting orders (your whole wallet family, subaccounts included; the incoming order's mode governs the step and resting orders' modes are never consulted). CANCEL_MAKER cancels each of your resting orders encountered and keeps matching. CANCEL_TAKER fills third-party liquidity up to the first self-touch, then cancels the incoming order's remainder — a zero-fill CANCELLED outcome is possible. CANCEL_BOTH additionally cancels the encountered resting orders. SKIP trades around your resting orders; a remainder that would rest crossing one of your surviving orders is cancelled instead of resting. Omitted, your wallet's configured default applies, else the platform default CANCEL_MAKER. STP cancellations carry terminalReason SELF_TRADE_PREVENTION and stpCounterpartyOrderId on reads and WebSocket events. With time_in_force FOK: CANCEL_MAKER cancels your makers first and then fills or kills; CANCEL_TAKER and SKIP cancel the whole order when self is in the fill path; CANCEL_BOTH rejects the placement with SELF_TRADE_NOT_ALLOWED. The requested value is echoed back as selfTradePreventionMode on order reads, absent when omitted here.
|
|
3440
|
+
* @example CANCEL_TAKER
|
|
3441
|
+
* @enum {string|null}
|
|
3442
|
+
*/
|
|
3443
|
+
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
3386
3444
|
};
|
|
3387
3445
|
CreateOrderResponse: {
|
|
3388
3446
|
/**
|
|
@@ -4598,6 +4656,12 @@ export interface components {
|
|
|
4598
4656
|
* @example 918342
|
|
4599
4657
|
*/
|
|
4600
4658
|
version?: number | null;
|
|
4659
|
+
/**
|
|
4660
|
+
* @description The per-order self-trade-prevention override REQUESTED when this order was placed or replaced: CANCEL_MAKER, CANCEL_TAKER, CANCEL_BOTH, or SKIP. Absent when the order carried no override — including every order placed before the field was accepted on write — even though a wallet or platform default still governed its matching. This echoes the request, not the resolved default.
|
|
4661
|
+
* @example CANCEL_TAKER
|
|
4662
|
+
* @enum {string|null}
|
|
4663
|
+
*/
|
|
4664
|
+
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
4601
4665
|
};
|
|
4602
4666
|
/** @description Orderbook snapshot with token metadata and sequence number. */
|
|
4603
4667
|
GetOrderbookResponse: {
|
|
@@ -6686,10 +6750,11 @@ export interface components {
|
|
|
6686
6750
|
};
|
|
6687
6751
|
ReplaceOrderRequest: {
|
|
6688
6752
|
/**
|
|
6689
|
-
* @description
|
|
6690
|
-
* @example
|
|
6753
|
+
* @description Per-order self-trade-prevention override for the replacement: CANCEL_MAKER, CANCEL_TAKER, CANCEL_BOTH, or SKIP (see the create-order field for the full semantics). A replacement is a new order with a new id, so it carries its own value and inherits nothing from the original — restate it to keep the override. Omitted, your wallet's configured default applies, else the platform default CANCEL_MAKER. The requested value is echoed back as selfTradePreventionMode on order reads, absent when omitted here.
|
|
6754
|
+
* @example CANCEL_TAKER
|
|
6755
|
+
* @enum {string|null}
|
|
6691
6756
|
*/
|
|
6692
|
-
|
|
6757
|
+
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
6693
6758
|
/**
|
|
6694
6759
|
* @description New limit price (if changing)
|
|
6695
6760
|
* @example 35500.00
|
|
@@ -6710,6 +6775,11 @@ export interface components {
|
|
|
6710
6775
|
* @example false
|
|
6711
6776
|
*/
|
|
6712
6777
|
postOnly?: boolean | null;
|
|
6778
|
+
/**
|
|
6779
|
+
* @description Client-assigned correlation handle, echoed back on order reads (detail and list) and on order WebSocket events. At most 64 characters from [A-Za-z0-9._:-]; surrounding whitespace is trimmed before storage, and a blank or whitespace-only value is treated as absent. Uniqueness is enforced only among your orders that are RESTING on the book: a create or replace reusing a value another of your resting orders still holds is rejected with HTTP 409 / gRPC ALREADY_EXISTS and the code CLIENT_ORDER_ID_CONFLICT. An order that never rests — MARKET, IOC/FOK, or a LIMIT that fills completely on arrival — does not take the handle, and the value is released the moment any order reaches a terminal state. It is therefore NOT an idempotency key, though on this replace path a retry cannot double-execute: the request names the original order id, and the sequencer revalidates that original in memory and on the book at sequence time, so once the first replacement succeeds the original is gone and a retry is rejected with ORDER_NOT_FOUND rather than placing a second order. That code is itself ambiguous — the original may instead have filled or been cancelled — so the risk here is acting on a stale view, not duplicate execution. Reconcile a lost response against the order WebSocket stream, which carries this value on the submit acknowledgement and on fills, including for orders that never rest; order history is replica-backed and can omit an order that did land. The stream is not replayable and has no sequence number to backfill from, and its fan-out is non-persistent Core NATS: the service can re-establish an ended upstream subscription without closing your socket, so events can be missed while your connection still looks healthy. A matching event is therefore positive proof the order was accepted, but silence is NEVER evidence it was not, and no client-observable condition makes it so. Absent positive evidence the outcome is unresolved: hold and escalate rather than resubmitting. A replacement carries no order type or time-in-force and its original must still be RESTING, so the post-acceptance rejection shapes are unreachable here: the reachable failures are all pre-acceptance — malformed, post-only would cross, handle conflict, or the original no longer resting (ORDER_NOT_FOUND) — and each fails the request, emits no event and is never written to order history (an order rejected AFTER acceptance is persisted with status REJECTED, so only the pre-acceptance class is absent). Where no surface is conclusive, do not resubmit. A replacement is a new order with a new id, so it carries its own value and inherits nothing from the original — restate it to keep the handle.
|
|
6780
|
+
* @example quote-btc-1130-a
|
|
6781
|
+
*/
|
|
6782
|
+
clientOrderId?: string | null;
|
|
6713
6783
|
};
|
|
6714
6784
|
ReplaceOrderResponse: {
|
|
6715
6785
|
/**
|
|
@@ -6895,6 +6965,25 @@ export interface components {
|
|
|
6895
6965
|
*/
|
|
6896
6966
|
priceChangePercent?: string | null;
|
|
6897
6967
|
};
|
|
6968
|
+
SelfTradePreventionDefaultResponse: {
|
|
6969
|
+
/**
|
|
6970
|
+
* @description The wallet's effective self-trade-prevention default: `CANCEL_MAKER`, `CANCEL_TAKER`, `CANCEL_BOTH`, or `SKIP`.
|
|
6971
|
+
* @example CANCEL_MAKER
|
|
6972
|
+
*/
|
|
6973
|
+
mode?: string | null;
|
|
6974
|
+
/**
|
|
6975
|
+
* @description True when this wallet has explicitly set a default; false when the platform default (`CANCEL_MAKER`) is in effect.
|
|
6976
|
+
* @example false
|
|
6977
|
+
*/
|
|
6978
|
+
isCustom?: boolean | null;
|
|
6979
|
+
};
|
|
6980
|
+
SetSelfTradePreventionDefaultRequest: {
|
|
6981
|
+
/**
|
|
6982
|
+
* @description The self-trade-prevention mode applied when an order from this wallet would match the wallet family's own resting order and the order names no override: `CANCEL_MAKER` (cancel the resting order — the platform default), `CANCEL_TAKER` (cancel the incoming order), `CANCEL_BOTH`, or `SKIP` (trade around own orders). Input is case-insensitive.
|
|
6983
|
+
* @example SKIP
|
|
6984
|
+
*/
|
|
6985
|
+
mode: string;
|
|
6986
|
+
};
|
|
6898
6987
|
SetTraderCodeRequest: {
|
|
6899
6988
|
/**
|
|
6900
6989
|
* @description The custom handle to claim or edit to: `[A-Za-z0-9_]`, must start with a letter, 5–20 characters. Case is preserved on store; uniqueness is case-insensitive.
|
|
@@ -8707,6 +8796,92 @@ export interface operations {
|
|
|
8707
8796
|
};
|
|
8708
8797
|
};
|
|
8709
8798
|
};
|
|
8799
|
+
get_self_trade_prevention_default: {
|
|
8800
|
+
parameters: {
|
|
8801
|
+
query?: never;
|
|
8802
|
+
header?: never;
|
|
8803
|
+
path?: never;
|
|
8804
|
+
cookie?: never;
|
|
8805
|
+
};
|
|
8806
|
+
requestBody?: never;
|
|
8807
|
+
responses: {
|
|
8808
|
+
/** @description OK */
|
|
8809
|
+
200: {
|
|
8810
|
+
headers: {
|
|
8811
|
+
[name: string]: unknown;
|
|
8812
|
+
};
|
|
8813
|
+
content: {
|
|
8814
|
+
"application/json": components["schemas"]["SelfTradePreventionDefaultResponse"];
|
|
8815
|
+
};
|
|
8816
|
+
};
|
|
8817
|
+
/** @description Authentication required */
|
|
8818
|
+
401: {
|
|
8819
|
+
headers: {
|
|
8820
|
+
[name: string]: unknown;
|
|
8821
|
+
};
|
|
8822
|
+
content?: never;
|
|
8823
|
+
};
|
|
8824
|
+
/** @description Internal server error */
|
|
8825
|
+
500: {
|
|
8826
|
+
headers: {
|
|
8827
|
+
[name: string]: unknown;
|
|
8828
|
+
};
|
|
8829
|
+
content?: never;
|
|
8830
|
+
};
|
|
8831
|
+
};
|
|
8832
|
+
};
|
|
8833
|
+
set_self_trade_prevention_default: {
|
|
8834
|
+
parameters: {
|
|
8835
|
+
query?: never;
|
|
8836
|
+
header?: never;
|
|
8837
|
+
path?: never;
|
|
8838
|
+
cookie?: never;
|
|
8839
|
+
};
|
|
8840
|
+
requestBody: {
|
|
8841
|
+
content: {
|
|
8842
|
+
"application/json": components["schemas"]["SetSelfTradePreventionDefaultRequest"];
|
|
8843
|
+
};
|
|
8844
|
+
};
|
|
8845
|
+
responses: {
|
|
8846
|
+
/** @description OK */
|
|
8847
|
+
200: {
|
|
8848
|
+
headers: {
|
|
8849
|
+
[name: string]: unknown;
|
|
8850
|
+
};
|
|
8851
|
+
content: {
|
|
8852
|
+
"application/json": components["schemas"]["SelfTradePreventionDefaultResponse"];
|
|
8853
|
+
};
|
|
8854
|
+
};
|
|
8855
|
+
/** @description Unknown mode */
|
|
8856
|
+
400: {
|
|
8857
|
+
headers: {
|
|
8858
|
+
[name: string]: unknown;
|
|
8859
|
+
};
|
|
8860
|
+
content?: never;
|
|
8861
|
+
};
|
|
8862
|
+
/** @description Authentication required */
|
|
8863
|
+
401: {
|
|
8864
|
+
headers: {
|
|
8865
|
+
[name: string]: unknown;
|
|
8866
|
+
};
|
|
8867
|
+
content?: never;
|
|
8868
|
+
};
|
|
8869
|
+
/** @description Delegated-agent sessions cannot change account settings */
|
|
8870
|
+
403: {
|
|
8871
|
+
headers: {
|
|
8872
|
+
[name: string]: unknown;
|
|
8873
|
+
};
|
|
8874
|
+
content?: never;
|
|
8875
|
+
};
|
|
8876
|
+
/** @description Internal server error */
|
|
8877
|
+
500: {
|
|
8878
|
+
headers: {
|
|
8879
|
+
[name: string]: unknown;
|
|
8880
|
+
};
|
|
8881
|
+
content?: never;
|
|
8882
|
+
};
|
|
8883
|
+
};
|
|
8884
|
+
};
|
|
8710
8885
|
list_sub_accounts_with_balances: {
|
|
8711
8886
|
parameters: {
|
|
8712
8887
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.58",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lint": "biome lint ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@0xmonaco/contracts": "1.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.58",
|
|
20
20
|
"zod": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|