@0xmonaco/types 1.0.73-develop.af0f5d0 → 1.0.74-develop.367860f
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/api/index.d.ts +0 -7
- package/dist/applications/index.d.ts +14 -15
- package/dist/applications/index.js +2 -2
- package/dist/applications/requests.d.ts +70 -15
- package/dist/applications/requests.js +2 -3
- package/dist/applications/responses.d.ts +35 -39
- package/dist/applications/responses.js +1 -1
- package/dist/buildercodes/index.d.ts +3 -4
- package/dist/buildercodes/responses.d.ts +10 -3
- package/dist/buildercodes/responses.js +24 -4
- package/dist/fees/responses.js +2 -2
- package/dist/managed-markets/index.d.ts +21 -2
- package/dist/margin-accounts/index.d.ts +72 -12
- package/dist/market/index.d.ts +76 -6
- package/dist/pitpass/index.d.ts +16 -11
- package/dist/pitpass/index.js +1 -1
- package/dist/pitpass/responses.d.ts +21 -0
- package/dist/pitpass/responses.js +43 -14
- package/dist/positions/index.d.ts +81 -14
- package/dist/profile/index.d.ts +114 -44
- package/dist/sdk/index.d.ts +12 -4
- package/dist/trading/index.d.ts +1 -1
- package/dist/trading/orders.d.ts +6 -32
- package/dist/trading/responses.d.ts +9 -14
- package/dist/validation/applications.d.ts +51 -0
- package/dist/validation/applications.js +45 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/managed-markets.d.ts +17 -0
- package/dist/validation/managed-markets.js +17 -0
- package/dist/validation/margin-accounts.d.ts +10 -3
- package/dist/validation/margin-accounts.js +17 -6
- package/dist/validation/market.d.ts +45 -0
- package/dist/validation/market.js +43 -0
- package/dist/validation/positions.d.ts +5 -3
- package/dist/validation/positions.js +12 -5
- package/dist/validation/profile.d.ts +19 -2
- package/dist/validation/profile.js +36 -4
- package/dist/validation/trading.d.ts +2 -2
- package/dist/validation/vault.d.ts +14 -0
- package/dist/validation/vault.js +14 -0
- package/dist/websocket/base.d.ts +56 -6
- package/dist/websocket/client.d.ts +8 -3
- package/dist/websocket/events/index.d.ts +1 -0
- package/dist/websocket/events/index.js +1 -0
- package/dist/websocket/events/market-stats-events.d.ts +33 -3
- package/dist/websocket/events/market-stats-events.js +3 -2
- package/dist/websocket/events/orders-events.d.ts +30 -3
- package/dist/websocket/events/position-events.d.ts +15 -0
- package/dist/websocket/events/position-valuation-events.d.ts +60 -0
- package/dist/websocket/events/position-valuation-events.js +15 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +2 -0
- package/dist/wire/schema.d.ts +906 -284
- package/dist/withdrawals/index.d.ts +27 -6
- package/package.json +2 -2
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { MarketSlippageToleranceBpsSchema, OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema } from "./trading";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const CursorPaginationSchema = z.object({
|
|
7
|
+
/**
|
|
8
|
+
* Rejected, not ignored. A non-strict object would let a JS or `any` caller
|
|
9
|
+
* keep passing `page`, and the request would then come back as the first
|
|
10
|
+
* cursor page every time — the same silent duplicate-page failure the REST
|
|
11
|
+
* 400 guard exists to prevent (0XM-2788).
|
|
12
|
+
*/
|
|
13
|
+
page: z.never().optional(),
|
|
14
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
|
|
15
|
+
pageToken: z.string().optional(),
|
|
9
16
|
});
|
|
10
|
-
export const ListMarginAccountsSchema =
|
|
17
|
+
export const ListMarginAccountsSchema = CursorPaginationSchema.extend({
|
|
11
18
|
state: z.string().trim().min(1, "State cannot be empty").optional(),
|
|
12
19
|
tradingPairId: UUIDSchema.optional(),
|
|
13
20
|
});
|
|
@@ -121,11 +128,11 @@ export const TransferCollateralToRiskBucketSchema = z.object({
|
|
|
121
128
|
export const TransferCollateralFromParentMarginAccountSchema = z.object({
|
|
122
129
|
request: ParentMarginAccountCollateralRequestSchema,
|
|
123
130
|
});
|
|
124
|
-
export const GetMarginAccountMovementsSchema =
|
|
131
|
+
export const GetMarginAccountMovementsSchema = CursorPaginationSchema.extend({
|
|
125
132
|
marginAccountId: UUIDSchema,
|
|
126
133
|
movementType: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
127
134
|
});
|
|
128
|
-
export const GetParentMarginAccountMovementsSchema =
|
|
135
|
+
export const GetParentMarginAccountMovementsSchema = CursorPaginationSchema.extend({
|
|
129
136
|
movementType: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
130
137
|
}).optional();
|
|
131
138
|
const BaseSimulateOrderRiskRequestSchema = z.object({
|
|
@@ -246,6 +253,10 @@ export const CreateMarginSubAccountSchema = z.object({
|
|
|
246
253
|
export const CloseMarginSubAccountSchema = z.object({
|
|
247
254
|
marginAccountId: UUIDSchema,
|
|
248
255
|
});
|
|
256
|
+
export const SubAccountCollateralTransferSchema = z.object({
|
|
257
|
+
marginAccountId: UUIDSchema,
|
|
258
|
+
amount: PositiveDecimalStringSchema,
|
|
259
|
+
});
|
|
249
260
|
export const GetMarginAccountPnlSchema = z.object({
|
|
250
261
|
marginAccountId: UUIDSchema,
|
|
251
262
|
});
|
|
@@ -220,3 +220,48 @@ export declare const SearchTradingPairsSchema: z.ZodObject<{
|
|
|
220
220
|
export declare const GetMarketMetadataSchema: z.ZodObject<{
|
|
221
221
|
tradingPairId: z.ZodUUID;
|
|
222
222
|
}, z.core.$strip>;
|
|
223
|
+
/** Per-pair funding history; the pair id is path-bound and validated separately. */
|
|
224
|
+
export declare const ListFundingHistorySchema: z.ZodObject<{
|
|
225
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
226
|
+
startTime: z.ZodOptional<z.ZodString>;
|
|
227
|
+
endTime: z.ZodOptional<z.ZodString>;
|
|
228
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
229
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
230
|
+
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
231
|
+
ASC: "ASC";
|
|
232
|
+
DESC: "DESC";
|
|
233
|
+
}>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
/** All-markets funding history. */
|
|
236
|
+
export declare const ListAllFundingHistorySchema: z.ZodObject<{
|
|
237
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
238
|
+
startTime: z.ZodOptional<z.ZodString>;
|
|
239
|
+
endTime: z.ZodOptional<z.ZodString>;
|
|
240
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
242
|
+
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
243
|
+
ASC: "ASC";
|
|
244
|
+
DESC: "DESC";
|
|
245
|
+
}>>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
/**
|
|
248
|
+
* Public trades-feed listing validation schema.
|
|
249
|
+
*
|
|
250
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted, but NOT for
|
|
251
|
+
* the same reason as {@link ListFundingHistorySchema}. That one is built on a
|
|
252
|
+
* query builder that serializes whatever keys the params object carries, so a
|
|
253
|
+
* leftover `page` reaches the wire and comes back as the server's `400`.
|
|
254
|
+
* `getTrades` instead sets `pageSize` and `pageToken` explicitly, so a stray
|
|
255
|
+
* `page` never leaves the client at all — which makes rejecting it more
|
|
256
|
+
* important here, not less. Stripped silently, it would leave the caller
|
|
257
|
+
* requesting page 2, 3, 4 and receiving the FIRST cursor page every time, with
|
|
258
|
+
* no error from either side to reveal the loop. `z.never()` turns that silent
|
|
259
|
+
* non-advancing walk into an immediate `ValidationError`.
|
|
260
|
+
*
|
|
261
|
+
* The ceiling is the cursor-mode 1000; the historical default of 25 stays.
|
|
262
|
+
*/
|
|
263
|
+
export declare const GetTradesSchema: z.ZodObject<{
|
|
264
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
265
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
267
|
+
}, z.core.$strip>;
|
|
@@ -224,3 +224,46 @@ export const SearchTradingPairsSchema = z.object({
|
|
|
224
224
|
export const GetMarketMetadataSchema = z.object({
|
|
225
225
|
tradingPairId: UUIDSchema,
|
|
226
226
|
});
|
|
227
|
+
/**
|
|
228
|
+
* Funding-history listing validation schemas.
|
|
229
|
+
*
|
|
230
|
+
* Cursor paged (0XM-2818). `page` is REJECTED rather than omitted: `withQuery`
|
|
231
|
+
* builds the query string from `Object.entries(params)`, so an untyped caller's
|
|
232
|
+
* leftover `page` would otherwise reach the wire and come back as a server
|
|
233
|
+
* `400` — a round trip to learn what the SDK already knows. Rejecting here
|
|
234
|
+
* fails the call immediately with a `ValidationError`, and the `deny_unknown_fields`
|
|
235
|
+
* 400 stays as the server-side backstop.
|
|
236
|
+
*/
|
|
237
|
+
const FundingHistoryCursorSchema = z.object({
|
|
238
|
+
page: z.never().optional(),
|
|
239
|
+
startTime: z.string().optional(),
|
|
240
|
+
endTime: z.string().optional(),
|
|
241
|
+
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(),
|
|
242
|
+
pageToken: z.string().optional(),
|
|
243
|
+
orderBy: z.enum(["ASC", "DESC"], { message: 'orderBy must be "ASC" or "DESC"' }).optional(),
|
|
244
|
+
});
|
|
245
|
+
/** Per-pair funding history; the pair id is path-bound and validated separately. */
|
|
246
|
+
export const ListFundingHistorySchema = FundingHistoryCursorSchema;
|
|
247
|
+
/** All-markets funding history. */
|
|
248
|
+
export const ListAllFundingHistorySchema = FundingHistoryCursorSchema;
|
|
249
|
+
/**
|
|
250
|
+
* Public trades-feed listing validation schema.
|
|
251
|
+
*
|
|
252
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted, but NOT for
|
|
253
|
+
* the same reason as {@link ListFundingHistorySchema}. That one is built on a
|
|
254
|
+
* query builder that serializes whatever keys the params object carries, so a
|
|
255
|
+
* leftover `page` reaches the wire and comes back as the server's `400`.
|
|
256
|
+
* `getTrades` instead sets `pageSize` and `pageToken` explicitly, so a stray
|
|
257
|
+
* `page` never leaves the client at all — which makes rejecting it more
|
|
258
|
+
* important here, not less. Stripped silently, it would leave the caller
|
|
259
|
+
* requesting page 2, 3, 4 and receiving the FIRST cursor page every time, with
|
|
260
|
+
* no error from either side to reveal the loop. `z.never()` turns that silent
|
|
261
|
+
* non-advancing walk into an immediate `ValidationError`.
|
|
262
|
+
*
|
|
263
|
+
* The ceiling is the cursor-mode 1000; the historical default of 25 stays.
|
|
264
|
+
*/
|
|
265
|
+
export const GetTradesSchema = z.object({
|
|
266
|
+
page: z.never().optional(),
|
|
267
|
+
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(),
|
|
268
|
+
pageToken: z.string().optional(),
|
|
269
|
+
});
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
export declare const ListPositionsSchema: z.ZodObject<{
|
|
6
|
-
page: z.ZodOptional<z.
|
|
6
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
7
7
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
8
9
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
9
10
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
10
11
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -21,9 +22,9 @@ export declare const ClosePositionSchema: z.ZodObject<{
|
|
|
21
22
|
positionId: z.ZodUUID;
|
|
22
23
|
request: z.ZodObject<{
|
|
23
24
|
closeType: z.ZodEnum<{
|
|
24
|
-
IOC: "IOC";
|
|
25
25
|
LIMIT: "LIMIT";
|
|
26
26
|
MARKET: "MARKET";
|
|
27
|
+
IOC: "IOC";
|
|
27
28
|
}>;
|
|
28
29
|
limitPrice: z.ZodOptional<z.ZodString>;
|
|
29
30
|
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
@@ -84,8 +85,9 @@ export declare const AttachPositionTpSlSchema: z.ZodObject<{
|
|
|
84
85
|
}, z.core.$strip>;
|
|
85
86
|
}, z.core.$strip>;
|
|
86
87
|
export declare const ListPositionHistorySchema: z.ZodObject<{
|
|
87
|
-
page: z.ZodOptional<z.
|
|
88
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
88
89
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
89
91
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
90
92
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
91
93
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
@@ -3,9 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ConditionalTimeInForceSchema, ISO8601DateSchema, OrderTypeSchema, PositiveDecimalStringSchema, SlippageToleranceBpsSchema, TrailingStopLegSchema, UUIDSchema, } from "./trading";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const CursorPaginationSchema = z.object({
|
|
7
|
+
/**
|
|
8
|
+
* Rejected, not ignored. A non-strict object would let a JS or `any` caller
|
|
9
|
+
* keep passing `page`, and the request would then come back as the first
|
|
10
|
+
* cursor page every time — the same silent duplicate-page failure the REST
|
|
11
|
+
* 400 guard exists to prevent (0XM-2788).
|
|
12
|
+
*/
|
|
13
|
+
page: z.never().optional(),
|
|
14
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
|
|
15
|
+
pageToken: z.string().optional(),
|
|
9
16
|
});
|
|
10
17
|
// Filter values accepted by the list-positions endpoint. Narrower than the
|
|
11
18
|
// returned PositionStatus: the backend folds EXPIRED positions under CLOSED, so
|
|
@@ -19,7 +26,7 @@ const ClosePositionTypeSchema = z.enum(["MARKET", "LIMIT", "IOC"], {
|
|
|
19
26
|
const PositionIdSchema = z.object({
|
|
20
27
|
positionId: UUIDSchema,
|
|
21
28
|
});
|
|
22
|
-
export const ListPositionsSchema =
|
|
29
|
+
export const ListPositionsSchema = CursorPaginationSchema.extend({
|
|
23
30
|
marginAccountId: UUIDSchema.optional(),
|
|
24
31
|
tradingPairId: UUIDSchema.optional(),
|
|
25
32
|
status: PositionStatusSchema.optional(),
|
|
@@ -100,7 +107,7 @@ export const AttachPositionTpSlSchema = PositionIdSchema.extend({
|
|
|
100
107
|
path: ["oco"],
|
|
101
108
|
}),
|
|
102
109
|
});
|
|
103
|
-
export const ListPositionHistorySchema =
|
|
110
|
+
export const ListPositionHistorySchema = CursorPaginationSchema.extend({
|
|
104
111
|
positionId: UUIDSchema.optional(),
|
|
105
112
|
marginAccountId: UUIDSchema.optional(),
|
|
106
113
|
tradingPairId: UUIDSchema.optional(),
|
|
@@ -48,8 +48,13 @@ export declare const SetSelfTradePreventionDefaultSchema: z.ZodObject<{
|
|
|
48
48
|
* All fields are optional — an empty object or undefined is valid.
|
|
49
49
|
*/
|
|
50
50
|
export declare const GetUserMovementsSchema: z.ZodObject<{
|
|
51
|
-
page: z.ZodOptional<z.
|
|
51
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
52
52
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
54
|
+
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
ASC: "ASC";
|
|
56
|
+
DESC: "DESC";
|
|
57
|
+
}>>;
|
|
53
58
|
entryType: z.ZodOptional<z.ZodEnum<{
|
|
54
59
|
CREDIT: "CREDIT";
|
|
55
60
|
DEBIT: "DEBIT";
|
|
@@ -81,9 +86,21 @@ export declare const GetUserTradesSchema: z.ZodObject<{
|
|
|
81
86
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
82
87
|
pageToken: z.ZodOptional<z.ZodString>;
|
|
83
88
|
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Get User Balances validation schema
|
|
91
|
+
*
|
|
92
|
+
* Validates parameters for the cursor-paged balances listing. All fields are
|
|
93
|
+
* optional — an empty object or undefined is valid.
|
|
94
|
+
*/
|
|
95
|
+
export declare const GetUserBalancesSchema: z.ZodObject<{
|
|
96
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
97
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>;
|
|
84
100
|
export declare const ListFundingPaymentsSchema: z.ZodObject<{
|
|
85
|
-
page: z.ZodOptional<z.
|
|
101
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
86
102
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
87
104
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
88
105
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
89
106
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
@@ -33,8 +33,16 @@ export const SetSelfTradePreventionDefaultSchema = z.object({
|
|
|
33
33
|
* All fields are optional — an empty object or undefined is valid.
|
|
34
34
|
*/
|
|
35
35
|
export const GetUserMovementsSchema = z.object({
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Rejected, not ignored. A non-strict object would let a JS or `any` caller
|
|
38
|
+
* keep passing `page`, and the request would come back as the first cursor
|
|
39
|
+
* page every time — the same silent duplicate-page failure the REST 400
|
|
40
|
+
* guard exists to prevent (0XM-2788).
|
|
41
|
+
*/
|
|
42
|
+
page: z.never().optional(),
|
|
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(),
|
|
44
|
+
pageToken: z.string().optional(),
|
|
45
|
+
orderBy: z.enum(["ASC", "DESC"]).optional(),
|
|
38
46
|
entryType: LedgerEntryTypeSchema.optional(),
|
|
39
47
|
transactionType: TransactionTypeSchema.optional(),
|
|
40
48
|
assetId: UUIDSchema.optional(),
|
|
@@ -57,9 +65,33 @@ export const GetUserTradesSchema = z.object({
|
|
|
57
65
|
tradingPairId: UUIDSchema.optional(),
|
|
58
66
|
pageToken: z.string().optional(),
|
|
59
67
|
});
|
|
68
|
+
/**
|
|
69
|
+
* Get User Balances validation schema
|
|
70
|
+
*
|
|
71
|
+
* Validates parameters for the cursor-paged balances listing. All fields are
|
|
72
|
+
* optional — an empty object or undefined is valid.
|
|
73
|
+
*/
|
|
74
|
+
export const GetUserBalancesSchema = z.object({
|
|
75
|
+
/**
|
|
76
|
+
* Rejected, not ignored. Without a schema at all a JS or `any` caller's
|
|
77
|
+
* `page` was silently dropped while building the query string, so the call
|
|
78
|
+
* resolved with the FIRST cursor page on every request — the quiet
|
|
79
|
+
* duplicate-page failure the REST 400 guard exists to prevent (0XM-2821).
|
|
80
|
+
*/
|
|
81
|
+
page: z.never().optional(),
|
|
82
|
+
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(),
|
|
83
|
+
pageToken: z.string().optional(),
|
|
84
|
+
});
|
|
60
85
|
export const ListFundingPaymentsSchema = z.object({
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Rejected, not ignored. A non-strict object would let a JS or `any` caller
|
|
88
|
+
* keep passing `page`, and the request would come back as the first cursor
|
|
89
|
+
* page every time — the same silent duplicate-page failure the REST 400
|
|
90
|
+
* guard exists to prevent (0XM-2788).
|
|
91
|
+
*/
|
|
92
|
+
page: z.never().optional(),
|
|
93
|
+
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(),
|
|
94
|
+
pageToken: z.string().optional(),
|
|
63
95
|
tradingPairId: UUIDSchema.optional(),
|
|
64
96
|
positionId: UUIDSchema.optional(),
|
|
65
97
|
marginAccountId: UUIDSchema.optional(),
|
|
@@ -375,11 +375,11 @@ export declare const ConditionalOrderTriggerSourceSchema: z.ZodEnum<{
|
|
|
375
375
|
export declare const ConditionalOrderStateSchema: z.ZodEnum<{
|
|
376
376
|
CANCELLED: "CANCELLED";
|
|
377
377
|
EXPIRED: "EXPIRED";
|
|
378
|
-
FAILED: "FAILED";
|
|
379
378
|
PENDING_PARENT: "PENDING_PARENT";
|
|
380
379
|
ACTIVE: "ACTIVE";
|
|
381
380
|
TRIGGERING: "TRIGGERING";
|
|
382
381
|
TRIGGERED: "TRIGGERED";
|
|
382
|
+
FAILED: "FAILED";
|
|
383
383
|
}>;
|
|
384
384
|
export declare const ClosePositionSideSchema: z.ZodEnum<{
|
|
385
385
|
LONG: "LONG";
|
|
@@ -395,11 +395,11 @@ export declare const ListConditionalOrdersSchema: z.ZodObject<{
|
|
|
395
395
|
state: z.ZodOptional<z.ZodEnum<{
|
|
396
396
|
CANCELLED: "CANCELLED";
|
|
397
397
|
EXPIRED: "EXPIRED";
|
|
398
|
-
FAILED: "FAILED";
|
|
399
398
|
PENDING_PARENT: "PENDING_PARENT";
|
|
400
399
|
ACTIVE: "ACTIVE";
|
|
401
400
|
TRIGGERING: "TRIGGERING";
|
|
402
401
|
TRIGGERED: "TRIGGERED";
|
|
402
|
+
FAILED: "FAILED";
|
|
403
403
|
}>>;
|
|
404
404
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
405
405
|
pageToken: z.ZodOptional<z.ZodString>;
|
|
@@ -75,3 +75,17 @@ export declare const WithdrawSchema: z.ZodObject<{
|
|
|
75
75
|
export declare const GetBalanceSchema: z.ZodObject<{
|
|
76
76
|
assetId: z.ZodUUID;
|
|
77
77
|
}, z.core.$strip>;
|
|
78
|
+
/**
|
|
79
|
+
* Pending-withdrawals listing validation schema.
|
|
80
|
+
*
|
|
81
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted: the client
|
|
82
|
+
* forwards the params field by field, which would drop a stray `page` before it
|
|
83
|
+
* reached the wire, so a JavaScript or `any` caller looping on `{ page: n }`
|
|
84
|
+
* would be handed the FIRST cursor page on every call and would never advance —
|
|
85
|
+
* the exact failure the REST 400 exists to surface.
|
|
86
|
+
*/
|
|
87
|
+
export declare const ListPendingWithdrawalsSchema: z.ZodObject<{
|
|
88
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
89
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>;
|
package/dist/validation/vault.js
CHANGED
|
@@ -86,3 +86,17 @@ export const WithdrawSchema = z.object({
|
|
|
86
86
|
export const GetBalanceSchema = z.object({
|
|
87
87
|
assetId: UUIDSchema,
|
|
88
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* Pending-withdrawals listing validation schema.
|
|
91
|
+
*
|
|
92
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted: the client
|
|
93
|
+
* forwards the params field by field, which would drop a stray `page` before it
|
|
94
|
+
* reached the wire, so a JavaScript or `any` caller looping on `{ page: n }`
|
|
95
|
+
* would be handed the FIRST cursor page on every call and would never advance —
|
|
96
|
+
* the exact failure the REST 400 exists to surface.
|
|
97
|
+
*/
|
|
98
|
+
export const ListPendingWithdrawalsSchema = z.object({
|
|
99
|
+
page: z.never().optional(),
|
|
100
|
+
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(),
|
|
101
|
+
pageToken: z.string().optional(),
|
|
102
|
+
});
|
package/dist/websocket/base.d.ts
CHANGED
|
@@ -7,8 +7,40 @@
|
|
|
7
7
|
* WebSocket connection status
|
|
8
8
|
*/
|
|
9
9
|
export type WebSocketStatus = "connected" | "connecting" | "disconnected" | "reconnecting";
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Connection-attempt context delivered with every status change.
|
|
12
|
+
*
|
|
13
|
+
* `"reconnecting"` with `hasConnected: false` means the client has never
|
|
14
|
+
* reached the server and is still trying (the first connect failed);
|
|
15
|
+
* `hasConnected: true` means a working connection was lost.
|
|
16
|
+
*/
|
|
17
|
+
export interface WebSocketStatusInfo {
|
|
18
|
+
/**
|
|
19
|
+
* The retry this status refers to. `0` for `"connecting"` and
|
|
20
|
+
* `"connected"`; `1`, `2`, … for `"reconnecting"` (the retry just
|
|
21
|
+
* scheduled); for `"disconnected"`, the number of retries scheduled in the
|
|
22
|
+
* outage before it, counting one still in backoff when `disconnect()` is
|
|
23
|
+
* called (`0` after a clean close of a working connection).
|
|
24
|
+
*/
|
|
25
|
+
attempt: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether this client has reached the server at least once since it was
|
|
28
|
+
* created or since the last `disconnect()`.
|
|
29
|
+
*/
|
|
30
|
+
hasConnected: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Set only on `"reconnecting"`: the delay, in milliseconds, before the
|
|
33
|
+
* scheduled retry opens its connection.
|
|
34
|
+
*/
|
|
35
|
+
nextRetryDelayMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handler invoked whenever the WebSocket connection status changes.
|
|
39
|
+
*
|
|
40
|
+
* Inside the handler, `getStatus()` returns the status being reported. A
|
|
41
|
+
* handler that takes only `status` remains valid.
|
|
42
|
+
*/
|
|
43
|
+
export type StatusHandler = (status: WebSocketStatus, info: WebSocketStatusInfo) => void;
|
|
12
44
|
/**
|
|
13
45
|
* Why the connection was re-established. Delivered by
|
|
14
46
|
* {@link MonacoWebSocketConfig.onResync} after the socket reopens and sends its
|
|
@@ -129,9 +161,11 @@ export interface MonacoWebSocketConfig {
|
|
|
129
161
|
/** Enable auto-reconnect on disconnect (default: true) */
|
|
130
162
|
autoReconnect?: boolean;
|
|
131
163
|
/**
|
|
132
|
-
* Maximum reconnection attempts (default: unlimited). Retry
|
|
133
|
-
* full-jitter exponential backoff capped at 30s, so unlimited
|
|
134
|
-
* capped-rate, not a tight loop.
|
|
164
|
+
* Maximum reconnection attempts per outage (default: unlimited). Retry
|
|
165
|
+
* delay is full-jitter exponential backoff capped at 30s, so unlimited
|
|
166
|
+
* retries are capped-rate, not a tight loop. Once the attempts run out the
|
|
167
|
+
* client reports `"disconnected"`; a later `connect()` starts a fresh
|
|
168
|
+
* budget.
|
|
135
169
|
*/
|
|
136
170
|
maxReconnectAttempts?: number;
|
|
137
171
|
/** Base delay for the exponential backoff in milliseconds (default: 1000) */
|
|
@@ -141,7 +175,23 @@ export interface MonacoWebSocketConfig {
|
|
|
141
175
|
* retried, in milliseconds (default: 10000)
|
|
142
176
|
*/
|
|
143
177
|
connectionTimeoutMs?: number;
|
|
144
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Called on every connection status change, with the attempt context in
|
|
180
|
+
* {@link WebSocketStatusInfo}:
|
|
181
|
+
*
|
|
182
|
+
* - `"connecting"` — a connection is opening outside a retry cycle: the
|
|
183
|
+
* first connect, a `connect()` after a terminal `"disconnected"`, or a
|
|
184
|
+
* fresh session's reconnect after terminal authentication loss.
|
|
185
|
+
* - `"connected"` — the connection opened.
|
|
186
|
+
* - `"reconnecting"` — a retry is scheduled, once per retry. It holds until
|
|
187
|
+
* a retry connects or the retries run out; retries do not report
|
|
188
|
+
* `"connecting"`.
|
|
189
|
+
* - `"disconnected"` — terminal: a clean close, retries exhausted, terminal
|
|
190
|
+
* authentication loss, or `disconnect()`.
|
|
191
|
+
*
|
|
192
|
+
* An error thrown by this callback, or a rejection of the promise an async
|
|
193
|
+
* callback returns, is logged and does not affect the connection.
|
|
194
|
+
*/
|
|
145
195
|
onStatusChange?: StatusHandler;
|
|
146
196
|
/**
|
|
147
197
|
* Called after every automatic reconnect sends authentication/subscription
|
|
@@ -52,7 +52,7 @@ import type { Interval } from "../market";
|
|
|
52
52
|
import type { TradingMode } from "../trading";
|
|
53
53
|
import type { WebSocketStatus } from "./base";
|
|
54
54
|
import type { OrderbookQuotationMode } from "./clients/orderbook-client";
|
|
55
|
-
import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, TradeEvent, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
55
|
+
import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, TradeEvent, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
56
56
|
import type { OrderSnapshotItem, SnapshotHandler } from "./snapshots";
|
|
57
57
|
export type MessageHandler<T> = (data: T) => void;
|
|
58
58
|
export interface MonacoWebSocket {
|
|
@@ -84,8 +84,13 @@ export interface MonacoWebSocket {
|
|
|
84
84
|
conditionalOrders: (handler: MessageHandler<ConditionalOrderEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<ConditionalOrderEventData>) => () => void;
|
|
85
85
|
/** Subscribe to TWAP parent-order lifecycle events (requires authentication) */
|
|
86
86
|
twapOrders: (handler: MessageHandler<TwapOrderEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<TwapOrderEventData>) => () => void;
|
|
87
|
-
/**
|
|
88
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to position state updates (requires authentication); omit `tradingPairId` for all pairs. `onSnapshot` receives every open position.
|
|
89
|
+
*
|
|
90
|
+
* `handler` receives lifecycle `position_update` frames only. `onValuation`, when given, receives the periodic `position_valuation`
|
|
91
|
+
* frames carried on the same channel; without it they are ignored. Apply a valuation only to a position already held as `OPEN`.
|
|
92
|
+
*/
|
|
93
|
+
positions: (handler: MessageHandler<PositionEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<PositionEventData>, onValuation?: MessageHandler<PositionValuationEvent>) => () => void;
|
|
89
94
|
/** Subscribe to liquidation alerts (requires authentication); omit `tradingPairId` for all pairs */
|
|
90
95
|
liquidations: (handler: MessageHandler<LiquidationEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<LiquidationEventData>) => () => void;
|
|
91
96
|
/** Subscribe to account-level margin health updates for the authenticated user (requires authentication) */
|
|
@@ -10,5 +10,6 @@ export * from "./ohlcv-events";
|
|
|
10
10
|
export * from "./orderbook-events";
|
|
11
11
|
export * from "./orders-events";
|
|
12
12
|
export * from "./position-events";
|
|
13
|
+
export * from "./position-valuation-events";
|
|
13
14
|
export * from "./trade-events";
|
|
14
15
|
export * from "./twap-order-events";
|
|
@@ -10,5 +10,6 @@ export * from "./ohlcv-events";
|
|
|
10
10
|
export * from "./orderbook-events";
|
|
11
11
|
export * from "./orders-events";
|
|
12
12
|
export * from "./position-events";
|
|
13
|
+
export * from "./position-valuation-events";
|
|
13
14
|
export * from "./trade-events";
|
|
14
15
|
export * from "./twap-order-events";
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Perp-only fields (index/mark price, open interest, funding) are optional and
|
|
15
15
|
* omitted on the wire for spot markets, which have no positions or funding.
|
|
16
|
-
* All numeric quantities are decimal strings except `fundingTimestamp
|
|
17
|
-
*
|
|
16
|
+
* All numeric quantities are decimal strings except `fundingTimestamp` and
|
|
17
|
+
* `lastFundingTime` (millisecond epoch numbers) and `fundingIntervalSeconds`
|
|
18
|
+
* (whole seconds).
|
|
18
19
|
*/
|
|
19
20
|
/**
|
|
20
21
|
* Market tradability label, derived from the oracle market status. Spot markets
|
|
@@ -23,6 +24,10 @@
|
|
|
23
24
|
export type MarketStatus = "TRADABLE" | "POST_ONLY" | "HALTED" | "NOT_READY" | "UNKNOWN";
|
|
24
25
|
/**
|
|
25
26
|
* Full per-market statistics for the `market_stats:<tradingPairId>` channel.
|
|
27
|
+
*
|
|
28
|
+
* `marketStatus` is typed `MarketStatus | (string & {})` for the same reason as
|
|
29
|
+
* on {@link MarketStatsSummary}: an unrecognized status is passed through
|
|
30
|
+
* rather than dropping the frame. Match it with a `default` branch.
|
|
26
31
|
*/
|
|
27
32
|
export interface MarketStatsData {
|
|
28
33
|
/** Market symbol, e.g. "BTC/USDC" */
|
|
@@ -41,8 +46,19 @@ export interface MarketStatsData {
|
|
|
41
46
|
bestAskPrice?: string;
|
|
42
47
|
/** Open interest (decimal string). Perp-only; omitted for spot. */
|
|
43
48
|
openInterest?: string;
|
|
44
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The market's gross open-interest cap, in quote (USD) notional (decimal
|
|
51
|
+
* string). `openInterest` is in base units: multiply it by `markPrice` to
|
|
52
|
+
* compare. Perp-only; omitted for spot.
|
|
53
|
+
*/
|
|
45
54
|
openInterestLimit?: string;
|
|
55
|
+
/**
|
|
56
|
+
* What is left of `openInterestLimit` at the mark, in quote (USD) notional,
|
|
57
|
+
* never below zero (decimal string). At zero, orders that open exposure are
|
|
58
|
+
* refused until open interest or the mark falls. Perp-only; omitted for spot
|
|
59
|
+
* and when there is no mark.
|
|
60
|
+
*/
|
|
61
|
+
openInterestHeadroom?: string;
|
|
46
62
|
/** Last trade price (decimal string) */
|
|
47
63
|
lastTradePrice?: string;
|
|
48
64
|
/** 24h base-token volume (decimal string) */
|
|
@@ -71,6 +87,20 @@ export interface MarketStatsData {
|
|
|
71
87
|
fundingClampSmall?: string;
|
|
72
88
|
/** Live funding cap, upper bound (decimal string). Perp-only; omitted for spot. */
|
|
73
89
|
fundingClampBig?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Tradability label, the same value the all-markets summary carries for this
|
|
92
|
+
* market. Perp markets report any {@link MarketStatus}; spot markets report
|
|
93
|
+
* `TRADABLE` or `HALTED`. Always present on frames from current servers.
|
|
94
|
+
*/
|
|
95
|
+
marketStatus?: MarketStatus | (string & {});
|
|
96
|
+
/** Funding settlement interval in whole seconds. Perp-only; omitted for spot. */
|
|
97
|
+
fundingIntervalSeconds?: number;
|
|
98
|
+
/**
|
|
99
|
+
* When the latest funding window settled, as a millisecond epoch number
|
|
100
|
+
* (REST `getFundingState` returns the same instant as an RFC 3339 string).
|
|
101
|
+
* Perp-only; omitted for spot and for a market that has not settled yet.
|
|
102
|
+
*/
|
|
103
|
+
lastFundingTime?: number;
|
|
74
104
|
}
|
|
75
105
|
/**
|
|
76
106
|
* Per-market statistics event on the `market_stats:<tradingPairId>` channel.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Perp-only fields (index/mark price, open interest, funding) are optional and
|
|
15
15
|
* omitted on the wire for spot markets, which have no positions or funding.
|
|
16
|
-
* All numeric quantities are decimal strings except `fundingTimestamp
|
|
17
|
-
*
|
|
16
|
+
* All numeric quantities are decimal strings except `fundingTimestamp` and
|
|
17
|
+
* `lastFundingTime` (millisecond epoch numbers) and `fundingIntervalSeconds`
|
|
18
|
+
* (whole seconds).
|
|
18
19
|
*/
|
|
@@ -227,6 +227,21 @@ export interface OrderPlacedEvent extends OrderEvent {
|
|
|
227
227
|
* spot. Wire: `reduce_only`.
|
|
228
228
|
*/
|
|
229
229
|
reduceOnly?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* The fill an edit carried over from the original order (decimal string).
|
|
232
|
+
* Sent only when the order is a replacement of a partly filled order; its
|
|
233
|
+
* `quantity` is then the order's total and its `status` is
|
|
234
|
+
* `PARTIALLY_FILLED`, as REST reports the edited order. Omitted on any
|
|
235
|
+
* other `OrderPlaced`. Wire: `filled_quantity`.
|
|
236
|
+
*/
|
|
237
|
+
filledQuantity?: string;
|
|
238
|
+
/** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
|
|
239
|
+
filledQuantityRaw?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Average fill price of the carried fill (decimal string). Sent with
|
|
242
|
+
* `filledQuantity`, omitted otherwise. Wire: `average_fill_price`.
|
|
243
|
+
*/
|
|
244
|
+
averageFillPrice?: string;
|
|
230
245
|
};
|
|
231
246
|
}
|
|
232
247
|
/**
|
|
@@ -311,7 +326,11 @@ export interface OrderMatchedEvent extends OrderEvent {
|
|
|
311
326
|
tradesCount: number;
|
|
312
327
|
/** Remaining quantity to be filled. */
|
|
313
328
|
remainingQuantity: string;
|
|
314
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* The order's cumulative average fill price, across every fill — those an
|
|
331
|
+
* edit carried over from the original order included, matching REST.
|
|
332
|
+
* `null` when there is none. This match's own price is `executionPrice`.
|
|
333
|
+
*/
|
|
315
334
|
averageFillPrice: string | null;
|
|
316
335
|
/** Order status. */
|
|
317
336
|
status: OrderStatus | (string & {});
|
|
@@ -345,7 +364,11 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
345
364
|
tradesCount?: number;
|
|
346
365
|
/** Remaining quantity (present for both taker and maker) */
|
|
347
366
|
remainingQuantity?: string;
|
|
348
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* The order's cumulative average fill price, on both roles: the average
|
|
369
|
+
* across every fill of the order (an edit's carried fills included), as
|
|
370
|
+
* REST reports it — not this trade's price, which is `executionPrice`.
|
|
371
|
+
*/
|
|
349
372
|
averageFillPrice?: string;
|
|
350
373
|
/** Order status (taker orders only) */
|
|
351
374
|
status?: OrderStatus | (string & {});
|
|
@@ -439,7 +462,11 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
439
462
|
tradesCount?: number;
|
|
440
463
|
/** Remaining quantity (present for both, should be 0 for filled orders) */
|
|
441
464
|
remainingQuantity?: string;
|
|
442
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* The order's cumulative average fill price, on both roles: the average
|
|
467
|
+
* across every fill of the order (an edit's carried fills included), as
|
|
468
|
+
* REST reports it — not this trade's price, which is `executionPrice`.
|
|
469
|
+
*/
|
|
443
470
|
averageFillPrice?: string;
|
|
444
471
|
/** Order status (taker orders only) */
|
|
445
472
|
status?: OrderStatus | (string & {});
|