@0xmonaco/types 1.0.59 → 1.0.60

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.
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./contracts";
12
12
  export * from "./delegated-agents";
13
13
  export * from "./faucet";
14
14
  export * from "./fees";
15
+ export * from "./managed-markets";
15
16
  export * from "./margin-accounts";
16
17
  export * from "./market";
17
18
  export * from "./pitpass";
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ export * from "./contracts";
13
13
  export * from "./delegated-agents";
14
14
  export * from "./faucet";
15
15
  export * from "./fees";
16
+ export * from "./managed-markets";
16
17
  export * from "./margin-accounts";
17
18
  export * from "./market";
18
19
  export * from "./pitpass";
@@ -0,0 +1,63 @@
1
+ import type { BaseAPI } from "../api";
2
+ /** Exact uint64 decimal text. Never convert generation or revision through Number. */
3
+ export type ManagedMarketFence = string;
4
+ export type ManagedMarketPhase = "pending" | "validating" | "registering" | "warming" | "activating" | "live" | "failed" | (string & {});
5
+ export interface ManagedMarketLease {
6
+ launchId: string;
7
+ ownerId: string;
8
+ generation: ManagedMarketFence;
9
+ quoteRevision: ManagedMarketFence;
10
+ expiresAt: string;
11
+ refreshIntervalMs: number;
12
+ phase: ManagedMarketPhase;
13
+ }
14
+ export interface ManagedMarketAssignment {
15
+ launchId: string;
16
+ tradingPairId: string;
17
+ symbol: string;
18
+ phase: ManagedMarketPhase;
19
+ refreshIntervalMs: number;
20
+ allocationUsdc: string;
21
+ lease?: ManagedMarketLease;
22
+ /** False assignments remain expected inventory but cannot claim or quote. */
23
+ quoteEnabled: boolean;
24
+ }
25
+ export interface ListManagedMarketAssignmentsRequest {
26
+ page?: number;
27
+ pageSize?: number;
28
+ }
29
+ export interface ListManagedMarketAssignmentsResponse {
30
+ items: ManagedMarketAssignment[];
31
+ total: number;
32
+ page: number;
33
+ pageSize: number;
34
+ inventoryObservedAt: string;
35
+ }
36
+ export interface ClaimManagedMarketLeaseRequest {
37
+ ownerId: string;
38
+ /** Required for renewal; omit for initial claim or after expiry. */
39
+ expectedGeneration?: ManagedMarketFence;
40
+ }
41
+ export interface RefreshManagedMarketQuotesRequest {
42
+ ownerId: string;
43
+ generation: ManagedMarketFence;
44
+ quoteRevision: ManagedMarketFence;
45
+ }
46
+ export interface ManagedMarketQuoteStatus {
47
+ launchId: string;
48
+ generation: ManagedMarketFence;
49
+ quoteRevision: ManagedMarketFence;
50
+ phase: ManagedMarketPhase;
51
+ bidNotional: string;
52
+ askNotional: string;
53
+ oracleReady: boolean;
54
+ readyToActivate: boolean;
55
+ observedAt: string;
56
+ }
57
+ /** Wallet session identity selects assignments; delegated sessions are unsupported. ownerId only fences processes. */
58
+ export interface ManagedMarketsAPI extends BaseAPI {
59
+ listAssignments(request?: ListManagedMarketAssignmentsRequest): Promise<ListManagedMarketAssignmentsResponse>;
60
+ claimLease(launchId: string, request: ClaimManagedMarketLeaseRequest): Promise<ManagedMarketLease>;
61
+ /** On an unknown outcome, reconcile through claimLease before advancing revision. */
62
+ refreshQuotes(launchId: string, request: RefreshManagedMarketQuotesRequest): Promise<ManagedMarketQuoteStatus>;
63
+ }
File without changes
@@ -251,9 +251,25 @@ export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskReques
251
251
  strategyKey?: string;
252
252
  selectedTradingPairIds?: never;
253
253
  };
254
+ /**
255
+ * Preview an order against the account's cross risk bucket, or the
256
+ * deterministic bucket a first cross order would create. A cross preview names
257
+ * no pairs: cross scope is derived from trading — a pair joins the bucket when
258
+ * a cross order on it succeeds and, once its positions close, stays listed
259
+ * until a later successful cross order on another pair reconciles the bucket —
260
+ * so the previewed pair is in scope by construction. Read the derived scope
261
+ * the preview ran against from the response's `selectedTradingPairIds`.
262
+ */
254
263
  export type SimulateCrossRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
255
264
  marginMode: "CROSS";
256
- selectedTradingPairIds: string[];
265
+ /**
266
+ * Removed. This used to declare the scope the preview ran against (required,
267
+ * containing `tradingPairId`, covering every open cross position) while the
268
+ * server never priced anything from it. The server now ignores the wire
269
+ * field; the SDK no longer sends it and rejects it here so a caller learns at
270
+ * compile time that it does nothing.
271
+ */
272
+ selectedTradingPairIds?: never;
257
273
  strategyKey?: never;
258
274
  };
259
275
  export type SimulateRiskBucketOrderRiskRequest = SimulateIsolatedRiskBucketOrderRiskRequest | SimulateCrossRiskBucketOrderRiskRequest;
@@ -264,6 +280,16 @@ export interface SimulateOrderRiskResponse {
264
280
  strategyKey?: string;
265
281
  riskBucketId?: string;
266
282
  marginMode?: MarginMode;
283
+ /**
284
+ * The cross scope the preview ran against; absent for isolated previews and
285
+ * never a caller's list. From `simulateRiskBucketOrderRisk` in CROSS mode it
286
+ * is the DERIVED scope: the active cross bucket's recorded pairs (a pair
287
+ * whose positions have closed stays recorded until a later cross order on
288
+ * another pair reconciles the bucket), every pair with an open position in
289
+ * that bucket, and the previewed pair — the previewed pair alone before the
290
+ * first cross order. `simulateOrderRisk` and `simulateParentMarginOrderRisk`
291
+ * report the recorded pairs plus the previewed pair.
292
+ */
267
293
  selectedTradingPairIds?: string[];
268
294
  equityAfter: string;
269
295
  initialMarginRequiredAfter: string;
@@ -5,6 +5,7 @@ import type { BuildercodesAPI } from "../buildercodes";
5
5
  import type { DelegatedAgentsAPI } from "../delegated-agents";
6
6
  import type { FaucetAPI } from "../faucet";
7
7
  import type { FeesAPI } from "../fees";
8
+ import type { ManagedMarketsAPI } from "../managed-markets";
8
9
  import type { MarginAccountsAPI } from "../margin-accounts";
9
10
  import type { MarketAPI } from "../market";
10
11
  import type { PitpassAPI } from "../pitpass";
@@ -118,6 +119,7 @@ export interface MonacoSDK {
118
119
  faucet: FaucetAPI;
119
120
  /** Deposit-address registration (sweeper) API; requires a session */
120
121
  sweeper: SweeperAPI;
122
+ managedMarkets: ManagedMarketsAPI;
121
123
  /** Public whitelist (waitlist) submission API */
122
124
  whitelist: WhitelistAPI;
123
125
  /** Profile operations API */
@@ -260,4 +260,4 @@ export interface TradingAPI extends BaseAPI {
260
260
  }
261
261
  export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, ListedOrderType, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState, } from "./orders";
262
262
  export { ORDER_STATUS_VALUES } from "./orders";
263
- export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder, UpdatedFields, } from "./responses";
263
+ export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TriggeredOrderSummary, TwapOrder, UpdatedFields, } from "./responses";
@@ -112,6 +112,19 @@ export interface Order {
112
112
  conditional?: ConditionalOrder;
113
113
  /** Stable cause when status is CANCELLED */
114
114
  terminalReason?: OrderTerminalReason;
115
+ /**
116
+ * Present only on an order the engine placed for a take-profit or
117
+ * stop-loss trigger: the conditional order that fired it — the reverse of
118
+ * `ConditionalOrder.triggeredOrderId`, so a close in order history can be
119
+ * attributed to the TP/SL that produced it without scanning the
120
+ * conditional list (0XM-2745).
121
+ *
122
+ * Absent on every order you placed yourself, on TWAP slice children (those
123
+ * carry `parentOrderId` on the wire), and on triggered closes written before
124
+ * the field existed — there is no backfill, so a missing value on an older
125
+ * close means unknown, not "placed by hand". Wire: `conditionalOrderId`.
126
+ */
127
+ conditionalOrderId?: string;
115
128
  /**
116
129
  * Opaque, compare-only revision counter for this order's state: a strictly
117
130
  * higher value is strictly newer state for that order, and equal values
@@ -4,7 +4,7 @@
4
4
  * Response types for trading operations.
5
5
  */
6
6
  import type { MarginMode } from "../margin-accounts";
7
- import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
7
+ import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
8
8
  /**
9
9
  * Match result information for order execution.
10
10
  * Contains detailed information about trades, fills, and execution quality.
@@ -446,6 +446,46 @@ export interface ListConditionalOrdersParams {
446
446
  page?: number;
447
447
  pageSize?: number;
448
448
  }
449
+ /**
450
+ * What the order a conditional fired into has done so far — a projection of
451
+ * that order's own row, read at request time (0XM-2744).
452
+ *
453
+ * Trigger price and fill price are different numbers: the trigger fires on the
454
+ * mark, the leg then trades against the book, so a MARKET leg fills at least
455
+ * the half-spread (plus its own impact) away from `triggerPrice`, and a LIMIT
456
+ * leg may rest or fill only partly. Every value here is numerically equal to
457
+ * what `getOrder` returns for the same order, but the printed decimal scale
458
+ * can differ between the two reads (this summary is served from the database,
459
+ * `getOrder` from the cache), so compare numerically rather than byte for byte.
460
+ */
461
+ export interface TriggeredOrderSummary {
462
+ /** The triggered order's id — the same value as the parent's `triggeredOrderId`. */
463
+ orderId: string;
464
+ /**
465
+ * The triggered order's CURRENT status: `SETTLED` for a leg that filled in
466
+ * full (a fully filled order is written as `SETTLED`, so `FILLED` does not
467
+ * appear here); `SUBMITTED` / `PARTIALLY_FILLED` for a LIMIT leg still
468
+ * resting; `CANCELLED` when the protective band left nothing fillable (see
469
+ * `terminalReason`); `EXPIRED` for a LIMIT leg that lapsed. Never
470
+ * `REJECTED`: a close the engine refused leaves the conditional `FAILED`
471
+ * with no `triggeredOrderId`, so no summary exists for it.
472
+ */
473
+ status: OrderStatus;
474
+ /** Quantity filled so far, in base units; `"0"` until it fills. */
475
+ filledQuantity: string;
476
+ /**
477
+ * Volume-weighted average fill price. Compare with the parent's
478
+ * `triggerPrice`: the gap is the half-spread plus the order's own market
479
+ * impact. Absent until the first fill.
480
+ */
481
+ averageFillPrice?: string;
482
+ /** Total taker fees paid, in quote units. Absent until it fills. */
483
+ totalTakerFees?: string;
484
+ /** When the order reached FILLED (ISO 8601). Absent otherwise. */
485
+ filledAt?: string;
486
+ /** Stable cause when `status` is `CANCELLED`, same vocabulary as `Order.terminalReason`. */
487
+ terminalReason?: OrderTerminalReason;
488
+ }
449
489
  export interface ConditionalOrder {
450
490
  conditionalOrderId: string;
451
491
  tradingPairId: string;
@@ -496,6 +536,17 @@ export interface ConditionalOrder {
496
536
  * zero. Wire: `version`.
497
537
  */
498
538
  version?: number;
539
+ /**
540
+ * The execution outcome of the order this conditional fired into
541
+ * (`triggeredOrderId`) — status, filled quantity, average fill price, fees
542
+ * and fill time — read from that order at request time (0XM-2744).
543
+ *
544
+ * Present only when `state` is `TRIGGERED` and the triggered order could be
545
+ * read. Absent while waiting on the trigger, on the `conditional_orders`
546
+ * WebSocket frames (snapshot and live), and in the rare case the close
547
+ * cannot be read. Wire: `triggeredOrder`.
548
+ */
549
+ triggeredOrder?: TriggeredOrderSummary;
499
550
  }
500
551
  export interface ListConditionalOrdersResponse {
501
552
  orders: ConditionalOrder[];
@@ -124,7 +124,13 @@ export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
124
124
  }, z.core.$strict>;
125
125
  }, z.core.$strip>;
126
126
  export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
127
- request: z.ZodUnion<readonly [z.ZodObject<{
127
+ request: z.ZodPipe<z.ZodObject<{
128
+ marginMode: z.ZodOptional<z.ZodEnum<{
129
+ ISOLATED: "ISOLATED";
130
+ CROSS: "CROSS";
131
+ }>>;
132
+ selectedTradingPairIds: z.ZodOptional<z.ZodUnknown>;
133
+ }, z.core.$loose>, z.ZodUnion<readonly [z.ZodObject<{
128
134
  side: z.ZodEnum<{
129
135
  BUY: "BUY";
130
136
  SELL: "SELL";
@@ -167,7 +173,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
167
173
  leverage: z.ZodOptional<z.ZodString>;
168
174
  reduceOnly: z.ZodOptional<z.ZodBoolean>;
169
175
  marginMode: z.ZodLiteral<"CROSS">;
170
- selectedTradingPairIds: z.ZodArray<z.ZodUUID>;
176
+ selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
171
177
  strategyKey: z.ZodOptional<z.ZodNever>;
172
- }, z.core.$strict>]>;
178
+ }, z.core.$strict>]>>;
173
179
  }, z.core.$strip>;
@@ -47,7 +47,6 @@ const RiskBucketRequestSchema = z.object({
47
47
  tradingPairId: UUIDSchema,
48
48
  strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
49
49
  });
50
- const SelectedCrossTradingPairIdsSchema = z.array(UUIDSchema).min(1, "selectedTradingPairIds is required for CROSS risk buckets");
51
50
  const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
52
51
  marginMode: z.literal("ISOLATED").optional(),
53
52
  selectedTradingPairIds: z.never().optional(),
@@ -56,11 +55,16 @@ const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
56
55
  // stays strict-rejected (no per-position margin to commit to).
57
56
  applyToPositionMargin: z.boolean().optional(),
58
57
  });
59
- // Simulation still declares the scope it wants previewed: a preview of a
60
- // bucket that may not exist yet has nothing recorded to read from.
61
- const CrossRiskBucketScopeSchema = z.object({
58
+ // A cross preview names no pairs. Cross scope is derived from trading, so a
59
+ // preview has nothing to declare; `selectedTradingPairIds` used to be REQUIRED
60
+ // here (non-empty, containing `tradingPairId`, covering every open cross
61
+ // position) while the server never priced anything from it. The server now
62
+ // ignores it and this schema rejects it, so the caller learns it does nothing
63
+ // rather than believing it took effect. `tradingPairId` stays required: it is
64
+ // the pair being previewed, not a scope declaration.
65
+ const CrossRiskBucketSimulateRequestSchema = z.object({
62
66
  marginMode: z.literal("CROSS"),
63
- selectedTradingPairIds: SelectedCrossTradingPairIdsSchema,
67
+ selectedTradingPairIds: z.never().optional(),
64
68
  strategyKey: z.never().optional(),
65
69
  });
66
70
  // A cross transfer-in names no pairs. Cross scope is derived from trading, so
@@ -83,7 +87,8 @@ export const TransferCollateralToParentMarginAccountSchema = z.object({
83
87
  });
84
88
  // Named ahead of the union: a union of two strict members collapses every
85
89
  // mismatch into a single "Invalid input" on `request`, which would hide the one
86
- // mistake this schema most needs to name.
90
+ // mistake this schema most needs to name — in EVERY mode, since the isolated
91
+ // member is strict too and the server names the field there as well.
87
92
  const CrossTransferNamesNoPairsSchema = z
88
93
  .object({
89
94
  marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
@@ -91,13 +96,16 @@ const CrossTransferNamesNoPairsSchema = z
91
96
  })
92
97
  .loose()
93
98
  .superRefine((request, ctx) => {
94
- if (request.marginMode === "CROSS" && request.selectedTradingPairIds !== undefined) {
95
- ctx.addIssue({
96
- code: "custom",
97
- path: ["selectedTradingPairIds"],
98
- message: "selectedTradingPairIds is not accepted on a CROSS transfer: cross scope is derived from trading, so a funding call has nothing to declare",
99
- });
99
+ if (request.selectedTradingPairIds === undefined) {
100
+ return;
100
101
  }
102
+ ctx.addIssue({
103
+ code: "custom",
104
+ path: ["selectedTradingPairIds"],
105
+ message: request.marginMode === "CROSS"
106
+ ? "selectedTradingPairIds is not accepted on a CROSS transfer: cross scope is derived from trading, so a funding call has nothing to declare"
107
+ : "selectedTradingPairIds is not supported for ISOLATED risk buckets",
108
+ });
101
109
  });
102
110
  export const TransferCollateralToRiskBucketSchema = z.object({
103
111
  request: CrossTransferNamesNoPairsSchema.pipe(z.union([
@@ -148,14 +156,33 @@ const SimulateOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.strict
148
156
  const SimulateIsolatedRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(IsolatedRiskBucketRequestSchema)
149
157
  .strict()
150
158
  .superRefine(validateOneWaySimulationFields);
151
- const SimulateCrossRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(CrossRiskBucketScopeSchema)
159
+ const SimulateCrossRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(CrossRiskBucketSimulateRequestSchema)
152
160
  .strict()
153
- .superRefine(validateOneWaySimulationFields)
154
- .refine((data) => data.selectedTradingPairIds.includes(data.tradingPairId), {
155
- message: "tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",
156
- path: ["selectedTradingPairIds"],
157
- });
158
- const SimulateRiskBucketOrderRiskRequestSchema = z.union([SimulateIsolatedRiskBucketOrderRiskRequestSchema, SimulateCrossRiskBucketOrderRiskRequestSchema]);
161
+ .superRefine(validateOneWaySimulationFields);
162
+ // Named ahead of the union for the same reason `CrossTransferNamesNoPairsSchema`
163
+ // is: a union of two strict members collapses every mismatch into a single
164
+ // "Invalid input" on `request`, which would hide the one mistake this schema
165
+ // most needs to name — in every mode, with the server's own wording for
166
+ // ISOLATED (where the field never applied).
167
+ const CrossSimulateNamesNoPairsSchema = z
168
+ .object({
169
+ marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
170
+ selectedTradingPairIds: z.unknown().optional(),
171
+ })
172
+ .loose()
173
+ .superRefine((request, ctx) => {
174
+ if (request.selectedTradingPairIds === undefined) {
175
+ return;
176
+ }
177
+ ctx.addIssue({
178
+ code: "custom",
179
+ path: ["selectedTradingPairIds"],
180
+ message: request.marginMode === "CROSS"
181
+ ? "selectedTradingPairIds is not accepted on a CROSS preview: cross scope is derived from trading, so a preview has nothing to declare"
182
+ : "selectedTradingPairIds is not supported for ISOLATED risk buckets",
183
+ });
184
+ });
185
+ const SimulateRiskBucketOrderRiskRequestSchema = CrossSimulateNamesNoPairsSchema.pipe(z.union([SimulateIsolatedRiskBucketOrderRiskRequestSchema, SimulateCrossRiskBucketOrderRiskRequestSchema]));
159
186
  export const SimulateOrderRiskSchema = z
160
187
  .object({
161
188
  marginAccountId: UUIDSchema,
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_managed_market_assignments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -23,6 +23,7 @@ export const OPERATION_IDS = [
23
23
  "cancel_twap_order",
24
24
  "check_trader_code_availability",
25
25
  "claim_buildercode_rewards",
26
+ "claim_managed_market_lease",
26
27
  "clear_trader_code",
27
28
  "close_position",
28
29
  "create_challenge",
@@ -98,6 +99,7 @@ export const OPERATION_IDS = [
98
99
  "list_delegated_agents",
99
100
  "list_funding_history",
100
101
  "list_funding_payments",
102
+ "list_managed_market_assignments",
101
103
  "list_margin_accounts",
102
104
  "list_pending_withdrawals",
103
105
  "list_position_history",
@@ -106,6 +108,7 @@ export const OPERATION_IDS = [
106
108
  "list_trading_pairs",
107
109
  "list_twap_orders",
108
110
  "mint_tokens",
111
+ "refresh_managed_market_quotes",
109
112
  "refresh_session",
110
113
  "register_deposit_address",
111
114
  "replace_order",
@@ -1079,6 +1079,66 @@ export interface paths {
1079
1079
  patch?: never;
1080
1080
  trace?: never;
1081
1081
  };
1082
+ "/api/v1/managed-markets/assignments": {
1083
+ parameters: {
1084
+ query?: never;
1085
+ header?: never;
1086
+ path?: never;
1087
+ cookie?: never;
1088
+ };
1089
+ /**
1090
+ * List caller managed market assignments
1091
+ * @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
1092
+ */
1093
+ get: operations["list_managed_market_assignments"];
1094
+ put?: never;
1095
+ post?: never;
1096
+ delete?: never;
1097
+ options?: never;
1098
+ head?: never;
1099
+ patch?: never;
1100
+ trace?: never;
1101
+ };
1102
+ "/api/v1/managed-markets/{launchId}/lease": {
1103
+ parameters: {
1104
+ query?: never;
1105
+ header?: never;
1106
+ path?: never;
1107
+ cookie?: never;
1108
+ };
1109
+ get?: never;
1110
+ put?: never;
1111
+ /**
1112
+ * Claim or renew a fenced maker lease
1113
+ * @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
1114
+ */
1115
+ post: operations["claim_managed_market_lease"];
1116
+ delete?: never;
1117
+ options?: never;
1118
+ head?: never;
1119
+ patch?: never;
1120
+ trace?: never;
1121
+ };
1122
+ "/api/v1/managed-markets/{launchId}/quotes": {
1123
+ parameters: {
1124
+ query?: never;
1125
+ header?: never;
1126
+ path?: never;
1127
+ cookie?: never;
1128
+ };
1129
+ get?: never;
1130
+ put?: never;
1131
+ /**
1132
+ * Refresh the server-bounded managed quote set
1133
+ * @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
1134
+ */
1135
+ post: operations["refresh_managed_market_quotes"];
1136
+ delete?: never;
1137
+ options?: never;
1138
+ head?: never;
1139
+ patch?: never;
1140
+ trace?: never;
1141
+ };
1082
1142
  "/api/v1/margin/accounts": {
1083
1143
  parameters: {
1084
1144
  query?: never;
@@ -3519,6 +3579,12 @@ export interface components {
3519
3579
  */
3520
3580
  tradingBalance?: string | null;
3521
3581
  };
3582
+ ClaimManagedMarketLeaseRequest: {
3583
+ launchId?: string | null;
3584
+ ownerId?: string | null;
3585
+ /** @description Required when renewing an unexpired lease. Decimal string in JSON. */
3586
+ expectedGeneration?: string | null;
3587
+ };
3522
3588
  ClosePositionRequest: {
3523
3589
  quantity?: string | null;
3524
3590
  closeType?: string | null;
@@ -3568,6 +3634,8 @@ export interface components {
3568
3634
  * @example 918342
3569
3635
  */
3570
3636
  version?: number | null;
3637
+ /** @description Present only when state is TRIGGERED: the execution outcome of the order this conditional fired into (triggeredOrderId) — status, filled quantity, volume-weighted average fill price, taker fees and fill time — read from that order at request time. Trigger price and fill price are different numbers: the trigger fires on the mark price and the leg then trades against the book, so a MARKET leg fills at least the half-spread plus its own impact away from triggerPrice, and a LIMIT leg may still be resting (SUBMITTED / PARTIALLY_FILLED) or have been cut by the protective band (CANCELLED with a terminalReason). Absent while waiting on the trigger, on the conditional_orders WebSocket frames, and in the rare case the triggered order cannot be read. */
3638
+ triggeredOrder?: components["schemas"]["TriggeredOrderSummary"] | null;
3571
3639
  };
3572
3640
  CreateDelegatedSessionRequest: {
3573
3641
  /**
@@ -5004,6 +5072,11 @@ export interface components {
5004
5072
  * @enum {string|null}
5005
5073
  */
5006
5074
  selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
5075
+ /**
5076
+ * @description Present only on an order the engine placed for a take-profit or stop-loss trigger: the conditional order (GET /api/v1/orders/conditional/{conditionalOrderId}) that fired it. The reverse of ConditionalOrder.triggeredOrderId, so a close in order history can be attributed to the TP/SL that produced it without scanning the conditional list. Absent on every order a client placed itself, on TWAP slice children (those carry parentOrderId), and on triggered closes written before the field existed — there is no backfill, so a missing key on an older close means unknown, not placed by hand.
5077
+ * @example 019aefab-f665-854c-99dc-ced6db9014aa
5078
+ */
5079
+ conditionalOrderId?: string | null;
5007
5080
  };
5008
5081
  /** @description Orderbook snapshot with token metadata and sequence number. */
5009
5082
  GetOrderbookResponse: {
@@ -6096,6 +6169,17 @@ export interface components {
6096
6169
  */
6097
6170
  totalPages?: number | null;
6098
6171
  };
6172
+ ListManagedMarketAssignmentsResponse: {
6173
+ /** @description Expected assignments, including phases currently unable to quote. */
6174
+ items?: components["schemas"]["ManagedMarketAssignment"][] | null;
6175
+ /** Format: uint32 */
6176
+ total?: number | null;
6177
+ /** Format: uint32 */
6178
+ page?: number | null;
6179
+ /** Format: uint32 */
6180
+ pageSize?: number | null;
6181
+ inventoryObservedAt?: string | null;
6182
+ };
6099
6183
  ListMarginAccountsResponse: {
6100
6184
  accounts?: components["schemas"]["MarginAccountSummary"][] | null;
6101
6185
  /** Format: uint32 */
@@ -6254,6 +6338,41 @@ export interface components {
6254
6338
  */
6255
6339
  pageSize?: number | null;
6256
6340
  };
6341
+ ManagedMarketAssignment: {
6342
+ launchId?: string | null;
6343
+ /** Format: uuid */
6344
+ tradingPairId?: string | null;
6345
+ symbol?: string | null;
6346
+ phase?: string | null;
6347
+ /** Format: uint32 */
6348
+ refreshIntervalMs?: number | null;
6349
+ allocationUsdc?: string | null;
6350
+ /** @description Last reserved lease. A claim reconciles its actual engine fencing state. */
6351
+ lease?: components["schemas"]["ManagedMarketLease"] | null;
6352
+ quoteEnabled?: boolean | null;
6353
+ };
6354
+ ManagedMarketLease: {
6355
+ launchId?: string | null;
6356
+ ownerId?: string | null;
6357
+ /** @description All uint64 fences are decimal strings in JSON to preserve exact values. */
6358
+ generation?: string | null;
6359
+ quoteRevision?: string | null;
6360
+ expiresAt?: string | null;
6361
+ /** Format: uint32 */
6362
+ refreshIntervalMs?: number | null;
6363
+ phase?: string | null;
6364
+ };
6365
+ ManagedMarketQuoteStatus: {
6366
+ launchId?: string | null;
6367
+ generation?: string | null;
6368
+ quoteRevision?: string | null;
6369
+ phase?: string | null;
6370
+ bidNotional?: string | null;
6371
+ askNotional?: string | null;
6372
+ oracleReady?: boolean | null;
6373
+ readyToActivate?: boolean | null;
6374
+ observedAt?: string | null;
6375
+ };
6257
6376
  MarginAccountMovement: {
6258
6377
  id?: string | null;
6259
6378
  movementType?: string | null;
@@ -7163,6 +7282,12 @@ export interface components {
7163
7282
  */
7164
7283
  relevance?: number | null;
7165
7284
  };
7285
+ RefreshManagedMarketQuotesRequest: {
7286
+ launchId?: string | null;
7287
+ ownerId?: string | null;
7288
+ generation?: string | null;
7289
+ quoteRevision?: string | null;
7290
+ };
7166
7291
  RefreshRequest: Record<string, never>;
7167
7292
  RefreshResponse: {
7168
7293
  /**
@@ -7602,7 +7727,17 @@ export interface components {
7602
7727
  riskBucketId?: string | null;
7603
7728
  /** @description Present when the simulation resolved against a risk bucket. Values: ISOLATED, CROSS. */
7604
7729
  marginMode?: string | null;
7605
- /** @description Present for cross risk-bucket simulations. */
7730
+ /**
7731
+ * @description The cross scope the preview ran against; absent for isolated previews and
7732
+ * never a request's deprecated list. `SimulateRiskBucketOrderRisk` in CROSS
7733
+ * mode reports the DERIVED scope: the active cross bucket's recorded pairs
7734
+ * (a pair whose positions have closed stays recorded until a later cross
7735
+ * order on another pair reconciles the bucket), every pair with an open
7736
+ * position in that bucket, and the previewed pair — the previewed pair alone
7737
+ * before the first cross order. `SimulateOrderRisk` and
7738
+ * `SimulateParentMarginOrderRisk` report the recorded pairs plus the
7739
+ * previewed pair.
7740
+ */
7606
7741
  selectedTradingPairIds?: string[] | null;
7607
7742
  };
7608
7743
  SimulateParentMarginOrderRiskRequest: {
@@ -7633,7 +7768,10 @@ export interface components {
7633
7768
  reduceOnly?: boolean | null;
7634
7769
  /** @description Risk bucket mode. Defaults to ISOLATED. Values: ISOLATED, CROSS. */
7635
7770
  marginMode?: string | null;
7636
- /** @description Trading pair UUIDs selected into the cross risk bucket. Required when marginMode is CROSS. */
7771
+ /**
7772
+ * @deprecated
7773
+ * @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds; after its positions close it stays listed until a later successful cross order on another pair reconciles the bucket), so a cross preview has nothing to declare: it runs against the account's active cross bucket — or the deterministic bucket a first cross order would create — and the previewed pair is in scope by construction. Rejected for ISOLATED, as before. The response's selectedTradingPairIds reports the derived scope (recorded pairs, pairs with open positions in the bucket, and the previewed pair), never this list.
7774
+ */
7637
7775
  selectedTradingPairIds?: string[] | null;
7638
7776
  };
7639
7777
  SubAccount: {
@@ -8144,7 +8282,7 @@ export interface components {
8144
8282
  marginMode?: string | null;
8145
8283
  /**
8146
8284
  * @deprecated
8147
- * @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds and leaves when its positions close), so a cross transfer-in has nothing to declare and can no longer replace the scope. Rejected for ISOLATED, as before. Read the current scope from the cross bucket's row in the margin-accounts list or from this response's selectedTradingPairIds; the parent row carries no scope. Pairs declared before scope became derived stay recorded until they trade and their positions close.
8285
+ * @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds; after its positions close it stays listed until a later successful cross order on another pair reconciles the bucket), so a cross transfer-in has nothing to declare and can no longer replace the scope. Rejected for ISOLATED, as before. Read the current scope from the cross bucket's row in the margin-accounts list or from this response's selectedTradingPairIds; the parent row carries no scope. Pairs declared before scope became derived stay recorded until they trade and their positions close.
8148
8286
  */
8149
8287
  selectedTradingPairIds?: string[] | null;
8150
8288
  /**
@@ -8197,6 +8335,53 @@ export interface components {
8197
8335
  */
8198
8336
  tradingBalance?: string | null;
8199
8337
  };
8338
+ /**
8339
+ * @description The execution outcome of the order a conditional order fired into — a
8340
+ * projection of that order's own row, read at request time (0XM-2744), so a
8341
+ * TP/SL history can show what the close actually did next to the price that
8342
+ * fired it. Trigger price and fill price are different numbers: the trigger
8343
+ * fires on the mark, the leg then trades against the book, so a MARKET leg
8344
+ * fills at least the half-spread (plus its own impact) away from the
8345
+ * trigger, and a LIMIT leg may rest or fill only partly.
8346
+ */
8347
+ TriggeredOrderSummary: {
8348
+ /**
8349
+ * Format: uuid
8350
+ * @description The triggered order's id — the same value as the parent's triggeredOrderId, repeated so the summary is self-contained.
8351
+ * @example 01a0887b-8e7c-7612-983f-b7ee89c2cbbf
8352
+ */
8353
+ orderId?: string | null;
8354
+ /**
8355
+ * @description The triggered order's CURRENT status, as GET /api/v1/orders/{orderId} reports it: SETTLED for a leg that filled in full (a fully filled order is written as SETTLED, so FILLED does not appear here); SUBMITTED or PARTIALLY_FILLED for a LIMIT leg still resting; CANCELLED when the protective band left nothing fillable or a reduce-only remainder was cut (see terminalReason); EXPIRED for a LIMIT leg that lapsed. Never REJECTED: a close the engine refused leaves the conditional order FAILED with no triggeredOrderId, so no summary exists for it.
8356
+ * @example SETTLED
8357
+ */
8358
+ status?: string | null;
8359
+ /**
8360
+ * @description Quantity the triggered order has filled so far, in base units. "0" until it fills. Numerically equal to the order's own filledQuantity; the printed decimal scale can differ between this read (served from the database) and GET /api/v1/orders/{orderId} (served from the cache), so compare numerically.
8361
+ * @example 3090659.3
8362
+ */
8363
+ filledQuantity?: string | null;
8364
+ /**
8365
+ * @description Volume-weighted average price the triggered order filled at. Compare with the parent's triggerPrice: the difference is the half-spread plus the order's own market impact. Absent until the first fill.
8366
+ * @example 0.145611
8367
+ */
8368
+ averageFillPrice?: string | null;
8369
+ /**
8370
+ * @description Total taker fees the triggered order has paid, in quote units. Absent until it fills.
8371
+ * @example 202.52
8372
+ */
8373
+ totalTakerFees?: string | null;
8374
+ /**
8375
+ * @description When the triggered order reached FILLED (RFC 3339). Absent while it is resting or partially filled, and on a terminal state that is not a full fill.
8376
+ * @example 2026-09-09T23:23:13.936682Z
8377
+ */
8378
+ filledAt?: string | null;
8379
+ /**
8380
+ * @description Stable cause when status is CANCELLED — the same vocabulary as the order's own terminalReason. Absent otherwise.
8381
+ * @example SYSTEM
8382
+ */
8383
+ terminalReason?: string | null;
8384
+ };
8200
8385
  TwapOrder: {
8201
8386
  /**
8202
8387
  * Format: uuid
@@ -11007,6 +11192,104 @@ export interface operations {
11007
11192
  };
11008
11193
  };
11009
11194
  };
11195
+ list_managed_market_assignments: {
11196
+ parameters: {
11197
+ query?: {
11198
+ /** @description Page number (1-indexed) */
11199
+ page?: number;
11200
+ /** @description Items per page (max 100) */
11201
+ pageSize?: number;
11202
+ };
11203
+ header?: never;
11204
+ path?: never;
11205
+ cookie?: never;
11206
+ };
11207
+ requestBody?: never;
11208
+ responses: {
11209
+ /** @description OK */
11210
+ 200: {
11211
+ headers: {
11212
+ [name: string]: unknown;
11213
+ };
11214
+ content: {
11215
+ "application/json": components["schemas"]["ListManagedMarketAssignmentsResponse"];
11216
+ };
11217
+ };
11218
+ /** @description Delegated-agent sessions cannot use managed maker controls */
11219
+ 403: {
11220
+ headers: {
11221
+ [name: string]: unknown;
11222
+ };
11223
+ content?: never;
11224
+ };
11225
+ };
11226
+ };
11227
+ claim_managed_market_lease: {
11228
+ parameters: {
11229
+ query?: never;
11230
+ header?: never;
11231
+ path: {
11232
+ launchId: string;
11233
+ };
11234
+ cookie?: never;
11235
+ };
11236
+ requestBody: {
11237
+ content: {
11238
+ "application/json": components["schemas"]["ClaimManagedMarketLeaseRequest"];
11239
+ };
11240
+ };
11241
+ responses: {
11242
+ /** @description OK */
11243
+ 200: {
11244
+ headers: {
11245
+ [name: string]: unknown;
11246
+ };
11247
+ content: {
11248
+ "application/json": components["schemas"]["ManagedMarketLease"];
11249
+ };
11250
+ };
11251
+ /** @description Delegated-agent sessions cannot use managed maker controls */
11252
+ 403: {
11253
+ headers: {
11254
+ [name: string]: unknown;
11255
+ };
11256
+ content?: never;
11257
+ };
11258
+ };
11259
+ };
11260
+ refresh_managed_market_quotes: {
11261
+ parameters: {
11262
+ query?: never;
11263
+ header?: never;
11264
+ path: {
11265
+ launchId: string;
11266
+ };
11267
+ cookie?: never;
11268
+ };
11269
+ requestBody: {
11270
+ content: {
11271
+ "application/json": components["schemas"]["RefreshManagedMarketQuotesRequest"];
11272
+ };
11273
+ };
11274
+ responses: {
11275
+ /** @description OK */
11276
+ 200: {
11277
+ headers: {
11278
+ [name: string]: unknown;
11279
+ };
11280
+ content: {
11281
+ "application/json": components["schemas"]["ManagedMarketQuoteStatus"];
11282
+ };
11283
+ };
11284
+ /** @description Delegated-agent sessions cannot use managed maker controls */
11285
+ 403: {
11286
+ headers: {
11287
+ [name: string]: unknown;
11288
+ };
11289
+ content?: never;
11290
+ };
11291
+ };
11292
+ };
11010
11293
  list_margin_accounts: {
11011
11294
  parameters: {
11012
11295
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "type": "module",
5
5
  "homepage": "https://docs.0xmonaco.com/sdk/typescript",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "lint": "biome lint ."
17
17
  },
18
18
  "dependencies": {
19
- "@0xmonaco/contracts": "1.0.59",
19
+ "@0xmonaco/contracts": "1.0.60",
20
20
  "zod": "^4.1.12"
21
21
  },
22
22
  "peerDependencies": {