@0xmonaco/types 1.0.29 → 1.0.32-develop.522174b
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/market/index.d.ts +16 -0
- package/dist/positions/index.d.ts +12 -2
- package/dist/profile/index.d.ts +39 -8
- package/dist/trading/index.d.ts +10 -2
- package/dist/trading/orders.d.ts +8 -0
- package/dist/trading/responses.d.ts +33 -10
- package/dist/validation/positions.d.ts +1 -0
- package/dist/validation/positions.js +5 -2
- package/dist/validation/profile.js +16 -2
- package/dist/validation/trading.d.ts +13 -4
- package/dist/validation/trading.js +19 -5
- package/dist/websocket/events/balance-events.d.ts +1 -1
- package/dist/websocket/events/balance-events.js +1 -1
- package/dist/websocket/events/movement-events.d.ts +1 -1
- package/dist/websocket/events/movement-events.js +1 -1
- package/dist/wire/schema.d.ts +33 -12
- package/package.json +2 -2
package/dist/market/index.d.ts
CHANGED
|
@@ -353,8 +353,24 @@ export interface FundingState {
|
|
|
353
353
|
}
|
|
354
354
|
export interface FundingRecord {
|
|
355
355
|
tradingPairId: string;
|
|
356
|
+
/** Sequential settlement-window index (serialized as a JSON number). */
|
|
357
|
+
epoch: number;
|
|
358
|
+
/** Capped settled rate for the window, as a decimal-string fraction per funding interval (e.g. "0.0001" = 0.01%). */
|
|
356
359
|
fundingRate: string;
|
|
360
|
+
/** Quote charged per unit of base position for this window (fundingRate × referencePrice; positive means longs paid shorts). */
|
|
361
|
+
fundingDeltaPerUnit: string;
|
|
362
|
+
/** Running sum of fundingDeltaPerUnit across settled windows; position payments settle against deltas of this value. */
|
|
357
363
|
cumulativeFundingPerUnit?: string;
|
|
364
|
+
/** Mark price at the window boundary — the payment basis for every position settled in the window. */
|
|
365
|
+
referencePrice: string;
|
|
366
|
+
/** Number of premium samples that fed the window's settled rate. */
|
|
367
|
+
sampleCount: number;
|
|
368
|
+
/** Window open time (ISO 8601). */
|
|
369
|
+
windowStartedAt: string;
|
|
370
|
+
/** Window close time (ISO 8601). */
|
|
371
|
+
windowClosedAt: string;
|
|
372
|
+
/** Settlement time (ISO 8601); the sort key for `listAllFundingHistory`. */
|
|
373
|
+
settledAt: string;
|
|
358
374
|
/** True when the window settled at the carried last rate (sparse-sample rule). */
|
|
359
375
|
carried?: boolean;
|
|
360
376
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { BaseAPI } from "../api";
|
|
2
2
|
import type { MarginMode } from "../margin-accounts";
|
|
3
3
|
import type { OrderType, PositionSide, TimeInForce } from "../trading";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Position lifecycle statuses the API returns. `CLOSED`, `LIQUIDATED`, and
|
|
6
|
+
* `EXPIRED` are terminal; `LIQUIDATING` is transient.
|
|
7
|
+
*/
|
|
8
|
+
export type PositionStatus = "OPEN" | "CLOSED" | "LIQUIDATING" | "LIQUIDATED" | "EXPIRED";
|
|
9
|
+
/**
|
|
10
|
+
* Accepted `status` filter values for {@link ListPositionsParams}. Narrower than
|
|
11
|
+
* {@link PositionStatus}: the backend folds `EXPIRED` positions under a `CLOSED`
|
|
12
|
+
* filter, so `EXPIRED` is not an accepted filter value.
|
|
13
|
+
*/
|
|
14
|
+
export type PositionStatusFilter = "OPEN" | "CLOSED" | "LIQUIDATING" | "LIQUIDATED";
|
|
5
15
|
export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
|
|
6
16
|
export interface Position {
|
|
7
17
|
positionId: string;
|
|
@@ -64,7 +74,7 @@ export interface Position {
|
|
|
64
74
|
export interface ListPositionsParams {
|
|
65
75
|
marginAccountId?: string;
|
|
66
76
|
tradingPairId?: string;
|
|
67
|
-
status?:
|
|
77
|
+
status?: PositionStatusFilter;
|
|
68
78
|
page?: number;
|
|
69
79
|
pageSize?: number;
|
|
70
80
|
}
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -231,16 +231,24 @@ export interface UserTrade {
|
|
|
231
231
|
* Query parameters for getting user trades
|
|
232
232
|
*/
|
|
233
233
|
export interface GetUserTradesParams {
|
|
234
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Page number for legacy offset pagination (starts from 1).
|
|
236
|
+
*
|
|
237
|
+
* @deprecated Use cursor pagination (`pageToken`) instead. Passing `page`
|
|
238
|
+
* selects legacy page-number mode, which only ever sees recent (hot)
|
|
239
|
+
* history; omitting both `page` and `pageToken` now drives cursor mode.
|
|
240
|
+
*/
|
|
235
241
|
page?: number;
|
|
236
|
-
/** Number of items per page (max 100) */
|
|
242
|
+
/** Number of items per page (max 100 in page-number mode, up to 1000 when `pageToken` is present) */
|
|
237
243
|
pageSize?: number;
|
|
238
244
|
/** Filter by trading pair ID (UUID) */
|
|
239
245
|
tradingPairId?: string;
|
|
240
246
|
/**
|
|
241
247
|
* Pagination cursor with three distinct states:
|
|
242
|
-
* - Omitted (`undefined`):
|
|
243
|
-
*
|
|
248
|
+
* - Omitted (`undefined`): the SDK starts a cursor walk (it sends
|
|
249
|
+
* `pageToken=""`) unless the deprecated `page` param was passed, in
|
|
250
|
+
* which case the request uses legacy page-number pagination, limited to
|
|
251
|
+
* recent history once the archive window is enabled.
|
|
244
252
|
* - Empty string (`""`): start a cursor walk with no prior position, from
|
|
245
253
|
* the newest row (this endpoint always sorts newest-first).
|
|
246
254
|
* - Non-empty: an opaque cursor from a previous response's
|
|
@@ -261,13 +269,28 @@ export interface GetUserTradesParams {
|
|
|
261
269
|
export interface GetUserTradesResponse {
|
|
262
270
|
/** List of user trades */
|
|
263
271
|
trades: UserTrade[];
|
|
264
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* Current page number.
|
|
274
|
+
*
|
|
275
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
276
|
+
* cursor mode. Use `pageToken`/`nextPageToken` pagination instead.
|
|
277
|
+
*/
|
|
265
278
|
page: number;
|
|
266
279
|
/** Items per page */
|
|
267
280
|
pageSize: number;
|
|
268
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* Total number of trades.
|
|
283
|
+
*
|
|
284
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
285
|
+
* cursor mode, which has no exact total. Walk `nextPageToken` instead.
|
|
286
|
+
*/
|
|
269
287
|
total: number;
|
|
270
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* Total number of pages.
|
|
290
|
+
*
|
|
291
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
292
|
+
* cursor mode, which has no exact total. Walk `nextPageToken` instead.
|
|
293
|
+
*/
|
|
271
294
|
totalPages: number;
|
|
272
295
|
/**
|
|
273
296
|
* Cursor for the next page. Empty on every page-number (legacy) response —
|
|
@@ -546,12 +569,20 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
546
569
|
*
|
|
547
570
|
* @param params - Optional query parameters for pagination and filtering
|
|
548
571
|
* @param params.page - Page number (starts from 1)
|
|
549
|
-
* @param params.limit - Number of items per page (max 100)
|
|
572
|
+
* @param params.limit - Number of items per page (max 100 in page-number mode, up to 1000 when `pageToken` is present)
|
|
550
573
|
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
551
574
|
* @returns Promise resolving to paginated trades response
|
|
552
575
|
* @throws ValidationError If pagination params (page/limit) are invalid or tradingPairId is not a valid UUID; this may occur before any network request.
|
|
553
576
|
*/
|
|
554
577
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
578
|
+
/**
|
|
579
|
+
* Walks the user's full trade history with cursor pagination, yielding one
|
|
580
|
+
* trade at a time. Follows each response's `nextPageToken` until the walk
|
|
581
|
+
* is exhausted; covers hot and archived history.
|
|
582
|
+
* @param params - Optional filters and page size; the cursor is managed internally
|
|
583
|
+
* @returns Async generator yielding trades
|
|
584
|
+
*/
|
|
585
|
+
iterateUserTrades(params?: Omit<GetUserTradesParams, "page" | "pageToken">): AsyncGenerator<UserTrade, void, undefined>;
|
|
555
586
|
/**
|
|
556
587
|
* List the current user's funding payment history with pagination and filters.
|
|
557
588
|
*
|
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 { OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
+
import type { Order, OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
9
9
|
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse } from "./responses";
|
|
10
10
|
/**
|
|
11
11
|
* Trading API interface.
|
|
@@ -135,6 +135,14 @@ export interface TradingAPI extends BaseAPI {
|
|
|
135
135
|
* @returns Promise resolving to the paginated orders result
|
|
136
136
|
*/
|
|
137
137
|
getPaginatedOrders(params?: GetPaginatedOrdersParams): Promise<GetPaginatedOrdersResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Walks the user's full order history with cursor pagination, yielding one
|
|
140
|
+
* order at a time. Follows each response's `nextPageToken` until the walk
|
|
141
|
+
* is exhausted; covers hot and archived history.
|
|
142
|
+
* @param params - Optional filters and page size; the cursor is managed internally
|
|
143
|
+
* @returns Async generator yielding orders
|
|
144
|
+
*/
|
|
145
|
+
iterateOrders(params?: Omit<GetPaginatedOrdersParams, "page" | "pageToken">): AsyncGenerator<Order, void, undefined>;
|
|
138
146
|
/**
|
|
139
147
|
* Gets a single order by its ID.
|
|
140
148
|
* @param orderId - ID of the order to retrieve
|
|
@@ -142,6 +150,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
142
150
|
*/
|
|
143
151
|
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
144
152
|
}
|
|
145
|
-
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderTerminalReason, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
153
|
+
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
146
154
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
147
155
|
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -115,6 +115,14 @@ export declare const ORDER_STATUS_VALUES: readonly ["SUBMITTED", "PARTIALLY_FILL
|
|
|
115
115
|
* - EXPIRED: Order expired based on time constraints
|
|
116
116
|
*/
|
|
117
117
|
export type OrderStatus = (typeof ORDER_STATUS_VALUES)[number];
|
|
118
|
+
/**
|
|
119
|
+
* Order status filter accepted by the order listing endpoints.
|
|
120
|
+
*
|
|
121
|
+
* A single status matches only that status; an array matches any of the listed
|
|
122
|
+
* statuses (sent to the API as a comma-separated `status` query parameter), so
|
|
123
|
+
* several statuses can be fetched in one request instead of one per status.
|
|
124
|
+
*/
|
|
125
|
+
export type OrderStatusFilter = OrderStatus | readonly OrderStatus[];
|
|
118
126
|
/**
|
|
119
127
|
* Trading mode
|
|
120
128
|
*/
|
|
@@ -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, OrderType, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
7
|
+
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderType, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
8
|
/**
|
|
9
9
|
* Match result information for order execution.
|
|
10
10
|
* Contains detailed information about trades, fills, and execution quality.
|
|
@@ -125,22 +125,30 @@ export interface UpdatedFields {
|
|
|
125
125
|
* Query parameters for getting paginated orders
|
|
126
126
|
*/
|
|
127
127
|
export interface GetPaginatedOrdersParams {
|
|
128
|
-
/** Filter by order status */
|
|
129
|
-
status?:
|
|
128
|
+
/** Filter by order status, or by any of several statuses when given an array */
|
|
129
|
+
status?: OrderStatusFilter;
|
|
130
130
|
/** Filter by trading pair UUID */
|
|
131
131
|
tradingPairId?: string;
|
|
132
132
|
/** Filter by trading mode */
|
|
133
133
|
tradingMode?: TradingMode;
|
|
134
134
|
/** Filter by margin account UUID */
|
|
135
135
|
marginAccountId?: string;
|
|
136
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Page number for legacy offset pagination.
|
|
138
|
+
*
|
|
139
|
+
* @deprecated Use cursor pagination (`pageToken`) instead. Passing `page`
|
|
140
|
+
* selects legacy page-number mode, which only ever sees recent (hot)
|
|
141
|
+
* history; omitting both `page` and `pageToken` now drives cursor mode.
|
|
142
|
+
*/
|
|
137
143
|
page?: number;
|
|
138
|
-
/** Number of orders per page (default: 10
|
|
144
|
+
/** Number of orders per page (default: 10; max 100 in page-number mode, up to 1000 when `pageToken` is present) */
|
|
139
145
|
pageSize?: number;
|
|
140
146
|
/**
|
|
141
147
|
* Pagination cursor with three distinct states:
|
|
142
|
-
* - Omitted (`undefined`):
|
|
143
|
-
*
|
|
148
|
+
* - Omitted (`undefined`): the SDK starts a cursor walk (it sends
|
|
149
|
+
* `pageToken=""`) unless the deprecated `page` param was passed, in
|
|
150
|
+
* which case the request uses legacy page-number pagination, limited to
|
|
151
|
+
* recent history once the archive window is enabled.
|
|
144
152
|
* - Empty string (`""`): start a cursor walk with no prior position, from
|
|
145
153
|
* the newest row (or the oldest, when `orderBy` is `"ASC"`).
|
|
146
154
|
* - Non-empty: an opaque cursor from a previous response's
|
|
@@ -166,13 +174,28 @@ export interface GetPaginatedOrdersResponse {
|
|
|
166
174
|
latest_orders?: Order[];
|
|
167
175
|
/** Array of historical orders from PostgreSQL (paginated) */
|
|
168
176
|
orders: Order[];
|
|
169
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* Total number of orders matching the query.
|
|
179
|
+
*
|
|
180
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
181
|
+
* cursor mode, which has no exact total. Walk `nextPageToken` instead.
|
|
182
|
+
*/
|
|
170
183
|
total: number;
|
|
171
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Current page number.
|
|
186
|
+
*
|
|
187
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
188
|
+
* cursor mode. Use `pageToken`/`nextPageToken` pagination instead.
|
|
189
|
+
*/
|
|
172
190
|
page: number;
|
|
173
191
|
/** Number of orders per page */
|
|
174
192
|
pageSize: number;
|
|
175
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Total number of pages.
|
|
195
|
+
*
|
|
196
|
+
* @deprecated Only populated by legacy page-number (offset) responses; 0 in
|
|
197
|
+
* cursor mode, which has no exact total. Walk `nextPageToken` instead.
|
|
198
|
+
*/
|
|
176
199
|
totalPages: number;
|
|
177
200
|
/**
|
|
178
201
|
* Cursor for the next page. Empty on every page-number (legacy) response —
|
|
@@ -7,8 +7,11 @@ const PaginationSchema = z.object({
|
|
|
7
7
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
8
8
|
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// Filter values accepted by the list-positions endpoint. Narrower than the
|
|
11
|
+
// returned PositionStatus: the backend folds EXPIRED positions under CLOSED, so
|
|
12
|
+
// EXPIRED is not an accepted filter value.
|
|
13
|
+
const PositionStatusSchema = z.enum(["OPEN", "CLOSED", "LIQUIDATING", "LIQUIDATED"], {
|
|
14
|
+
message: 'Position status must be "OPEN", "CLOSED", "LIQUIDATING", or "LIQUIDATED"',
|
|
12
15
|
});
|
|
13
16
|
const ClosePositionTypeSchema = z.enum(["MARKET", "LIMIT", "IOC"], {
|
|
14
17
|
message: 'Close type must be "MARKET", "LIMIT", or "IOC"',
|
|
@@ -37,11 +37,25 @@ export const GetUserMovementsSchema = z.object({
|
|
|
37
37
|
* Validates parameters for fetching paginated user trades.
|
|
38
38
|
* All fields are optional — an empty object or undefined is valid.
|
|
39
39
|
*/
|
|
40
|
-
export const GetUserTradesSchema = z
|
|
40
|
+
export const GetUserTradesSchema = z
|
|
41
|
+
.object({
|
|
41
42
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
42
|
-
pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(
|
|
43
|
+
pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
|
|
43
44
|
tradingPairId: UUIDSchema.optional(),
|
|
44
45
|
pageToken: z.string().optional(),
|
|
46
|
+
})
|
|
47
|
+
.superRefine((params, ctx) => {
|
|
48
|
+
// The higher 1000 cap only applies to cursor (pageToken) requests; the
|
|
49
|
+
// server keeps the 100 cap for page-number requests (offset scans).
|
|
50
|
+
// Legacy page-number mode is selected only by passing `page` without
|
|
51
|
+
// `pageToken` — omitting both starts a cursor walk.
|
|
52
|
+
if (params.page !== undefined && params.pageToken === undefined && params.pageSize !== undefined && params.pageSize > 100) {
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: z.ZodIssueCode.custom,
|
|
55
|
+
message: "Page size cannot exceed 100 in page-number mode (page without pageToken)",
|
|
56
|
+
path: ["pageSize"],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
45
59
|
});
|
|
46
60
|
export const ListFundingPaymentsSchema = z.object({
|
|
47
61
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
@@ -237,13 +237,13 @@ export declare const ReplaceOrderSchema: z.ZodObject<{
|
|
|
237
237
|
*
|
|
238
238
|
* Validates parameters for fetching paginated orders.
|
|
239
239
|
* Matches the getPaginatedOrders method signature which accepts:
|
|
240
|
-
* - status: OrderStatus (optional filter)
|
|
240
|
+
* - status: OrderStatus, or a non-empty array of them (optional filter)
|
|
241
241
|
* - tradingPairId: trading pair UUID (optional filter)
|
|
242
242
|
* - page: number (default: 1)
|
|
243
|
-
* - pageSize: number (default: 10, max: 100)
|
|
243
|
+
* - pageSize: number (default: 10, max: 100 in page-number mode, 1000 when pageToken is present)
|
|
244
244
|
*/
|
|
245
245
|
export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
246
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
246
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
247
247
|
SUBMITTED: "SUBMITTED";
|
|
248
248
|
PARTIALLY_FILLED: "PARTIALLY_FILLED";
|
|
249
249
|
FILLED: "FILLED";
|
|
@@ -252,7 +252,16 @@ export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
|
252
252
|
CANCELLED: "CANCELLED";
|
|
253
253
|
REJECTED: "REJECTED";
|
|
254
254
|
EXPIRED: "EXPIRED";
|
|
255
|
-
}
|
|
255
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
256
|
+
SUBMITTED: "SUBMITTED";
|
|
257
|
+
PARTIALLY_FILLED: "PARTIALLY_FILLED";
|
|
258
|
+
FILLED: "FILLED";
|
|
259
|
+
SETTLED_ON_CHAIN: "SETTLED_ON_CHAIN";
|
|
260
|
+
SETTLED: "SETTLED";
|
|
261
|
+
CANCELLED: "CANCELLED";
|
|
262
|
+
REJECTED: "REJECTED";
|
|
263
|
+
EXPIRED: "EXPIRED";
|
|
264
|
+
}>>]>>;
|
|
256
265
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
257
266
|
tradingMode: z.ZodOptional<z.ZodEnum<{
|
|
258
267
|
SPOT: "SPOT";
|
|
@@ -281,19 +281,33 @@ export const ReplaceOrderSchema = z.object({
|
|
|
281
281
|
*
|
|
282
282
|
* Validates parameters for fetching paginated orders.
|
|
283
283
|
* Matches the getPaginatedOrders method signature which accepts:
|
|
284
|
-
* - status: OrderStatus (optional filter)
|
|
284
|
+
* - status: OrderStatus, or a non-empty array of them (optional filter)
|
|
285
285
|
* - tradingPairId: trading pair UUID (optional filter)
|
|
286
286
|
* - page: number (default: 1)
|
|
287
|
-
* - pageSize: number (default: 10, max: 100)
|
|
287
|
+
* - pageSize: number (default: 10, max: 100 in page-number mode, 1000 when pageToken is present)
|
|
288
288
|
*/
|
|
289
|
-
export const GetPaginatedOrdersSchema = z
|
|
290
|
-
|
|
289
|
+
export const GetPaginatedOrdersSchema = z
|
|
290
|
+
.object({
|
|
291
|
+
status: z.union([z.enum(ORDER_STATUS_VALUES), z.array(z.enum(ORDER_STATUS_VALUES)).min(1, "Status filter must list at least one status")]).optional(),
|
|
291
292
|
tradingPairId: UUIDSchema.optional(),
|
|
292
293
|
tradingMode: TradingModeSchema.optional(),
|
|
293
294
|
marginAccountId: UUIDSchema.optional(),
|
|
294
295
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
295
|
-
pageSize: z.number().int().min(1, "Page size must be at least 1").max(
|
|
296
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
|
|
296
297
|
pageToken: z.string().optional(),
|
|
298
|
+
})
|
|
299
|
+
.superRefine((params, ctx) => {
|
|
300
|
+
// The higher 1000 cap only applies to cursor (pageToken) requests; the
|
|
301
|
+
// server keeps the 100 cap for page-number requests (offset scans).
|
|
302
|
+
// Legacy page-number mode is selected only by passing `page` without
|
|
303
|
+
// `pageToken` — omitting both starts a cursor walk.
|
|
304
|
+
if (params.page !== undefined && params.pageToken === undefined && params.pageSize !== undefined && params.pageSize > 100) {
|
|
305
|
+
ctx.addIssue({
|
|
306
|
+
code: z.ZodIssueCode.custom,
|
|
307
|
+
message: "Page size cannot exceed 100 in page-number mode (page without pageToken)",
|
|
308
|
+
path: ["pageSize"],
|
|
309
|
+
});
|
|
310
|
+
}
|
|
297
311
|
});
|
|
298
312
|
export const ConditionalOrderConditionTypeSchema = z.enum(["STOP_LOSS", "TAKE_PROFIT"], {
|
|
299
313
|
message: 'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* User Balance WebSocket Event Types
|
|
3
3
|
*
|
|
4
4
|
* Types for real-time user balance update events.
|
|
5
|
-
* This is an authenticated channel - requires
|
|
5
|
+
* This is an authenticated channel - requires the signed session-key handshake.
|
|
6
6
|
*/
|
|
7
7
|
import type { Address } from "viem";
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* User Movement WebSocket Event Types
|
|
3
3
|
*
|
|
4
4
|
* Types for real-time user ledger movement events (deposits, withdrawals, transfers).
|
|
5
|
-
* This is an authenticated channel - requires
|
|
5
|
+
* This is an authenticated channel - requires the signed session-key handshake.
|
|
6
6
|
*/
|
|
7
7
|
import type { Address } from "viem";
|
|
8
8
|
/**
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* User Movement WebSocket Event Types
|
|
3
3
|
*
|
|
4
4
|
* Types for real-time user ledger movement events (deposits, withdrawals, transfers).
|
|
5
|
-
* This is an authenticated channel - requires
|
|
5
|
+
* This is an authenticated channel - requires the signed session-key handshake.
|
|
6
6
|
*/
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1496,8 +1496,17 @@ export interface paths {
|
|
|
1496
1496
|
* Batch replace orders
|
|
1497
1497
|
* @description Batch replace orders.
|
|
1498
1498
|
*
|
|
1499
|
-
* Replace multiple orders in
|
|
1500
|
-
*
|
|
1499
|
+
* Replace multiple orders in one engine step with per-item results: every
|
|
1500
|
+
* original is cancelled first, then each replacement is placed in request
|
|
1501
|
+
* order. A
|
|
1502
|
+
* two-sided quote can therefore shift across its own resting prices in one
|
|
1503
|
+
* call, and a replacement may use funds freed by any original in the batch.
|
|
1504
|
+
*
|
|
1505
|
+
* Failure semantics: an item that fails validation, or whose original
|
|
1506
|
+
* cannot be found, leaves the original resting. An item whose replacement
|
|
1507
|
+
* fails to PLACE (for example insufficient balance or self-trade
|
|
1508
|
+
* prevention) reports the error with its original already cancelled — the
|
|
1509
|
+
* original is never silently left resting after a failed replacement.
|
|
1501
1510
|
*/
|
|
1502
1511
|
post: operations["batch_replace_orders"];
|
|
1503
1512
|
delete?: never;
|
|
@@ -4507,7 +4516,8 @@ export interface components {
|
|
|
4507
4516
|
GetUserTradesResponse: {
|
|
4508
4517
|
trades?: components["schemas"]["UserTrade"][] | null;
|
|
4509
4518
|
/**
|
|
4510
|
-
* @
|
|
4519
|
+
* @deprecated
|
|
4520
|
+
* @description Deprecated: current page number (legacy offset mode only; 0 in cursor mode)
|
|
4511
4521
|
* @example 1
|
|
4512
4522
|
*/
|
|
4513
4523
|
page?: string | null;
|
|
@@ -4517,12 +4527,14 @@ export interface components {
|
|
|
4517
4527
|
*/
|
|
4518
4528
|
pageSize?: string | null;
|
|
4519
4529
|
/**
|
|
4520
|
-
* @
|
|
4530
|
+
* @deprecated
|
|
4531
|
+
* @description Deprecated: total number of trades (legacy offset mode only; 0 in cursor mode)
|
|
4521
4532
|
* @example 150
|
|
4522
4533
|
*/
|
|
4523
4534
|
total?: string | null;
|
|
4524
4535
|
/**
|
|
4525
|
-
* @
|
|
4536
|
+
* @deprecated
|
|
4537
|
+
* @description Deprecated: total number of pages (legacy offset mode only; 0 in cursor mode)
|
|
4526
4538
|
* @example 8
|
|
4527
4539
|
*/
|
|
4528
4540
|
totalPages?: string | null;
|
|
@@ -4887,13 +4899,15 @@ export interface components {
|
|
|
4887
4899
|
orders?: components["schemas"]["GetOrderResponse"][] | null;
|
|
4888
4900
|
/**
|
|
4889
4901
|
* Format: uint32
|
|
4890
|
-
* @
|
|
4902
|
+
* @deprecated
|
|
4903
|
+
* @description Deprecated: total number of orders matching the filter (legacy offset mode only; 0 in cursor mode)
|
|
4891
4904
|
* @example 150
|
|
4892
4905
|
*/
|
|
4893
4906
|
total?: number | null;
|
|
4894
4907
|
/**
|
|
4895
4908
|
* Format: uint32
|
|
4896
|
-
* @
|
|
4909
|
+
* @deprecated
|
|
4910
|
+
* @description Deprecated: current page number (legacy offset mode only; 0 in cursor mode)
|
|
4897
4911
|
* @example 1
|
|
4898
4912
|
*/
|
|
4899
4913
|
page?: number | null;
|
|
@@ -4905,7 +4919,8 @@ export interface components {
|
|
|
4905
4919
|
pageSize?: number | null;
|
|
4906
4920
|
/**
|
|
4907
4921
|
* Format: uint32
|
|
4908
|
-
* @
|
|
4922
|
+
* @deprecated
|
|
4923
|
+
* @description Deprecated: total number of pages (legacy offset mode only; 0 in cursor mode)
|
|
4909
4924
|
* @example 8
|
|
4910
4925
|
*/
|
|
4911
4926
|
totalPages?: number | null;
|
|
@@ -7570,9 +7585,12 @@ export interface operations {
|
|
|
7570
7585
|
get_user_trades: {
|
|
7571
7586
|
parameters: {
|
|
7572
7587
|
query?: {
|
|
7573
|
-
/**
|
|
7588
|
+
/**
|
|
7589
|
+
* @deprecated
|
|
7590
|
+
* @description Deprecated: page number for legacy offset pagination (1-indexed). Use pageToken cursor pagination instead.
|
|
7591
|
+
*/
|
|
7574
7592
|
page?: number;
|
|
7575
|
-
/** @description Items per page (max 100) */
|
|
7593
|
+
/** @description Items per page (max: 100 in page-number mode; up to 1000 when pageToken is present) */
|
|
7576
7594
|
pageSize?: number;
|
|
7577
7595
|
/** @description Trading pair identifier (UUID) */
|
|
7578
7596
|
tradingPairId?: string;
|
|
@@ -9483,9 +9501,12 @@ export interface operations {
|
|
|
9483
9501
|
get_orders: {
|
|
9484
9502
|
parameters: {
|
|
9485
9503
|
query?: {
|
|
9486
|
-
/**
|
|
9504
|
+
/**
|
|
9505
|
+
* @deprecated
|
|
9506
|
+
* @description Deprecated: page number for legacy offset pagination (1-indexed). Use pageToken cursor pagination instead.
|
|
9507
|
+
*/
|
|
9487
9508
|
page?: number;
|
|
9488
|
-
/** @description Items per page (max 100) */
|
|
9509
|
+
/** @description Items per page (max 100 in page-number mode; up to 1000 when pageToken is present) */
|
|
9489
9510
|
pageSize?: number;
|
|
9490
9511
|
/** @description Order status (single value or comma-separated list) */
|
|
9491
9512
|
status?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32-develop.522174b",
|
|
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.32-develop.522174b",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|