@0xmonaco/types 1.1.8 → 1.1.10

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.
@@ -5,8 +5,8 @@
5
5
  * endpoints.
6
6
  */
7
7
  import type { BaseAPI } from "../api";
8
- import type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
9
- import type { ApplicationConfigResponse, GetAppStatsResponse, ListAppBalancesResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse } from "./responses";
8
+ import type { GetAppStatsParams, ListAppBalancesParams, ListAppMarginAccountsParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
9
+ import type { ApplicationConfigResponse, GetAppStatsResponse, ListAppBalancesResponse, ListAppMarginAccountsResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse } from "./responses";
10
10
  /**
11
11
  * Applications API interface.
12
12
  *
@@ -46,12 +46,26 @@ export interface ApplicationsAPI extends BaseAPI {
46
46
  */
47
47
  listApplicationMovements(params: ListAppMovementsParams): Promise<ListAppMovementsResponse>;
48
48
  /**
49
- * Lists user balances held within the application. Public, selected by `clientId`.
49
+ * Lists user wallet balances held within the application. Public, selected by `clientId`.
50
+ *
51
+ * Funds held in a margin account are not included, so a user funded through
52
+ * margin can show zero here. Read those users from
53
+ * `GET /api/v1/applications/margin-accounts` (`listApplicationMarginAccounts`).
50
54
  *
51
55
  * @param params - Pagination and filter options
52
56
  * @returns Promise resolving to a paginated list of balances
53
57
  */
54
58
  listApplicationBalances(params: ListAppBalancesParams): Promise<ListAppBalancesResponse>;
59
+ /**
60
+ * Lists the application's margin accounts, sub-accounts included. Public,
61
+ * selected by `clientId`. Figures are a persisted baseline repriced at the
62
+ * latest risk marks, so they can briefly lag the matching engine.
63
+ * Copy-trading accounts are not listed.
64
+ *
65
+ * @param params - Pagination and filter options
66
+ * @returns Promise resolving to a paginated list of margin accounts
67
+ */
68
+ listApplicationMarginAccounts(params: ListAppMarginAccountsParams): Promise<ListAppMarginAccountsResponse>;
55
69
  /**
56
70
  * Gets aggregate volume and fee stats for the application. Public, selected by `clientId`.
57
71
  *
@@ -60,5 +74,5 @@ export interface ApplicationsAPI extends BaseAPI {
60
74
  */
61
75
  getApplicationStats(params: GetAppStatsParams): Promise<GetAppStatsResponse>;
62
76
  }
63
- export type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
64
- export type { AppBalance, ApplicationConfigResponse, AppMovement, AppOrder, AppUser, GetAppStatsResponse, ListAppBalancesResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse, } from "./responses";
77
+ export type { GetAppStatsParams, ListAppBalancesParams, ListAppMarginAccountsParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams, } from "./requests";
78
+ export type { AppBalance, ApplicationConfigResponse, AppMarginAccount, AppMovement, AppOrder, AppUser, GetAppStatsResponse, ListAppBalancesResponse, ListAppMarginAccountsResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse, } from "./responses";
@@ -95,6 +95,26 @@ export interface ListAppMovementsParams {
95
95
  /** Filter by asset UUID */
96
96
  assetId?: string;
97
97
  }
98
+ /**
99
+ * Query parameters for listing application margin accounts.
100
+ */
101
+ export interface ListAppMarginAccountsParams {
102
+ /** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
103
+ clientId: string;
104
+ /**
105
+ * Keep only this wallet's margin accounts in the application. A wallet with
106
+ * no margin account here returns an empty page.
107
+ */
108
+ address?: string;
109
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
110
+ pageSize?: number;
111
+ /**
112
+ * Pagination cursor: omit or pass `""` to start, otherwise a previous
113
+ * response's `nextPageToken`. Ordered by margin account id ascending.
114
+ * Filters must match the request that minted the token.
115
+ */
116
+ pageToken?: string;
117
+ }
98
118
  /**
99
119
  * Query parameters for listing application balances.
100
120
  */
@@ -132,13 +132,13 @@ export interface AppBalance {
132
132
  decimals: number;
133
133
  /** Balance UUID */
134
134
  id: string;
135
- /** Last sync timestamp (ISO 8601) */
135
+ /** @deprecated This timestamp is not kept up to date and must not be used. It is not a sync or health signal. */
136
136
  lastSyncAt: string | null;
137
- /** Last sync block number */
137
+ /** @deprecated This block number is not kept up to date and must not be used. It is not a sync or health signal. */
138
138
  lastSyncBlock: number | null;
139
139
  /** Locked balance */
140
140
  lockedBalance: string;
141
- /** On-chain balance */
141
+ /** @deprecated This value is not kept up to date and must not be used. It is not a sync or health signal. */
142
142
  onChainBalance: string;
143
143
  /** Token symbol */
144
144
  symbol: string | null;
@@ -225,6 +225,50 @@ export interface ListAppBalancesResponse {
225
225
  */
226
226
  totalCapped: boolean;
227
227
  }
228
+ /**
229
+ * One margin account of an application.
230
+ *
231
+ * Every figure is a persisted baseline repriced at the latest risk marks, so it
232
+ * can briefly lag the matching engine.
233
+ */
234
+ export interface AppMarginAccount {
235
+ /** Margin account UUID */
236
+ marginAccountId: string;
237
+ /** UUID of the user who owns this margin account */
238
+ userId: string;
239
+ /** Wallet address of the owning user */
240
+ address: string;
241
+ /** Sub-account key; `default` is the parent margin account */
242
+ subaccountKey: string;
243
+ /** `ACTIVE`, or `CLOSED` for a closed sub-account */
244
+ marginAccountState: string;
245
+ /** Deposited collateral in USD, before any PnL */
246
+ collateral: string;
247
+ /** Settled collateral, unrealized PnL at the latest risk marks, and realized PnL held by open risk buckets */
248
+ equity: string;
249
+ /** Collateral available for new margin. Not the withdrawal bound. */
250
+ freeCollateral: string;
251
+ /** Collateral a transfer out can take. The matching engine enforces the transfer and can accept less. */
252
+ withdrawableCollateral: string;
253
+ /** When this margin account was last persisted. Repricing at newer marks does not move it. */
254
+ updatedAt: string;
255
+ }
256
+ /**
257
+ * Paginated list of application margin accounts.
258
+ */
259
+ export interface ListAppMarginAccountsResponse {
260
+ marginAccounts: AppMarginAccount[];
261
+ /** Margin accounts matching the filter, bounded by the server count ceiling. */
262
+ total: number;
263
+ /** Items per page */
264
+ pageSize: number;
265
+ /** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
266
+ totalPages: number;
267
+ /** Cursor for the next page; `""` proves the walk is exhausted. */
268
+ nextPageToken: string;
269
+ /** `true` when more than the server ceiling matched, so `total` / `totalPages` are a lower bound. */
270
+ totalCapped: boolean;
271
+ }
228
272
  /**
229
273
  * Aggregate volume and fee stats for an application.
230
274
  *
@@ -593,7 +593,7 @@ export interface CloseMarginSubAccountResponse {
593
593
  /** Collateral moved to the default margin account. */
594
594
  amount: string;
595
595
  }
596
- /** One side of a collateral transfer: the spot wallet, or a margin account. */
596
+ /** One side of a collateral transfer: the spot wallet, a margin account, or one of its risk buckets. */
597
597
  export type CollateralTransferEndpoint = {
598
598
  wallet: true;
599
599
  marginAccountId?: never;
@@ -604,9 +604,11 @@ export type CollateralTransferEndpoint = {
604
604
  riskBucketId?: string;
605
605
  };
606
606
  /**
607
- * Move collateral between the spot wallet and the caller's margin accounts.
608
- * Supported: wallet to the default margin account and back, and margin
609
- * account to margin account.
607
+ * Move collateral between any two of the caller's places: the spot wallet, a
608
+ * margin account, a risk bucket. A route that crosses accounts or the wallet
609
+ * runs up to three moves in one step, and a refused request moves nothing. The
610
+ * wallet is reached through the default margin account. A route to or from the
611
+ * wallet or a risk bucket refuses a copy-trading sub-account.
610
612
  */
611
613
  export interface TransferMarginCollateralRequest {
612
614
  asset: string;
@@ -628,6 +630,9 @@ export interface TransferMarginCollateralResponse {
628
630
  fromMarginAccountId?: string;
629
631
  toMarginAccountId?: string;
630
632
  toRiskBucketId?: string;
633
+ fromRiskBucketId?: string;
634
+ /** Whether funding the risk bucket credited its sole open position's margin. Absent when the destination is not a risk bucket. */
635
+ positionMarginCredited?: boolean;
631
636
  }
632
637
  export interface MarginAccountsAPI extends BaseAPI {
633
638
  /**
@@ -239,6 +239,8 @@ export interface ScreenerItem {
239
239
  totalQuoteVolumeLtd: string;
240
240
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
241
241
  totalTradeCountLtd: number;
242
+ /** The life-to-date totals split into their order-book and RFQ parts */
243
+ totalVolumeLtdBySource?: LtdVolumeBySource;
242
244
  /**
243
245
  * Latest settled funding rate as a decimal fraction per funding window (the
244
246
  * capped settled value); null for spot pairs and margin pairs with no
@@ -273,11 +275,27 @@ export interface ScreenerItem {
273
275
  /**
274
276
  * Estimated rate for the in-progress funding window (decimal fraction per
275
277
  * window), the same value as `getFundingState().estimatedNextFundingRate`.
276
- * A window that ends with too few accepted samples settles at the previous
277
- * settled rate (0 if none has settled), so the settled rate can differ.
278
+ * A window that ends with too few accepted samples settles at zero, so the
279
+ * settled rate can differ.
278
280
  * Null for spot pairs and margin pairs whose current window has no samples yet
279
281
  */
280
282
  estimatedNextFundingRate: string | null;
283
+ /**
284
+ * The 24h quote volume split into its order-book and RFQ parts; absent while
285
+ * any candle in the window has no recorded split, or when `quoteVolume24h`
286
+ * is null.
287
+ */
288
+ quoteVolume24hBySource?: ScreenerQuoteVolumeBySource | null;
289
+ }
290
+ /**
291
+ * A screener row's 24h quote volume split by execution source: the order-book
292
+ * part plus the RFQ part is `quoteVolume24h` (decimal strings).
293
+ */
294
+ export interface ScreenerQuoteVolumeBySource {
295
+ /** Quote-token volume filled on the order book in the last 24 hours */
296
+ orderBookQuoteVolume: string;
297
+ /** Quote-token volume filled by RFQ block trades in the last 24 hours */
298
+ rfqQuoteVolume: string;
281
299
  }
282
300
  /**
283
301
  * Paginated screener response, sorted by quoteVolume24h desc (nulls last)
@@ -329,12 +347,33 @@ export interface MarketMetadata {
329
347
  totalQuoteVolumeLtd: string;
330
348
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
331
349
  totalTradeCountLtd: number;
350
+ /** The life-to-date totals split into their order-book and RFQ parts */
351
+ totalVolumeLtdBySource?: LtdVolumeBySource;
332
352
  /**
333
353
  * The rolling 24h volumes split into their order-book and RFQ parts; absent
334
354
  * while any candle in the window has no recorded split.
335
355
  */
336
356
  volume24hBySource?: Volume24hBySource | null;
337
357
  }
358
+ /**
359
+ * Life-to-date totals split by how they executed (RFQ-17): the order-book part
360
+ * and the RFQ part, which add up exactly to the totals beside them. Base volume
361
+ * is set only for a single market (null or absent elsewhere).
362
+ */
363
+ export interface LtdVolumeBySource {
364
+ /** Life-to-date base-token volume filled on the order book (single market only) */
365
+ orderBookBaseVolume?: string | null;
366
+ /** Life-to-date base-token volume filled by RFQ block trades (single market only) */
367
+ rfqBaseVolume?: string | null;
368
+ /** Life-to-date quote-token volume filled on the order book */
369
+ orderBookQuoteVolume: string;
370
+ /** Life-to-date quote-token volume filled by RFQ block trades */
371
+ rfqQuoteVolume: string;
372
+ /** Life-to-date number of order-book trades */
373
+ orderBookTradeCount: number;
374
+ /** Life-to-date number of RFQ fills (one per maker child) */
375
+ rfqTradeCount: number;
376
+ }
338
377
  /**
339
378
  * A market's rolling 24h volume split by execution source: each total is the
340
379
  * order-book part plus the RFQ part (decimal strings).
@@ -357,6 +396,8 @@ export interface MarketStats {
357
396
  totalQuoteVolumeLtd: string;
358
397
  /** Life-to-date cumulative number of trades summed across all pairs */
359
398
  totalTradeCountLtd: number;
399
+ /** The life-to-date totals split into their order-book and RFQ parts */
400
+ totalVolumeLtdBySource?: LtdVolumeBySource;
360
401
  }
361
402
  /**
362
403
  * One notional bracket of a market's margin ladder. Brackets are MARGINAL: a
@@ -524,7 +565,11 @@ export interface FundingRecord {
524
565
  windowClosedAt: string;
525
566
  /** Settlement time (ISO 8601); the sort key for `listAllFundingHistory`. */
526
567
  settledAt: string;
527
- /** True when the window settled at the carried last rate (sparse-sample rule). */
568
+ /**
569
+ * True when the window held too few accepted samples and settled at zero
570
+ * (sparse-sample rule). Windows settled before 0XM-3728 carried the last
571
+ * settled rate instead.
572
+ */
528
573
  carried?: boolean;
529
574
  }
530
575
  export interface ListFundingHistoryParams {
@@ -73,6 +73,8 @@ export interface PortfolioPerformance {
73
73
  netExternalFlows: string;
74
74
  pnl?: string;
75
75
  returnPct?: string;
76
+ /** Modified Dietz return: pnl over starting equity plus deposits minus withdrawals, each weighted by time in the account. Never below -100%. Defined after equity touches zero; omitted when the window has no positive-equity sample or withdrawals leave the time-weighted capital below 5% of what it would have been without them. Not bounded above: a capital just over that limit can still give a gain of up to about 20 times the return on the full base. */
77
+ modifiedDietzReturnPct?: string;
76
78
  maxDrawdown?: PortfolioPerformanceDrawdown;
77
79
  points: PortfolioPerformancePoint[];
78
80
  }
@@ -116,6 +118,7 @@ export interface PortfolioRealizedPnl {
116
118
  export interface PortfolioAssetsPerformance {
117
119
  pnl?: string;
118
120
  returnPct?: string;
121
+ modifiedDietzReturnPct?: string;
119
122
  calculationMethod: "sampled_twr";
120
123
  }
121
124
  export interface PortfolioAssetRow {
@@ -9,7 +9,30 @@
9
9
  */
10
10
  import type { BaseAPI } from "../api";
11
11
  import type { AcceptRfqParams, CancelRfqParams, CreateRfqParams, RespondRfqLastLookParams, UpsertRfqQuoteParams, WithdrawRfqQuoteParams } from "../validation/rfq";
12
- import type { GetRfqCapabilitiesResponse, RespondRfqLastLookResponse, RfqQuoteVersion, RfqStatus, WithdrawRfqQuoteResponse } from "./responses";
12
+ import type { GetRfqCapabilitiesResponse, ListRfqsResponse, RespondRfqLastLookResponse, RfqQuoteVersion, RfqStatus, RfqView, WithdrawRfqQuoteResponse } from "./responses";
13
+ /** `listRfqs` paging: up to 100 per page (default 50), and the previous page's token. */
14
+ export interface ListRfqsParams {
15
+ pageSize?: number;
16
+ pageToken?: string;
17
+ }
18
+ /** Options for `waitForRfqView`. */
19
+ export interface WaitForRfqViewOptions {
20
+ /**
21
+ * How long to wait for a matching view, in milliseconds (default 10000).
22
+ * When it passes, the RFQ is read once; no match then rejects.
23
+ */
24
+ timeoutMs?: number;
25
+ /** A view you already hold (e.g. `createRfq`'s `view`), checked first. */
26
+ initialView?: RfqView | null;
27
+ /** Aborts the wait; it rejects with the signal's reason. */
28
+ signal?: AbortSignal;
29
+ }
30
+ /** The taker's view `waitForRfqView` found, and where it came from. */
31
+ export interface RfqViewMatch {
32
+ view: RfqView;
33
+ /** `push` from the `rfq` channel; `read` from a `getRfq` fallback; `initial` from `initialView`. */
34
+ source: "initial" | "push" | "read";
35
+ }
13
36
  /**
14
37
  * RFQ API.
15
38
  *
@@ -27,9 +50,17 @@ export interface RfqAPI extends BaseAPI {
27
50
  /**
28
51
  * An RFQ's authoritative status. As taker: the current `view` and, once
29
52
  * executed, the `outcome`. As maker: your latest quote, `ownLatestVersion`
30
- * and, once selected, `ownSelection` for last look.
53
+ * and, once selected, `ownSelection` for last look. To wait for quotes,
54
+ * follow the `rfq` channel's `RfqView` pushes (`waitForRfqView` in
55
+ * `@0xmonaco/core`) instead of polling this: each read rebuilds the view.
31
56
  */
32
57
  getRfq(rfqId: string): Promise<RfqStatus>;
58
+ /**
59
+ * Your RFQs as the taker, newest first, in every state (those that filled
60
+ * nothing included). Each is as `getRfq` gives it, without the live `view`.
61
+ * Follow `nextPageToken` until it is empty.
62
+ */
63
+ listRfqs(params?: ListRfqsParams): Promise<ListRfqsResponse>;
33
64
  /** Accept one side of the view you last saw (`view.viewVersion`). Binding. */
34
65
  acceptRfq(rfqId: string, params: AcceptRfqParams): Promise<RfqStatus>;
35
66
  /** Cancel an RFQ you have not accepted, before its deadline. */
@@ -336,6 +336,147 @@ export declare const RfqStatusSchema: z.ZodObject<{
336
336
  bookFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
337
337
  }, z.core.$strip>>>;
338
338
  }, z.core.$strip>;
339
+ /** A page of your RFQs as the taker, newest first. */
340
+ export declare const ListRfqsResponseSchema: z.ZodObject<{
341
+ rfqs: z.ZodArray<z.ZodObject<{
342
+ terms: z.ZodOptional<z.ZodNullable<z.ZodObject<{
343
+ rfqId: z.ZodString;
344
+ tradingPairId: z.ZodString;
345
+ product: z.ZodOptional<z.ZodNullable<z.ZodType<"PERPETUAL" | "SPOT" | (string & {}), unknown, z.core.$ZodTypeInternals<"PERPETUAL" | "SPOT" | (string & {}), unknown>>>>;
346
+ quantity: z.ZodString;
347
+ createdAtMs: z.ZodNumber;
348
+ deadlineAtMs: z.ZodNumber;
349
+ side: z.ZodOptional<z.ZodNullable<z.ZodType<"BUY" | "SELL" | (string & {}), unknown, z.core.$ZodTypeInternals<"BUY" | "SELL" | (string & {}), unknown>>>>;
350
+ quoteSide: z.ZodOptional<z.ZodNullable<z.ZodType<"ASK" | "BID" | (string & {}), unknown, z.core.$ZodTypeInternals<"ASK" | "BID" | (string & {}), unknown>>>>;
351
+ leverage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
352
+ marginMode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
+ }, z.core.$strip>>>;
354
+ state: z.ZodType<RfqState | (string & {}), unknown, z.core.$ZodTypeInternals<RfqState | (string & {}), unknown>>;
355
+ stateVersion: z.ZodNumber;
356
+ acceptedSide: z.ZodOptional<z.ZodNullable<z.ZodType<"BUY" | "SELL" | (string & {}), unknown, z.core.$ZodTypeInternals<"BUY" | "SELL" | (string & {}), unknown>>>>;
357
+ lastLookDeadlineAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
358
+ view: z.ZodOptional<z.ZodNullable<z.ZodObject<{
359
+ viewVersion: z.ZodNumber;
360
+ bid: z.ZodOptional<z.ZodNullable<z.ZodObject<{
361
+ vwap: z.ZodString;
362
+ availableQuantity: z.ZodString;
363
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
365
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
366
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
367
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
368
+ vwap: z.ZodString;
369
+ grossVwap: z.ZodString;
370
+ asOfMs: z.ZodNumber;
371
+ levels: z.ZodNumber;
372
+ }, z.core.$strip>>>;
373
+ }, z.core.$strip>>>;
374
+ ask: z.ZodOptional<z.ZodNullable<z.ZodObject<{
375
+ vwap: z.ZodString;
376
+ availableQuantity: z.ZodString;
377
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
378
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
379
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
381
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
382
+ vwap: z.ZodString;
383
+ grossVwap: z.ZodString;
384
+ asOfMs: z.ZodNumber;
385
+ levels: z.ZodNumber;
386
+ }, z.core.$strip>>>;
387
+ }, z.core.$strip>>>;
388
+ asOfMs: z.ZodNumber;
389
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
390
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
391
+ }, z.core.$strip>>>;
392
+ ownQuote: z.ZodOptional<z.ZodNullable<z.ZodObject<{
393
+ rfqId: z.ZodString;
394
+ quoteId: z.ZodString;
395
+ version: z.ZodNumber;
396
+ bid: z.ZodOptional<z.ZodNullable<z.ZodObject<{
397
+ price: z.ZodString;
398
+ capacity: z.ZodString;
399
+ }, z.core.$strip>>>;
400
+ ask: z.ZodOptional<z.ZodNullable<z.ZodObject<{
401
+ price: z.ZodString;
402
+ capacity: z.ZodString;
403
+ }, z.core.$strip>>>;
404
+ issuedAtMs: z.ZodNumber;
405
+ validUntilMs: z.ZodNumber;
406
+ leverage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
407
+ marginMode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
408
+ refusedSides: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
409
+ side: z.ZodType<"ASK" | "BID" | (string & {}), unknown, z.core.$ZodTypeInternals<"ASK" | "BID" | (string & {}), unknown>>;
410
+ code: z.ZodString;
411
+ reason: z.ZodString;
412
+ }, z.core.$strip>>>>;
413
+ }, z.core.$strip>>>;
414
+ ownSelection: z.ZodOptional<z.ZodNullable<z.ZodObject<{
415
+ acceptanceId: z.ZodString;
416
+ takerSide: z.ZodOptional<z.ZodNullable<z.ZodType<"BUY" | "SELL" | (string & {}), unknown, z.core.$ZodTypeInternals<"BUY" | "SELL" | (string & {}), unknown>>>>;
417
+ quoteId: z.ZodString;
418
+ quoteVersion: z.ZodNumber;
419
+ quantity: z.ZodString;
420
+ frozenTerms: z.ZodOptional<z.ZodNullable<z.ZodObject<{
421
+ price: z.ZodString;
422
+ capacity: z.ZodString;
423
+ }, z.core.$strip>>>;
424
+ lastLookDeadlineAtMs: z.ZodNumber;
425
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
426
+ maxBuilderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
427
+ estimatedNet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ }, z.core.$strip>>>;
429
+ ownLatestVersion: z.ZodNumber;
430
+ ownQuoteWithdrawn: z.ZodBoolean;
431
+ outcome: z.ZodOptional<z.ZodNullable<z.ZodObject<{
432
+ executedQuantity: z.ZodString;
433
+ unfilledQuantity: z.ZodString;
434
+ vwap: z.ZodString;
435
+ fills: z.ZodArray<z.ZodObject<{
436
+ executionId: z.ZodString;
437
+ price: z.ZodString;
438
+ quantity: z.ZodString;
439
+ fee: z.ZodString;
440
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
441
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
442
+ }, z.core.$strip>>;
443
+ allInVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
444
+ bookAtFill: z.ZodOptional<z.ZodNullable<z.ZodObject<{
445
+ vwap: z.ZodString;
446
+ grossVwap: z.ZodString;
447
+ asOfMs: z.ZodNumber;
448
+ levels: z.ZodNumber;
449
+ }, z.core.$strip>>>;
450
+ bookAtFillFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
451
+ }, z.core.$strip>>>;
452
+ durableSequence: z.ZodNumber;
453
+ ownFills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
454
+ executionId: z.ZodString;
455
+ price: z.ZodString;
456
+ quantity: z.ZodString;
457
+ fee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
458
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
459
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
460
+ }, z.core.$strip>>>>;
461
+ acceptance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
462
+ viewVersion: z.ZodNumber;
463
+ acceptedAtMs: z.ZodNumber;
464
+ vwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
465
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
466
+ availableQuantity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
467
+ monacoFeeCbps: z.ZodNumber;
468
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
469
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
470
+ vwap: z.ZodString;
471
+ grossVwap: z.ZodString;
472
+ asOfMs: z.ZodNumber;
473
+ levels: z.ZodNumber;
474
+ }, z.core.$strip>>>;
475
+ bookFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
476
+ }, z.core.$strip>>>;
477
+ }, z.core.$strip>>;
478
+ nextPageToken: z.ZodString;
479
+ }, z.core.$strip>;
339
480
  /** A market RFQ is offered on. */
340
481
  export declare const RfqMarketCapabilitySchema: z.ZodObject<{
341
482
  tradingPairId: z.ZodString;
@@ -385,6 +526,7 @@ export type RfqQuoteVersion = z.infer<typeof RfqQuoteVersionSchema>;
385
526
  export type RfqRefusedSide = z.infer<typeof RfqRefusedSideSchema>;
386
527
  export type RfqMakerSelection = z.infer<typeof RfqMakerSelectionSchema>;
387
528
  export type RfqStatus = z.infer<typeof RfqStatusSchema>;
529
+ export type ListRfqsResponse = z.infer<typeof ListRfqsResponseSchema>;
388
530
  export type RfqMarketCapability = z.infer<typeof RfqMarketCapabilitySchema>;
389
531
  export type GetRfqCapabilitiesResponse = z.infer<typeof GetRfqCapabilitiesResponseSchema>;
390
532
  export type WithdrawRfqQuoteResponse = z.infer<typeof WithdrawRfqQuoteResponseSchema>;
@@ -233,6 +233,13 @@ export const RfqStatusSchema = z.object({
233
233
  /** Taker only: what your view showed when you accepted. */
234
234
  acceptance: RfqAcceptanceRecordSchema.nullish(),
235
235
  });
236
+ /** A page of your RFQs as the taker, newest first. */
237
+ export const ListRfqsResponseSchema = z.object({
238
+ /** Each as `getRfq` gives it to the taker, without the live `view`. */
239
+ rfqs: z.array(RfqStatusSchema),
240
+ /** Pass as `pageToken` for the next page; empty once there are no more. */
241
+ nextPageToken: z.string(),
242
+ });
236
243
  /** A market RFQ is offered on. */
237
244
  export const RfqMarketCapabilitySchema = z.object({
238
245
  tradingPairId: z.string(),
@@ -161,11 +161,29 @@ export interface MonacoSDK {
161
161
  pageSize?: number;
162
162
  /** Cursor from a previous response's `nextPageToken`; omit to start */
163
163
  pageToken?: string;
164
+ /** The execution source to keep: RFQ block fills or order-book fills (each trade's `data.executionSource`); omit for every fill. */
165
+ executionSource?: "RFQ" | "CLOB";
164
166
  }) => Promise<{
165
167
  trades: TradeEvent[];
166
168
  /** Empty exactly when the walk is finished. */
167
169
  nextPageToken: string;
168
170
  }>;
171
+ /**
172
+ * The RFQ block prints a `rfqTrades` subscriber missed, oldest first: pages
173
+ * the pair's RFQ history newest first until `sinceExecutionId`.
174
+ * `complete` is `false` when `maxPages` ran out first.
175
+ */
176
+ recoverRfqTrades: (tradingPairId: string, options?: {
177
+ /** The newest `executionId` already seen; omit to read only the newest page. */
178
+ sinceExecutionId?: string;
179
+ /** Rows per page (default: 100, max: 1000) */
180
+ pageSize?: number;
181
+ /** Most pages to read (default: 10) */
182
+ maxPages?: number;
183
+ }) => Promise<{
184
+ trades: TradeEvent[];
185
+ complete: boolean;
186
+ }>;
169
187
  /**
170
188
  * One page of the trade feed: every market, newest first, or only the
171
189
  * trades one application took (`takerApplicationId`). Public and rate
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Public application listing validation schemas
3
3
  *
4
- * The four reporting listings are cursor paged (0XM-2822). Each schema
4
+ * The five reporting listings are cursor paged (0XM-2822). Each schema
5
5
  * REJECTS `page` rather than omitting it: forwarding the params field by
6
6
  * field drops a stray `page` before it reaches the wire, which means a
7
7
  * JavaScript or `any` caller looping on `{ page: n }` would be handed the
@@ -49,3 +49,10 @@ export declare const ListAppBalancesSchema: z.ZodObject<{
49
49
  userId: z.ZodOptional<z.ZodUUID>;
50
50
  assetId: z.ZodOptional<z.ZodUUID>;
51
51
  }, z.core.$strip>;
52
+ export declare const ListAppMarginAccountsSchema: z.ZodObject<{
53
+ clientId: z.ZodString;
54
+ page: z.ZodOptional<z.ZodNever>;
55
+ pageSize: z.ZodOptional<z.ZodNumber>;
56
+ pageToken: z.ZodOptional<z.ZodString>;
57
+ address: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Public application listing validation schemas
3
3
  *
4
- * The four reporting listings are cursor paged (0XM-2822). Each schema
4
+ * The five reporting listings are cursor paged (0XM-2822). Each schema
5
5
  * REJECTS `page` rather than omitting it: forwarding the params field by
6
6
  * field drops a stray `page` before it reaches the wire, which means a
7
7
  * JavaScript or `any` caller looping on `{ page: n }` would be handed the
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { z } from "zod";
14
14
  import { UUIDSchema } from "./trading";
15
+ import { AddressSchema } from "./vault";
15
16
  /** A client ID is required; `page` is gone; a page size is bounded; a cursor may be `""` to start. */
16
17
  const AppCursorPaginationSchema = z.object({
17
18
  /** The application's public client ID; the listings are selected by it. */
@@ -43,3 +44,6 @@ export const ListAppBalancesSchema = AppCursorPaginationSchema.extend({
43
44
  userId: UUIDSchema.optional(),
44
45
  assetId: UUIDSchema.optional(),
45
46
  });
47
+ export const ListAppMarginAccountsSchema = AppCursorPaginationSchema.extend({
48
+ address: AddressSchema.optional(),
49
+ });
@@ -246,26 +246,14 @@ export declare const ListAllFundingHistorySchema: z.ZodObject<{
246
246
  DESC: "DESC";
247
247
  }>>;
248
248
  }, z.core.$strip>;
249
- /**
250
- * Public trades-feed listing validation schema.
251
- *
252
- * Cursor paged (0XM-2821). `page` is REJECTED rather than omitted, but NOT for
253
- * the same reason as {@link ListFundingHistorySchema}. That one is built on a
254
- * query builder that serializes whatever keys the params object carries, so a
255
- * leftover `page` reaches the wire and comes back as the server's `400`.
256
- * `getTrades` instead sets `pageSize` and `pageToken` explicitly, so a stray
257
- * `page` never leaves the client at all — which makes rejecting it more
258
- * important here, not less. Stripped silently, it would leave the caller
259
- * requesting page 2, 3, 4 and receiving the FIRST cursor page every time, with
260
- * no error from either side to reveal the loop. `z.never()` turns that silent
261
- * non-advancing walk into an immediate `ValidationError`.
262
- *
263
- * The ceiling is the cursor-mode 1000; the historical default of 25 stays.
264
- */
265
249
  export declare const GetTradesSchema: z.ZodObject<{
266
250
  page: z.ZodOptional<z.ZodNever>;
267
251
  pageSize: z.ZodOptional<z.ZodNumber>;
268
252
  pageToken: z.ZodOptional<z.ZodString>;
253
+ executionSource: z.ZodOptional<z.ZodEnum<{
254
+ CLOB: "CLOB";
255
+ RFQ: "RFQ";
256
+ }>>;
269
257
  }, z.core.$strip>;
270
258
  /** Options for the every-market trade feed (`listTrades`). */
271
259
  export declare const ListTradesSchema: z.ZodObject<{
@@ -262,12 +262,16 @@ export const ListAllFundingHistorySchema = FundingHistoryCursorSchema;
262
262
  *
263
263
  * The ceiling is the cursor-mode 1000; the historical default of 25 stays.
264
264
  */
265
- export const GetTradesSchema = z.object({
265
+ const TradesPageSchema = z.object({
266
266
  page: z.never().optional(),
267
267
  pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
268
268
  pageToken: z.string().optional(),
269
269
  });
270
+ export const GetTradesSchema = TradesPageSchema.extend({
271
+ /** The execution source to keep (RFQ-15). */
272
+ executionSource: z.enum(["RFQ", "CLOB"]).optional(),
273
+ });
270
274
  /** Options for the every-market trade feed (`listTrades`). */
271
- export const ListTradesSchema = GetTradesSchema.extend({
275
+ export const ListTradesSchema = TradesPageSchema.extend({
272
276
  takerApplicationId: UUIDSchema.optional(),
273
277
  });
@@ -62,6 +62,11 @@ export declare const CancelRfqSchema: z.ZodObject<{
62
62
  idempotencyKey: z.ZodOptional<z.ZodString>;
63
63
  }, z.core.$strict>;
64
64
  /** Params for placing or replacing a quote: a bid, an ask or both. */
65
+ /** `listRfqs` paging: 1 to 100 per page, and the previous page's token. */
66
+ export declare const ListRfqsSchema: z.ZodObject<{
67
+ pageSize: z.ZodOptional<z.ZodNumber>;
68
+ pageToken: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strict>;
65
70
  export declare const UpsertRfqQuoteSchema: z.ZodObject<{
66
71
  expectedVersion: z.ZodNumber;
67
72
  bid: z.ZodOptional<z.ZodObject<{