@0xmonaco/types 1.0.69 → 1.0.70

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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copy trading WebSocket event types (owner-private `copy` channel, 0XM-2848).
3
+ *
4
+ * The channel streams to the FOLLOWER: every change to one of your copy
5
+ * relationships (follows), and every leader fill a relationship could not
6
+ * mirror. A leader receives nothing on this channel.
7
+ *
8
+ * Field names mirror the backend payloads (snake_case on the wire, camelCased
9
+ * by the client). The SDK parser normalizes explicit `null` values to absent,
10
+ * so nullable wire fields are optional here.
11
+ *
12
+ * **The value unions below are the values the server sends today, not a
13
+ * runtime guarantee**, which is why each value field is typed
14
+ * `Union | (string & {})`: `@0xmonaco/core` validates no value field, so an
15
+ * unrecognized status, policy or reason arrives as-is rather than dropping the
16
+ * update (0XM-2628). `switch` over one with a `default` branch.
17
+ */
@@ -1,6 +1,7 @@
1
1
  export * from "./account-events";
2
2
  export * from "./balance-events";
3
3
  export * from "./conditional-order-events";
4
+ export * from "./copy-events";
4
5
  export * from "./instrument-events";
5
6
  export * from "./liquidation-events";
6
7
  export * from "./market-stats-events";
@@ -1,6 +1,7 @@
1
1
  export * from "./account-events";
2
2
  export * from "./balance-events";
3
3
  export * from "./conditional-order-events";
4
+ export * from "./copy-events";
4
5
  export * from "./instrument-events";
5
6
  export * from "./liquidation-events";
6
7
  export * from "./market-stats-events";
@@ -150,6 +150,24 @@ export interface CommonOrderEventData {
150
150
  * Wire: `self_trade_prevention_mode`.
151
151
  */
152
152
  selfTradePreventionMode?: SelfTradePreventionMode | (string & {});
153
+ /**
154
+ * What placed the order (0XM-2848): `"USER"`, `"LIQUIDATION"`, `"SYSTEM"`,
155
+ * `"ADL"` or `"COPY"` (a copy trading order the engine placed for one of
156
+ * your follows).
157
+ *
158
+ * Absent means **not reported**, never `"USER"`: the key is omitted until
159
+ * the event's producer fills it, and `"USER"` is sent explicitly once it
160
+ * does. Widened past {@link OrderOrigin} because the parser passes an
161
+ * unrecognized value through rather than dropping the frame.
162
+ * Wire: `origin`.
163
+ */
164
+ origin?: OrderOrigin | (string & {});
165
+ /**
166
+ * The follow (copy relationship) a `"COPY"` order was placed for — the same
167
+ * id as `Follow.followId` and the `copy` channel's `relationshipId`.
168
+ * Omitted on every other order. Wire: `copy_relationship_id`.
169
+ */
170
+ copyRelationshipId?: string;
153
171
  /**
154
172
  * The TWAP parent of a child order: the same id REST `getOrder` returns as
155
173
  * `parentOrderId`, so a subscriber can group a TWAP's children from the
@@ -161,7 +179,24 @@ export interface CommonOrderEventData {
161
179
  * Wire: `parent_order_id`.
162
180
  */
163
181
  parentOrderId?: string;
182
+ /**
183
+ * The margin position this order is bound to: the same id REST `getOrder`
184
+ * returns as `positionId`. A margin order placed while its margin account
185
+ * (cross) or risk bucket (isolated) already holds an open position in the
186
+ * pair is bound when it is admitted, so a resting close or reduce-only order
187
+ * names its position before it fills; otherwise its first fill binds it.
188
+ * Carried on the `OrderPlaced` acknowledgement, taker and maker fills,
189
+ * remainder cancels, and the resting order's cancel, partial-cancel and
190
+ * expiry frames. Omitted while the order is unbound, always for spot, and by
191
+ * servers predating the field. Wire: `position_id`.
192
+ */
193
+ positionId?: string;
164
194
  }
195
+ /**
196
+ * What placed an order, as carried on order events' `origin` (0XM-2848).
197
+ * The values the server sends today; see {@link CommonOrderEventData.origin}.
198
+ */
199
+ export type OrderOrigin = "USER" | "LIQUIDATION" | "SYSTEM" | "ADL" | "COPY";
165
200
  /**
166
201
  * OrderPlaced event - emitted when a new order is placed
167
202
  */
@@ -170,6 +205,22 @@ export interface OrderPlacedEvent extends OrderEvent {
170
205
  data: CommonOrderEventData & {
171
206
  /** Order status */
172
207
  status: OrderStatus | (string & {});
208
+ /**
209
+ * Margin account backing a margin order (UUID), as REST reports it.
210
+ * Omitted for spot. Wire: `margin_account_id`.
211
+ */
212
+ marginAccountId?: string;
213
+ /**
214
+ * Requested leverage of a margin order (decimal string). Omitted for spot
215
+ * and for a margin order placed without one. Wire: `leverage`.
216
+ */
217
+ leverage?: string;
218
+ /**
219
+ * Whether the margin order can only reduce exposure. Present on every
220
+ * margin order, `false` included, like REST's `reduceOnly`; omitted for
221
+ * spot. Wire: `reduce_only`.
222
+ */
223
+ reduceOnly?: boolean;
173
224
  };
174
225
  }
175
226
  /**
@@ -60,8 +60,9 @@ export type SnapshotHandler<T> = (items: T[]) => void;
60
60
  * Nullability mirrors the wire exactly. Every optional field below is a Rust
61
61
  * `Option` serialized WITHOUT `skip_serializing_if`, so the key is always
62
62
  * present and carries `null` when unset — hence `| null` rather than `?`.
63
- * `clientOrderId`, `selfTradePreventionMode` and `version` are the fields the
64
- * server omits outright, so they are the `?`s.
63
+ * `clientOrderId`, `selfTradePreventionMode`, `parentOrderId`, `postOnly`,
64
+ * `expirationDate`, `triggerPrice`, `positionSide` and `version` are the fields
65
+ * the server omits outright, so they are the `?`s.
65
66
  *
66
67
  * The value unions are widened (`Union | (string & {})`) for the same reason
67
68
  * the order event's are: the parser hands an unrecognized value through rather
@@ -117,6 +118,27 @@ export interface OrderSnapshotItem {
117
118
  leverage: string | null;
118
119
  /** Whether the order can only reduce existing exposure */
119
120
  reduceOnly: boolean;
121
+ /**
122
+ * `true` when the order rests post-only. Omitted — never `false` — otherwise,
123
+ * matching REST's `postOnly` and the live order events. Wire: `post_only`.
124
+ */
125
+ postOnly?: boolean;
126
+ /**
127
+ * Custom GTC expiry (RFC 3339), as REST returns it. Omitted when the order
128
+ * has none. Wire: `expiration_date`.
129
+ */
130
+ expirationDate?: string;
131
+ /**
132
+ * Trigger price (decimal string) of an order a conditional placed, as REST
133
+ * returns it. Omitted otherwise. Wire: `trigger_price`.
134
+ */
135
+ triggerPrice?: string;
136
+ /**
137
+ * @deprecated REST's derived compatibility label (`"Long" | "Short"`),
138
+ * passed through; `side` is authoritative. Omitted when REST omits it.
139
+ * Wire: `position_side`.
140
+ */
141
+ positionSide?: string;
120
142
  /**
121
143
  * Client-assigned correlation handle, carried so the baseline and the live
122
144
  * events that follow it identify orders the same way. Omitted — not `null` —
@@ -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", "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_referral_downline", "get_my_referral_position", "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"];
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_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "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_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_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_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_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"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -41,14 +41,17 @@ export const OPERATION_IDS = [
41
41
  "get_candles",
42
42
  "get_conditional_order",
43
43
  "get_faucet_info",
44
+ "get_follow",
44
45
  "get_funding_state",
45
46
  "get_index_price",
47
+ "get_lead_trader",
46
48
  "get_margin_account_movements",
47
49
  "get_margin_account_summary",
48
50
  "get_mark_price",
49
51
  "get_market_metadata",
50
52
  "get_market_stats",
51
53
  "get_my_fee_tier",
54
+ "get_my_lead_trader",
52
55
  "get_my_referral_downline",
53
56
  "get_my_referral_position",
54
57
  "get_my_trader_code",
@@ -99,10 +102,16 @@ export const OPERATION_IDS = [
99
102
  "list_conditional_orders",
100
103
  "list_delegated_agent_owners",
101
104
  "list_delegated_agents",
105
+ "list_follow_leader_positions",
102
106
  "list_funding_history",
103
107
  "list_funding_payments",
108
+ "list_lead_trader_closed_trades",
109
+ "list_lead_trader_open_positions",
110
+ "list_lead_traders",
104
111
  "list_managed_market_assignments",
105
112
  "list_margin_accounts",
113
+ "list_my_followers",
114
+ "list_my_follows",
106
115
  "list_pending_withdrawals",
107
116
  "list_position_history",
108
117
  "list_positions",
@@ -110,6 +119,7 @@ export const OPERATION_IDS = [
110
119
  "list_trading_pairs",
111
120
  "list_twap_orders",
112
121
  "mint_tokens",
122
+ "preview_follow",
113
123
  "refresh_managed_market_quotes",
114
124
  "refresh_session",
115
125
  "register_deposit_address",
@@ -122,6 +132,7 @@ export const OPERATION_IDS = [
122
132
  "simulate_order_risk",
123
133
  "simulate_parent_margin_order_risk",
124
134
  "simulate_risk_bucket_order_risk",
135
+ "stop_follow",
125
136
  "submit_whitelist",
126
137
  "transfer_collateral_from_margin_account",
127
138
  "transfer_collateral_from_parent_margin_account",
@@ -131,5 +142,7 @@ export const OPERATION_IDS = [
131
142
  "transfer_rewards",
132
143
  "update_sub_account_limit",
133
144
  "upsert_delegated_agent",
145
+ "upsert_follow",
146
+ "upsert_lead_trader",
134
147
  "verify_signature",
135
148
  ];