@0xmonaco/types 1.0.66 → 1.0.69

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.
@@ -18,9 +18,9 @@ import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, Ge
18
18
  export interface BuildercodesAPI extends BaseAPI {
19
19
  /** Read this authenticated frontend's enrollment, payout address, and live budget. */
20
20
  getConfig(): Promise<GetBuildercodesConfigResponse>;
21
- /** List this authenticated frontend's per-trade BuilderCodes credits. */
21
+ /** List this authenticated frontend's per-trade BuilderCodes credits, optionally of one payout `kind`. */
22
22
  listPayouts(params?: ListBuildercodePayoutsParams): Promise<ListBuildercodePayoutsResponse>;
23
- /** Summarize this authenticated frontend's BuilderCodes credits by token. */
23
+ /** Summarize this authenticated frontend's BuilderCodes credits by token, and by token and payout kind. */
24
24
  getPayoutSummary(): Promise<GetBuildercodePayoutSummaryResponse>;
25
25
  /** Read the authenticated wallet's available reserved reward balances. */
26
26
  getRewardsBalance(): Promise<GetBuildercodeRewardsBalanceResponse>;
@@ -67,5 +67,5 @@ export interface BuildercodesAPI extends BaseAPI {
67
67
  */
68
68
  claimBuildercodeRewards(params: ClaimBuildercodeRewardsParams): Promise<ClaimBuildercodeRewardsResponse>;
69
69
  }
70
- export type { BuildercodePayout, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, } from "./responses";
71
- export { BuildercodePayoutSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
70
+ export type { BuildercodePayout, BuildercodePayoutKind, BuildercodePayoutTokenKindTotal, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, } from "./responses";
71
+ export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
@@ -4,4 +4,4 @@
4
4
  * Types for the BuilderCodes API: reading and claiming an enrolled frontend's
5
5
  * per-trade revenue share.
6
6
  */
7
- export { BuildercodePayoutSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
7
+ export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
@@ -13,10 +13,23 @@ export declare const GetBuildercodesConfigResponseSchema: z.ZodObject<{
13
13
  buildercodesEnabled: z.ZodBoolean;
14
14
  buildercodesBudgetBps: z.ZodNumber;
15
15
  }, z.core.$strip>;
16
- /** Pagination accepted by the per-trade payout history endpoint. */
16
+ /**
17
+ * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
18
+ * frontend's share of Monaco's fee; `BUILDER_FEE` is the frontend's own builder
19
+ * fee, paid by the taker. Both land in the same claimable balance.
20
+ */
21
+ export declare const BuildercodePayoutKindSchema: z.ZodEnum<{
22
+ REVENUE_SHARE: "REVENUE_SHARE";
23
+ BUILDER_FEE: "BUILDER_FEE";
24
+ }>;
25
+ /** Pagination and filter accepted by the per-trade payout history endpoint. */
17
26
  export declare const ListBuildercodePayoutsParamsSchema: z.ZodObject<{
18
27
  page: z.ZodOptional<z.ZodNumber>;
19
28
  pageSize: z.ZodOptional<z.ZodNumber>;
29
+ kind: z.ZodOptional<z.ZodEnum<{
30
+ REVENUE_SHARE: "REVENUE_SHARE";
31
+ BUILDER_FEE: "BUILDER_FEE";
32
+ }>>;
20
33
  }, z.core.$strip>;
21
34
  /** One per-trade BuilderCodes credit. Amounts are RAW atomic units. */
22
35
  export declare const BuildercodePayoutSchema: z.ZodObject<{
@@ -26,6 +39,10 @@ export declare const BuildercodePayoutSchema: z.ZodObject<{
26
39
  amount: z.ZodString;
27
40
  appliedBps: z.ZodNumber;
28
41
  createdAt: z.ZodString;
42
+ kind: z.ZodOptional<z.ZodEnum<{
43
+ REVENUE_SHARE: "REVENUE_SHARE";
44
+ BUILDER_FEE: "BUILDER_FEE";
45
+ }>>;
29
46
  }, z.core.$strip>;
30
47
  /** Schema for the paginated per-trade payout history. */
31
48
  export declare const ListBuildercodePayoutsResponseSchema: z.ZodObject<{
@@ -36,6 +53,10 @@ export declare const ListBuildercodePayoutsResponseSchema: z.ZodObject<{
36
53
  amount: z.ZodString;
37
54
  appliedBps: z.ZodNumber;
38
55
  createdAt: z.ZodString;
56
+ kind: z.ZodOptional<z.ZodEnum<{
57
+ REVENUE_SHARE: "REVENUE_SHARE";
58
+ BUILDER_FEE: "BUILDER_FEE";
59
+ }>>;
39
60
  }, z.core.$strip>>;
40
61
  total: z.ZodNumber;
41
62
  page: z.ZodNumber;
@@ -49,6 +70,17 @@ export declare const BuildercodePayoutTokenTotalSchema: z.ZodObject<{
49
70
  payoutCount: z.ZodNumber;
50
71
  lastCreditedAt: z.ZodString;
51
72
  }, z.core.$strip>;
73
+ /** One token-denominated BuilderCodes earnings total for one payout kind. */
74
+ export declare const BuildercodePayoutTokenKindTotalSchema: z.ZodObject<{
75
+ token: z.ZodString;
76
+ kind: z.ZodEnum<{
77
+ REVENUE_SHARE: "REVENUE_SHARE";
78
+ BUILDER_FEE: "BUILDER_FEE";
79
+ }>;
80
+ totalAmount: z.ZodString;
81
+ payoutCount: z.ZodNumber;
82
+ lastCreditedAt: z.ZodString;
83
+ }, z.core.$strip>;
52
84
  /** Schema for this frontend's payout summary. */
53
85
  export declare const GetBuildercodePayoutSummaryResponseSchema: z.ZodObject<{
54
86
  totalPayouts: z.ZodNumber;
@@ -59,6 +91,16 @@ export declare const GetBuildercodePayoutSummaryResponseSchema: z.ZodObject<{
59
91
  payoutCount: z.ZodNumber;
60
92
  lastCreditedAt: z.ZodString;
61
93
  }, z.core.$strip>>;
94
+ byTokenAndKind: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
+ token: z.ZodString;
96
+ kind: z.ZodEnum<{
97
+ REVENUE_SHARE: "REVENUE_SHARE";
98
+ BUILDER_FEE: "BUILDER_FEE";
99
+ }>;
100
+ totalAmount: z.ZodString;
101
+ payoutCount: z.ZodNumber;
102
+ lastCreditedAt: z.ZodString;
103
+ }, z.core.$strip>>>;
62
104
  }, z.core.$strip>;
63
105
  /** One available balance in the reserved BuilderCodes reward bucket. */
64
106
  export declare const BuildercodeRewardsBalanceSchema: z.ZodObject<{
@@ -86,9 +128,11 @@ export type ClaimBuildercodeRewardsParams = z.infer<typeof ClaimBuildercodeRewar
86
128
  export type ClaimBuildercodeRewardsResponse = z.infer<typeof ClaimBuildercodeRewardsResponseSchema>;
87
129
  export type GetBuildercodesConfigResponse = z.infer<typeof GetBuildercodesConfigResponseSchema>;
88
130
  export type ListBuildercodePayoutsParams = z.infer<typeof ListBuildercodePayoutsParamsSchema>;
131
+ export type BuildercodePayoutKind = z.infer<typeof BuildercodePayoutKindSchema>;
89
132
  export type BuildercodePayout = z.infer<typeof BuildercodePayoutSchema>;
90
133
  export type ListBuildercodePayoutsResponse = z.infer<typeof ListBuildercodePayoutsResponseSchema>;
91
134
  export type BuildercodePayoutTokenTotal = z.infer<typeof BuildercodePayoutTokenTotalSchema>;
135
+ export type BuildercodePayoutTokenKindTotal = z.infer<typeof BuildercodePayoutTokenKindTotalSchema>;
92
136
  export type GetBuildercodePayoutSummaryResponse = z.infer<typeof GetBuildercodePayoutSummaryResponseSchema>;
93
137
  export type BuildercodeRewardsBalance = z.infer<typeof BuildercodeRewardsBalanceSchema>;
94
138
  export type GetBuildercodeRewardsBalanceResponse = z.infer<typeof GetBuildercodeRewardsBalanceResponseSchema>;
@@ -17,10 +17,18 @@ export const GetBuildercodesConfigResponseSchema = z.object({
17
17
  buildercodesEnabled: z.boolean(),
18
18
  buildercodesBudgetBps: z.number().int().min(0).max(10_000),
19
19
  });
20
- /** Pagination accepted by the per-trade payout history endpoint. */
20
+ /**
21
+ * The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
22
+ * frontend's share of Monaco's fee; `BUILDER_FEE` is the frontend's own builder
23
+ * fee, paid by the taker. Both land in the same claimable balance.
24
+ */
25
+ export const BuildercodePayoutKindSchema = z.enum(["REVENUE_SHARE", "BUILDER_FEE"]);
26
+ /** Pagination and filter accepted by the per-trade payout history endpoint. */
21
27
  export const ListBuildercodePayoutsParamsSchema = z.object({
22
28
  page: z.number().int().min(1).max(10_000).optional(),
23
29
  pageSize: z.number().int().min(1).max(100).optional(),
30
+ /** Only return credits of this kind; `total` counts the filtered rows. Omit for every kind. */
31
+ kind: BuildercodePayoutKindSchema.optional(),
24
32
  });
25
33
  /** One per-trade BuilderCodes credit. Amounts are RAW atomic units. */
26
34
  export const BuildercodePayoutSchema = z.object({
@@ -30,6 +38,8 @@ export const BuildercodePayoutSchema = z.object({
30
38
  amount: z.string(),
31
39
  appliedBps: z.number().int(),
32
40
  createdAt: z.string(),
41
+ /** Payout stream of this credit. Absent from servers older than this field, whose credits are all `REVENUE_SHARE`. */
42
+ kind: BuildercodePayoutKindSchema.optional(),
33
43
  });
34
44
  /** Schema for the paginated per-trade payout history. */
35
45
  export const ListBuildercodePayoutsResponseSchema = z.object({
@@ -46,11 +56,25 @@ export const BuildercodePayoutTokenTotalSchema = z.object({
46
56
  payoutCount: z.number().int().nonnegative(),
47
57
  lastCreditedAt: z.string(),
48
58
  });
59
+ /** One token-denominated BuilderCodes earnings total for one payout kind. */
60
+ export const BuildercodePayoutTokenKindTotalSchema = z.object({
61
+ token: z.string(),
62
+ kind: BuildercodePayoutKindSchema,
63
+ totalAmount: z.string(),
64
+ payoutCount: z.number().int().nonnegative(),
65
+ lastCreditedAt: z.string(),
66
+ });
49
67
  /** Schema for this frontend's payout summary. */
50
68
  export const GetBuildercodePayoutSummaryResponseSchema = z.object({
51
69
  totalPayouts: z.number().int().nonnegative(),
52
70
  lastCreditedAt: z.string().nullable().optional(),
71
+ /** Per-token totals, summed across every payout kind. */
53
72
  byToken: z.array(BuildercodePayoutTokenTotalSchema),
73
+ /**
74
+ * The same totals split by token AND kind; a token's rows sum to its
75
+ * `byToken` total. Absent from servers older than this field.
76
+ */
77
+ byTokenAndKind: z.array(BuildercodePayoutTokenKindTotalSchema).optional(),
54
78
  });
55
79
  /** One available balance in the reserved BuilderCodes reward bucket. */
56
80
  export const BuildercodeRewardsBalanceSchema = z.object({
@@ -117,8 +117,9 @@ export interface FaucetAPI extends BaseAPI {
117
117
  * Fetches the authenticated wallet's faucet quota and recent requests.
118
118
  *
119
119
  * Read-only: remaining requests in the rolling 24h window, when the next
120
- * request becomes available, and the 5 most recent requests. Wallet-scoped
121
- * across apps, matching mint enforcement.
120
+ * request becomes available, and the 5 most recent requests. Scoped to the
121
+ * wallet on this app (each app has its own quota), matching mint
122
+ * enforcement.
122
123
  *
123
124
  * @returns Promise resolving to the quota and recent-request history
124
125
  */
@@ -191,6 +191,8 @@ export interface ScreenerSnapshotPoint {
191
191
  quoteVolume: string;
192
192
  /** Percent price change (close - open) / open * 100 for the day */
193
193
  priceChangePercent: string;
194
+ /** Daily average of the valued completed-UTC-minute open interest notionals; null for spot or when fewer than 95% of the day's 1440 minutes (1368) are valued */
195
+ openInterestNotionalAvg: string | null;
194
196
  }
195
197
  /**
196
198
  * Per-pair screener row. Window fields are null when there is insufficient history.
@@ -251,6 +253,12 @@ export interface ScreenerItem {
251
253
  * getOpenInterest
252
254
  */
253
255
  openInterestNotional: string | null;
256
+ /** Average of the valued completed-UTC-minute gross open-interest notionals over the last 60 minutes; null for spot or when fewer than 95% of them (57) are valued */
257
+ openInterestNotionalAvg1h: string | null;
258
+ /** Average of the valued completed-UTC-minute gross open-interest notionals over the last 1440 minutes; null for spot or when fewer than 95% of them (1368) are valued */
259
+ openInterestNotionalAvg24h: string | null;
260
+ /** Average of the valued completed-UTC-minute gross open-interest notionals over the last 10080 minutes; null for spot or when fewer than 95% of them (9576) are valued */
261
+ openInterestNotionalAvg7d: string | null;
254
262
  }
255
263
  /**
256
264
  * Paginated screener response, sorted by quoteVolume24h desc (nulls last)
@@ -32,16 +32,13 @@ export interface Position {
32
32
  unrealizedPnl: string;
33
33
  realizedPnl: string;
34
34
  /**
35
- * Open ISOLATED rows: the position's current backing — its risk bucket's
36
- * allocated collateral adjusted by settled realized PnL and funding paid,
37
- * net of collateral reserved for the bucket's open orders, clamped at zero
38
- * (0XM-2558). Partial closes shrink the posted margin pro-rata while the
39
- * realized loss stays in the bucket, so this is the unrealized-return
40
- * denominator. Not a hard -100% bound: liquidation measures the bucket's
41
- * whole equity, order reserves included, and a mark can gap past the
42
- * backing. Open CROSS rows: the position's posted margin. Terminal rows:
43
- * total initial margin allocated across the position's reducing executions
44
- * when available — the margin basis for lifetime realized return.
35
+ * Open ISOLATED rows: principal committed to the filled position, adjusted
36
+ * by settled realized PnL, fees and funding, clamped at zero. Unfilled-order
37
+ * collateral is excluded. This is the unrealized-return denominator and
38
+ * the same backing used by isolated liquidation, on live and persisted reads.
39
+ * A price gap can pass the backing before asynchronous liquidation occurs.
40
+ * Open CROSS rows: posted margin. Terminal rows: total initial margin
41
+ * allocated across reducing executions, the lifetime-return denominator.
45
42
  */
46
43
  isolatedMargin: string;
47
44
  leverage?: string;
@@ -69,11 +66,16 @@ export interface Position {
69
66
  /**
70
67
  * Lifetime realized PnL net of trading fees and funding. Terminal rows
71
68
  * only; absent when the position's reducing executions are unavailable.
69
+ * Deducts whole-life `cumFees` once. Also absent until its final close is
70
+ * recorded in the PnL sample and fee history is complete; poll again while
71
+ * pending. With no sample, remains absent for 28 days after close, then
72
+ * falls back to closing-execution net without unavailable opening fees.
72
73
  */
73
74
  netRealizedPnl?: string;
74
75
  /**
75
76
  * Lifetime realized return on the total allocated initial margin, as a
76
- * percentage. Terminal rows only; absent when unavailable.
77
+ * percentage. Terminal rows only; absent when unavailable, including under
78
+ * the same conditions as `netRealizedPnl`.
77
79
  */
78
80
  realizedRoe?: string;
79
81
  /**
@@ -104,7 +106,8 @@ export interface Position {
104
106
  * terminal rows alike. Null when the opening-fill fees are unavailable —
105
107
  * before the position's first PnL sample flushes, after its samples age out
106
108
  * of PnL retention, or for positions predating the PnL service — rather than
107
- * an understated partial.
109
+ * an understated partial. On a terminal row it is also null until the
110
+ * final close is recorded in its PnL sample, or while fee data is incomplete.
108
111
  */
109
112
  cumFees?: string;
110
113
  /**
@@ -235,8 +235,21 @@ export interface UserTrade {
235
235
  quoteVolume: string;
236
236
  /** Side of the trade */
237
237
  side: OrderSide;
238
- /** Fee paid for this trade (as string to preserve precision) */
238
+ /**
239
+ * Total fee paid for this trade (as string to preserve precision). For a
240
+ * taker this is Monaco's taker fee plus the frontend's builder fee; for a
241
+ * maker it is the maker fee (negative for a rebate). Equals
242
+ * `monacoFee + builderFee`.
243
+ */
239
244
  fee: string;
245
+ /** Monaco's component of `fee`. Absent from servers older than this field. */
246
+ monacoFee?: string;
247
+ /**
248
+ * The frontend's builder fee component of `fee`. Always `"0"` for a maker:
249
+ * builder fees are charged to takers only. Absent from servers older than
250
+ * this field.
251
+ */
252
+ builderFee?: string;
240
253
  /** Timestamp when the trade was executed (ISO string) */
241
254
  executedAt: string;
242
255
  }
@@ -120,7 +120,7 @@ export interface MonacoSDK {
120
120
  /** Deposit-address registration (sweeper) API; requires a session */
121
121
  sweeper: SweeperAPI;
122
122
  managedMarkets: ManagedMarketsAPI;
123
- /** Public whitelist (waitlist) submission API */
123
+ /** @deprecated Public whitelist applications are closed; submissions return HTTP 403. */
124
124
  whitelist: WhitelistAPI;
125
125
  /** Profile operations API */
126
126
  profile: ProfileAPI;
@@ -32,6 +32,7 @@ export interface TradingAPI extends BaseAPI {
32
32
  marginAccountId?: string;
33
33
  marginMode?: MarginMode;
34
34
  riskBucketId?: string;
35
+ /** Initial order budget; unfilled funds do not back the isolated position. */
35
36
  riskBucketCollateral?: string;
36
37
  strategyKey?: string;
37
38
  /** @deprecated Order side is authoritative. */
@@ -85,6 +86,7 @@ export interface TradingAPI extends BaseAPI {
85
86
  marginAccountId?: string;
86
87
  marginMode?: MarginMode;
87
88
  riskBucketId?: string;
89
+ /** Initial order budget; unfilled funds do not back the isolated position. */
88
90
  riskBucketCollateral?: string;
89
91
  strategyKey?: string;
90
92
  /** @deprecated Order side is authoritative. */
@@ -125,6 +125,12 @@ export interface Order {
125
125
  * close means unknown, not "placed by hand". Wire: `conditionalOrderId`.
126
126
  */
127
127
  conditionalOrderId?: string;
128
+ /**
129
+ * Present only on a TWAP child order: the TWAP parent that placed it. The
130
+ * same id the `orders` WebSocket frames and snapshot rows carry for the
131
+ * child. Wire: `parentOrderId`.
132
+ */
133
+ parentOrderId?: string;
128
134
  /**
129
135
  * Opaque, compare-only revision counter for this order's state: a strictly
130
136
  * higher value is strictly newer state for that order, and equal values
@@ -487,8 +487,31 @@ export interface ListConditionalOrdersParams {
487
487
  marginAccountId?: string;
488
488
  tradingPairId?: string;
489
489
  state?: ConditionalOrderState;
490
+ /**
491
+ * Page number for legacy offset pagination.
492
+ *
493
+ * @deprecated Use cursor pagination (`pageToken`) instead. Passing `page`
494
+ * selects legacy page-number mode; omitting both `page` and `pageToken`
495
+ * drives cursor mode.
496
+ */
490
497
  page?: number;
498
+ /** Items per page (max 100 in page-number mode, up to 1000 when `pageToken` is present) */
491
499
  pageSize?: number;
500
+ /**
501
+ * Pagination cursor with three distinct states:
502
+ * - Omitted (`undefined`): the SDK starts a cursor walk (it sends
503
+ * `pageToken=""`) unless the deprecated `page` param was passed, in which
504
+ * case the request uses legacy page-number pagination.
505
+ * - Empty string (`""`): start a cursor walk with no prior position, from
506
+ * the newest conditional order.
507
+ * - Non-empty: an opaque cursor from a previous response's `nextPageToken`;
508
+ * results resume immediately after that position.
509
+ *
510
+ * In either cursor-walk state, `page` and `total` come back as 0 — cursor
511
+ * mode runs no COUNT (AIP-158). Follow `nextPageToken` until it comes back
512
+ * empty. Filters must match the request that produced the token.
513
+ */
514
+ pageToken?: string;
492
515
  }
493
516
  /**
494
517
  * What the order a conditional fired into has done so far — a projection of
@@ -586,18 +609,14 @@ export interface ConditionalOrder {
586
609
  * the sequencer step that wrote it (0XM-2440). A strictly higher value is
587
610
  * strictly newer state for that conditional order.
588
611
  *
589
- * Present on REST reads and on the subscribe-time `conditional_orders`
590
- * snapshot frame. **Absent on live conditional events**, by design: those are
591
- * emitted from a model captured before the sequencer acted, so the only value
592
- * available there is the one the row held *before* the change being
593
- * announced — a client merging on `>=` would let a snapshot read at that
594
- * version win the tie and undo the transition.
595
- *
596
- * So seed conditional state from the snapshot and REST, comparing with
597
- * `snapshot.version >= local.version`, and apply live events as state without
598
- * ranking them. `>=` rather than `>`: one sequencer step can write several
612
+ * Present on REST reads, on live `conditionalOrders` updates and on the
613
+ * subscribe-time snapshot frame, always the version of the row described.
614
+ * When both sides carry one, merge with `incoming.version >= local.version`:
615
+ * `>=` rather than `>`, because one sequencer step can write several
599
616
  * conditional rows (a trigger writes the triggered row and cancels its OCO
600
- * sibling), so equal means "same step", not identical state.
617
+ * sibling), so equal means "same step", not identical state. Never compare
618
+ * an absent version numerically: a versioned row supersedes an unversioned
619
+ * one, and two unversioned rows compare on `updatedAt`.
601
620
  *
602
621
  * Absent means unknown — a row last written before the field existed — never
603
622
  * zero. Wire: `version`.
@@ -618,14 +637,28 @@ export interface ConditionalOrder {
618
637
  export interface ListConditionalOrdersResponse {
619
638
  orders: ConditionalOrder[];
620
639
  /**
621
- * Matching conditional orders. Exact up to 10,000 pages of the requested
622
- * page size (`pageSize` x 10,000 rows) and saturates there, so a caller with
623
- * more matching conditional orders than the listing can page through reads
624
- * the cap, not its lifetime total. `page` is capped at 10,000.
640
+ * Matching conditional orders in page-number (offset) mode: exact up to
641
+ * 10,000 pages of the requested page size (`pageSize` x 10,000 rows) and
642
+ * saturates there, so a caller with more matching conditional orders than the
643
+ * listing can page through reads the cap, not its lifetime total. `0` in
644
+ * cursor (`pageToken`) mode, which runs no COUNT (AIP-158).
625
645
  */
626
646
  total: number;
647
+ /**
648
+ * Current page number in legacy offset mode; `0` in cursor mode.
649
+ *
650
+ * @deprecated Use cursor pagination (`pageToken`/`nextPageToken`) instead.
651
+ */
627
652
  page: number;
628
653
  pageSize: number;
654
+ /**
655
+ * Cursor for the next page, minted only while a further page exists (the read
656
+ * over-fetches one row to decide). Empty on every page-number response and on
657
+ * the final cursor page — an empty token is the definitive end of the walk,
658
+ * so no extra request is needed. Do not feed the empty token back as
659
+ * `pageToken`; an empty input restarts the walk from the newest row.
660
+ */
661
+ nextPageToken: string;
629
662
  }
630
663
  /**
631
664
  * Options for creating a server-side TWAP parent order.
@@ -881,10 +914,31 @@ export interface ListTwapOrdersParams {
881
914
  state?: TwapOrderState;
882
915
  /** Filter by trading pair UUID */
883
916
  tradingPairId?: string;
884
- /** Page number (1-indexed) */
917
+ /**
918
+ * Page number for legacy offset pagination.
919
+ *
920
+ * @deprecated Use cursor pagination (`pageToken`) instead. Passing `page`
921
+ * selects legacy page-number mode; omitting both `page` and `pageToken`
922
+ * drives cursor mode.
923
+ */
885
924
  page?: number;
886
- /** Items per page (max 100) */
925
+ /** Items per page (max 100 in page-number mode, up to 1000 when `pageToken` is present) */
887
926
  pageSize?: number;
927
+ /**
928
+ * Pagination cursor with three distinct states:
929
+ * - Omitted (`undefined`): the SDK starts a cursor walk (it sends
930
+ * `pageToken=""`) unless the deprecated `page` param was passed, in which
931
+ * case the request uses legacy page-number pagination.
932
+ * - Empty string (`""`): start a cursor walk with no prior position, from
933
+ * the newest TWAP parent.
934
+ * - Non-empty: an opaque cursor from a previous response's `nextPageToken`;
935
+ * results resume immediately after that position.
936
+ *
937
+ * In either cursor-walk state, `page` and `total` come back as 0 — cursor
938
+ * mode runs no COUNT (AIP-158). Follow `nextPageToken` until it comes back
939
+ * empty. Filters must match the request that produced the token.
940
+ */
941
+ pageToken?: string;
888
942
  }
889
943
  /**
890
944
  * Response from listing TWAP parent orders.
@@ -892,14 +946,27 @@ export interface ListTwapOrdersParams {
892
946
  export interface ListTwapOrdersResponse {
893
947
  orders: TwapOrder[];
894
948
  /**
895
- * Matching TWAP orders. Exact up to 10,000 pages of the requested page size
896
- * (`pageSize` x 10,000 rows) and saturates there, so a caller with more
897
- * matching TWAP orders than the listing can page through reads the cap, not
898
- * its lifetime total. `page` is capped at 10,000.
949
+ * Matching TWAP orders in page-number (offset) mode: exact up to 10,000 pages
950
+ * of the requested page size (`pageSize` x 10,000 rows) and saturates there,
951
+ * so a caller with more matching TWAP orders than the listing can page through
952
+ * reads the cap, not its lifetime total. `0` in cursor (`pageToken`) mode,
953
+ * which runs no COUNT (AIP-158).
899
954
  */
900
955
  total: number;
901
- /** Current page number */
956
+ /**
957
+ * Current page number in legacy offset mode; `0` in cursor mode.
958
+ *
959
+ * @deprecated Use cursor pagination (`pageToken`/`nextPageToken`) instead.
960
+ */
902
961
  page: number;
903
962
  /** Items per page */
904
963
  pageSize: number;
964
+ /**
965
+ * Cursor for the next page, minted only while a further page exists (the read
966
+ * over-fetches one row to decide). Empty on every page-number response and on
967
+ * the final cursor page — an empty token is the definitive end of the walk,
968
+ * so no extra request is needed. Do not feed the empty token back as
969
+ * `pageToken`; an empty input restarts the walk from the newest row.
970
+ */
971
+ nextPageToken: string;
905
972
  }
@@ -403,6 +403,7 @@ export declare const ListConditionalOrdersSchema: z.ZodObject<{
403
403
  }>>;
404
404
  page: z.ZodOptional<z.ZodNumber>;
405
405
  pageSize: z.ZodOptional<z.ZodNumber>;
406
+ pageToken: z.ZodOptional<z.ZodString>;
406
407
  }, z.core.$strip>;
407
408
  export declare const TwapOrderStateSchema: z.ZodEnum<{
408
409
  CANCELLED: "CANCELLED";
@@ -464,6 +465,7 @@ export declare const ListTwapOrdersSchema: z.ZodObject<{
464
465
  tradingPairId: z.ZodOptional<z.ZodUUID>;
465
466
  page: z.ZodOptional<z.ZodNumber>;
466
467
  pageSize: z.ZodOptional<z.ZodNumber>;
468
+ pageToken: z.ZodOptional<z.ZodString>;
467
469
  }, z.core.$strip>;
468
470
  /**
469
471
  * Single batch create order item validation schema
@@ -420,12 +420,27 @@ export const ClosePositionSideSchema = z.enum(["LONG", "SHORT"], {
420
420
  export const CancelConditionalOrderSchema = z.object({
421
421
  conditionalOrderId: UUIDSchema,
422
422
  });
423
- export const ListConditionalOrdersSchema = z.object({
423
+ export const ListConditionalOrdersSchema = z
424
+ .object({
424
425
  marginAccountId: UUIDSchema.optional(),
425
426
  tradingPairId: UUIDSchema.optional(),
426
427
  state: ConditionalOrderStateSchema.optional(),
427
428
  page: z.number().int().min(1, "Page must be at least 1").optional(),
428
- pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
429
+ pageSize: z.number().int().min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
430
+ pageToken: z.string().optional(),
431
+ })
432
+ .superRefine((params, ctx) => {
433
+ // The higher 1000 cap only applies to cursor (pageToken) requests; the
434
+ // server keeps the 100 cap for page-number requests (offset scans).
435
+ // Legacy page-number mode is selected only by passing `page` without
436
+ // `pageToken` — omitting both starts a cursor walk.
437
+ if (params.page !== undefined && params.pageToken === undefined && params.pageSize !== undefined && params.pageSize > 100) {
438
+ ctx.addIssue({
439
+ code: z.ZodIssueCode.custom,
440
+ message: "Page size cannot exceed 100 in page-number mode (page without pageToken)",
441
+ path: ["pageSize"],
442
+ });
443
+ }
429
444
  });
430
445
  export const TwapOrderStateSchema = z.enum(["PENDING", "ACTIVE", "COMPLETED", "CANCELLED"], {
431
446
  message: "Invalid TWAP order state",
@@ -549,11 +564,26 @@ export const CreateTwapOrderSchema = z
549
564
  export const CancelTwapOrderSchema = z.object({
550
565
  twapOrderId: UUIDSchema,
551
566
  });
552
- export const ListTwapOrdersSchema = z.object({
567
+ export const ListTwapOrdersSchema = z
568
+ .object({
553
569
  state: TwapOrderStateSchema.optional(),
554
570
  tradingPairId: UUIDSchema.optional(),
555
571
  page: z.number().int().min(1, "Page must be at least 1").optional(),
556
- pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
572
+ pageSize: z.number().int().min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
573
+ pageToken: z.string().optional(),
574
+ })
575
+ .superRefine((params, ctx) => {
576
+ // The higher 1000 cap only applies to cursor (pageToken) requests; the
577
+ // server keeps the 100 cap for page-number requests (offset scans).
578
+ // Legacy page-number mode is selected only by passing `page` without
579
+ // `pageToken` — omitting both starts a cursor walk.
580
+ if (params.page !== undefined && params.pageToken === undefined && params.pageSize !== undefined && params.pageSize > 100) {
581
+ ctx.addIssue({
582
+ code: z.ZodIssueCode.custom,
583
+ message: "Page size cannot exceed 100 in page-number mode (page without pageToken)",
584
+ path: ["pageSize"],
585
+ });
586
+ }
557
587
  });
558
588
  /**
559
589
  * Single batch create order item validation schema
@@ -64,9 +64,11 @@ export type WebSocketErrorCode =
64
64
  */
65
65
  | "SNAPSHOT_UNAVAILABLE"
66
66
  /**
67
- * The per-connection inbound message-rate cap was exceeded; the connection
68
- * is closed (1008) after this frame. Batch subscriptions and back off
69
- * before reconnecting — a hot re-subscribe loop trips the cap again.
67
+ * A per-connection inbound cap was exceeded: the message rate, or the byte
68
+ * budget that refuses a burst of very large frames. The connection is
69
+ * closed (1008) after this frame. Batch subscriptions, keep frames small,
70
+ * and back off before reconnecting — a hot re-subscribe loop trips the cap
71
+ * again.
70
72
  */
71
73
  | "MESSAGE_RATE_LIMIT";
72
74
  /**