@0xmonaco/types 0.8.7-develop.5d0e403 → 0.8.7-develop.ab57a24

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.
@@ -3,6 +3,8 @@ import type { OrderSide, OrderType, PositionSide } from "../trading";
3
3
  export interface MarginAccountSummary {
4
4
  margin_account_id: string;
5
5
  label?: string;
6
+ margin_bucket_id?: string;
7
+ margin_mode?: "ISOLATED" | "CROSS";
6
8
  trading_pair_id?: string;
7
9
  strategy_key?: string;
8
10
  account_state: string;
@@ -31,6 +33,8 @@ export interface ListMarginAccountsResponse {
31
33
  export interface EnsureParentMarginAccountRequest {
32
34
  label?: string;
33
35
  collateralAsset?: string;
36
+ marginMode?: "ISOLATED" | "CROSS";
37
+ selectedTradingPairIds?: string[];
34
38
  }
35
39
  export interface EnsureParentMarginAccountResponse {
36
40
  margin_account_id: string;
@@ -38,6 +42,9 @@ export interface EnsureParentMarginAccountResponse {
38
42
  account_state: string;
39
43
  collateral_asset: string;
40
44
  created_at: string;
45
+ margin_bucket_id?: string;
46
+ margin_mode?: "ISOLATED" | "CROSS";
47
+ selected_trading_pair_ids: string[];
41
48
  }
42
49
  export interface GetAvailableCollateralParams {
43
50
  asset?: string;
@@ -250,6 +250,67 @@ export interface GetUserTradesResponse {
250
250
  /** Total number of pages */
251
251
  total_pages: number;
252
252
  }
253
+ /**
254
+ * Direction of a funding payment from the user's perspective.
255
+ */
256
+ export type FundingDirection = "PAID" | "RECEIVED";
257
+ /**
258
+ * A single funding payment settled against a margin position.
259
+ */
260
+ export interface FundingPayment {
261
+ /** Funding payment unique identifier (UUID) */
262
+ id: string;
263
+ /** Margin position identifier (UUID) */
264
+ position_id: string;
265
+ /** Margin account identifier (UUID) */
266
+ margin_account_id: string;
267
+ /** Trading pair identifier (UUID) */
268
+ trading_pair_id: string;
269
+ /** Funding rate applied for the epoch (as string to preserve precision) */
270
+ funding_rate: string;
271
+ /** Absolute position size at settlement (as string to preserve precision) */
272
+ position_size: string;
273
+ /** Signed funding amount; positive means paid, negative means received (as string) */
274
+ payment_amount: string;
275
+ /** Funding direction for the user */
276
+ direction: FundingDirection;
277
+ /** Funding window start timestamp (ISO 8601), if known */
278
+ period_start?: string;
279
+ /** Funding window end timestamp (ISO 8601), if known */
280
+ period_end?: string;
281
+ /** Funding payment creation timestamp (ISO 8601), if known */
282
+ created_at?: string;
283
+ }
284
+ /**
285
+ * Query parameters for listing funding payments.
286
+ */
287
+ export interface ListFundingPaymentsParams {
288
+ /** Page number (starts from 1) */
289
+ page?: number;
290
+ /** Number of items per page (max 100) */
291
+ page_size?: number;
292
+ /** Filter by trading pair ID (UUID) */
293
+ trading_pair_id?: string;
294
+ /** Filter by margin position ID (UUID) */
295
+ position_id?: string;
296
+ /** Filter by margin account ID (UUID) */
297
+ margin_account_id?: string;
298
+ }
299
+ /**
300
+ * Response from listing funding payments.
301
+ */
302
+ export interface ListFundingPaymentsResponse {
303
+ /** List of funding payment records */
304
+ records: FundingPayment[];
305
+ /** Current page number */
306
+ page: number;
307
+ /** Items per page */
308
+ page_size: number;
309
+ /** Total number of matching records */
310
+ total: number;
311
+ /** Total number of pages */
312
+ total_pages: number;
313
+ }
253
314
  /**
254
315
  * Time period for portfolio stats and chart queries.
255
316
  */
@@ -412,4 +473,20 @@ export interface ProfileAPI extends BaseAPI {
412
473
  * @throws ValidationError If pagination params (page/limit) are invalid or trading_pair_id is not a valid UUID; this may occur before any network request.
413
474
  */
414
475
  getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
476
+ /**
477
+ * List the current user's funding payment history with pagination and filters.
478
+ *
479
+ * Fetches funding payments from the /api/v1/accounts/funding-payments endpoint.
480
+ * Requires a valid access token to be set.
481
+ *
482
+ * @param params - Optional query parameters for pagination and filtering
483
+ * @param params.page - Page number (starts from 1)
484
+ * @param params.page_size - Number of items per page (max 100)
485
+ * @param params.trading_pair_id - Filter by trading pair ID (UUID)
486
+ * @param params.position_id - Filter by margin position ID (UUID)
487
+ * @param params.margin_account_id - Filter by margin account ID (UUID)
488
+ * @returns Promise resolving to paginated funding payments response
489
+ * @throws ValidationError If pagination params or a UUID filter are invalid; this may occur before any network request.
490
+ */
491
+ listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
415
492
  }
@@ -11,6 +11,11 @@ export declare const ListMarginAccountsSchema: z.ZodObject<{
11
11
  export declare const EnsureParentMarginAccountSchema: z.ZodOptional<z.ZodObject<{
12
12
  label: z.ZodOptional<z.ZodString>;
13
13
  collateralAsset: z.ZodOptional<z.ZodString>;
14
+ marginMode: z.ZodOptional<z.ZodEnum<{
15
+ ISOLATED: "ISOLATED";
16
+ CROSS: "CROSS";
17
+ }>>;
18
+ selectedTradingPairIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
14
19
  }, z.core.$strip>>;
15
20
  export declare const GetMarginAccountSummarySchema: z.ZodObject<{
16
21
  marginAccountId: z.ZodUUID;
@@ -15,6 +15,16 @@ export const EnsureParentMarginAccountSchema = z
15
15
  .object({
16
16
  label: z.string().trim().min(1, "Label cannot be empty").optional(),
17
17
  collateralAsset: z.string().trim().min(1, "Collateral asset cannot be empty").optional(),
18
+ marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
19
+ selectedTradingPairIds: z.array(UUIDSchema).optional(),
20
+ })
21
+ .refine((data) => data.marginMode !== "CROSS" || (data.selectedTradingPairIds?.length ?? 0) > 0, {
22
+ message: "selectedTradingPairIds is required when marginMode is CROSS",
23
+ path: ["selectedTradingPairIds"],
24
+ })
25
+ .refine((data) => data.marginMode === "CROSS" || (data.selectedTradingPairIds?.length ?? 0) === 0, {
26
+ message: "selectedTradingPairIds can only be set when marginMode is CROSS",
27
+ path: ["selectedTradingPairIds"],
18
28
  })
19
29
  .optional();
20
30
  export const GetMarginAccountSummarySchema = z.object({
@@ -67,3 +67,10 @@ export declare const GetUserTradesSchema: z.ZodObject<{
67
67
  page_size: z.ZodOptional<z.ZodNumber>;
68
68
  trading_pair_id: z.ZodOptional<z.ZodUUID>;
69
69
  }, z.core.$strip>;
70
+ export declare const ListFundingPaymentsSchema: z.ZodObject<{
71
+ page: z.ZodOptional<z.ZodNumber>;
72
+ page_size: z.ZodOptional<z.ZodNumber>;
73
+ trading_pair_id: z.ZodOptional<z.ZodUUID>;
74
+ position_id: z.ZodOptional<z.ZodUUID>;
75
+ margin_account_id: z.ZodOptional<z.ZodUUID>;
76
+ }, z.core.$strip>;
@@ -42,3 +42,10 @@ export const GetUserTradesSchema = z.object({
42
42
  page_size: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
43
43
  trading_pair_id: UUIDSchema.optional(),
44
44
  });
45
+ export const ListFundingPaymentsSchema = z.object({
46
+ page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
47
+ page_size: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
48
+ trading_pair_id: UUIDSchema.optional(),
49
+ position_id: UUIDSchema.optional(),
50
+ margin_account_id: UUIDSchema.optional(),
51
+ });
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Endpoint-coverage audit (MON-1489 gate logic).
3
+ *
4
+ * Each hand-written SDK surface (`@0xmonaco/core`, `@0xmonaco/react`,
5
+ * `@0xmonaco/mcp-server`) maintains a `coverage.ts` with two registries: a
6
+ * `COVERED` map (operationId → the ergonomic method/hook/tool that implements
7
+ * it) and an `INTENTIONALLY_EXCLUDED` map (operationId → reason it is
8
+ * deliberately not surfaced). {@link auditSurface} checks those two registries
9
+ * against the full {@link OPERATION_IDS} list and reports any operationId that
10
+ * is left unclassified (in neither), double-classified (in both), or stale (a
11
+ * registry key that is no longer a real operationId).
12
+ *
13
+ * This is the runtime counterpart to the `satisfies Partial<Record<keyof
14
+ * operations, string>>` constraint each registry already carries: that
15
+ * constraint makes every *key* a compile-time-checked operationId, while this
16
+ * audit makes the *set* of keys provably exhaustive. A new proto REST endpoint
17
+ * forces a new operationId into the generated `OPERATION_IDS`, and the surface
18
+ * build/CI fails here until a developer either implements it or excludes it
19
+ * with a reason — mirroring the MON-1475 route↔spec allowlist UX.
20
+ */
21
+ import { type OperationId } from "./operations";
22
+ import type { operations } from "./schema";
23
+ /** A surface's coverage registries (the two maps exported by its `coverage.ts`). */
24
+ export interface SurfaceClassification {
25
+ /** operationId → the SDK symbol (method/hook/tool) that covers it. */
26
+ covered: Partial<Record<keyof operations, string>>;
27
+ /** operationId → the reason it is intentionally not covered. */
28
+ excluded: Partial<Record<keyof operations, string>>;
29
+ }
30
+ /** Result of auditing one surface's classification against the spec. */
31
+ export interface CoverageAudit {
32
+ /** operationIds in the spec that appear in neither `covered` nor `excluded`. */
33
+ unclassified: OperationId[];
34
+ /** operationIds listed in BOTH `covered` and `excluded`. */
35
+ duplicated: string[];
36
+ /** Registry keys that are not (or no longer) real operationIds. */
37
+ unknown: string[];
38
+ /** True when the surface classifies every operationId exactly once. */
39
+ ok: boolean;
40
+ }
41
+ /**
42
+ * Audit one surface: assert `covered ∪ excluded == operationIds` and that the
43
+ * two sets are disjoint and free of stale keys. `operationIds` defaults to the
44
+ * generated {@link OPERATION_IDS}; it is injectable so the gate's own tests can
45
+ * exercise synthetic op sets.
46
+ */
47
+ export declare function auditSurface(classification: SurfaceClassification, operationIds?: readonly string[]): CoverageAudit;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Endpoint-coverage audit (MON-1489 gate logic).
3
+ *
4
+ * Each hand-written SDK surface (`@0xmonaco/core`, `@0xmonaco/react`,
5
+ * `@0xmonaco/mcp-server`) maintains a `coverage.ts` with two registries: a
6
+ * `COVERED` map (operationId → the ergonomic method/hook/tool that implements
7
+ * it) and an `INTENTIONALLY_EXCLUDED` map (operationId → reason it is
8
+ * deliberately not surfaced). {@link auditSurface} checks those two registries
9
+ * against the full {@link OPERATION_IDS} list and reports any operationId that
10
+ * is left unclassified (in neither), double-classified (in both), or stale (a
11
+ * registry key that is no longer a real operationId).
12
+ *
13
+ * This is the runtime counterpart to the `satisfies Partial<Record<keyof
14
+ * operations, string>>` constraint each registry already carries: that
15
+ * constraint makes every *key* a compile-time-checked operationId, while this
16
+ * audit makes the *set* of keys provably exhaustive. A new proto REST endpoint
17
+ * forces a new operationId into the generated `OPERATION_IDS`, and the surface
18
+ * build/CI fails here until a developer either implements it or excludes it
19
+ * with a reason — mirroring the MON-1475 route↔spec allowlist UX.
20
+ */
21
+ import { OPERATION_IDS } from "./operations";
22
+ /**
23
+ * Audit one surface: assert `covered ∪ excluded == operationIds` and that the
24
+ * two sets are disjoint and free of stale keys. `operationIds` defaults to the
25
+ * generated {@link OPERATION_IDS}; it is injectable so the gate's own tests can
26
+ * exercise synthetic op sets.
27
+ */
28
+ export function auditSurface(classification, operationIds = OPERATION_IDS) {
29
+ const covered = Object.keys(classification.covered);
30
+ const excluded = Object.keys(classification.excluded);
31
+ const all = new Set(operationIds);
32
+ const classified = new Set([...covered, ...excluded]);
33
+ const excludedSet = new Set(excluded);
34
+ const unclassified = operationIds.filter((op) => !classified.has(op));
35
+ const duplicated = covered.filter((op) => excludedSet.has(op)).sort();
36
+ const unknown = [...new Set([...covered, ...excluded].filter((op) => !all.has(op)))].sort();
37
+ return {
38
+ unclassified: unclassified,
39
+ duplicated,
40
+ unknown,
41
+ ok: unclassified.length === 0 && duplicated.length === 0 && unknown.length === 0,
42
+ };
43
+ }
@@ -9,6 +9,13 @@
9
9
  *
10
10
  * Consumers import the raw spec types from the `@0xmonaco/types/wire` subpath;
11
11
  * the ergonomic types in the rest of the package are the supported surface.
12
+ *
13
+ * It also exports the generated runtime `OPERATION_IDS` list and the
14
+ * `auditSurface` helper that power the MON-1489 endpoint-coverage gate.
12
15
  */
13
16
  export type { Expect, MissingWireFields, WireCovered, WireSchema, WireSchemas } from "./assert";
17
+ export type { CoverageAudit, SurfaceClassification } from "./audit";
18
+ export { auditSurface } from "./audit";
19
+ export type { OperationId } from "./operations";
20
+ export { OPERATION_IDS } from "./operations";
14
21
  export type { components, operations, paths } from "./schema";
@@ -0,0 +1,2 @@
1
+ export { auditSurface } from "./audit";
2
+ export { OPERATION_IDS } from "./operations";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * GENERATED — DO NOT EDIT BY HAND.
3
+ *
4
+ * Runtime list of every OpenAPI operationId in the canonical spec
5
+ * (docs/src/proto-openapi/api/openapi.yaml), emitted by `make ts-wire-gen`
6
+ * (scripts/gen-operation-ids.ts) alongside the type-only `schema.ts`.
7
+ *
8
+ * The MON-1489 endpoint-coverage gate iterates this list to assert that every
9
+ * operationId is classified (covered or intentionally excluded) on each
10
+ * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
+ * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
+ */
13
+ export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_conditional_order", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "ensure_parent_margin_account", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_auto_margin_order_risk", "simulate_fees", "simulate_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_to_auto_margin_account", "transfer_collateral_to_margin_account", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
14
+ /** Union of every OpenAPI operationId in the spec. */
15
+ export type OperationId = (typeof OPERATION_IDS)[number];
@@ -0,0 +1,95 @@
1
+ /**
2
+ * GENERATED — DO NOT EDIT BY HAND.
3
+ *
4
+ * Runtime list of every OpenAPI operationId in the canonical spec
5
+ * (docs/src/proto-openapi/api/openapi.yaml), emitted by `make ts-wire-gen`
6
+ * (scripts/gen-operation-ids.ts) alongside the type-only `schema.ts`.
7
+ *
8
+ * The MON-1489 endpoint-coverage gate iterates this list to assert that every
9
+ * operationId is classified (covered or intentionally excluded) on each
10
+ * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
+ * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
+ */
13
+ export const OPERATION_IDS = [
14
+ "add_position_margin",
15
+ "attach_position_tp_sl",
16
+ "authenticate_backend",
17
+ "batch_cancel_all",
18
+ "batch_cancel_all_by_pair",
19
+ "batch_cancel_orders",
20
+ "batch_create_orders",
21
+ "batch_replace_orders",
22
+ "cancel_conditional_order",
23
+ "cancel_order",
24
+ "close_position",
25
+ "create_challenge",
26
+ "create_conditional_order",
27
+ "create_delegated_session",
28
+ "create_order",
29
+ "create_sub_account_limit",
30
+ "delete_sub_account_limit",
31
+ "ensure_parent_margin_account",
32
+ "get_application_config",
33
+ "get_application_stats",
34
+ "get_available_collateral",
35
+ "get_candles",
36
+ "get_funding_state",
37
+ "get_index_price",
38
+ "get_margin_account_movements",
39
+ "get_margin_account_summary",
40
+ "get_mark_price",
41
+ "get_market_metadata",
42
+ "get_open_interest",
43
+ "get_order_by_id",
44
+ "get_orderbook_snapshot",
45
+ "get_orders",
46
+ "get_perp_market_config",
47
+ "get_perp_market_summary",
48
+ "get_portfolio_chart",
49
+ "get_portfolio_stats",
50
+ "get_position",
51
+ "get_position_risk",
52
+ "get_screener",
53
+ "get_sub_account_limits",
54
+ "get_trade_by_id",
55
+ "get_trades",
56
+ "get_trading_pair_by_id",
57
+ "get_user_balance_by_asset",
58
+ "get_user_balances",
59
+ "get_user_movements",
60
+ "get_user_profile",
61
+ "get_user_trades",
62
+ "get_withdrawal",
63
+ "health_check",
64
+ "initiate_withdrawal",
65
+ "list_application_balances",
66
+ "list_application_movements",
67
+ "list_application_orders",
68
+ "list_application_users",
69
+ "list_conditional_orders",
70
+ "list_delegated_agent_owners",
71
+ "list_delegated_agents",
72
+ "list_funding_history",
73
+ "list_funding_payments",
74
+ "list_margin_accounts",
75
+ "list_position_history",
76
+ "list_positions",
77
+ "list_sub_accounts_with_balances",
78
+ "list_trading_pairs",
79
+ "mint_tokens",
80
+ "reduce_position_margin",
81
+ "refresh_session",
82
+ "replace_order",
83
+ "revoke_delegated_agent",
84
+ "revoke_session",
85
+ "simulate_auto_margin_order_risk",
86
+ "simulate_fees",
87
+ "simulate_order_risk",
88
+ "submit_whitelist",
89
+ "transfer_collateral_from_margin_account",
90
+ "transfer_collateral_to_auto_margin_account",
91
+ "transfer_collateral_to_margin_account",
92
+ "update_sub_account_limit",
93
+ "upsert_delegated_agent",
94
+ "verify_signature",
95
+ ];
@@ -1496,23 +1496,6 @@ export interface paths {
1496
1496
  patch?: never;
1497
1497
  trace?: never;
1498
1498
  };
1499
- "/api/v1/trades/user": {
1500
- parameters: {
1501
- query?: never;
1502
- header?: never;
1503
- path?: never;
1504
- cookie?: never;
1505
- };
1506
- /** @description Authenticated user's perp/spot trade history. */
1507
- get: operations["list_user_trades"];
1508
- put?: never;
1509
- post?: never;
1510
- delete?: never;
1511
- options?: never;
1512
- head?: never;
1513
- patch?: never;
1514
- trace?: never;
1515
- };
1516
1499
  "/api/v1/trades/{trading_pair_id}": {
1517
1500
  parameters: {
1518
1501
  query?: never;
@@ -2123,6 +2106,11 @@ export interface components {
2123
2106
  * @example false
2124
2107
  */
2125
2108
  reduce_only?: boolean | null;
2109
+ /**
2110
+ * @description Strategy key used to group auto-margin buckets for delegated/margin orders
2111
+ * @example my-strategy
2112
+ */
2113
+ strategy_key?: string | null;
2126
2114
  };
2127
2115
  BatchCreateOrdersRequest: {
2128
2116
  orders: components["schemas"]["BatchCreateOrderItem"][];
@@ -2641,6 +2629,11 @@ export interface components {
2641
2629
  reduce_only?: boolean | null;
2642
2630
  take_profit?: components["schemas"]["ParentTpSlLeg"];
2643
2631
  stop_loss?: components["schemas"]["ParentTpSlLeg"];
2632
+ /**
2633
+ * @description Strategy key used to group auto-margin buckets for delegated/margin orders
2634
+ * @example my-strategy
2635
+ */
2636
+ strategy_key?: string | null;
2644
2637
  };
2645
2638
  CreateOrderResponse: {
2646
2639
  /**
@@ -2761,18 +2754,31 @@ export interface components {
2761
2754
  label?: string | null;
2762
2755
  /** @description Collateral asset for the parent margin account. USDC is the current v1 path. */
2763
2756
  collateral_asset?: string | null;
2757
+ /**
2758
+ * @description Optional margin mode to initialize under the parent. Defaults to ISOLATED
2759
+ * compatibility, which creates only the parent account.
2760
+ */
2761
+ margin_mode?: string | null;
2762
+ /**
2763
+ * @description Selected trading pairs for the parent-scoped CROSS bucket. Required when
2764
+ * margin_mode is CROSS.
2765
+ */
2766
+ selected_trading_pair_ids?: string[] | null;
2764
2767
  };
2765
2768
  EnsureParentMarginAccountResponse: {
2766
2769
  /**
2767
2770
  * @description Current implementation note:
2768
2771
  * EnsureParentMarginAccount is idempotent and returns the user's parent margin account,
2769
- * initializing it only when no parent exists for the application/collateral scope.
2772
+ * initializing it only when no parent exists for the application scope.
2770
2773
  */
2771
2774
  margin_account_id?: string | null;
2772
2775
  account_state?: string | null;
2773
2776
  collateral_asset?: string | null;
2774
2777
  created_at?: string | null;
2775
2778
  label?: string | null;
2779
+ margin_bucket_id?: string | null;
2780
+ margin_mode?: string | null;
2781
+ selected_trading_pair_ids?: string[] | null;
2776
2782
  };
2777
2783
  ExecutionPriceRange: {
2778
2784
  /**
@@ -3055,6 +3061,8 @@ export interface components {
3055
3061
  /** Format: uuid */
3056
3062
  trading_pair_id?: string | null;
3057
3063
  strategy_key?: string | null;
3064
+ margin_bucket_id?: string | null;
3065
+ margin_mode?: string | null;
3058
3066
  };
3059
3067
  GetMarkPriceResponse: {
3060
3068
  /** Format: uuid */
@@ -3605,7 +3613,23 @@ export interface components {
3605
3613
  };
3606
3614
  /** @description A single trade. */
3607
3615
  GetTradeByIdResponse: {
3608
- trade?: components["schemas"]["PublicTrade"];
3616
+ data?: components["schemas"]["TradeData"];
3617
+ /**
3618
+ * @description Event type identifier
3619
+ * @example trade
3620
+ */
3621
+ event_type?: string | null;
3622
+ /**
3623
+ * Format: uuid
3624
+ * @description Trading pair UUID
3625
+ * @example 456e7890-e12b-12d3-a456-426614174000
3626
+ */
3627
+ trading_pair_id?: string | null;
3628
+ /**
3629
+ * @description Trading mode: SPOT or MARGIN
3630
+ * @example SPOT
3631
+ */
3632
+ trading_mode?: string | null;
3609
3633
  };
3610
3634
  /** @description Recent trades for a trading pair. */
3611
3635
  GetTradesResponse: {
@@ -4034,15 +4058,6 @@ export interface components {
4034
4058
  */
4035
4059
  total_pages?: number | null;
4036
4060
  };
4037
- ListUserTradesResponse: {
4038
- trades?: components["schemas"]["UserTrade"][] | null;
4039
- /** Format: uint32 */
4040
- total?: number | null;
4041
- /** Format: uint32 */
4042
- page?: number | null;
4043
- /** Format: uint32 */
4044
- page_size?: number | null;
4045
- };
4046
4061
  MarginAccountMovement: {
4047
4062
  id?: string | null;
4048
4063
  movement_type?: string | null;
@@ -4052,7 +4067,7 @@ export interface components {
4052
4067
  created_at?: string | null;
4053
4068
  };
4054
4069
  MarginAccountSummary: {
4055
- /** @description The margin account currently acts as the isolated bucket for a live position. */
4070
+ /** @description Parent margin account UUID. */
4056
4071
  margin_account_id?: string | null;
4057
4072
  account_state?: string | null;
4058
4073
  equity?: string | null;
@@ -4068,6 +4083,10 @@ export interface components {
4068
4083
  /** Format: uuid */
4069
4084
  trading_pair_id?: string | null;
4070
4085
  strategy_key?: string | null;
4086
+ /** @description Present only for risk-bucket summary rows. */
4087
+ margin_bucket_id?: string | null;
4088
+ /** @description Present only for risk-bucket summary rows. Values: ISOLATED, CROSS. */
4089
+ margin_mode?: string | null;
4071
4090
  };
4072
4091
  MatchResult: {
4073
4092
  /**
@@ -4295,44 +4314,25 @@ export interface components {
4295
4314
  */
4296
4315
  timestamp?: number | null;
4297
4316
  };
4317
+ /** @description A public trade event. Serializes to the historical REST/WebSocket envelope: { data: { ... }, event_type, trading_pair_id, trading_mode }. */
4298
4318
  PublicTrade: {
4319
+ data?: components["schemas"]["TradeData"];
4299
4320
  /**
4300
- * Format: uuid
4301
- * @description Trade UUID
4302
- * @example 123e4567-e89b-12d3-a456-426614174000
4321
+ * @description Event type identifier
4322
+ * @example trade
4303
4323
  */
4304
- trade_id?: string | null;
4324
+ event_type?: string | null;
4305
4325
  /**
4306
4326
  * Format: uuid
4307
4327
  * @description Trading pair UUID
4308
4328
  * @example 456e7890-e12b-12d3-a456-426614174000
4309
4329
  */
4310
4330
  trading_pair_id?: string | null;
4311
- /**
4312
- * @description Execution price
4313
- * @example 35000.00
4314
- */
4315
- price?: string | null;
4316
- /**
4317
- * @description Traded quantity in base token
4318
- * @example 0.5
4319
- */
4320
- quantity?: string | null;
4321
- /**
4322
- * @description Taker side: BUY or SELL
4323
- * @example BUY
4324
- */
4325
- side?: string | null;
4326
4331
  /**
4327
4332
  * @description Trading mode: SPOT or MARGIN
4328
4333
  * @example SPOT
4329
4334
  */
4330
4335
  trading_mode?: string | null;
4331
- /**
4332
- * @description Trade execution timestamp (ISO 8601)
4333
- * @example 2023-11-13T10:30:00Z
4334
- */
4335
- executed_at?: string | null;
4336
4336
  };
4337
4337
  ReducePositionMarginRequest: {
4338
4338
  amount?: string | null;
@@ -4616,6 +4616,13 @@ export interface components {
4616
4616
  free_collateral_after?: string | null;
4617
4617
  estimated_fee?: string | null;
4618
4618
  estimated_liquidation_price?: string | null;
4619
+ /**
4620
+ * @description The margin account the simulation was resolved against. Always populated;
4621
+ * useful for auto-resolved buckets where the caller didn't supply the id.
4622
+ */
4623
+ margin_account_id?: string | null;
4624
+ /** @description Populated when the simulated account is an auto-resolved bucket. */
4625
+ strategy_key?: string | null;
4619
4626
  };
4620
4627
  SubAccount: {
4621
4628
  /**
@@ -4743,6 +4750,40 @@ export interface components {
4743
4750
  slippage_tolerance_bps?: number | null;
4744
4751
  expires_at?: string | null;
4745
4752
  };
4753
+ /** @description Core fields of a single executed trade, nested under `data` in the public trade event envelope. */
4754
+ TradeData: {
4755
+ /**
4756
+ * @description Trade execution timestamp (ISO 8601). Omitted when the trade has no execution time.
4757
+ * @example 2023-11-13T10:30:00Z
4758
+ */
4759
+ executed_at?: string | null;
4760
+ /**
4761
+ * @description Maker order side: BUY or SELL
4762
+ * @example BUY
4763
+ */
4764
+ maker_side?: string | null;
4765
+ /**
4766
+ * @description Execution price
4767
+ * @example 35000.00
4768
+ */
4769
+ price?: string | null;
4770
+ /**
4771
+ * @description Traded quantity in base token (normalized)
4772
+ * @example 0.5
4773
+ */
4774
+ quantity?: string | null;
4775
+ /**
4776
+ * @description Traded quantity in raw base-token units
4777
+ * @example 50000000
4778
+ */
4779
+ quantity_raw?: string | null;
4780
+ /**
4781
+ * Format: uuid
4782
+ * @description Trade UUID
4783
+ * @example 123e4567-e89b-12d3-a456-426614174000
4784
+ */
4785
+ trade_id?: string | null;
4786
+ };
4746
4787
  /** @description Trading pair configuration including tokens, fees, and order limits. */
4747
4788
  TradingPairData: {
4748
4789
  /**
@@ -8166,34 +8207,6 @@ export interface operations {
8166
8207
  };
8167
8208
  };
8168
8209
  };
8169
- list_user_trades: {
8170
- parameters: {
8171
- query?: {
8172
- margin_account_id?: string;
8173
- /** @description Trading pair identifier (UUID) */
8174
- trading_pair_id?: string;
8175
- /** @description Page number (1-indexed) */
8176
- page?: number;
8177
- /** @description Items per page (max 100) */
8178
- page_size?: number;
8179
- };
8180
- header?: never;
8181
- path?: never;
8182
- cookie?: never;
8183
- };
8184
- requestBody?: never;
8185
- responses: {
8186
- /** @description OK */
8187
- 200: {
8188
- headers: {
8189
- [name: string]: unknown;
8190
- };
8191
- content: {
8192
- "application/json": components["schemas"]["ListUserTradesResponse"];
8193
- };
8194
- };
8195
- };
8196
- };
8197
8210
  get_trades: {
8198
8211
  parameters: {
8199
8212
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.8.7-develop.5d0e403",
3
+ "version": "0.8.7-develop.ab57a24",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "lint": "biome lint ."
21
21
  },
22
22
  "dependencies": {
23
- "@0xmonaco/contracts": "0.8.7-develop.5d0e403",
23
+ "@0xmonaco/contracts": "0.8.7-develop.ab57a24",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {