@0xmonaco/types 1.0.73 → 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 (50) 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/buildercodes/responses.d.ts +2 -3
  9. package/dist/buildercodes/responses.js +2 -3
  10. package/dist/copy-trading/index.d.ts +7 -7
  11. package/dist/delegated-agents/index.d.ts +15 -5
  12. package/dist/fees/responses.js +2 -2
  13. package/dist/margin-accounts/index.d.ts +185 -21
  14. package/dist/market/index.d.ts +76 -6
  15. package/dist/pitpass/index.d.ts +31 -11
  16. package/dist/pitpass/index.js +1 -1
  17. package/dist/pitpass/responses.d.ts +67 -0
  18. package/dist/pitpass/responses.js +92 -8
  19. package/dist/portfolio/index.d.ts +36 -14
  20. package/dist/positions/index.d.ts +81 -14
  21. package/dist/profile/index.d.ts +114 -44
  22. package/dist/trading/index.d.ts +1 -1
  23. package/dist/trading/orders.d.ts +6 -32
  24. package/dist/trading/responses.d.ts +9 -14
  25. package/dist/validation/applications.d.ts +51 -0
  26. package/dist/validation/applications.js +45 -0
  27. package/dist/validation/index.d.ts +1 -0
  28. package/dist/validation/index.js +1 -0
  29. package/dist/validation/margin-accounts.d.ts +44 -3
  30. package/dist/validation/margin-accounts.js +57 -6
  31. package/dist/validation/market.d.ts +24 -0
  32. package/dist/validation/market.js +22 -0
  33. package/dist/validation/positions.d.ts +5 -3
  34. package/dist/validation/positions.js +12 -5
  35. package/dist/validation/profile.d.ts +19 -2
  36. package/dist/validation/profile.js +36 -4
  37. package/dist/validation/trading.d.ts +2 -2
  38. package/dist/websocket/base.d.ts +56 -6
  39. package/dist/websocket/client.d.ts +8 -3
  40. package/dist/websocket/events/index.d.ts +1 -0
  41. package/dist/websocket/events/index.js +1 -0
  42. package/dist/websocket/events/liquidation-events.d.ts +3 -3
  43. package/dist/websocket/events/orders-events.d.ts +6 -0
  44. package/dist/websocket/events/position-events.d.ts +33 -15
  45. package/dist/websocket/events/position-valuation-events.d.ts +60 -0
  46. package/dist/websocket/events/position-valuation-events.js +15 -0
  47. package/dist/wire/operations.d.ts +1 -1
  48. package/dist/wire/operations.js +7 -0
  49. package/dist/wire/schema.d.ts +1441 -307
  50. 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
  */
@@ -65,9 +65,8 @@ export declare const ListBuilderFeeChangesResponseSchema: z.ZodObject<{
65
65
  nextPageToken: z.ZodString;
66
66
  }, z.core.$strip>;
67
67
  /**
68
- * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
69
- * active frontend-revenue-share category; `BUILDER_FEE` is reserved and is not
70
- * currently emitted.
68
+ * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` records
69
+ * Monaco revenue share; `BUILDER_FEE` records builder fees charged to takers.
71
70
  */
72
71
  export declare const BuildercodePayoutKindSchema: z.ZodEnum<{
73
72
  REVENUE_SHARE: "REVENUE_SHARE";
@@ -54,9 +54,8 @@ export const ListBuilderFeeChangesResponseSchema = z.object({
54
54
  nextPageToken: z.string(),
55
55
  });
56
56
  /**
57
- * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
58
- * active frontend-revenue-share category; `BUILDER_FEE` is reserved and is not
59
- * currently emitted.
57
+ * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` records
58
+ * Monaco revenue share; `BUILDER_FEE` records builder fees charged to takers.
60
59
  */
61
60
  export const BuildercodePayoutKindSchema = z.enum(["REVENUE_SHARE", "BUILDER_FEE"]);
62
61
  /** Pagination and filter accepted by the per-trade payout history endpoint. */
@@ -65,8 +65,9 @@ export interface CopyTradingAPI extends BaseAPI {
65
65
  upsertFollow(params: UpsertFollowParams): Promise<UpsertFollowResponse>;
66
66
  /**
67
67
  * Stop one of your follows: the leader's fills stop being mirrored. An exit
68
- * is never gated beyond ownership, except that a delegated agent session
69
- * cannot stop a follow (403).
68
+ * is never refused for the state of the account or the platform. Only
69
+ * ownership applies, a delegated agent session cannot stop a follow (403),
70
+ * and stops have a rate limit of their own (429 past it).
70
71
  */
71
72
  stopFollow(followId: string): Promise<StopFollowResponse>;
72
73
  /**
@@ -106,11 +107,10 @@ export interface CopyTradingAPI extends BaseAPI {
106
107
  *
107
108
  * Master account sessions only (a delegated agent or a sub-account gets
108
109
  * 403); 404 for a follow that is not yours; 409 while the follow is
109
- * stopping or once it is stopped, or `COPY_TRADING_UNAVAILABLE` when copy
110
- * trading is not available on the platform; 400 `COPY_TRADING_REJECTED`
111
- * when the engine refuses (no isolated copy position on the pair, the
112
- * position or the margin account is being liquidated, the position has
113
- * lost more than its margin, more than the copy account can put in); 429
110
+ * stopping or once it is stopped; 400 `COPY_TRADING_REJECTED` when the add
111
+ * is refused (no isolated copy position on the pair, the copy position is
112
+ * being liquidated or is in bad debt, more than the copy account can put
113
+ * in); 429
114
114
  * over the movement budget withdrawals and collateral transfers share.
115
115
  *
116
116
  * Not idempotent: a retry after a timeout whose first attempt landed adds
@@ -1,16 +1,22 @@
1
1
  import type { Address } from "viem";
2
2
  import type { BaseAPI } from "../api";
3
- export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "create_order" | "cancel_order" | "replace_order";
3
+ export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "READ" | "MANAGE_RISK_BUCKETS" | "create_order" | "cancel_order" | "replace_order" | "read" | "manage_risk_buckets";
4
4
  export interface UpsertDelegatedAgentRequest {
5
5
  agentAddress: string;
6
6
  name?: string;
7
- /** Delegation expiry (ISO 8601); ends reads, trading, and session refresh. */
7
+ /** Delegation expiry (ISO 8601); ends reads, trading, and session refresh. Omit for the default of 14 days from now; at most 180 days ahead. */
8
8
  expiresAt?: string;
9
- /** Required. An empty list permits no actions. */
9
+ /**
10
+ * Required. An empty list permits no order actions. Every delegated session may read the owner's
11
+ * data, so a list of only `READ` (or none) is a read-only key.
12
+ */
10
13
  allowedActions: DelegatedAgentAction[];
11
- /** Required. A matching market OR account permits an order; both scopes empty deny all orders. */
14
+ /** Required. Each listed scope must match: a listed market AND a listed account. Both empty deny all orders. */
12
15
  allowedTradingPairIds: string[];
13
- /** Additional account scope. Omit or send [] for market-only scope, not access to every account. */
16
+ /**
17
+ * The margin accounts the agent is bound to (a sub-account's own key). Omit or send [] to leave the
18
+ * account unrestricted.
19
+ */
14
20
  allowedMarginAccountIds?: string[];
15
21
  /** Omit or send [] for unrestricted order types. */
16
22
  allowedOrderTypes?: Array<"LIMIT" | "MARKET">;
@@ -20,6 +26,8 @@ export interface UpsertDelegatedAgentRequest {
20
26
  maxOrderNotional?: string;
21
27
  /** @deprecated Unsupported: setting this field causes the server to reject the request. */
22
28
  maxOpenOrders?: number;
29
+ /** Up to 20 IP addresses or CIDR ranges the agent may create its delegated session from. Omit for any. */
30
+ ipAllowlist?: string[];
23
31
  }
24
32
  export interface DelegatedAgent {
25
33
  id: string;
@@ -38,6 +46,8 @@ export interface DelegatedAgent {
38
46
  maxOrderNotional?: string;
39
47
  /** @deprecated Legacy data only; no concurrent open-order cap is enforced. */
40
48
  maxOpenOrders?: number;
49
+ /** Normalized IP addresses and CIDR ranges; empty allows any address. */
50
+ ipAllowlist?: string[];
41
51
  }
42
52
  export interface ListDelegatedAgentsResponse {
43
53
  agents: DelegatedAgent[];
@@ -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(),