@0xmonaco/types 1.1.5 → 1.1.7

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 (42) hide show
  1. package/README.md +1 -3
  2. package/dist/analytics/builders.d.ts +135 -0
  3. package/dist/analytics/builders.js +11 -0
  4. package/dist/analytics/index.d.ts +153 -0
  5. package/dist/analytics/index.js +27 -0
  6. package/dist/analytics/wallets.d.ts +205 -0
  7. package/dist/analytics/wallets.js +16 -0
  8. package/dist/applications/requests.d.ts +5 -5
  9. package/dist/buildercodes/index.d.ts +13 -11
  10. package/dist/buildercodes/responses.d.ts +1 -0
  11. package/dist/buildercodes/responses.js +10 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/margin-accounts/index.d.ts +7 -2
  15. package/dist/market/index.d.ts +19 -20
  16. package/dist/profile/index.d.ts +10 -17
  17. package/dist/rfq/responses.d.ts +145 -0
  18. package/dist/rfq/responses.js +102 -0
  19. package/dist/sdk/index.d.ts +4 -1
  20. package/dist/trading/index.d.ts +7 -3
  21. package/dist/trading/orders.d.ts +11 -0
  22. package/dist/trading/responses.d.ts +9 -3
  23. package/dist/validation/margin-accounts.d.ts +2 -2
  24. package/dist/validation/margin-accounts.js +5 -5
  25. package/dist/validation/trading.d.ts +15 -0
  26. package/dist/validation/trading.js +34 -42
  27. package/dist/websocket/base.d.ts +40 -10
  28. package/dist/websocket/client.d.ts +32 -4
  29. package/dist/websocket/depth.d.ts +142 -0
  30. package/dist/websocket/depth.js +13 -0
  31. package/dist/websocket/events/market-stats-events.d.ts +19 -0
  32. package/dist/websocket/events/orderbook-events.d.ts +41 -1
  33. package/dist/websocket/events/position-events.d.ts +3 -2
  34. package/dist/websocket/events/rfq-events.d.ts +51 -1
  35. package/dist/websocket/events/trade-events.d.ts +37 -0
  36. package/dist/websocket/index.d.ts +1 -0
  37. package/dist/websocket/index.js +1 -0
  38. package/dist/websocket/snapshots.d.ts +23 -1
  39. package/dist/wire/operations.d.ts +1 -1
  40. package/dist/wire/operations.js +16 -0
  41. package/dist/wire/schema.d.ts +2485 -308
  42. package/package.json +2 -2
@@ -5,6 +5,7 @@
5
5
  * All types are derived from Zod schemas for runtime validation.
6
6
  */
7
7
  import { z } from "zod";
8
+ import { OrderIdempotencyKeySchema } from "../validation/trading";
8
9
  /** Schema for this frontend's current BuilderCodes program state. */
9
10
  export const GetBuildercodesConfigResponseSchema = z.object({
10
11
  applicationId: z.string().uuid(),
@@ -189,6 +190,15 @@ export const ClaimBuildercodeRewardsParamsSchema = z.object({
189
190
  .trim()
190
191
  .min(1, "amount is required")
191
192
  .refine((v) => /^\d+$/.test(v) && BigInt(v) > 0n, "amount must be a positive integer string"),
193
+ /**
194
+ * Optional submission identity, shared with order create (1-64 characters
195
+ * from `[A-Za-z0-9._:-]`). Retrying the same key and claim within 15 minutes
196
+ * of the original acceptance returns the original claim's result without
197
+ * moving money again; the same key with a different claim is refused with
198
+ * `IDEMPOTENCY_KEY_CONFLICT` (409). Generate a fresh key for each intended
199
+ * claim and keep it across retries of that claim.
200
+ */
201
+ idempotencyKey: OrderIdempotencyKeySchema.optional(),
192
202
  });
193
203
  /** Schema for the claim-BuilderCodes-rewards response. */
194
204
  export const ClaimBuildercodeRewardsResponseSchema = z.object({
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * This package provides TypeScript types for the Monaco protocol.
5
5
  * It includes SDK types, vault types, trading types, contract types, and common types.
6
6
  */
7
+ export * from "./analytics";
7
8
  export * from "./api";
8
9
  export * from "./applications";
9
10
  export * from "./auth";
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * It includes SDK types, vault types, trading types, contract types, and common types.
6
6
  */
7
7
  // Export everything from all modules
8
+ export * from "./analytics";
8
9
  export * from "./api";
9
10
  export * from "./applications";
10
11
  export * from "./auth";
@@ -223,6 +223,7 @@ export interface TransferCollateralRequest {
223
223
  asset: string;
224
224
  amount: string;
225
225
  tradingPairId?: string;
226
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
226
227
  strategyKey?: string;
227
228
  /**
228
229
  * Risk bucket mode. Defaults to ISOLATED, which is selected by
@@ -263,6 +264,7 @@ export interface TransferCollateralToIsolatedRiskBucketRequest extends TransferC
263
264
  /** The margin account whose bucket is funded: omit for the default account, or name an open sub-account. */
264
265
  marginAccountId?: string;
265
266
  tradingPairId: string;
267
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
266
268
  strategyKey?: string;
267
269
  selectedTradingPairIds?: never;
268
270
  /**
@@ -303,7 +305,8 @@ export interface TransferCollateralToCrossRiskBucketRequest extends TransferColl
303
305
  */
304
306
  selectedTradingPairIds?: never;
305
307
  tradingPairId?: never;
306
- strategyKey?: never;
308
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
309
+ strategyKey?: string;
307
310
  /** Cross risk is pooled at bucket equity — there is no per-position margin; an explicit `true` is rejected. */
308
311
  applyToPositionMargin?: never;
309
312
  }
@@ -424,6 +427,7 @@ export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskReques
424
427
  marginMode?: "ISOLATED";
425
428
  /** The margin account previewed: omit for the default account, or name an open sub-account. */
426
429
  marginAccountId?: string;
430
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
427
431
  strategyKey?: string;
428
432
  selectedTradingPairIds?: never;
429
433
  };
@@ -446,7 +450,8 @@ export type SimulateCrossRiskBucketOrderRiskRequest = SimulateOrderRiskRequest &
446
450
  * compile time that it does nothing.
447
451
  */
448
452
  selectedTradingPairIds?: never;
449
- strategyKey?: never;
453
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
454
+ strategyKey?: string;
450
455
  };
451
456
  export type SimulateRiskBucketOrderRiskRequest = SimulateIsolatedRiskBucketOrderRiskRequest | SimulateCrossRiskBucketOrderRiskRequest;
452
457
  export interface SimulateOrderRiskResponse {
@@ -54,26 +54,6 @@ export interface TradingPair {
54
54
  * `CROSS_MARGIN_NOT_ALLOWED`; open the position with `marginMode: "ISOLATED"`.
55
55
  */
56
56
  isolatedOnly: boolean;
57
- /**
58
- * Flat pair-level maker fee in basis points (negative = rebate).
59
- *
60
- * @deprecated Not the rate an order is charged: fees are tiered per account.
61
- * Use `fees.getFeeSchedule(tradingPairId)` for the pair's tier schedule,
62
- * `fees.getMyFeeTier({ tradingPairId })` for your own rate, and
63
- * `placementMakerFeeBps` on an order for the rate it was placed at. This
64
- * field will be removed in a later release.
65
- */
66
- makerFeeBps: number;
67
- /**
68
- * Flat pair-level taker fee in basis points.
69
- *
70
- * @deprecated Not the rate an order is charged: fees are tiered per account.
71
- * Use `fees.getFeeSchedule(tradingPairId)` for the pair's tier schedule,
72
- * `fees.getMyFeeTier({ tradingPairId })` for your own rate, and
73
- * `placementTakerFeeBps` on an order for the rate it was placed at. This
74
- * field will be removed in a later release.
75
- */
76
- takerFeeBps: number;
77
57
  /** Minimum order size */
78
58
  minOrderSize: string;
79
59
  /** Maximum order size */
@@ -349,6 +329,25 @@ export interface MarketMetadata {
349
329
  totalQuoteVolumeLtd: string;
350
330
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
351
331
  totalTradeCountLtd: number;
332
+ /**
333
+ * The rolling 24h volumes split into their order-book and RFQ parts; absent
334
+ * while any candle in the window has no recorded split.
335
+ */
336
+ volume24hBySource?: Volume24hBySource | null;
337
+ }
338
+ /**
339
+ * A market's rolling 24h volume split by execution source: each total is the
340
+ * order-book part plus the RFQ part (decimal strings).
341
+ */
342
+ export interface Volume24hBySource {
343
+ /** Base-token volume filled on the order book in the last 24 hours */
344
+ orderBookBaseVolume: string;
345
+ /** Base-token volume filled by RFQ block trades in the last 24 hours */
346
+ rfqBaseVolume: string;
347
+ /** Quote-token volume filled on the order book in the last 24 hours; null when the 24h quote volume is unavailable */
348
+ orderBookQuoteVolume?: string | null;
349
+ /** Quote-token volume filled by RFQ block trades in the last 24 hours; null when the 24h quote volume is unavailable */
350
+ rfqQuoteVolume?: string | null;
352
351
  }
353
352
  /**
354
353
  * Exchange-wide life-to-date cumulative statistics across all trading pairs.
@@ -326,6 +326,16 @@ export interface UserTrade {
326
326
  liquidityRole: "MAKER" | "TAKER";
327
327
  /** Timestamp when the trade was executed (RFC 3339). Absent when none is recorded. */
328
328
  executedAt?: string;
329
+ /**
330
+ * The RFQ (block trade) this user's own order filled in. Absent on an
331
+ * order-book fill. Read the RFQ with `rfq.getRfq`.
332
+ */
333
+ rfqId?: string;
334
+ /**
335
+ * Set on a maker's RFQ fill only: the internal engine id of the quote
336
+ * version the maker's order rested for. Not the public `quoteId`.
337
+ */
338
+ rfqQuoteId?: string;
329
339
  }
330
340
  /**
331
341
  * Query parameters for getting user trades
@@ -602,23 +612,6 @@ export interface UserProfile {
602
612
  accountType: string;
603
613
  /** Whether the user can withdraw funds */
604
614
  canWithdraw: boolean;
605
- /**
606
- * Flat taker fee in basis points, echoed from a trading pair.
607
- *
608
- * @deprecated Not the rate you are charged: fees are tiered per account. Use
609
- * `fees.getMyFeeTier({ tradingPairId })` for your own rate. This field will
610
- * be removed in a later release.
611
- */
612
- takerFeeBps: number;
613
- /**
614
- * Flat maker fee in basis points (negative = rebate), echoed from a trading
615
- * pair.
616
- *
617
- * @deprecated Not the rate you are charged: fees are tiered per account. Use
618
- * `fees.getMyFeeTier({ tradingPairId })` for your own rate. This field will
619
- * be removed in a later release.
620
- */
621
- makerFeeBps: number;
622
615
  /** Account creation timestamp (ISO string) */
623
616
  createdAt: string;
624
617
  /** Additional taker fee in basis points contributed by the application (if any) */
@@ -33,10 +33,27 @@ export declare const RfqRequestTermsSchema: z.ZodObject<{
33
33
  leverage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
34
  marginMode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
35
  }, z.core.$strip>;
36
+ /** The taker's requested size priced against the public order book (RFQ-08). */
37
+ export declare const RfqBookComparisonSchema: z.ZodObject<{
38
+ vwap: z.ZodString;
39
+ grossVwap: z.ZodString;
40
+ asOfMs: z.ZodNumber;
41
+ levels: z.ZodNumber;
42
+ }, z.core.$strip>;
36
43
  /** One side of the taker's view: the allocation that would fill the quantity. */
37
44
  export declare const RfqSideViewSchema: z.ZodObject<{
38
45
  vwap: z.ZodString;
39
46
  availableQuantity: z.ZodString;
47
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
52
+ vwap: z.ZodString;
53
+ grossVwap: z.ZodString;
54
+ asOfMs: z.ZodNumber;
55
+ levels: z.ZodNumber;
56
+ }, z.core.$strip>>>;
40
57
  }, z.core.$strip>;
41
58
  /** The taker's current view of the quotes. */
42
59
  export declare const RfqViewSchema: z.ZodObject<{
@@ -44,12 +61,34 @@ export declare const RfqViewSchema: z.ZodObject<{
44
61
  bid: z.ZodOptional<z.ZodNullable<z.ZodObject<{
45
62
  vwap: z.ZodString;
46
63
  availableQuantity: z.ZodString;
64
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
69
+ vwap: z.ZodString;
70
+ grossVwap: z.ZodString;
71
+ asOfMs: z.ZodNumber;
72
+ levels: z.ZodNumber;
73
+ }, z.core.$strip>>>;
47
74
  }, z.core.$strip>>>;
48
75
  ask: z.ZodOptional<z.ZodNullable<z.ZodObject<{
49
76
  vwap: z.ZodString;
50
77
  availableQuantity: z.ZodString;
78
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
83
+ vwap: z.ZodString;
84
+ grossVwap: z.ZodString;
85
+ asOfMs: z.ZodNumber;
86
+ levels: z.ZodNumber;
87
+ }, z.core.$strip>>>;
51
88
  }, z.core.$strip>>>;
52
89
  asOfMs: z.ZodNumber;
90
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
91
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
53
92
  }, z.core.$strip>;
54
93
  /** One fill of an executed RFQ. */
55
94
  export declare const RfqFillSchema: z.ZodObject<{
@@ -57,6 +96,8 @@ export declare const RfqFillSchema: z.ZodObject<{
57
96
  price: z.ZodString;
58
97
  quantity: z.ZodString;
59
98
  fee: z.ZodString;
99
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
101
  }, z.core.$strip>;
61
102
  /** What an accepted RFQ executed. */
62
103
  export declare const RfqOutcomeSchema: z.ZodObject<{
@@ -68,7 +109,46 @@ export declare const RfqOutcomeSchema: z.ZodObject<{
68
109
  price: z.ZodString;
69
110
  quantity: z.ZodString;
70
111
  fee: z.ZodString;
112
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
114
  }, z.core.$strip>>;
115
+ allInVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
+ bookAtFill: z.ZodOptional<z.ZodNullable<z.ZodObject<{
117
+ vwap: z.ZodString;
118
+ grossVwap: z.ZodString;
119
+ asOfMs: z.ZodNumber;
120
+ levels: z.ZodNumber;
121
+ }, z.core.$strip>>>;
122
+ bookAtFillFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
123
+ }, z.core.$strip>;
124
+ /**
125
+ * One fill of your quote, as a maker. The fee parts are what the trade
126
+ * recorded as charged, unset until trade history has the fill.
127
+ */
128
+ export declare const RfqMakerFillSchema: z.ZodObject<{
129
+ executionId: z.ZodString;
130
+ price: z.ZodString;
131
+ quantity: z.ZodString;
132
+ fee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ }, z.core.$strip>;
136
+ /** What the taker's view showed on the accepted side when it accepted (RFQ-08). */
137
+ export declare const RfqAcceptanceRecordSchema: z.ZodObject<{
138
+ viewVersion: z.ZodNumber;
139
+ acceptedAtMs: z.ZodNumber;
140
+ vwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
+ availableQuantity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ monacoFeeCbps: z.ZodNumber;
144
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
145
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
146
+ vwap: z.ZodString;
147
+ grossVwap: z.ZodString;
148
+ asOfMs: z.ZodNumber;
149
+ levels: z.ZodNumber;
150
+ }, z.core.$strip>>>;
151
+ bookFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
72
152
  }, z.core.$strip>;
73
153
  /** A quoted side the venue refused; nothing is reserved for it. */
74
154
  export declare const RfqRefusedSideSchema: z.ZodObject<{
@@ -111,6 +191,9 @@ export declare const RfqMakerSelectionSchema: z.ZodObject<{
111
191
  capacity: z.ZodString;
112
192
  }, z.core.$strip>>>;
113
193
  lastLookDeadlineAtMs: z.ZodNumber;
194
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
195
+ maxBuilderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
196
+ estimatedNet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
197
  }, z.core.$strip>;
115
198
  /**
116
199
  * Authoritative RFQ status. A taker sees `view` and `outcome`; a maker sees
@@ -138,12 +221,34 @@ export declare const RfqStatusSchema: z.ZodObject<{
138
221
  bid: z.ZodOptional<z.ZodNullable<z.ZodObject<{
139
222
  vwap: z.ZodString;
140
223
  availableQuantity: z.ZodString;
224
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
228
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
229
+ vwap: z.ZodString;
230
+ grossVwap: z.ZodString;
231
+ asOfMs: z.ZodNumber;
232
+ levels: z.ZodNumber;
233
+ }, z.core.$strip>>>;
141
234
  }, z.core.$strip>>>;
142
235
  ask: z.ZodOptional<z.ZodNullable<z.ZodObject<{
143
236
  vwap: z.ZodString;
144
237
  availableQuantity: z.ZodString;
238
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
+ estimatedMonacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
240
+ estimatedBuilderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
241
+ estimatedTotalFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
243
+ vwap: z.ZodString;
244
+ grossVwap: z.ZodString;
245
+ asOfMs: z.ZodNumber;
246
+ levels: z.ZodNumber;
247
+ }, z.core.$strip>>>;
145
248
  }, z.core.$strip>>>;
146
249
  asOfMs: z.ZodNumber;
250
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
251
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
147
252
  }, z.core.$strip>>>;
148
253
  ownQuote: z.ZodOptional<z.ZodNullable<z.ZodObject<{
149
254
  rfqId: z.ZodString;
@@ -178,6 +283,9 @@ export declare const RfqStatusSchema: z.ZodObject<{
178
283
  capacity: z.ZodString;
179
284
  }, z.core.$strip>>>;
180
285
  lastLookDeadlineAtMs: z.ZodNumber;
286
+ monacoFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
287
+ maxBuilderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
288
+ estimatedNet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
289
  }, z.core.$strip>>>;
182
290
  ownLatestVersion: z.ZodNumber;
183
291
  ownQuoteWithdrawn: z.ZodBoolean;
@@ -190,9 +298,43 @@ export declare const RfqStatusSchema: z.ZodObject<{
190
298
  price: z.ZodString;
191
299
  quantity: z.ZodString;
192
300
  fee: z.ZodString;
301
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
303
  }, z.core.$strip>>;
304
+ allInVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
+ bookAtFill: z.ZodOptional<z.ZodNullable<z.ZodObject<{
306
+ vwap: z.ZodString;
307
+ grossVwap: z.ZodString;
308
+ asOfMs: z.ZodNumber;
309
+ levels: z.ZodNumber;
310
+ }, z.core.$strip>>>;
311
+ bookAtFillFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
194
312
  }, z.core.$strip>>>;
195
313
  durableSequence: z.ZodNumber;
314
+ ownFills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
315
+ executionId: z.ZodString;
316
+ price: z.ZodString;
317
+ quantity: z.ZodString;
318
+ fee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
+ monacoFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
320
+ builderFee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
321
+ }, z.core.$strip>>>>;
322
+ acceptance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
323
+ viewVersion: z.ZodNumber;
324
+ acceptedAtMs: z.ZodNumber;
325
+ vwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
326
+ grossVwap: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ availableQuantity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ monacoFeeCbps: z.ZodNumber;
329
+ builderFeeCbps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
330
+ book: z.ZodOptional<z.ZodNullable<z.ZodObject<{
331
+ vwap: z.ZodString;
332
+ grossVwap: z.ZodString;
333
+ asOfMs: z.ZodNumber;
334
+ levels: z.ZodNumber;
335
+ }, z.core.$strip>>>;
336
+ bookFullSize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
337
+ }, z.core.$strip>>>;
196
338
  }, z.core.$strip>;
197
339
  /** A market RFQ is offered on. */
198
340
  export declare const RfqMarketCapabilitySchema: z.ZodObject<{
@@ -236,6 +378,9 @@ export type RfqSideView = z.infer<typeof RfqSideViewSchema>;
236
378
  export type RfqView = z.infer<typeof RfqViewSchema>;
237
379
  export type RfqFill = z.infer<typeof RfqFillSchema>;
238
380
  export type RfqOutcome = z.infer<typeof RfqOutcomeSchema>;
381
+ export type RfqMakerFill = z.infer<typeof RfqMakerFillSchema>;
382
+ export type RfqBookComparison = z.infer<typeof RfqBookComparisonSchema>;
383
+ export type RfqAcceptanceRecord = z.infer<typeof RfqAcceptanceRecordSchema>;
239
384
  export type RfqQuoteVersion = z.infer<typeof RfqQuoteVersionSchema>;
240
385
  export type RfqRefusedSide = z.infer<typeof RfqRefusedSideSchema>;
241
386
  export type RfqMakerSelection = z.infer<typeof RfqMakerSelectionSchema>;
@@ -46,11 +46,35 @@ export const RfqRequestTermsSchema = z.object({
46
46
  /** Taker only: the margin mode given on create (perpetuals). */
47
47
  marginMode: z.string().nullish(),
48
48
  });
49
+ /** The taker's requested size priced against the public order book (RFQ-08). */
50
+ export const RfqBookComparisonSchema = z.object({
51
+ /** All-in book VWAP: the cost per unit when buying, the net proceeds per unit when selling. */
52
+ vwap: z.string(),
53
+ /** The book VWAP before fees. */
54
+ grossVwap: z.string(),
55
+ /** When the book snapshot was read, Unix milliseconds. */
56
+ asOfMs: z.number(),
57
+ /** Price levels the size walked. */
58
+ levels: z.number(),
59
+ });
49
60
  /** One side of the taker's view: the allocation that would fill the quantity. */
50
61
  export const RfqSideViewSchema = z.object({
51
62
  /** All-in volume-weighted price, fees included. */
52
63
  vwap: z.string(),
53
64
  availableQuantity: z.string(),
65
+ /** The volume-weighted price before fees. */
66
+ grossVwap: z.string().nullish(),
67
+ /** Estimated Monaco taker fee on availableQuantity, in the quote asset. */
68
+ estimatedMonacoFee: z.string().nullish(),
69
+ /** Estimated builder fee on availableQuantity, in the quote asset. */
70
+ estimatedBuilderFee: z.string().nullish(),
71
+ /** Estimated total taker fee on availableQuantity, in the quote asset. */
72
+ estimatedTotalFee: z.string().nullish(),
73
+ /**
74
+ * The requested size on the public order book, for comparison. Display
75
+ * only; absent when a fresh book snapshot cannot fill the whole size.
76
+ */
77
+ book: RfqBookComparisonSchema.nullish(),
54
78
  });
55
79
  /** The taker's current view of the quotes. */
56
80
  export const RfqViewSchema = z.object({
@@ -59,13 +83,20 @@ export const RfqViewSchema = z.object({
59
83
  bid: RfqSideViewSchema.nullish(),
60
84
  ask: RfqSideViewSchema.nullish(),
61
85
  asOfMs: z.number(),
86
+ /** The taker's Monaco fee rate in this view, in centi-bps. */
87
+ monacoFeeCbps: z.number().nullish(),
88
+ /** The taker's builder fee rate in this view, in centi-bps. */
89
+ builderFeeCbps: z.number().nullish(),
62
90
  });
63
91
  /** One fill of an executed RFQ. */
64
92
  export const RfqFillSchema = z.object({
65
93
  executionId: z.string(),
66
94
  price: z.string(),
67
95
  quantity: z.string(),
96
+ /** The taker's whole fee on this fill: monacoFee plus builderFee. */
68
97
  fee: z.string(),
98
+ monacoFee: z.string().nullish(),
99
+ builderFee: z.string().nullish(),
69
100
  });
70
101
  /** What an accepted RFQ executed. */
71
102
  export const RfqOutcomeSchema = z.object({
@@ -73,6 +104,59 @@ export const RfqOutcomeSchema = z.object({
73
104
  unfilledQuantity: z.string(),
74
105
  vwap: z.string(),
75
106
  fills: z.array(RfqFillSchema),
107
+ /**
108
+ * Your all-in VWAP: notional plus your whole fee for a buy, minus it for a
109
+ * sell, over the executed quantity. Unset when nothing filled.
110
+ */
111
+ allInVwap: z.string().nullish(),
112
+ /**
113
+ * Post-fill benchmark: the executed quantity priced against the public
114
+ * order book on your side, at the rates frozen at acceptance, read when the
115
+ * outcome was recorded. Display only.
116
+ */
117
+ bookAtFill: RfqBookComparisonSchema.nullish(),
118
+ /** Whether a fresh book snapshot filled the executed quantity then; absent when none was fresh. */
119
+ bookAtFillFullSize: z.boolean().nullish(),
120
+ });
121
+ /**
122
+ * One fill of your quote, as a maker. The fee parts are what the trade
123
+ * recorded as charged, unset until trade history has the fill.
124
+ */
125
+ export const RfqMakerFillSchema = z.object({
126
+ executionId: z.string(),
127
+ price: z.string(),
128
+ quantity: z.string(),
129
+ /** Your whole fee as charged: monacoFee plus builderFee; negative for a net rebate. */
130
+ fee: z.string().nullish(),
131
+ /** Your Monaco maker fee as charged; negative is a rebate. */
132
+ monacoFee: z.string().nullish(),
133
+ /** The builder add-on your frontend charged (0 when none). */
134
+ builderFee: z.string().nullish(),
135
+ });
136
+ /** What the taker's view showed on the accepted side when it accepted (RFQ-08). */
137
+ export const RfqAcceptanceRecordSchema = z.object({
138
+ /** The view version accepted. */
139
+ viewVersion: z.number(),
140
+ /** When the taker accepted, Unix milliseconds. */
141
+ acceptedAtMs: z.number(),
142
+ /** All-in VWAP shown for the accepted side, fees included. */
143
+ vwap: z.string().nullish(),
144
+ /** The VWAP shown before fees. */
145
+ grossVwap: z.string().nullish(),
146
+ /** Quantity the shown allocation filled. */
147
+ availableQuantity: z.string().nullish(),
148
+ /** The Monaco fee rate frozen at acceptance, in centi-bps. */
149
+ monacoFeeCbps: z.number(),
150
+ /** The builder fee rate frozen at acceptance, in centi-bps. */
151
+ builderFeeCbps: z.number().nullish(),
152
+ /**
153
+ * The requested size on the public order book when the taker accepted: the
154
+ * pair's latest snapshot at most 500 ms old, at the rates frozen at
155
+ * acceptance. `asOfMs` identifies the snapshot.
156
+ */
157
+ book: RfqBookComparisonSchema.nullish(),
158
+ /** Whether that snapshot filled the whole size; absent when no snapshot at most 500 ms old was held. */
159
+ bookFullSize: z.boolean().nullish(),
76
160
  });
77
161
  /** A quoted side the venue refused; nothing is reserved for it. */
78
162
  export const RfqRefusedSideSchema = z.object({
@@ -111,6 +195,20 @@ export const RfqMakerSelectionSchema = z.object({
111
195
  quantity: z.string(),
112
196
  frozenTerms: RfqQuoteTermsResponseSchema.nullish(),
113
197
  lastLookDeadlineAtMs: z.number(),
198
+ /** Your Monaco maker fee rate in centi-bps, frozen at acceptance; negative for a rebate. */
199
+ monacoFeeCbps: z.number().nullish(),
200
+ /**
201
+ * The MOST your frontend's builder add-on charges on this fill, in centi-bps:
202
+ * the rate stored on your quote order. A fill charges it or nothing, never
203
+ * more; an IMPROVE re-places the quote at the rate configured then.
204
+ */
205
+ maxBuilderFeeCbps: z.number().nullish(),
206
+ /**
207
+ * Estimated net at the selected quantity and frozen price, in the quote
208
+ * asset, at monacoFeeCbps plus the maximum add-on: the least you receive
209
+ * when selling, the most you pay when buying.
210
+ */
211
+ estimatedNet: z.string().nullish(),
114
212
  });
115
213
  /**
116
214
  * Authoritative RFQ status. A taker sees `view` and `outcome`; a maker sees
@@ -130,6 +228,10 @@ export const RfqStatusSchema = z.object({
130
228
  ownQuoteWithdrawn: z.boolean(),
131
229
  outcome: RfqOutcomeSchema.nullish(),
132
230
  durableSequence: z.number(),
231
+ /** Maker only: your own fills once the RFQ settled, never another maker's. */
232
+ ownFills: z.array(RfqMakerFillSchema).nullish(),
233
+ /** Taker only: what your view showed when you accepted. */
234
+ acceptance: RfqAcceptanceRecordSchema.nullish(),
133
235
  });
134
236
  /** A market RFQ is offered on. */
135
237
  export const RfqMarketCapabilitySchema = z.object({
@@ -1,4 +1,5 @@
1
1
  import type { Address, PublicClient, TransactionReceipt, WalletClient } from "viem";
2
+ import type { AnalyticsAPI } from "../analytics";
2
3
  import type { ApplicationsAPI } from "../applications";
3
4
  import type { AuthAPI, AuthState } from "../auth/index";
4
5
  import type { BuildercodesAPI } from "../buildercodes";
@@ -134,10 +135,12 @@ export interface MonacoSDK {
134
135
  pulse: PulseAPI;
135
136
  /** Public region status API: whether Monaco is available in the caller's region */
136
137
  compliance: ComplianceAPI;
138
+ /** Public explorer analytics API: protocol totals and series, market volume, treasury net fees */
139
+ analytics: AnalyticsAPI;
137
140
  /** Orderbook REST API for fetching orderbook snapshots */
138
141
  orderbook: {
139
142
  getOrderbook: (tradingPairId: string, options?: {
140
- /** Number of price levels to return (max 100). Defaults to 10. */
143
+ /** Number of price levels per side (max 1000). Defaults to 10. Above 100 the snapshot comes from the market-data book and carries `bookSeq`. */
141
144
  depth?: number;
142
145
  /** Trading mode: 'Spot' or 'Margin'. Defaults to 'Spot'. */
143
146
  tradingMode?: TradingMode;
@@ -20,7 +20,7 @@ export interface TradingAPI extends BaseAPI {
20
20
  * @param quantity - Order quantity as string
21
21
  * @param price - Order price as string
22
22
  * @param options - Optional parameters for the limit order
23
- * @param options.tradingMode - Trading mode (e.g., "SPOT")
23
+ * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
24
24
  * @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
25
25
  * @returns Promise resolving to the order result
26
26
  */
@@ -42,6 +42,7 @@ export interface TradingAPI extends BaseAPI {
42
42
  riskBucketId?: string;
43
43
  /** Initial order budget; unfilled funds do not back the isolated position. */
44
44
  riskBucketCollateral?: string;
45
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
45
46
  strategyKey?: string;
46
47
  /** @deprecated Order side is authoritative. */
47
48
  positionSide?: PositionSide;
@@ -84,7 +85,7 @@ export interface TradingAPI extends BaseAPI {
84
85
  * @param side - Order side ("BUY" or "SELL")
85
86
  * @param quantity - Order quantity as string
86
87
  * @param options - Optional parameters for the market order
87
- * @param options.tradingMode - Trading mode (e.g., "SPOT")
88
+ * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
88
89
  * @param options.slippageTolerance - Slippage tolerance as decimal (e.g., 0.01 for 1%, 0 for best price only, undefined for unlimited slippage)
89
90
  * @returns Promise resolving to the order result
90
91
  */
@@ -104,6 +105,7 @@ export interface TradingAPI extends BaseAPI {
104
105
  riskBucketId?: string;
105
106
  /** Initial order budget; unfilled funds do not back the isolated position. */
106
107
  riskBucketCollateral?: string;
108
+ /** Names the margin account by its sub-account key, like `marginAccountId` (`default` is the default account). */
107
109
  strategyKey?: string;
108
110
  /** @deprecated Order side is authoritative. */
109
111
  positionSide?: PositionSide;
@@ -154,7 +156,9 @@ export interface TradingAPI extends BaseAPI {
154
156
  */
155
157
  listConditionalOrders(params?: ListConditionalOrdersParams): Promise<ListConditionalOrdersResponse>;
156
158
  /**
157
- * Batch cancels specific orders by their IDs.
159
+ * Batch cancels specific orders by their IDs. Every ID gets one result, in
160
+ * request order; an ID that is not one of your live orders fails with
161
+ * `ORDER_NOT_FOUND`.
158
162
  * @param orderIds - Array of order IDs to cancel
159
163
  * @returns Promise resolving to the batch cancellation result
160
164
  */
@@ -164,6 +164,17 @@ export interface Order {
164
164
  * Wire: `placementMakerFeeBps`.
165
165
  */
166
166
  placementMakerFeeBps?: string;
167
+ /**
168
+ * The RFQ (block trade) this order belongs to; set on RFQ orders only
169
+ * (`origin` `RFQ`). Read the RFQ with `rfq.getRfq`. Wire: `rfqId`.
170
+ */
171
+ rfqId?: string;
172
+ /**
173
+ * Set on a maker's RFQ quote order only: the internal engine id of the quote
174
+ * version the order rested for. Not the public `quoteId`; the taker's order,
175
+ * which fills from several quotes, carries none. Wire: `rfqQuoteId`.
176
+ */
177
+ rfqQuoteId?: string;
167
178
  /**
168
179
  * Opaque, compare-only revision counter for this order's state: a strictly
169
180
  * higher value is strictly newer state for that order, and equal values
@@ -284,7 +284,13 @@ export interface BatchCancelResult {
284
284
  error?: BatchCancelError;
285
285
  }
286
286
  /**
287
- * Response from batch cancelling orders
287
+ * Response from batch cancelling orders.
288
+ *
289
+ * For `batchCancel`, `results` holds one entry per requested ID, in request
290
+ * order (a repeated ID is answered at each occurrence), and
291
+ * `totalRequested === totalCancelled + totalFailed === results.length`. An ID
292
+ * that is not one of your live orders (unknown, another user's, or already
293
+ * terminal) is a failed entry with code `ORDER_NOT_FOUND`.
288
294
  */
289
295
  export interface BatchCancelOrdersResponse {
290
296
  /** Total number of orders requested to cancel */
@@ -371,7 +377,7 @@ export interface BatchCreateOrderParams {
371
377
  price?: string;
372
378
  /** Order quantity */
373
379
  quantity: string;
374
- /** Trading mode (defaults to "SPOT") */
380
+ /** Trading mode: "SPOT" or "MARGIN". Omit it to use the trading pair market type. */
375
381
  tradingMode?: TradingMode;
376
382
  /** Maximum slippage for market orders as decimal (e.g., 0.01 for 1%) */
377
383
  slippageTolerance?: number;
@@ -684,7 +690,7 @@ export interface CreateTwapOrderOptions {
684
690
  executionStyle?: "TAKER" | "PASSIVE";
685
691
  /** Whether the TWAP parent is reduce-only (margin only). Child orders inherit it and clamp to the live position. */
686
692
  reduceOnly?: boolean;
687
- /** Trading mode: "SPOT" or "MARGIN" (default: "SPOT"). */
693
+ /** Trading mode: "SPOT" or "MARGIN". Omit it to use the trading pair market type; a mode that does not match the pair is rejected. */
688
694
  tradingMode?: TradingMode;
689
695
  /** Margin account UUID for margin TWAP orders. Resolved once at creation and reused by every child order. */
690
696
  marginAccountId?: string;