@0xmonaco/types 1.0.74 → 1.0.75

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.
Files changed (43) hide show
  1. package/dist/api/index.d.ts +0 -7
  2. package/dist/applications/index.d.ts +14 -15
  3. package/dist/applications/index.js +2 -2
  4. package/dist/applications/requests.d.ts +70 -15
  5. package/dist/applications/requests.js +2 -3
  6. package/dist/applications/responses.d.ts +35 -39
  7. package/dist/applications/responses.js +1 -1
  8. package/dist/fees/responses.js +2 -2
  9. package/dist/margin-accounts/index.d.ts +72 -12
  10. package/dist/market/index.d.ts +76 -6
  11. package/dist/pitpass/index.d.ts +16 -11
  12. package/dist/pitpass/index.js +1 -1
  13. package/dist/pitpass/responses.d.ts +21 -0
  14. package/dist/pitpass/responses.js +43 -14
  15. package/dist/positions/index.d.ts +81 -14
  16. package/dist/profile/index.d.ts +114 -44
  17. package/dist/trading/index.d.ts +1 -1
  18. package/dist/trading/orders.d.ts +6 -32
  19. package/dist/trading/responses.d.ts +9 -14
  20. package/dist/validation/applications.d.ts +51 -0
  21. package/dist/validation/applications.js +45 -0
  22. package/dist/validation/index.d.ts +1 -0
  23. package/dist/validation/index.js +1 -0
  24. package/dist/validation/margin-accounts.d.ts +10 -3
  25. package/dist/validation/margin-accounts.js +17 -6
  26. package/dist/validation/market.d.ts +24 -0
  27. package/dist/validation/market.js +22 -0
  28. package/dist/validation/positions.d.ts +5 -3
  29. package/dist/validation/positions.js +12 -5
  30. package/dist/validation/profile.d.ts +19 -2
  31. package/dist/validation/profile.js +36 -4
  32. package/dist/validation/trading.d.ts +2 -2
  33. package/dist/websocket/base.d.ts +56 -6
  34. package/dist/websocket/client.d.ts +8 -3
  35. package/dist/websocket/events/index.d.ts +1 -0
  36. package/dist/websocket/events/index.js +1 -0
  37. package/dist/websocket/events/position-events.d.ts +15 -0
  38. package/dist/websocket/events/position-valuation-events.d.ts +60 -0
  39. package/dist/websocket/events/position-valuation-events.js +15 -0
  40. package/dist/wire/operations.d.ts +1 -1
  41. package/dist/wire/operations.js +2 -0
  42. package/dist/wire/schema.d.ts +748 -235
  43. package/package.json +2 -2
@@ -16,11 +16,4 @@ export interface BaseAPI {
16
16
  * @param credentials - Hex-encoded session keypair, or `undefined` to clear.
17
17
  */
18
18
  setSessionKeypair(credentials: SessionCredentials | undefined): void;
19
- /**
20
- * Set (or clear) the application secret key used for backend-authenticated
21
- * requests. When set, it is sent in the `x-server-key` header.
22
- *
23
- * @param serverKey - The application secret key (`sk_...`), or `undefined` to clear.
24
- */
25
- setServerKey(serverKey: string | undefined): void;
26
19
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Applications Types
3
3
  *
4
- * Types for application configuration and the backend-authenticated
5
- * application reporting endpoints.
4
+ * Types for application configuration and the public application reporting
5
+ * endpoints.
6
6
  */
7
7
  import type { BaseAPI } from "../api";
8
8
  import type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
@@ -11,9 +11,8 @@ import type { ApplicationConfigResponse, GetAppStatsResponse, ListAppBalancesRes
11
11
  * Applications API interface.
12
12
  *
13
13
  * `getApplicationConfig` is session-authenticated (signed with the session
14
- * key). The reporting methods are backend-authenticated: set the application's
15
- * secret key with {@link BaseAPI.setServerKey} before calling them — each
16
- * request sends it in the `x-server-key` header.
14
+ * key). The reporting methods are public: each selects its application by
15
+ * `clientId` and is rate limited per client IP.
17
16
  */
18
17
  export interface ApplicationsAPI extends BaseAPI {
19
18
  /**
@@ -26,40 +25,40 @@ export interface ApplicationsAPI extends BaseAPI {
26
25
  */
27
26
  getApplicationConfig(): Promise<ApplicationConfigResponse>;
28
27
  /**
29
- * Lists orders placed by the application's users. Backend-authenticated.
28
+ * Lists orders placed by the application's users. Public, selected by `clientId`.
30
29
  *
31
30
  * @param params - Pagination and filter options
32
31
  * @returns Promise resolving to a paginated list of orders
33
32
  */
34
- listApplicationOrders(params?: ListAppOrdersParams): Promise<ListAppOrdersResponse>;
33
+ listApplicationOrders(params: ListAppOrdersParams): Promise<ListAppOrdersResponse>;
35
34
  /**
36
- * Lists the application's users. Backend-authenticated.
35
+ * Lists the application's users. Public, selected by `clientId`.
37
36
  *
38
37
  * @param params - Pagination and filter options
39
38
  * @returns Promise resolving to a paginated list of users
40
39
  */
41
- listApplicationUsers(params?: ListAppUsersParams): Promise<ListAppUsersResponse>;
40
+ listApplicationUsers(params: ListAppUsersParams): Promise<ListAppUsersResponse>;
42
41
  /**
43
- * Lists ledger movements for the application's users. Backend-authenticated.
42
+ * Lists ledger movements for the application's users. Public, selected by `clientId`.
44
43
  *
45
44
  * @param params - Pagination and filter options
46
45
  * @returns Promise resolving to a paginated list of movements
47
46
  */
48
- listApplicationMovements(params?: ListAppMovementsParams): Promise<ListAppMovementsResponse>;
47
+ listApplicationMovements(params: ListAppMovementsParams): Promise<ListAppMovementsResponse>;
49
48
  /**
50
- * Lists user balances held within the application. Backend-authenticated.
49
+ * Lists user balances held within the application. Public, selected by `clientId`.
51
50
  *
52
51
  * @param params - Pagination and filter options
53
52
  * @returns Promise resolving to a paginated list of balances
54
53
  */
55
- listApplicationBalances(params?: ListAppBalancesParams): Promise<ListAppBalancesResponse>;
54
+ listApplicationBalances(params: ListAppBalancesParams): Promise<ListAppBalancesResponse>;
56
55
  /**
57
- * Gets aggregate volume and fee stats for the application. Backend-authenticated.
56
+ * Gets aggregate volume and fee stats for the application. Public, selected by `clientId`.
58
57
  *
59
58
  * @param params - Optional `since` filter
60
59
  * @returns Promise resolving to the application stats
61
60
  */
62
- getApplicationStats(params?: GetAppStatsParams): Promise<GetAppStatsResponse>;
61
+ getApplicationStats(params: GetAppStatsParams): Promise<GetAppStatsResponse>;
63
62
  }
64
63
  export type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
65
64
  export type { AppBalance, ApplicationConfigResponse, AppMovement, AppOrder, AppUser, GetAppStatsResponse, ListAppBalancesResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse, } from "./responses";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Applications Types
3
3
  *
4
- * Types for application configuration and the backend-authenticated
5
- * application reporting endpoints.
4
+ * Types for application configuration and the public application reporting
5
+ * endpoints.
6
6
  */
@@ -1,18 +1,30 @@
1
1
  /**
2
2
  * Applications Request Types
3
3
  *
4
- * Query parameters for the backend-authenticated application reporting
5
- * endpoints. Field names match the wire (snake_case) so they can be passed
6
- * straight through to the query string.
4
+ * Query parameters for the public application reporting endpoints. Each one
5
+ * selects its application by `clientId`.
7
6
  */
8
7
  /**
9
8
  * Query parameters for listing application orders.
10
9
  */
11
10
  export interface ListAppOrdersParams {
12
- /** Page number (starts from 1, at most 10,000 — the last page the listing counts towards) */
13
- page?: number;
14
- /** Items per page (max 100) */
11
+ /** Public client ID of the application to list (required). An unknown or inactive one is a `404`. */
12
+ clientId: string;
13
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
15
14
  pageSize?: number;
15
+ /**
16
+ * Pagination cursor with two states:
17
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
18
+ * no prior position.
19
+ * - Non-empty: an opaque cursor from a previous response's
20
+ * `nextPageToken`; results resume immediately after that position.
21
+ *
22
+ * Page-number pagination was removed (0XM-2822): there is no `page`, and
23
+ * sending one is a `400`. The response carries no item count — follow
24
+ * `nextPageToken` until it comes back empty. Filters must match the request
25
+ * that minted the token.
26
+ */
27
+ pageToken?: string;
16
28
  /** Filter by order status (e.g. SUBMITTED, PARTIALLY_FILLED, FILLED, SETTLED, CANCELLED, EXPIRED, REJECTED) */
17
29
  status?: string;
18
30
  /** Filter by user UUID */
@@ -28,10 +40,24 @@ export interface ListAppOrdersParams {
28
40
  * Query parameters for listing application users.
29
41
  */
30
42
  export interface ListAppUsersParams {
31
- /** Page number (starts from 1) */
32
- page?: number;
33
- /** Items per page (max 100) */
43
+ /** Public client ID of the application to list (required). An unknown or inactive one is a `404`. */
44
+ clientId: string;
45
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
34
46
  pageSize?: number;
47
+ /**
48
+ * Pagination cursor with two states:
49
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
50
+ * no prior position.
51
+ * - Non-empty: an opaque cursor from a previous response's
52
+ * `nextPageToken`; results resume immediately after that position.
53
+ *
54
+ * Page-number pagination was removed (0XM-2822): there is no `page`, and
55
+ * sending one is a `400`. Ordered by id ascending, not newest-first.
56
+ * `total` / `totalPages` are populated, bounded by the server count
57
+ * ceiling — see `totalCapped`. Filters must match the request that minted
58
+ * the token.
59
+ */
60
+ pageToken?: string;
35
61
  /** Filter by active status */
36
62
  isActive?: boolean;
37
63
  /** Filter by account type: master or sub */
@@ -43,10 +69,23 @@ export interface ListAppUsersParams {
43
69
  * Query parameters for listing application movements.
44
70
  */
45
71
  export interface ListAppMovementsParams {
46
- /** Page number (starts from 1, at most 10,000 — the last page the listing counts towards) */
47
- page?: number;
48
- /** Items per page (max 100) */
72
+ /** Public client ID of the application to list (required). An unknown or inactive one is a `404`. */
73
+ clientId: string;
74
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
49
75
  pageSize?: number;
76
+ /**
77
+ * Pagination cursor with two states:
78
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
79
+ * no prior position.
80
+ * - Non-empty: an opaque cursor from a previous response's
81
+ * `nextPageToken`; results resume immediately after that position.
82
+ *
83
+ * Page-number pagination was removed (0XM-2822): there is no `page`, and
84
+ * sending one is a `400`. The response carries no item count — follow
85
+ * `nextPageToken` until it comes back empty. Filters must match the request
86
+ * that minted the token.
87
+ */
88
+ pageToken?: string;
50
89
  /** Filter by user UUID */
51
90
  userId?: string;
52
91
  /** Filter by transaction type (e.g. DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD) */
@@ -60,10 +99,24 @@ export interface ListAppMovementsParams {
60
99
  * Query parameters for listing application balances.
61
100
  */
62
101
  export interface ListAppBalancesParams {
63
- /** Page number (starts from 1) */
64
- page?: number;
65
- /** Items per page (max 100) */
102
+ /** Public client ID of the application to list (required). An unknown or inactive one is a `404`. */
103
+ clientId: string;
104
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
66
105
  pageSize?: number;
106
+ /**
107
+ * Pagination cursor with two states:
108
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
109
+ * no prior position.
110
+ * - Non-empty: an opaque cursor from a previous response's
111
+ * `nextPageToken`; results resume immediately after that position.
112
+ *
113
+ * Page-number pagination was removed (0XM-2822): there is no `page`, and
114
+ * sending one is a `400`. Ordered by id ascending, not newest-first.
115
+ * `total` / `totalPages` are populated, bounded by the server count
116
+ * ceiling — see `totalCapped`. Filters must match the request that minted
117
+ * the token.
118
+ */
119
+ pageToken?: string;
67
120
  /** Filter by user UUID */
68
121
  userId?: string;
69
122
  /** Filter by asset UUID */
@@ -73,6 +126,8 @@ export interface ListAppBalancesParams {
73
126
  * Query parameters for application stats.
74
127
  */
75
128
  export interface GetAppStatsParams {
129
+ /** Public client ID of the application to list (required). An unknown or inactive one is a `404`. */
130
+ clientId: string;
76
131
  /** ISO 8601 datetime to filter stats from (e.g. 2026-01-01T00:00:00Z). Omit for all-time. */
77
132
  since?: string;
78
133
  }
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Applications Request Types
3
3
  *
4
- * Query parameters for the backend-authenticated application reporting
5
- * endpoints. Field names match the wire (snake_case) so they can be passed
6
- * straight through to the query string.
4
+ * Query parameters for the public application reporting endpoints. Each one
5
+ * selects its application by `clientId`.
7
6
  */
@@ -2,7 +2,7 @@
2
2
  * Applications Response Types
3
3
  *
4
4
  * Response types for application configuration operations and the
5
- * backend-authenticated application reporting endpoints. Reporting types use
5
+ * public application reporting endpoints. Reporting types use
6
6
  * the wire shape (snake_case); optional fields are `null` rather than omitted.
7
7
  */
8
8
  import type { Address } from "viem";
@@ -72,16 +72,10 @@ export interface AppUser {
72
72
  username: string | null;
73
73
  /** Account type: master or sub */
74
74
  accountType: string;
75
- /** Whether the user is allowed to withdraw */
76
- canWithdraw: boolean;
77
75
  /** Account creation timestamp (ISO 8601) */
78
76
  createdAt: string | null;
79
- /** Email address */
80
- email: string | null;
81
77
  /** Whether the user account is active */
82
78
  isActive: boolean | null;
83
- /** Whether the user is banned */
84
- isBanned: boolean | null;
85
79
  /** Master account ID (for sub-accounts) */
86
80
  masterAccountId: string | null;
87
81
  /** Last update timestamp (ISO 8601) */
@@ -162,72 +156,74 @@ export interface AppBalance {
162
156
  */
163
157
  export interface ListAppOrdersResponse {
164
158
  orders: AppOrder[];
165
- /**
166
- * Matching orders. Exact up to 10,000 pages of the requested page size
167
- * (`pageSize` x 10,000 rows) and saturates there, so an application with
168
- * more matching orders than the listing can page through reads the cap,
169
- * not its lifetime total.
170
- */
171
- total: number;
172
- /** Current page number */
173
- page: number;
174
159
  /** Items per page */
175
160
  pageSize: number;
176
161
  /**
177
- * Number of pages at the requested page size. Exact up to 10,000 and
178
- * saturates there, the last page this listing can reach.
162
+ * Cursor for the next page, minted from the last row of an over-fetched
163
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
164
+ * proves the walk is exhausted and this is `""`.
179
165
  */
180
- totalPages: number;
166
+ nextPageToken: string;
181
167
  }
182
168
  /**
183
169
  * Paginated list of application users.
184
170
  */
185
171
  export interface ListAppUsersResponse {
186
172
  users: AppUser[];
187
- /** Total number of users */
173
+ /** Users matching the filter, bounded by the server count ceiling. */
188
174
  total: number;
189
- /** Current page number */
190
- page: number;
191
175
  /** Items per page */
192
176
  pageSize: number;
193
- /** Total number of pages */
177
+ /** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
194
178
  totalPages: number;
179
+ /**
180
+ * Cursor for the next page, minted from the last row of an over-fetched
181
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
182
+ * proves the walk is exhausted and this is `""`.
183
+ */
184
+ nextPageToken: string;
185
+ /**
186
+ * `true` when MORE than the server ceiling matched, so the count stopped
187
+ * there and `total` / `totalPages` are a lower bound.
188
+ */
189
+ totalCapped: boolean;
195
190
  }
196
191
  /**
197
192
  * Paginated list of application movements.
198
193
  */
199
194
  export interface ListAppMovementsResponse {
200
195
  movements: AppMovement[];
201
- /**
202
- * Matching movements. Exact up to 10,000 pages of the requested page size
203
- * (`pageSize` x 10,000 rows) and saturates there, so an application with
204
- * more matching movements than the listing can page through reads the cap,
205
- * not its lifetime total.
206
- */
207
- total: number;
208
- /** Current page number */
209
- page: number;
210
196
  /** Items per page */
211
197
  pageSize: number;
212
198
  /**
213
- * Number of pages at the requested page size. Exact up to 10,000 and
214
- * saturates there, the last page this listing can reach.
199
+ * Cursor for the next page, minted from the last row of an over-fetched
200
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
201
+ * proves the walk is exhausted and this is `""`.
215
202
  */
216
- totalPages: number;
203
+ nextPageToken: string;
217
204
  }
218
205
  /**
219
206
  * Paginated list of application balances.
220
207
  */
221
208
  export interface ListAppBalancesResponse {
222
209
  balances: AppBalance[];
223
- /** Total matching balances */
210
+ /** Balances matching the filter, bounded by the server count ceiling. */
224
211
  total: number;
225
- /** Current page number */
226
- page: number;
227
212
  /** Items per page */
228
213
  pageSize: number;
229
- /** Total number of pages */
214
+ /** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
230
215
  totalPages: number;
216
+ /**
217
+ * Cursor for the next page, minted from the last row of an over-fetched
218
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
219
+ * proves the walk is exhausted and this is `""`.
220
+ */
221
+ nextPageToken: string;
222
+ /**
223
+ * `true` when MORE than the server ceiling matched, so the count stopped
224
+ * there and `total` / `totalPages` are a lower bound.
225
+ */
226
+ totalCapped: boolean;
231
227
  }
232
228
  /**
233
229
  * Aggregate volume and fee stats for an application.
@@ -2,6 +2,6 @@
2
2
  * Applications Response Types
3
3
  *
4
4
  * Response types for application configuration operations and the
5
- * backend-authenticated application reporting endpoints. Reporting types use
5
+ * public application reporting endpoints. Reporting types use
6
6
  * the wire shape (snake_case); optional fields are `null` rather than omitted.
7
7
  */
@@ -126,7 +126,7 @@ export const FeeTierScheduleRowSchema = z.object({
126
126
  * Zod schema for the "my fee tier" response
127
127
  */
128
128
  export const GetMyFeeTierResponseSchema = z.object({
129
- /** Caller's resolved tier (1–6) from their wallet's stored weighted 14-day volume */
129
+ /** Caller's resolved tier (1–6) from the higher of their wallet's weighted 14-day volume and any volume floor set on the wallet. A floor that is set or changed counts once it applies to the wallet's fills, usually within a minute, and likewise for an account the wallet opens in a new application; a removed or expired floor stops counting at once */
130
130
  currentTierLevel: z.number().int(),
131
131
  /** Caller's weighted 14-day volume (perp + 2.5× spot), summed across every application the wallet trades through */
132
132
  weightedVolume14d: z.string(),
@@ -134,7 +134,7 @@ export const GetMyFeeTierResponseSchema = z.object({
134
134
  spotVolume14d: z.string(),
135
135
  /** Caller's rolling 14-day perp volume, summed across every application the wallet trades through */
136
136
  perpVolume14d: z.string(),
137
- /** Additional weighted volume needed to reach the next tier; absent at tier 6 */
137
+ /** Additional weighted volume needed to reach the next tier, counted from the volume the current tier resolved from; absent at tier 6 */
138
138
  volumeToNextTier: z.string().nullable().optional(),
139
139
  /** Next tier level; absent when already at tier 6 */
140
140
  nextTierLevel: z.number().int().nullable().optional(),
@@ -42,7 +42,8 @@ export interface MarginAccountSummary {
42
42
  * liquidation or frozen as bad debt) and on one whose realized loss has used
43
43
  * up its allocation; the parent margin account is charged at most a risk
44
44
  * bucket's allocation. Size transfers against this field, not
45
- * `freeCollateral`.
45
+ * `freeCollateral`. Truncated toward zero at the quote asset's precision,
46
+ * so the printed amount itself is always accepted.
46
47
  */
47
48
  withdrawableCollateral: string;
48
49
  totalPositionNotional: string;
@@ -88,7 +89,8 @@ export interface MarginAccountSummary {
88
89
  *
89
90
  * Present only on risk-bucket rows served from a live risk engine snapshot;
90
91
  * absent (the key is omitted, never null) on parent rows and on
91
- * persisted-fallback reads.
92
+ * persisted-fallback reads. Truncated toward zero at the quote asset's
93
+ * precision, like `withdrawableCollateral`.
92
94
  */
93
95
  availableOrderCollateral?: string;
94
96
  /**
@@ -105,8 +107,29 @@ export interface MarginAccountSummary {
105
107
  copyLeaderHandle?: string;
106
108
  }
107
109
  export interface ListMarginAccountsParams {
108
- page?: number;
110
+ /** Number of items per page, 1 to 1000 (default 20) */
109
111
  pageSize?: number;
112
+ /**
113
+ * Pagination cursor with two states:
114
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
115
+ * no prior position, from the lowest margin account id.
116
+ * - Non-empty: an opaque cursor from a previous response's
117
+ * `nextPageToken`; results resume immediately after that position.
118
+ *
119
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
120
+ * sending one is a `400`. The walk seeks on
121
+ * `(marginAccountId, tradingPairId, riskBucketId, strategyKey)` over the
122
+ * repriced set the server builds per request — the parent account row ahead
123
+ * of its own bucket rows — so a bucket that opens or closes mid-walk no
124
+ * longer shifts the rows behind it across the resume point. The strategy key
125
+ * is part of the key because an auto bucket the engine has not materialized
126
+ * yet carries no `riskBucketId`, and one account and pair can hold several
127
+ * strategies; such a row sorts under the id its bucket will carry once the
128
+ * engine projects it, so provisioning completing mid-walk cannot serve the
129
+ * same risk bucket twice. The filters must match the request that minted the
130
+ * token.
131
+ */
132
+ pageToken?: string;
110
133
  /**
111
134
  * Keep only risk-bucket rows in this state (see
112
135
  * {@link MarginAccountSummary.riskBucketState}). A parent margin account row
@@ -117,9 +140,19 @@ export interface ListMarginAccountsParams {
117
140
  }
118
141
  export interface ListMarginAccountsResponse {
119
142
  accounts: MarginAccountSummary[];
143
+ /**
144
+ * Rows matching the filters. Exact — a user's margin accounts and risk
145
+ * buckets are a small bounded set, counted in memory after the repricing
146
+ * pass.
147
+ */
120
148
  total: number;
121
- page: number;
122
149
  pageSize: number;
150
+ /**
151
+ * Cursor for the next page, `""` once the walk is exhausted. The whole set
152
+ * is already in memory, so each page over-fetches one row and an empty token
153
+ * is definitive — follow a non-empty token, stop on an empty one.
154
+ */
155
+ nextPageToken: string;
123
156
  }
124
157
  export interface GetMarginAccountSummaryParams {
125
158
  tradingPairId?: string;
@@ -247,6 +280,10 @@ export interface TransferCollateralResponse {
247
280
  status: string;
248
281
  newEquity: string;
249
282
  newTotalCollateralValue: string;
283
+ /**
284
+ * The largest amount a further transfer-out will accept after this one,
285
+ * truncated toward zero at the collateral asset's precision.
286
+ */
250
287
  newWithdrawableCollateral: string;
251
288
  /**
252
289
  * Whether the transfer was committed to a position's stored margin. Present
@@ -261,8 +298,21 @@ export interface TransferCollateralResponse {
261
298
  }
262
299
  export interface GetMarginAccountMovementsParams {
263
300
  movementType?: string;
264
- page?: number;
301
+ /** Items per page, 1 to 1000 (default 20). */
265
302
  pageSize?: number;
303
+ /**
304
+ * Pagination cursor with two states:
305
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
306
+ * no prior position, from the newest row — this listing always sorts
307
+ * newest-first.
308
+ * - Non-empty: an opaque cursor from a previous response's
309
+ * `nextPageToken`; results resume immediately after that position.
310
+ *
311
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
312
+ * sending one is a 400. Filters must match the request that produced the
313
+ * token, or the request is rejected.
314
+ */
315
+ pageToken?: string;
266
316
  }
267
317
  export interface MarginAccountMovement {
268
318
  movementId: string;
@@ -274,15 +324,17 @@ export interface MarginAccountMovement {
274
324
  }
275
325
  export interface GetMarginAccountMovementsResponse {
276
326
  movements: MarginAccountMovement[];
327
+ pageSize: number;
277
328
  /**
278
- * Matching movements. Exact up to 10,000 pages of the requested page size
279
- * (`pageSize` x 10,000 rows) and saturates there, so a caller with more
280
- * movements than the listing can page through reads the cap, not its
281
- * lifetime total. `page` is capped at 10,000.
329
+ * Cursor for the next page, minted from the last row of an over-fetched
330
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
331
+ * proves the walk is exhausted and this is `""`. A non-empty token always
332
+ * has at least one further row behind it.
333
+ *
334
+ * The response carries no item count: the underlying ledger is too large to
335
+ * count behind a filter.
282
336
  */
283
- total: number;
284
- page: number;
285
- pageSize: number;
337
+ nextPageToken: string;
286
338
  }
287
339
  export interface SimulateOrderRiskRequest {
288
340
  tradingPairId: string;
@@ -521,6 +573,14 @@ export interface MarginAccountsAPI extends BaseAPI {
521
573
  /** One of the caller's margin accounts' own realized and unrealized PnL. */
522
574
  getMarginAccountPnl(marginAccountId: string): Promise<MarginAccountPnl>;
523
575
  transferMarginCollateral(request: TransferMarginCollateralRequest): Promise<TransferMarginCollateralResponse>;
576
+ /**
577
+ * Move collateral from the default margin account to one of the caller's sub-accounts, in one
578
+ * sequenced step. The default margin account itself is refused; fund it with the
579
+ * parent-margin-account routes.
580
+ */
581
+ transferCollateralToSubAccount(marginAccountId: string, amount: string): Promise<TransferMarginCollateralResponse>;
582
+ /** Move collateral from one of the caller's sub-accounts back to the default margin account. */
583
+ transferCollateralFromSubAccount(marginAccountId: string, amount: string): Promise<TransferMarginCollateralResponse>;
524
584
  listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
525
585
  getParentMarginAccountSummary(params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
526
586
  /**
@@ -48,6 +48,12 @@ export interface TradingPair {
48
48
  category: string;
49
49
  /** Whether the market is active */
50
50
  isActive: boolean;
51
+ /**
52
+ * Isolated-only market: cross margin may only reduce a position here. A
53
+ * CROSS order that is not reduce-only is rejected with the error code
54
+ * `CROSS_MARGIN_NOT_ALLOWED`; open the position with `marginMode: "ISOLATED"`.
55
+ */
56
+ isolatedOnly: boolean;
51
57
  /** Maker fee in basis points */
52
58
  makerFeeBps: number;
53
59
  /** Taker fee in basis points */
@@ -486,30 +492,94 @@ export interface FundingRecord {
486
492
  export interface ListFundingHistoryParams {
487
493
  startTime?: string;
488
494
  endTime?: string;
489
- page?: number;
495
+ /** Number of items per page, 1 to 1000 (default 50) */
490
496
  pageSize?: number;
491
- /** Sort direction for epoch: "ASC" or "DESC" (default DESC). */
497
+ /** Sort direction for `settledAt`: "ASC" or "DESC" (default DESC). */
492
498
  orderBy?: "ASC" | "DESC";
499
+ /**
500
+ * Pagination cursor with two states:
501
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
502
+ * no prior position, from the newest settlement (the oldest when
503
+ * `orderBy` is `"ASC"`).
504
+ * - Non-empty: an opaque cursor from a previous response's
505
+ * `nextPageToken`; results resume immediately after that position.
506
+ *
507
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
508
+ * sending one is a `400`. The walk seeks on `(settledAt, id)` in the
509
+ * requested direction. Filters and `orderBy` must match the request that
510
+ * minted the token.
511
+ */
512
+ pageToken?: string;
493
513
  }
494
514
  export interface ListFundingHistoryResponse {
495
515
  records: FundingRecord[];
516
+ /**
517
+ * Settlements matching the filter, bounded by the server count ceiling — see
518
+ * `totalCapped`. A lower bound when `totalCapped` is `true`.
519
+ */
496
520
  total: number;
497
- page: number;
521
+ /** Items per page */
498
522
  pageSize: number;
523
+ /**
524
+ * Cursor for the next page, minted from the last row of an over-fetched
525
+ * page. This listing is one ordered read, so a page shorter than `pageSize`
526
+ * proves the walk is exhausted and this is `""`. A non-empty token always
527
+ * has at least one further row behind it.
528
+ */
529
+ nextPageToken: string;
530
+ /**
531
+ * `true` when MORE than the server ceiling of settlements matched, so the
532
+ * count stopped at the ceiling and `total` is a lower bound. `false` when
533
+ * `total` is the exact count — including exactly the ceiling, which is
534
+ * still reported exactly.
535
+ */
536
+ totalCapped: boolean;
499
537
  }
500
538
  export interface ListAllFundingHistoryParams {
501
539
  startTime?: string;
502
540
  endTime?: string;
503
- page?: number;
541
+ /** Number of items per page, 1 to 1000 (default 50) */
504
542
  pageSize?: number;
505
- /** Sort direction for settledAt (default DESC). */
543
+ /** Sort direction for `settledAt` (default DESC). */
506
544
  orderBy?: "ASC" | "DESC";
545
+ /**
546
+ * Pagination cursor with two states:
547
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
548
+ * no prior position, from the newest settlement (the oldest when
549
+ * `orderBy` is `"ASC"`).
550
+ * - Non-empty: an opaque cursor from a previous response's
551
+ * `nextPageToken`; results resume immediately after that position.
552
+ *
553
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
554
+ * sending one is a `400`. The walk seeks on `(settledAt, id)` in the
555
+ * requested direction. Filters and `orderBy` must match the request that
556
+ * minted the token.
557
+ */
558
+ pageToken?: string;
507
559
  }
508
560
  export interface ListAllFundingHistoryResponse {
509
561
  records: FundingRecord[];
562
+ /**
563
+ * Settlements matching the filter, bounded by the server count ceiling — see
564
+ * `totalCapped`. A lower bound when `totalCapped` is `true`.
565
+ */
510
566
  total: number;
511
- page: number;
567
+ /** Items per page */
512
568
  pageSize: number;
569
+ /**
570
+ * Cursor for the next page, minted from the last row of an over-fetched
571
+ * page. This listing is one ordered read, so a page shorter than `pageSize`
572
+ * proves the walk is exhausted and this is `""`. A non-empty token always
573
+ * has at least one further row behind it.
574
+ */
575
+ nextPageToken: string;
576
+ /**
577
+ * `true` when MORE than the server ceiling of settlements matched, so the
578
+ * count stopped at the ceiling and `total` is a lower bound. `false` when
579
+ * `total` is the exact count — including exactly the ceiling, which is
580
+ * still reported exactly.
581
+ */
582
+ totalCapped: boolean;
513
583
  }
514
584
  export interface OpenInterest {
515
585
  tradingPairId: string;