@0xmonaco/types 1.0.74 → 1.0.76
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/instrument-events.d.ts +27 -1
- package/dist/websocket/events/instrument-events.js +6 -1
- package/dist/websocket/events/market-stats-events.d.ts +41 -5
- 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
package/dist/profile/index.d.ts
CHANGED
|
@@ -98,13 +98,24 @@ export type TransactionType = "DEPOSIT" | "WITHDRAWAL" | "TRADE" | "FEE" | "FUND
|
|
|
98
98
|
* Query parameters for getting user movements
|
|
99
99
|
*/
|
|
100
100
|
export interface GetUserMovementsParams {
|
|
101
|
+
/** Number of items per page, 1 to 1000 (default 20) */
|
|
102
|
+
pageSize?: number;
|
|
101
103
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
+
* Pagination cursor with two states:
|
|
105
|
+
* - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
|
|
106
|
+
* no prior position, from the newest row (or the oldest, when `orderBy`
|
|
107
|
+
* is `"ASC"`).
|
|
108
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
109
|
+
* `nextPageToken`; results resume immediately after that position.
|
|
110
|
+
*
|
|
111
|
+
* Page-number pagination was removed (0XM-2788): there is no `page`, and
|
|
112
|
+
* sending one is a `400`. Every walk covers the ledger and funding arms
|
|
113
|
+
* merged. Filters and `orderBy` must match the request that minted the
|
|
114
|
+
* token.
|
|
104
115
|
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
|
|
116
|
+
pageToken?: string;
|
|
117
|
+
/** Sort direction for `createdAt`: `"ASC"` or `"DESC"` (default `"DESC"`) */
|
|
118
|
+
orderBy?: "ASC" | "DESC";
|
|
108
119
|
/** Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE) */
|
|
109
120
|
entryType?: LedgerEntryType;
|
|
110
121
|
/** Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD) */
|
|
@@ -116,10 +127,22 @@ export interface GetUserMovementsParams {
|
|
|
116
127
|
* Query parameters for getting user balances
|
|
117
128
|
*/
|
|
118
129
|
export interface GetUserBalancesParams {
|
|
119
|
-
/**
|
|
120
|
-
page?: number;
|
|
121
|
-
/** Number of items per page (max 100) */
|
|
130
|
+
/** Number of items per page, 1 to 1000 (default 20) */
|
|
122
131
|
pageSize?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Pagination cursor with two states:
|
|
134
|
+
* - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
|
|
135
|
+
* no prior position, from the lowest token address.
|
|
136
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
137
|
+
* `nextPageToken`; results resume immediately after that position.
|
|
138
|
+
*
|
|
139
|
+
* Page-number pagination was removed (0XM-2788): there is no `page`, and
|
|
140
|
+
* sending one is a `400`. The walk seeks on `(token, assetId)` over the
|
|
141
|
+
* balance set the server builds after overlaying the matching engine's
|
|
142
|
+
* authoritative amounts, so a balance that appears or is zeroed mid-walk no
|
|
143
|
+
* longer shifts the rows behind it across the resume point.
|
|
144
|
+
*/
|
|
145
|
+
pageToken?: string;
|
|
123
146
|
}
|
|
124
147
|
/**
|
|
125
148
|
* Response from getting user movements
|
|
@@ -127,22 +150,30 @@ export interface GetUserBalancesParams {
|
|
|
127
150
|
export interface GetPaginatedUserMovementsResponse {
|
|
128
151
|
/** All movements from PostgreSQL (historical, paginated) */
|
|
129
152
|
movements: LedgerMovement[];
|
|
130
|
-
/** Current page number */
|
|
131
|
-
page: number;
|
|
132
153
|
/** Items per page */
|
|
133
154
|
pageSize: number;
|
|
134
155
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* matching movements than the listing can page through reads the cap, not
|
|
138
|
-
* their lifetime total.
|
|
156
|
+
* Movements matching the filter, bounded by the server count ceiling — see
|
|
157
|
+
* `totalCapped`. A lower bound when `totalCapped` is `true`.
|
|
139
158
|
*/
|
|
140
159
|
total: number;
|
|
160
|
+
/** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
|
|
161
|
+
totalPages: number;
|
|
141
162
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
163
|
+
* Cursor for the next page, minted from the last row of an over-fetched
|
|
164
|
+
* page. Each arm of the ledger+funding union is cut at the same
|
|
165
|
+
* over-fetched depth inside one statement, so a page shorter than
|
|
166
|
+
* `pageSize` means both arms are exhausted and this is `""`. A non-empty
|
|
167
|
+
* token always has at least one further row behind it.
|
|
144
168
|
*/
|
|
145
|
-
|
|
169
|
+
nextPageToken: string;
|
|
170
|
+
/**
|
|
171
|
+
* `true` when MORE than the server ceiling of movements matched, so the
|
|
172
|
+
* count stopped at the ceiling and `total` / `totalPages` are a lower
|
|
173
|
+
* bound. `false` when `total` is the exact count — including exactly the
|
|
174
|
+
* ceiling, which is still reported exactly.
|
|
175
|
+
*/
|
|
176
|
+
totalCapped: boolean;
|
|
146
177
|
}
|
|
147
178
|
/**
|
|
148
179
|
* Response from getting user balances
|
|
@@ -150,14 +181,21 @@ export interface GetPaginatedUserMovementsResponse {
|
|
|
150
181
|
export interface GetUserBalancesResponse {
|
|
151
182
|
/** List of token balances for the user */
|
|
152
183
|
balances: AccountBalance[];
|
|
153
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Total number of balances. Exact — the set is bounded by the asset universe
|
|
186
|
+
* and counted in memory after the live overlay, so no ceiling applies.
|
|
187
|
+
*/
|
|
154
188
|
total: number;
|
|
155
189
|
/** Items per page */
|
|
156
190
|
pageSize: number;
|
|
157
|
-
/** Current page number */
|
|
158
|
-
page: number;
|
|
159
191
|
/** Total number of pages */
|
|
160
192
|
totalPages: number;
|
|
193
|
+
/**
|
|
194
|
+
* Cursor for the next page, `""` once the walk is exhausted. The whole set
|
|
195
|
+
* is already in memory, so each page over-fetches one row and an empty token
|
|
196
|
+
* is definitive — follow a non-empty token, stop on an empty one.
|
|
197
|
+
*/
|
|
198
|
+
nextPageToken: string;
|
|
161
199
|
}
|
|
162
200
|
/**
|
|
163
201
|
* Order information for recent orders.
|
|
@@ -351,13 +389,21 @@ export interface FundingPayment {
|
|
|
351
389
|
* Query parameters for listing funding payments.
|
|
352
390
|
*/
|
|
353
391
|
export interface ListFundingPaymentsParams {
|
|
392
|
+
/** Number of items per page, 1 to 1000 (default 20) */
|
|
393
|
+
pageSize?: number;
|
|
354
394
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
395
|
+
* Pagination cursor with two states:
|
|
396
|
+
* - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
|
|
397
|
+
* no prior position, from the newest payment.
|
|
398
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
399
|
+
* `nextPageToken`; results resume immediately after that position.
|
|
400
|
+
*
|
|
401
|
+
* Page-number pagination was removed (0XM-2788): there is no `page`, and
|
|
402
|
+
* sending one is a `400`. The walk seeks on `(createdAt, id)` descending —
|
|
403
|
+
* not `periodEnd`, which the removed mode led its sort with and which is
|
|
404
|
+
* nullable. Filters must match the request that minted the token.
|
|
357
405
|
*/
|
|
358
|
-
|
|
359
|
-
/** Number of items per page (max 100) */
|
|
360
|
-
pageSize?: number;
|
|
406
|
+
pageToken?: string;
|
|
361
407
|
/** Filter by trading pair ID (UUID) */
|
|
362
408
|
tradingPairId?: string;
|
|
363
409
|
/** Filter by margin position ID (UUID) */
|
|
@@ -371,22 +417,29 @@ export interface ListFundingPaymentsParams {
|
|
|
371
417
|
export interface ListFundingPaymentsResponse {
|
|
372
418
|
/** List of funding payment records */
|
|
373
419
|
records: FundingPayment[];
|
|
374
|
-
/** Current page number */
|
|
375
|
-
page: number;
|
|
376
420
|
/** Items per page */
|
|
377
421
|
pageSize: number;
|
|
378
422
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* user with more matching payments than the listing can page through reads
|
|
382
|
-
* the cap, not their lifetime total.
|
|
423
|
+
* Payments matching the filter, bounded by the server count ceiling — see
|
|
424
|
+
* `totalCapped`. A lower bound when `totalCapped` is `true`.
|
|
383
425
|
*/
|
|
384
426
|
total: number;
|
|
427
|
+
/** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
|
|
428
|
+
totalPages: number;
|
|
385
429
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
430
|
+
* Cursor for the next page, minted from the last row of an over-fetched
|
|
431
|
+
* page. This listing is one ordered read, so a page shorter than `pageSize`
|
|
432
|
+
* proves the walk is exhausted and this is `""`. A non-empty token always
|
|
433
|
+
* has at least one further row behind it.
|
|
388
434
|
*/
|
|
389
|
-
|
|
435
|
+
nextPageToken: string;
|
|
436
|
+
/**
|
|
437
|
+
* `true` when MORE than the server ceiling of payments matched, so the count
|
|
438
|
+
* stopped at the ceiling and `total` / `totalPages` are a lower bound.
|
|
439
|
+
* `false` when `total` is the exact count — including exactly the ceiling,
|
|
440
|
+
* which is still reported exactly.
|
|
441
|
+
*/
|
|
442
|
+
totalCapped: boolean;
|
|
390
443
|
}
|
|
391
444
|
/**
|
|
392
445
|
* Time period for portfolio stats and chart queries.
|
|
@@ -539,9 +592,14 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
539
592
|
* Fetches the user's transaction history from the /api/v1/accounts/movements endpoint.
|
|
540
593
|
* Requires a valid access token to be set.
|
|
541
594
|
*
|
|
595
|
+
* Cursor paged (0XM-2788/0XM-2820): omit `pageToken` or pass `""` to start,
|
|
596
|
+
* then follow `nextPageToken` until it comes back empty. There is no `page`
|
|
597
|
+
* — sending one is a `400`.
|
|
598
|
+
*
|
|
542
599
|
* @param params - Optional query parameters for pagination and filtering
|
|
543
|
-
* @param params.
|
|
544
|
-
* @param params.
|
|
600
|
+
* @param params.pageToken - Cursor from a previous response's `nextPageToken`
|
|
601
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 1000)
|
|
602
|
+
* @param params.orderBy - Sort direction for `createdAt` (default `"DESC"`)
|
|
545
603
|
* @param params.entryType - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
546
604
|
* @param params.transactionType - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
547
605
|
* @param params.assetId - Filter by asset ID (UUID)
|
|
@@ -554,10 +612,15 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
554
612
|
* Fetches the user's token balances from the /api/v1/accounts/balances endpoint.
|
|
555
613
|
* Requires a valid access token to be set.
|
|
556
614
|
*
|
|
615
|
+
* Cursor paged (0XM-2788/0XM-2821): omit `pageToken` or pass `""` to start,
|
|
616
|
+
* then follow `nextPageToken` until it comes back empty. There is no `page`
|
|
617
|
+
* — sending one is a `400`.
|
|
618
|
+
*
|
|
557
619
|
* @param params - Optional query parameters for pagination
|
|
558
|
-
* @param params.
|
|
559
|
-
* @param params.
|
|
620
|
+
* @param params.pageToken - Cursor from a previous response's `nextPageToken`
|
|
621
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 1000)
|
|
560
622
|
* @returns Promise resolving to paginated balances response
|
|
623
|
+
* @throws ValidationError If the page size is invalid or `page` is sent; this may occur before any network request.
|
|
561
624
|
*/
|
|
562
625
|
getUserBalances(params?: GetUserBalancesParams): Promise<GetUserBalancesResponse>;
|
|
563
626
|
/**
|
|
@@ -597,12 +660,15 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
597
660
|
* Fetches the user's executed trades from the /api/v1/accounts/trades endpoint.
|
|
598
661
|
* Requires a valid access token to be set.
|
|
599
662
|
*
|
|
663
|
+
* Cursor paged (0XM-2963): omit `pageToken` or pass `""` to start, then
|
|
664
|
+
* follow `nextPageToken` until it comes back empty. There is no `page`.
|
|
665
|
+
*
|
|
600
666
|
* @param params - Optional query parameters for pagination and filtering
|
|
601
|
-
* @param params.
|
|
602
|
-
* @param params.
|
|
667
|
+
* @param params.pageToken - Cursor from a previous response's `nextPageToken`
|
|
668
|
+
* @param params.pageSize - Number of items per page (max 1000)
|
|
603
669
|
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
604
670
|
* @returns Promise resolving to paginated trades response
|
|
605
|
-
* @throws ValidationError If
|
|
671
|
+
* @throws ValidationError If the page size is invalid, `page` is sent, or tradingPairId is not a valid UUID; this may occur before any network request.
|
|
606
672
|
*/
|
|
607
673
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
608
674
|
/**
|
|
@@ -619,14 +685,18 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
619
685
|
* Fetches funding payments from the /api/v1/accounts/funding-payments endpoint.
|
|
620
686
|
* Requires a valid access token to be set.
|
|
621
687
|
*
|
|
688
|
+
* Cursor paged (0XM-2788/0XM-2818): omit `pageToken` or pass `""` to start,
|
|
689
|
+
* then follow `nextPageToken` until it comes back empty. There is no `page`
|
|
690
|
+
* — sending one is a `400`.
|
|
691
|
+
*
|
|
622
692
|
* @param params - Optional query parameters for pagination and filtering
|
|
623
|
-
* @param params.
|
|
624
|
-
* @param params.pageSize - Number of items per page (max
|
|
693
|
+
* @param params.pageToken - Cursor from a previous response's `nextPageToken`
|
|
694
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 1000)
|
|
625
695
|
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
626
696
|
* @param params.positionId - Filter by margin position ID (UUID)
|
|
627
697
|
* @param params.marginAccountId - Filter by margin account ID (UUID)
|
|
628
698
|
* @returns Promise resolving to paginated funding payments response
|
|
629
|
-
* @throws ValidationError If
|
|
699
|
+
* @throws ValidationError If the page size is invalid, `page` is sent, or a UUID filter is invalid; this may occur before any network request.
|
|
630
700
|
*/
|
|
631
701
|
listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
|
|
632
702
|
/**
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -144,12 +144,20 @@ export interface MonacoSDK {
|
|
|
144
144
|
};
|
|
145
145
|
/** Trades REST API for fetching historical trades */
|
|
146
146
|
trades: {
|
|
147
|
+
/**
|
|
148
|
+
* One page of a pair's trade feed, newest first. Cursor paged (0XM-2821):
|
|
149
|
+
* omit `pageToken` to start, then follow `nextPageToken` until it is empty.
|
|
150
|
+
*/
|
|
147
151
|
getTrades: (tradingPairId: string, options?: {
|
|
148
|
-
/**
|
|
149
|
-
page?: number;
|
|
150
|
-
/** Maximum number of records to return (default: 25, max: 100) */
|
|
152
|
+
/** Maximum number of records to return (default: 25, max: 1000) */
|
|
151
153
|
pageSize?: number;
|
|
152
|
-
|
|
154
|
+
/** Cursor from a previous response's `nextPageToken`; omit to start */
|
|
155
|
+
pageToken?: string;
|
|
156
|
+
}) => Promise<{
|
|
157
|
+
trades: TradeEvent[];
|
|
158
|
+
/** Empty exactly when the walk is finished. */
|
|
159
|
+
nextPageToken: string;
|
|
160
|
+
}>;
|
|
153
161
|
};
|
|
154
162
|
/** WebSocket client for real-time data — the full typed channel surface of {@link MonacoWebSocket} */
|
|
155
163
|
ws: MonacoWebSocket;
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -267,6 +267,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
267
267
|
*/
|
|
268
268
|
listTwapOrders(params?: ListTwapOrdersParams): Promise<ListTwapOrdersResponse>;
|
|
269
269
|
}
|
|
270
|
-
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource,
|
|
270
|
+
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState, } from "./orders";
|
|
271
271
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
272
272
|
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, ParentTrailingStopLegParams, ReplaceOrderResponse, TriggeredOrderSummary, TwapOrder, UpdatedFields, } from "./responses";
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for trading operations and order management.
|
|
5
5
|
*/
|
|
6
|
-
import type { ConditionalOrder, TwapOrder } from "./responses";
|
|
7
6
|
/**
|
|
8
7
|
* Standard order structure used across all order-related responses.
|
|
9
8
|
* This represents the complete order information as returned by the API.
|
|
@@ -14,12 +13,9 @@ import type { ConditionalOrder, TwapOrder } from "./responses";
|
|
|
14
13
|
* Orders can transition to `CANCELLED`, `REJECTED`, or `EXPIRED` at various stages.
|
|
15
14
|
* Fee fields are only populated after order fills occur.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* detail hangs off `twap` / `conditional`, and the fields above are populated
|
|
21
|
-
* for every kind — a parent's `quantity` is its total, `filledQuantity` what
|
|
22
|
-
* it has executed so far, and `status` its state expressed as an order status.
|
|
16
|
+
* Every row is a book order: the order listing carries `LIMIT` and `MARKET`
|
|
17
|
+
* orders only. TWAP parents and conditional (TP/SL) orders are listed by
|
|
18
|
+
* `listTwapOrders` and `listConditionalOrders`, never here.
|
|
23
19
|
*
|
|
24
20
|
* @example
|
|
25
21
|
* To calculate remaining quantity:
|
|
@@ -34,8 +30,8 @@ export interface Order {
|
|
|
34
30
|
tradingPairId: string;
|
|
35
31
|
/** Order side (BUY or SELL) */
|
|
36
32
|
side: OrderSide;
|
|
37
|
-
/**
|
|
38
|
-
orderType:
|
|
33
|
+
/** Order type (LIMIT or MARKET) */
|
|
34
|
+
orderType: OrderType;
|
|
39
35
|
/** Order status - see OrderStatus for lifecycle details */
|
|
40
36
|
status: OrderStatus;
|
|
41
37
|
/** Order price - null for market orders, required for limit orders */
|
|
@@ -98,18 +94,6 @@ export interface Order {
|
|
|
98
94
|
clientOrderId?: string;
|
|
99
95
|
/** Position ID linked to the order, when available */
|
|
100
96
|
positionId?: string;
|
|
101
|
-
/**
|
|
102
|
-
* The TWAP parent behind this row - its schedule, slice counters and
|
|
103
|
-
* progress - present only when `orderType` is `"TWAP"`. Identical to what
|
|
104
|
-
* `getTwapOrder` returns for the same id.
|
|
105
|
-
*/
|
|
106
|
-
twap?: TwapOrder;
|
|
107
|
-
/**
|
|
108
|
-
* The conditional order behind this row - its trigger and the order it fires
|
|
109
|
-
* - present only when `orderType` is `"CONDITIONAL"`. Identical to what the
|
|
110
|
-
* conditional-order endpoints return for the same id.
|
|
111
|
-
*/
|
|
112
|
-
conditional?: ConditionalOrder;
|
|
113
97
|
/** Stable cause when status is CANCELLED */
|
|
114
98
|
terminalReason?: OrderTerminalReason;
|
|
115
99
|
/**
|
|
@@ -178,7 +162,7 @@ export interface Order {
|
|
|
178
162
|
version?: number;
|
|
179
163
|
}
|
|
180
164
|
/** Stable terminal causes for accepted orders that end as CANCELLED. */
|
|
181
|
-
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SELF_TRADE_PREVENTION" | "AUTO_DELEVERAGING" | "SYSTEM";
|
|
165
|
+
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SELF_TRADE_PREVENTION" | "AUTO_DELEVERAGING" | "PRICE_BAND" | "SLIPPAGE_TOLERANCE" | "SYSTEM";
|
|
182
166
|
/**
|
|
183
167
|
* Role of the creator or order
|
|
184
168
|
*/
|
|
@@ -201,16 +185,6 @@ export type PositionSide = "LONG" | "SHORT" | "NONE";
|
|
|
201
185
|
* - TRAILING_STOP: Stop order that trails the market price
|
|
202
186
|
*/
|
|
203
187
|
export type OrderType = "LIMIT" | "MARKET";
|
|
204
|
-
/**
|
|
205
|
-
* What kind of order a listed row is.
|
|
206
|
-
*
|
|
207
|
-
* Wider than {@link OrderType}, which is what you can place: the order listing
|
|
208
|
-
* serves book orders, TWAP parents and conditional orders as one stream, and
|
|
209
|
-
* `"TWAP"` / `"CONDITIONAL"` name the two kinds that are created through their
|
|
210
|
-
* own endpoints rather than `createOrder`. A row of either kind carries its
|
|
211
|
-
* detail on {@link Order.twap} or {@link Order.conditional}.
|
|
212
|
-
*/
|
|
213
|
-
export type ListedOrderType = OrderType | "TWAP" | "CONDITIONAL";
|
|
214
188
|
/**
|
|
215
189
|
* Source-of-truth order status values used by runtime validation schemas.
|
|
216
190
|
*/
|
|
@@ -197,23 +197,18 @@ export interface GetPaginatedOrdersParams {
|
|
|
197
197
|
/** Number of orders per page (default: 10; max 1000) */
|
|
198
198
|
pageSize?: number;
|
|
199
199
|
/**
|
|
200
|
-
* Pagination cursor with
|
|
201
|
-
* - Omitted (`undefined`)
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* recent history once the archive window is enabled.
|
|
205
|
-
* - Empty string (`""`): start a cursor walk with no prior position, from
|
|
206
|
-
* the newest row (or the oldest, when `orderBy` is `"ASC"`).
|
|
200
|
+
* Pagination cursor with two states:
|
|
201
|
+
* - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
|
|
202
|
+
* no prior position, from the newest row (or the oldest, when `orderBy`
|
|
203
|
+
* is `"ASC"`).
|
|
207
204
|
* - Non-empty: an opaque cursor from a previous response's
|
|
208
205
|
* `nextPageToken`; results resume immediately after that position.
|
|
209
206
|
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* the server count ceiling
|
|
213
|
-
* history
|
|
214
|
-
*
|
|
215
|
-
* must use the cursor form (pass `""` to start, then follow `nextPageToken`)
|
|
216
|
-
* rather than `page`.
|
|
207
|
+
* Page-number pagination was removed (0XM-2788): there is no `page`, and
|
|
208
|
+
* sending one is a `400`. `total` and `totalPages` are still populated,
|
|
209
|
+
* bounded by the server count ceiling — see `totalCapped`. Every walk
|
|
210
|
+
* covers full order history, hot and archived rows merged. Filters and
|
|
211
|
+
* `orderBy` must match the request that minted the token.
|
|
217
212
|
*/
|
|
218
213
|
pageToken?: string;
|
|
219
214
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public application listing validation schemas
|
|
3
|
+
*
|
|
4
|
+
* The four reporting listings are cursor paged (0XM-2822). Each schema
|
|
5
|
+
* REJECTS `page` rather than omitting it: forwarding the params field by
|
|
6
|
+
* field drops a stray `page` before it reaches the wire, which means a
|
|
7
|
+
* JavaScript or `any` caller looping on `{ page: n }` would be handed the
|
|
8
|
+
* FIRST cursor page on every call and would export the same rows forever —
|
|
9
|
+
* the exact failure the REST 400 exists to surface. Validating here turns
|
|
10
|
+
* that into an immediate `ValidationError`, which is what the 400 would have
|
|
11
|
+
* done before the field-by-field forwarding hid it.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
export declare const ListAppOrdersSchema: z.ZodObject<{
|
|
15
|
+
clientId: z.ZodString;
|
|
16
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
17
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
19
|
+
status: z.ZodOptional<z.ZodString>;
|
|
20
|
+
userId: z.ZodOptional<z.ZodUUID>;
|
|
21
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
22
|
+
side: z.ZodOptional<z.ZodString>;
|
|
23
|
+
orderType: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const ListAppUsersSchema: z.ZodObject<{
|
|
26
|
+
clientId: z.ZodString;
|
|
27
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
28
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
30
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
accountType: z.ZodOptional<z.ZodString>;
|
|
32
|
+
address: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const ListAppMovementsSchema: z.ZodObject<{
|
|
35
|
+
clientId: z.ZodString;
|
|
36
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
37
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
39
|
+
userId: z.ZodOptional<z.ZodUUID>;
|
|
40
|
+
transactionType: z.ZodOptional<z.ZodString>;
|
|
41
|
+
entryType: z.ZodOptional<z.ZodString>;
|
|
42
|
+
assetId: z.ZodOptional<z.ZodUUID>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export declare const ListAppBalancesSchema: z.ZodObject<{
|
|
45
|
+
clientId: z.ZodString;
|
|
46
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
47
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
49
|
+
userId: z.ZodOptional<z.ZodUUID>;
|
|
50
|
+
assetId: z.ZodOptional<z.ZodUUID>;
|
|
51
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public application listing validation schemas
|
|
3
|
+
*
|
|
4
|
+
* The four reporting listings are cursor paged (0XM-2822). Each schema
|
|
5
|
+
* REJECTS `page` rather than omitting it: forwarding the params field by
|
|
6
|
+
* field drops a stray `page` before it reaches the wire, which means a
|
|
7
|
+
* JavaScript or `any` caller looping on `{ page: n }` would be handed the
|
|
8
|
+
* FIRST cursor page on every call and would export the same rows forever —
|
|
9
|
+
* the exact failure the REST 400 exists to surface. Validating here turns
|
|
10
|
+
* that into an immediate `ValidationError`, which is what the 400 would have
|
|
11
|
+
* done before the field-by-field forwarding hid it.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { UUIDSchema } from "./trading";
|
|
15
|
+
/** A client ID is required; `page` is gone; a page size is bounded; a cursor may be `""` to start. */
|
|
16
|
+
const AppCursorPaginationSchema = z.object({
|
|
17
|
+
/** The application's public client ID; the listings are selected by it. */
|
|
18
|
+
clientId: z.string().trim().min(1, "Client ID is required"),
|
|
19
|
+
page: z.never().optional(),
|
|
20
|
+
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(),
|
|
21
|
+
pageToken: z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
export const ListAppOrdersSchema = AppCursorPaginationSchema.extend({
|
|
24
|
+
status: z.string().trim().min(1, "Status cannot be empty").optional(),
|
|
25
|
+
userId: UUIDSchema.optional(),
|
|
26
|
+
tradingPairId: UUIDSchema.optional(),
|
|
27
|
+
side: z.string().trim().min(1, "Side cannot be empty").optional(),
|
|
28
|
+
orderType: z.string().trim().min(1, "Order type cannot be empty").optional(),
|
|
29
|
+
});
|
|
30
|
+
export const ListAppUsersSchema = AppCursorPaginationSchema.extend({
|
|
31
|
+
isActive: z.boolean().optional(),
|
|
32
|
+
accountType: z.string().trim().min(1, "Account type cannot be empty").optional(),
|
|
33
|
+
// A partial, case-insensitive match, so not a full address.
|
|
34
|
+
address: z.string().trim().min(1, "Address filter cannot be empty").optional(),
|
|
35
|
+
});
|
|
36
|
+
export const ListAppMovementsSchema = AppCursorPaginationSchema.extend({
|
|
37
|
+
userId: UUIDSchema.optional(),
|
|
38
|
+
transactionType: z.string().trim().min(1, "Transaction type cannot be empty").optional(),
|
|
39
|
+
entryType: z.string().trim().min(1, "Entry type cannot be empty").optional(),
|
|
40
|
+
assetId: UUIDSchema.optional(),
|
|
41
|
+
});
|
|
42
|
+
export const ListAppBalancesSchema = AppCursorPaginationSchema.extend({
|
|
43
|
+
userId: UUIDSchema.optional(),
|
|
44
|
+
assetId: UUIDSchema.optional(),
|
|
45
|
+
});
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
* - Vault schemas (deposits, withdrawals)
|
|
14
14
|
* - Market schemas (trading pairs, candlesticks)
|
|
15
15
|
*/
|
|
16
|
+
export * from "./applications.js";
|
|
16
17
|
export * from "./common.js";
|
|
17
18
|
export * from "./copy-trading.js";
|
|
19
|
+
export * from "./managed-markets.js";
|
|
18
20
|
export * from "./margin-accounts.js";
|
|
19
21
|
export * from "./market.js";
|
|
20
22
|
export * from "./positions.js";
|
package/dist/validation/index.js
CHANGED
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* - Market schemas (trading pairs, candlesticks)
|
|
15
15
|
*/
|
|
16
16
|
// Export validation utilities
|
|
17
|
+
export * from "./applications.js";
|
|
17
18
|
export * from "./common.js";
|
|
18
19
|
export * from "./copy-trading.js";
|
|
20
|
+
export * from "./managed-markets.js";
|
|
19
21
|
export * from "./margin-accounts.js";
|
|
20
22
|
export * from "./market.js";
|
|
21
23
|
export * from "./positions.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed Markets API Validation Schemas
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
/**
|
|
6
|
+
* Managed market assignments listing validation schema.
|
|
7
|
+
*
|
|
8
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted: the client
|
|
9
|
+
* builds the query string field by field, so a stray `page` never reaches the
|
|
10
|
+
* REST guard, and a caller looping `{ page: 1 }`, `{ page: 2 }` would send
|
|
11
|
+
* identical cursorless requests and reread the first page forever.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ListManagedMarketAssignmentsSchema: z.ZodObject<{
|
|
14
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
15
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed Markets API Validation Schemas
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
/**
|
|
6
|
+
* Managed market assignments listing validation schema.
|
|
7
|
+
*
|
|
8
|
+
* Cursor paged (0XM-2821). `page` is REJECTED rather than omitted: the client
|
|
9
|
+
* builds the query string field by field, so a stray `page` never reaches the
|
|
10
|
+
* REST guard, and a caller looping `{ page: 1 }`, `{ page: 2 }` would send
|
|
11
|
+
* identical cursorless requests and reread the first page forever.
|
|
12
|
+
*/
|
|
13
|
+
export const ListManagedMarketAssignmentsSchema = z.object({
|
|
14
|
+
page: z.never().optional(),
|
|
15
|
+
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(),
|
|
16
|
+
pageToken: z.string().optional(),
|
|
17
|
+
});
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
export declare const ListMarginAccountsSchema: 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
|
state: z.ZodOptional<z.ZodString>;
|
|
9
10
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
10
11
|
}, z.core.$strip>;
|
|
@@ -70,14 +71,16 @@ export declare const TransferCollateralFromParentMarginAccountSchema: z.ZodObjec
|
|
|
70
71
|
}, z.core.$strip>;
|
|
71
72
|
}, z.core.$strip>;
|
|
72
73
|
export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
|
|
73
|
-
page: z.ZodOptional<z.
|
|
74
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
74
75
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
75
77
|
marginAccountId: z.ZodUUID;
|
|
76
78
|
movementType: z.ZodOptional<z.ZodString>;
|
|
77
79
|
}, z.core.$strip>;
|
|
78
80
|
export declare const GetParentMarginAccountMovementsSchema: z.ZodOptional<z.ZodObject<{
|
|
79
|
-
page: z.ZodOptional<z.
|
|
81
|
+
page: z.ZodOptional<z.ZodNever>;
|
|
80
82
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
81
84
|
movementType: z.ZodOptional<z.ZodString>;
|
|
82
85
|
}, z.core.$strip>>;
|
|
83
86
|
export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
@@ -194,6 +197,10 @@ export declare const CreateMarginSubAccountSchema: z.ZodObject<{
|
|
|
194
197
|
export declare const CloseMarginSubAccountSchema: z.ZodObject<{
|
|
195
198
|
marginAccountId: z.ZodUUID;
|
|
196
199
|
}, z.core.$strip>;
|
|
200
|
+
export declare const SubAccountCollateralTransferSchema: z.ZodObject<{
|
|
201
|
+
marginAccountId: z.ZodUUID;
|
|
202
|
+
amount: z.ZodString;
|
|
203
|
+
}, z.core.$strip>;
|
|
197
204
|
export declare const GetMarginAccountPnlSchema: z.ZodObject<{
|
|
198
205
|
marginAccountId: z.ZodUUID;
|
|
199
206
|
}, z.core.$strip>;
|