@0xmonaco/types 1.0.60 → 1.0.62

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.
@@ -9,6 +9,22 @@
9
9
  * A lost key or terminal update need not have a later replacement. Each
10
10
  * frame carries the account's full current health, so consume it as a
11
11
  * terminal-state snapshot per margin account, never as an additive delta.
12
+ *
13
+ * A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
14
+ * per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
15
+ * including FLAT accounts, which the live producer never emits for. Live
16
+ * delivery is wider: it is per user and carries no application filter, so if
17
+ * the same wallet trades through more than one application you also receive
18
+ * live frames for those accounts. Do NOT treat an account absent from the
19
+ * snapshot as deleted - merge per `marginAccountId` rather than replacing your
20
+ * whole map. Snapshot rows are this same payload with `sequence` absent; see
21
+ * that field.
22
+ *
23
+ * Live frames emitted before your subscription activated are buffered during
24
+ * the snapshot read and delivered after it, so one can supersede a newer
25
+ * snapshot row. A later frame normally corrects that within the ~30s
26
+ * keepalive; if the account went flat in that window and its final frame never
27
+ * arrived, reconnect to re-seed.
12
28
  */
13
29
  /**
14
30
  * Account event data carrying the current margin health of a single account.
@@ -17,23 +33,33 @@ export interface AccountEventData {
17
33
  /** Margin account this update describes (UUID) */
18
34
  marginAccountId: string;
19
35
  /**
20
- * Monotonic per-account counter within one producer run. It advances only on
21
- * published frames, may SKIP values (at-most-once publishing/delivery), and
22
- * resets to zero when the producer restarts — which can happen while your
23
- * WebSocket stays connected, because the socket is owned by a different
24
- * service. It is therefore never a gap detector and never a cross-restart
25
- * total order.
36
+ * Monotonic per-account counter within one producer run, on LIVE frames
37
+ * only. It advances only on published frames, may SKIP values (at-most-once
38
+ * publishing/delivery), and resets to zero when the producer restarts —
39
+ * which can happen while your WebSocket stays connected, because the socket
40
+ * is owned by a different service. It is therefore never a gap detector and
41
+ * never a cross-restart total order.
42
+ *
43
+ * Dedupe rule, LIVE FRAMES ONLY: order them per account by `updatedAt`,
44
+ * newest wins, and use `sequence` only to break ties between frames carrying
45
+ * the SAME `updatedAt` (those come from the same producer run). A snapshot
46
+ * row is not ranked this way — see below.
26
47
  *
27
- * Dedupe rule: order frames per account by `updatedAt`, newest wins; use
28
- * `sequence` only to break ties between frames carrying the SAME `updatedAt`
29
- * (those come from the same producer run).
48
+ * **Absent on a subscribe-time snapshot row.** The counter belongs to the
49
+ * matching engine's own producer process and the snapshot is served by a
50
+ * different service, which cannot mint one; a `0` would be worse than
51
+ * absent, because it is indistinguishable from a restarted producer's first
52
+ * frame and would make you drop live frames behind the baseline.
30
53
  *
31
- * There is no subscribe-time snapshot: an account with active exposure
32
- * delivers a baseline within ~30s (keepalive republish), but a FLAT account
33
- * is silent until it re-activates — fetch the margin-accounts REST endpoint
34
- * when an immediate flat baseline is needed.
54
+ * A snapshot row's `updatedAt` is the instant that account's state was
55
+ * PERSISTED (a database write), while a live frame's is when the engine
56
+ * SAMPLED it. Those clocks are not comparable under persistence lag, so the
57
+ * rule is simply that **a live frame always supersedes a snapshot row for the
58
+ * same `marginAccountId`** — rank `updatedAt` only between live frames, with
59
+ * `sequence` breaking ties inside one producer run, which a snapshot is not
60
+ * part of. Treat `undefined` as "unknown", never as zero.
35
61
  */
36
- sequence: number;
62
+ sequence?: number;
37
63
  /** Mark-inclusive account equity: collateral + unrealized PnL + funding (decimal string) */
38
64
  equity: string;
39
65
  /** Raw deposited collateral in USD (decimal string) */
@@ -9,4 +9,20 @@
9
9
  * A lost key or terminal update need not have a later replacement. Each
10
10
  * frame carries the account's full current health, so consume it as a
11
11
  * terminal-state snapshot per margin account, never as an additive delta.
12
+ *
13
+ * A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
14
+ * per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
15
+ * including FLAT accounts, which the live producer never emits for. Live
16
+ * delivery is wider: it is per user and carries no application filter, so if
17
+ * the same wallet trades through more than one application you also receive
18
+ * live frames for those accounts. Do NOT treat an account absent from the
19
+ * snapshot as deleted - merge per `marginAccountId` rather than replacing your
20
+ * whole map. Snapshot rows are this same payload with `sequence` absent; see
21
+ * that field.
22
+ *
23
+ * Live frames emitted before your subscription activated are buffered during
24
+ * the snapshot read and delivered after it, so one can supersede a newer
25
+ * snapshot row. A later frame normally corrects that within the ~30s
26
+ * keepalive; if the account went flat in that window and its final frame never
27
+ * arrived, reconnect to re-seed.
12
28
  */
@@ -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_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_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"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -49,6 +49,8 @@ export const OPERATION_IDS = [
49
49
  "get_market_metadata",
50
50
  "get_market_stats",
51
51
  "get_my_fee_tier",
52
+ "get_my_referral_downline",
53
+ "get_my_referral_position",
52
54
  "get_my_trader_code",
53
55
  "get_open_interest",
54
56
  "get_order_by_id",