@0xmonaco/types 1.0.74 → 1.0.76

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 (58) hide show
  1. package/dist/api/index.d.ts +0 -7
  2. package/dist/applications/index.d.ts +14 -15
  3. package/dist/applications/index.js +2 -2
  4. package/dist/applications/requests.d.ts +70 -15
  5. package/dist/applications/requests.js +2 -3
  6. package/dist/applications/responses.d.ts +35 -39
  7. package/dist/applications/responses.js +1 -1
  8. package/dist/buildercodes/index.d.ts +3 -4
  9. package/dist/buildercodes/responses.d.ts +10 -3
  10. package/dist/buildercodes/responses.js +24 -4
  11. package/dist/fees/responses.js +2 -2
  12. package/dist/managed-markets/index.d.ts +21 -2
  13. package/dist/margin-accounts/index.d.ts +72 -12
  14. package/dist/market/index.d.ts +76 -6
  15. package/dist/pitpass/index.d.ts +16 -11
  16. package/dist/pitpass/index.js +1 -1
  17. package/dist/pitpass/responses.d.ts +21 -0
  18. package/dist/pitpass/responses.js +43 -14
  19. package/dist/positions/index.d.ts +81 -14
  20. package/dist/profile/index.d.ts +114 -44
  21. package/dist/sdk/index.d.ts +12 -4
  22. package/dist/trading/index.d.ts +1 -1
  23. package/dist/trading/orders.d.ts +6 -32
  24. package/dist/trading/responses.d.ts +9 -14
  25. package/dist/validation/applications.d.ts +51 -0
  26. package/dist/validation/applications.js +45 -0
  27. package/dist/validation/index.d.ts +2 -0
  28. package/dist/validation/index.js +2 -0
  29. package/dist/validation/managed-markets.d.ts +17 -0
  30. package/dist/validation/managed-markets.js +17 -0
  31. package/dist/validation/margin-accounts.d.ts +10 -3
  32. package/dist/validation/margin-accounts.js +17 -6
  33. package/dist/validation/market.d.ts +45 -0
  34. package/dist/validation/market.js +43 -0
  35. package/dist/validation/positions.d.ts +5 -3
  36. package/dist/validation/positions.js +12 -5
  37. package/dist/validation/profile.d.ts +19 -2
  38. package/dist/validation/profile.js +36 -4
  39. package/dist/validation/trading.d.ts +2 -2
  40. package/dist/validation/vault.d.ts +14 -0
  41. package/dist/validation/vault.js +14 -0
  42. package/dist/websocket/base.d.ts +56 -6
  43. package/dist/websocket/client.d.ts +8 -3
  44. package/dist/websocket/events/index.d.ts +1 -0
  45. package/dist/websocket/events/index.js +1 -0
  46. package/dist/websocket/events/instrument-events.d.ts +27 -1
  47. package/dist/websocket/events/instrument-events.js +6 -1
  48. package/dist/websocket/events/market-stats-events.d.ts +41 -5
  49. package/dist/websocket/events/market-stats-events.js +3 -2
  50. package/dist/websocket/events/orders-events.d.ts +30 -3
  51. package/dist/websocket/events/position-events.d.ts +15 -0
  52. package/dist/websocket/events/position-valuation-events.d.ts +60 -0
  53. package/dist/websocket/events/position-valuation-events.js +15 -0
  54. package/dist/wire/operations.d.ts +1 -1
  55. package/dist/wire/operations.js +2 -0
  56. package/dist/wire/schema.d.ts +906 -284
  57. package/dist/withdrawals/index.d.ts +27 -6
  58. package/package.json +2 -2
@@ -13,8 +13,9 @@
13
13
  *
14
14
  * Perp-only fields (index/mark price, open interest, funding) are optional and
15
15
  * omitted on the wire for spot markets, which have no positions or funding.
16
- * All numeric quantities are decimal strings except `fundingTimestamp`, which
17
- * is a millisecond epoch number.
16
+ * All numeric quantities are decimal strings except `fundingTimestamp` and
17
+ * `lastFundingTime` (millisecond epoch numbers) and `fundingIntervalSeconds`
18
+ * (whole seconds).
18
19
  */
19
20
  /**
20
21
  * Market tradability label, derived from the oracle market status. Spot markets
@@ -23,6 +24,10 @@
23
24
  export type MarketStatus = "TRADABLE" | "POST_ONLY" | "HALTED" | "NOT_READY" | "UNKNOWN";
24
25
  /**
25
26
  * Full per-market statistics for the `market_stats:<tradingPairId>` channel.
27
+ *
28
+ * `marketStatus` is typed `MarketStatus | (string & {})` for the same reason as
29
+ * on {@link MarketStatsSummary}: an unrecognized status is passed through
30
+ * rather than dropping the frame. Match it with a `default` branch.
26
31
  */
27
32
  export interface MarketStatsData {
28
33
  /** Market symbol, e.g. "BTC/USDC" */
@@ -39,10 +44,24 @@ export interface MarketStatsData {
39
44
  bestBidPrice?: string;
40
45
  /** Best ask price (decimal string) */
41
46
  bestAskPrice?: string;
42
- /** Open interest (decimal string). Perp-only; omitted for spot. */
47
+ /**
48
+ * Open interest (decimal string). Perp-only; omitted for spot, and omitted
49
+ * (never zero) until the market's open interest is known.
50
+ */
43
51
  openInterest?: string;
44
- /** Open interest limit (decimal string). Perp-only; omitted for spot. */
52
+ /**
53
+ * The market's gross open-interest cap, in quote (USD) notional (decimal
54
+ * string). `openInterest` is in base units: multiply it by `markPrice` to
55
+ * compare. Perp-only; omitted for spot.
56
+ */
45
57
  openInterestLimit?: string;
58
+ /**
59
+ * What is left of `openInterestLimit` at the mark, in quote (USD) notional,
60
+ * never below zero (decimal string). At zero, orders that open exposure are
61
+ * refused until open interest or the mark falls. Perp-only; omitted for spot,
62
+ * when there is no mark, and until open interest is known.
63
+ */
64
+ openInterestHeadroom?: string;
46
65
  /** Last trade price (decimal string) */
47
66
  lastTradePrice?: string;
48
67
  /** 24h base-token volume (decimal string) */
@@ -71,6 +90,20 @@ export interface MarketStatsData {
71
90
  fundingClampSmall?: string;
72
91
  /** Live funding cap, upper bound (decimal string). Perp-only; omitted for spot. */
73
92
  fundingClampBig?: string;
93
+ /**
94
+ * Tradability label, the same value the all-markets summary carries for this
95
+ * market. Perp markets report any {@link MarketStatus}; spot markets report
96
+ * `TRADABLE` or `HALTED`. Always present on frames from current servers.
97
+ */
98
+ marketStatus?: MarketStatus | (string & {});
99
+ /** Funding settlement interval in whole seconds. Perp-only; omitted for spot. */
100
+ fundingIntervalSeconds?: number;
101
+ /**
102
+ * When the latest funding window settled, as a millisecond epoch number
103
+ * (REST `getFundingState` returns the same instant as an RFC 3339 string).
104
+ * Perp-only; omitted for spot and for a market that has not settled yet.
105
+ */
106
+ lastFundingTime?: number;
74
107
  }
75
108
  /**
76
109
  * Per-market statistics event on the `market_stats:<tradingPairId>` channel.
@@ -111,7 +144,10 @@ export interface MarketStatsSummary {
111
144
  dailyPriceHigh?: string;
112
145
  /** 24h low price (decimal string) */
113
146
  dailyPriceLow?: string;
114
- /** Open interest (decimal string). Perp-only; omitted for spot. */
147
+ /**
148
+ * Open interest (decimal string). Perp-only; omitted for spot, and omitted
149
+ * (never zero) until the market's open interest is known.
150
+ */
115
151
  openInterest?: string;
116
152
  /** Current (last settled) funding rate (decimal string). Perp-only; omitted for spot. */
117
153
  currentFundingRate?: string;
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * Perp-only fields (index/mark price, open interest, funding) are optional and
15
15
  * omitted on the wire for spot markets, which have no positions or funding.
16
- * All numeric quantities are decimal strings except `fundingTimestamp`, which
17
- * is a millisecond epoch number.
16
+ * All numeric quantities are decimal strings except `fundingTimestamp` and
17
+ * `lastFundingTime` (millisecond epoch numbers) and `fundingIntervalSeconds`
18
+ * (whole seconds).
18
19
  */
@@ -227,6 +227,21 @@ export interface OrderPlacedEvent extends OrderEvent {
227
227
  * spot. Wire: `reduce_only`.
228
228
  */
229
229
  reduceOnly?: boolean;
230
+ /**
231
+ * The fill an edit carried over from the original order (decimal string).
232
+ * Sent only when the order is a replacement of a partly filled order; its
233
+ * `quantity` is then the order's total and its `status` is
234
+ * `PARTIALLY_FILLED`, as REST reports the edited order. Omitted on any
235
+ * other `OrderPlaced`. Wire: `filled_quantity`.
236
+ */
237
+ filledQuantity?: string;
238
+ /** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
239
+ filledQuantityRaw?: string;
240
+ /**
241
+ * Average fill price of the carried fill (decimal string). Sent with
242
+ * `filledQuantity`, omitted otherwise. Wire: `average_fill_price`.
243
+ */
244
+ averageFillPrice?: string;
230
245
  };
231
246
  }
232
247
  /**
@@ -311,7 +326,11 @@ export interface OrderMatchedEvent extends OrderEvent {
311
326
  tradesCount: number;
312
327
  /** Remaining quantity to be filled. */
313
328
  remainingQuantity: string;
314
- /** Average fill price across all trades. `null` when there is none. */
329
+ /**
330
+ * The order's cumulative average fill price, across every fill — those an
331
+ * edit carried over from the original order included, matching REST.
332
+ * `null` when there is none. This match's own price is `executionPrice`.
333
+ */
315
334
  averageFillPrice: string | null;
316
335
  /** Order status. */
317
336
  status: OrderStatus | (string & {});
@@ -345,7 +364,11 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
345
364
  tradesCount?: number;
346
365
  /** Remaining quantity (present for both taker and maker) */
347
366
  remainingQuantity?: string;
348
- /** Average fill price (taker orders only) */
367
+ /**
368
+ * The order's cumulative average fill price, on both roles: the average
369
+ * across every fill of the order (an edit's carried fills included), as
370
+ * REST reports it — not this trade's price, which is `executionPrice`.
371
+ */
349
372
  averageFillPrice?: string;
350
373
  /** Order status (taker orders only) */
351
374
  status?: OrderStatus | (string & {});
@@ -439,7 +462,11 @@ export interface OrderFilledEvent extends OrderEvent {
439
462
  tradesCount?: number;
440
463
  /** Remaining quantity (present for both, should be 0 for filled orders) */
441
464
  remainingQuantity?: string;
442
- /** Average fill price (taker orders only) */
465
+ /**
466
+ * The order's cumulative average fill price, on both roles: the average
467
+ * across every fill of the order (an edit's carried fills included), as
468
+ * REST reports it — not this trade's price, which is `executionPrice`.
469
+ */
443
470
  averageFillPrice?: string;
444
471
  /** Order status (taker orders only) */
445
472
  status?: OrderStatus | (string & {});
@@ -141,6 +141,21 @@ export interface PositionEventData {
141
141
  * that window, and the frame is the fresher one.
142
142
  */
143
143
  updatedAt: string;
144
+ /**
145
+ * When the position OPENED (ISO 8601): the fill that took its exposure from
146
+ * zero to non-zero. It never changes for the life of `positionId`, so time
147
+ * held is now minus `openedAt` while open, and `updatedAt` minus `openedAt`
148
+ * on a terminal frame. A flip closes the position and opens a new one with
149
+ * a new `positionId` and its own `openedAt`.
150
+ *
151
+ * Absent when the server does not know it — never filled with the time the
152
+ * frame was sent. A REST read of the same position reports the same
153
+ * instant, normally to within one matching-engine step; after a server
154
+ * restart it can move by the server's own clock drift. Clamp a computed time
155
+ * held at zero. Not versioned: take it from the newest payload (frame or
156
+ * REST read) rather than skipping it on an equal `version`.
157
+ */
158
+ openedAt?: string;
144
159
  /**
145
160
  * Opaque, non-negative producer-owned row version for this position
146
161
  * (0XM-2673). Compare only within the same `positionId`; higher is newer.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Position Valuation WebSocket Event Types
3
+ *
4
+ * Periodic mark-derived valuation of one OPEN position, delivered on the same
5
+ * authenticated `positions` / `positions:<tradingPairId>` channel as lifecycle
6
+ * `position_update` frames, with `eventType: "position_valuation"`.
7
+ *
8
+ * Valuation data only: it carries no size, side, status or version, and never
9
+ * creates, reopens, closes or resizes a position. Apply it only to a position
10
+ * you already hold as `OPEN` whose `updatedAt` is earlier than the frame's
11
+ * `valuedAt`, and ignore it otherwise: valuations are spread over each
12
+ * interval, so one can arrive after a newer `position_update` (a fill, a close,
13
+ * a funding settlement) for the same position. `@0xmonaco/core` delivers these to the `onValuation` callback of
14
+ * `positions(...)`, never to its lifecycle handler.
15
+ */
16
+ /**
17
+ * The five mark-derived figures of one open position, from the same
18
+ * derivation as a lifecycle frame's figures for that position.
19
+ */
20
+ export interface PositionValuationEventData {
21
+ /** Position identifier (UUID) */
22
+ positionId: string;
23
+ /** Margin account that owns the position (UUID) */
24
+ marginAccountId: string;
25
+ /** Trading pair identifier (UUID) */
26
+ tradingPairId: string;
27
+ /** Current mark price (decimal string) */
28
+ markPrice: string;
29
+ /** Unrealized PnL at the mark price (decimal string) */
30
+ unrealizedPnl: string;
31
+ /**
32
+ * Liquidation price (decimal string), or `null` when the server cannot
33
+ * derive one for this position (for example an isolated risk bucket shared
34
+ * by several positions, or one whose collateral basis is not positive).
35
+ */
36
+ liquidationPrice: string | null;
37
+ /** Initial margin this position requires at the mark price (decimal string) */
38
+ initialMarginRequired: string;
39
+ /** Maintenance margin this position requires at the mark price (decimal string) */
40
+ maintenanceMarginRequired: string;
41
+ /**
42
+ * When the server read the position (RFC 3339). Not the oracle publish time
43
+ * and not the position's last mutation (`updatedAt` on lifecycle frames),
44
+ * but on the same server clock as `updatedAt`: a valuation whose `valuedAt`
45
+ * is not later than the held position's `updatedAt` was read before that
46
+ * state and is stale.
47
+ */
48
+ valuedAt: string;
49
+ }
50
+ /**
51
+ * Periodic valuation frame for one open position.
52
+ */
53
+ export interface PositionValuationEvent {
54
+ /** Event type identifier */
55
+ eventType: "position_valuation";
56
+ /** User ID (UUID) */
57
+ userId: string;
58
+ /** Valuation data */
59
+ data: PositionValuationEventData;
60
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Position Valuation WebSocket Event Types
3
+ *
4
+ * Periodic mark-derived valuation of one OPEN position, delivered on the same
5
+ * authenticated `positions` / `positions:<tradingPairId>` channel as lifecycle
6
+ * `position_update` frames, with `eventType: "position_valuation"`.
7
+ *
8
+ * Valuation data only: it carries no size, side, status or version, and never
9
+ * creates, reopens, closes or resizes a position. Apply it only to a position
10
+ * you already hold as `OPEN` whose `updatedAt` is earlier than the frame's
11
+ * `valuedAt`, and ignore it otherwise: valuations are spread over each
12
+ * interval, so one can arrive after a newer `position_update` (a fill, a close,
13
+ * a funding settlement) for the same position. `@0xmonaco/core` delivers these to the `onValuation` callback of
14
+ * `positions(...)`, never to its lifecycle handler.
15
+ */
@@ -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 ["add_follow_position_margin", "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_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "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_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "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_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "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", "upsert_follow", "upsert_lead_trader", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["add_follow_position_margin", "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_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "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_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "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_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -146,9 +146,11 @@ export const OPERATION_IDS = [
146
146
  "transfer_collateral",
147
147
  "transfer_collateral_from_margin_account",
148
148
  "transfer_collateral_from_parent_margin_account",
149
+ "transfer_collateral_from_sub_account",
149
150
  "transfer_collateral_to_margin_account",
150
151
  "transfer_collateral_to_parent_margin_account",
151
152
  "transfer_collateral_to_risk_bucket",
153
+ "transfer_collateral_to_sub_account",
152
154
  "transfer_rewards",
153
155
  "update_sub_account_limit",
154
156
  "upsert_delegated_agent",