@0xmonaco/types 1.0.36 → 1.0.37
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/trading/index.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export interface TradingAPI extends BaseAPI {
|
|
|
38
38
|
positionSide?: PositionSide;
|
|
39
39
|
leverage?: string;
|
|
40
40
|
reduceOnly?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Maker-only: rejected with a 400 whose message contains
|
|
43
|
+
* `post-only order would cross` if this limit order would cross the
|
|
44
|
+
* book. LIMIT orders with GTC/GTD only; rejected together with IOC/FOK.
|
|
45
|
+
*/
|
|
46
|
+
postOnly?: boolean;
|
|
41
47
|
takeProfit?: ParentTpSlLegParams;
|
|
42
48
|
stopLoss?: ParentTpSlLegParams;
|
|
43
49
|
}): Promise<CreateOrderResponse>;
|
|
@@ -104,12 +110,14 @@ export interface TradingAPI extends BaseAPI {
|
|
|
104
110
|
* @param newOrder.price - New order price as string (optional)
|
|
105
111
|
* @param newOrder.quantity - New order quantity as string
|
|
106
112
|
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
113
|
+
* @param newOrder.postOnly - Re-states post-only intent for the replacement (nothing is inherited from the original order)
|
|
107
114
|
* @returns Promise resolving to a `ReplaceOrderResponse`
|
|
108
115
|
*/
|
|
109
116
|
replaceOrder(orderId: string, newOrder: {
|
|
110
117
|
price?: string;
|
|
111
118
|
quantity?: string;
|
|
112
119
|
useMasterBalance?: boolean;
|
|
120
|
+
postOnly?: boolean;
|
|
113
121
|
}): Promise<ReplaceOrderResponse>;
|
|
114
122
|
/**
|
|
115
123
|
* Batch creates multiple orders in a single request.
|
|
@@ -356,6 +356,13 @@ export interface BatchCreateOrderParams {
|
|
|
356
356
|
leverage?: string;
|
|
357
357
|
/** Whether the order can only reduce existing exposure */
|
|
358
358
|
reduceOnly?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Maker-only: rejected with a 400 whose message contains
|
|
361
|
+
* `post-only order would cross` if this limit order would cross the book.
|
|
362
|
+
* LIMIT orders with GTC/GTD only; rejected on MARKET orders and combined
|
|
363
|
+
* with IOC/FOK.
|
|
364
|
+
*/
|
|
365
|
+
postOnly?: boolean;
|
|
359
366
|
}
|
|
360
367
|
/**
|
|
361
368
|
* Parameters for a single order in a batch replace request
|
|
@@ -369,6 +376,11 @@ export interface BatchReplaceOrderParams {
|
|
|
369
376
|
quantity?: string;
|
|
370
377
|
/** For sub-accounts: use master's balance (optional) */
|
|
371
378
|
useMasterBalance?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Re-states post-only intent for the replacement (optional). Nothing is
|
|
381
|
+
* inherited from the original order — see `TradingAPI.replaceOrder`.
|
|
382
|
+
*/
|
|
383
|
+
postOnly?: boolean;
|
|
372
384
|
}
|
|
373
385
|
export interface CancelConditionalOrderResponse {
|
|
374
386
|
conditionalOrderId: string;
|
|
@@ -119,6 +119,7 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
119
119
|
}>>;
|
|
120
120
|
leverage: z.ZodOptional<z.ZodString>;
|
|
121
121
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
122
123
|
takeProfit: z.ZodOptional<z.ZodObject<{
|
|
123
124
|
triggerPrice: z.ZodString;
|
|
124
125
|
orderType: z.ZodEnum<{
|
|
@@ -230,6 +231,7 @@ export declare const ReplaceOrderSchema: z.ZodObject<{
|
|
|
230
231
|
price: z.ZodOptional<z.ZodString>;
|
|
231
232
|
quantity: z.ZodOptional<z.ZodString>;
|
|
232
233
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
233
235
|
}, z.core.$strip>;
|
|
234
236
|
}, z.core.$strip>;
|
|
235
237
|
/**
|
|
@@ -356,6 +358,7 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
356
358
|
}>>;
|
|
357
359
|
leverage: z.ZodOptional<z.ZodString>;
|
|
358
360
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
361
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
359
362
|
}, z.core.$strip>;
|
|
360
363
|
/**
|
|
361
364
|
* Batch Create Orders validation schema
|
|
@@ -402,6 +405,7 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
402
405
|
}>>;
|
|
403
406
|
leverage: z.ZodOptional<z.ZodString>;
|
|
404
407
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
408
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
405
409
|
}, z.core.$strip>>;
|
|
406
410
|
}, z.core.$strip>;
|
|
407
411
|
/**
|
|
@@ -415,6 +419,7 @@ export declare const BatchReplaceOrderItemSchema: z.ZodObject<{
|
|
|
415
419
|
price: z.ZodOptional<z.ZodString>;
|
|
416
420
|
quantity: z.ZodOptional<z.ZodString>;
|
|
417
421
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
418
423
|
}, z.core.$strip>;
|
|
419
424
|
/**
|
|
420
425
|
* Batch Replace Orders validation schema
|
|
@@ -427,5 +432,6 @@ export declare const BatchReplaceOrdersSchema: z.ZodObject<{
|
|
|
427
432
|
price: z.ZodOptional<z.ZodString>;
|
|
428
433
|
quantity: z.ZodOptional<z.ZodString>;
|
|
429
434
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
435
|
+
postOnly: z.ZodOptional<z.ZodBoolean>;
|
|
430
436
|
}, z.core.$strip>>;
|
|
431
437
|
}, z.core.$strip>;
|
|
@@ -128,6 +128,7 @@ export const PlaceLimitOrderSchema = z
|
|
|
128
128
|
positionSide: PositionSideSchema.optional(),
|
|
129
129
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
130
130
|
reduceOnly: z.boolean().optional(),
|
|
131
|
+
postOnly: z.boolean().optional(),
|
|
131
132
|
takeProfit: ParentTpSlLegSchema.optional(),
|
|
132
133
|
stopLoss: ParentTpSlLegSchema.optional(),
|
|
133
134
|
})
|
|
@@ -180,6 +181,10 @@ export const PlaceLimitOrderSchema = z
|
|
|
180
181
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.reduceOnly !== true, {
|
|
181
182
|
message: "reduceOnly orders cannot create a new risk bucket",
|
|
182
183
|
path: ["options", "reduceOnly"],
|
|
184
|
+
})
|
|
185
|
+
.refine((data) => data.options?.postOnly !== true || data.options?.timeInForce === undefined || (data.options.timeInForce !== "IOC" && data.options.timeInForce !== "FOK"), {
|
|
186
|
+
message: "postOnly cannot be combined with IOC/FOK time in force",
|
|
187
|
+
path: ["options", "timeInForce"],
|
|
183
188
|
});
|
|
184
189
|
/**
|
|
185
190
|
* Place Market Order validation schema
|
|
@@ -274,6 +279,10 @@ export const ReplaceOrderSchema = z.object({
|
|
|
274
279
|
price: PositiveDecimalStringSchema.optional(),
|
|
275
280
|
quantity: PositiveDecimalStringSchema.optional(),
|
|
276
281
|
useMasterBalance: z.boolean().optional(),
|
|
282
|
+
// No MARKET/IOC-FOK refine here: order type and time-in-force are not
|
|
283
|
+
// replaceable fields — the server validates postOnly against the
|
|
284
|
+
// persisted original order, which this client-side schema cannot see.
|
|
285
|
+
postOnly: z.boolean().optional(),
|
|
277
286
|
}),
|
|
278
287
|
});
|
|
279
288
|
/**
|
|
@@ -358,6 +367,7 @@ export const BatchCreateOrderItemSchema = z
|
|
|
358
367
|
positionSide: PositionSideSchema.optional(),
|
|
359
368
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
360
369
|
reduceOnly: z.boolean().optional(),
|
|
370
|
+
postOnly: z.boolean().optional(),
|
|
361
371
|
})
|
|
362
372
|
.refine((data) => data.orderType !== "LIMIT" || data.price !== undefined, {
|
|
363
373
|
message: "Price is required for LIMIT orders",
|
|
@@ -370,6 +380,14 @@ export const BatchCreateOrderItemSchema = z
|
|
|
370
380
|
.refine((data) => data.orderType !== "MARKET" || data.timeInForce === undefined, {
|
|
371
381
|
message: "timeInForce must not be provided for MARKET orders",
|
|
372
382
|
path: ["timeInForce"],
|
|
383
|
+
})
|
|
384
|
+
.refine((data) => data.orderType !== "MARKET" || data.postOnly !== true, {
|
|
385
|
+
message: "postOnly must not be provided for MARKET orders",
|
|
386
|
+
path: ["postOnly"],
|
|
387
|
+
})
|
|
388
|
+
.refine((data) => data.postOnly !== true || data.timeInForce === undefined || (data.timeInForce !== "IOC" && data.timeInForce !== "FOK"), {
|
|
389
|
+
message: "postOnly cannot be combined with IOC/FOK time in force",
|
|
390
|
+
path: ["postOnly"],
|
|
373
391
|
})
|
|
374
392
|
.refine((data) => data.riskBucketCollateral === undefined || data.tradingMode === "MARGIN", {
|
|
375
393
|
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
@@ -431,6 +449,10 @@ export const BatchReplaceOrderItemSchema = z
|
|
|
431
449
|
price: PositiveDecimalStringSchema.optional(),
|
|
432
450
|
quantity: PositiveDecimalStringSchema.optional(),
|
|
433
451
|
useMasterBalance: z.boolean().optional(),
|
|
452
|
+
// No MARKET/IOC-FOK refine here: order type and time-in-force are not
|
|
453
|
+
// replaceable fields — the server validates postOnly against the
|
|
454
|
+
// persisted original order, which this client-side schema cannot see.
|
|
455
|
+
postOnly: z.boolean().optional(),
|
|
434
456
|
})
|
|
435
457
|
.refine((data) => data.price !== undefined || data.quantity !== undefined, {
|
|
436
458
|
message: "At least one of price or quantity must be provided",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -2714,6 +2714,11 @@ export interface components {
|
|
|
2714
2714
|
* @enum {string|null}
|
|
2715
2715
|
*/
|
|
2716
2716
|
marginMode?: "ISOLATED" | "CROSS" | null;
|
|
2717
|
+
/**
|
|
2718
|
+
* @description Post-only: reject instead of matching if this limit order would cross the book (HTTP 400 / gRPC INVALID_ARGUMENT; the error message contains 'post-only order would cross'). LIMIT orders with GTC/GTD only; rejected on MARKET orders and IOC/FOK.
|
|
2719
|
+
* @example false
|
|
2720
|
+
*/
|
|
2721
|
+
postOnly?: boolean | null;
|
|
2717
2722
|
};
|
|
2718
2723
|
BatchCreateOrdersRequest: {
|
|
2719
2724
|
orders: components["schemas"]["BatchCreateOrderItem"][];
|
|
@@ -2783,6 +2788,11 @@ export interface components {
|
|
|
2783
2788
|
* @example false
|
|
2784
2789
|
*/
|
|
2785
2790
|
useMasterBalance?: boolean | null;
|
|
2791
|
+
/**
|
|
2792
|
+
* @description Post-only: reject instead of matching if this limit order would cross the book (HTTP 400 / gRPC INVALID_ARGUMENT; the error message contains 'post-only order would cross'). LIMIT orders with GTC/GTD only; rejected on MARKET orders and IOC/FOK.
|
|
2793
|
+
* @example false
|
|
2794
|
+
*/
|
|
2795
|
+
postOnly?: boolean | null;
|
|
2786
2796
|
};
|
|
2787
2797
|
BatchReplaceOrdersRequest: {
|
|
2788
2798
|
orders: components["schemas"]["BatchReplaceOrderItem"][];
|
|
@@ -3177,6 +3187,11 @@ export interface components {
|
|
|
3177
3187
|
* @enum {string|null}
|
|
3178
3188
|
*/
|
|
3179
3189
|
marginMode?: "ISOLATED" | "CROSS" | null;
|
|
3190
|
+
/**
|
|
3191
|
+
* @description Post-only: reject instead of matching if this limit order would cross the book (HTTP 400 / gRPC INVALID_ARGUMENT; the error message contains 'post-only order would cross'). LIMIT orders with GTC/GTD only; rejected on MARKET orders and IOC/FOK.
|
|
3192
|
+
* @example false
|
|
3193
|
+
*/
|
|
3194
|
+
postOnly?: boolean | null;
|
|
3180
3195
|
};
|
|
3181
3196
|
CreateOrderResponse: {
|
|
3182
3197
|
/**
|
|
@@ -5902,10 +5917,10 @@ export interface components {
|
|
|
5902
5917
|
};
|
|
5903
5918
|
ReplaceOrderRequest: {
|
|
5904
5919
|
/**
|
|
5905
|
-
* @description
|
|
5920
|
+
* @description Post-only: reject instead of matching if this limit order would cross the book (HTTP 400 / gRPC INVALID_ARGUMENT; the error message contains 'post-only order would cross'). LIMIT orders with GTC/GTD only; rejected on MARKET orders and IOC/FOK.
|
|
5906
5921
|
* @example false
|
|
5907
5922
|
*/
|
|
5908
|
-
|
|
5923
|
+
postOnly?: boolean | null;
|
|
5909
5924
|
/**
|
|
5910
5925
|
* @description New limit price (if changing)
|
|
5911
5926
|
* @example 35500.00
|
|
@@ -5916,6 +5931,11 @@ export interface components {
|
|
|
5916
5931
|
* @example 0.7
|
|
5917
5932
|
*/
|
|
5918
5933
|
quantity?: string | null;
|
|
5934
|
+
/**
|
|
5935
|
+
* @description Use master account balance for sub-account orders
|
|
5936
|
+
* @example false
|
|
5937
|
+
*/
|
|
5938
|
+
useMasterBalance?: boolean | null;
|
|
5919
5939
|
};
|
|
5920
5940
|
ReplaceOrderResponse: {
|
|
5921
5941
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "1.0.
|
|
23
|
+
"@0xmonaco/contracts": "1.0.37",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|