@0xmonaco/types 1.0.99 → 1.1.0

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.
@@ -87,9 +87,12 @@ export interface MarginAccountSummary {
87
87
  * reducing, reduce-only, or opposite-side order sheltered by a larger
88
88
  * resting ladder needs less or none of it (and can be admitted even when
89
89
  * this field is zero), while an order crossing a losing position can need
90
- * more than its own margin-plus-fee. Divide by a market's initial margin
91
- * rate for indicative notional capacity; the authoritative per-order answer
92
- * remains `simulateRiskBucketOrderRisk`.
90
+ * more than its own margin-plus-fee. A bucket below its initial margin pays
91
+ * that gap out of the parent headroom first: its next order that opens,
92
+ * adds to or flips a position draws the gap with its own requirement, so
93
+ * the figure there is the headroom less the gap. Divide by a market's
94
+ * initial margin rate for indicative notional capacity; the authoritative
95
+ * per-order answer remains `simulateRiskBucketOrderRisk`.
93
96
  *
94
97
  * Present only on risk-bucket rows served from a live risk engine snapshot;
95
98
  * absent (the key is omitted, never null) on parent rows and on
@@ -46,7 +46,7 @@ export interface Order {
46
46
  /** Trading mode (SPOT or MARGIN) */
47
47
  tradingMode: TradingMode;
48
48
  /**
49
- * Time in force - GTC, IOC, or FOK (GTD is deprecated and rejected).
49
+ * Time in force - GTC, IOC, or FOK.
50
50
  * Absent on a MARKET order, which has none.
51
51
  */
52
52
  timeInForce?: TimeInForce;
@@ -269,12 +269,11 @@ export type TradingMode = "SPOT" | "MARGIN";
269
269
  * - GTC: Good Till Cancel - remains active until filled or canceled
270
270
  * - IOC: Immediate or Cancel - execute immediately and cancel unfilled portion
271
271
  * - FOK: Fill or Kill - execute completely or cancel entirely
272
- * - GTD: **deprecated, never implemented** - the server rejects it with HTTP
273
- * 400 (`Time in force must be GTC, IOC, or FOK`). The variant is retained so
274
- * existing code keeps compiling. For an order that expires at a set time, use
275
- * `GTC` together with `expirationDate`.
272
+ *
273
+ * For an order that expires at a set time, use `GTC` together with
274
+ * `expirationDate`.
276
275
  */
277
- export type TimeInForce = "GTC" | "IOC" | "FOK" | "GTD";
276
+ export type TimeInForce = "GTC" | "IOC" | "FOK";
278
277
  /**
279
278
  * Per-order self-trade-prevention override: how the engine resolves the order
280
279
  * matching against one of your own resting orders (whole wallet family,
@@ -8,24 +8,20 @@ import type { Address } from "viem";
8
8
  /**
9
9
  * Reason for the balance update.
10
10
  *
11
- * `fee` and `rebate` accompany a fill: `fee` when a taker/application fee is
12
- * charged, `rebate` when a maker rebate is credited (including perp/margin
13
- * makers). `funding` accompanies a funding settlement against margin collateral
14
- * (also surfaced on the movements channel with `transactionType: "funding"`).
15
- * `liquidation` and `adl` accompany a forced-close on the liquidation-worker
16
- * path: `liquidation` on the liquidated victim's collateral, `adl` on an
17
- * account impacted by auto-deleveraging.
11
+ * Every `balance_update` carries one spot `user_balances` row. Its
12
+ * producer-owned `version`, when present, is scoped to the authenticated
13
+ * user/application and token: higher is newer, equal is idempotent. `fee` and `rebate` accompany a
14
+ * spot fill: `fee` when a taker/application fee is charged, `rebate` when a
15
+ * maker rebate is credited. A collateral transfer that moves the spot wallet
16
+ * row (`margin_transfer_in` / `margin_transfer_out`) sends a versioned spot
17
+ * frame for that leg.
18
18
  *
19
- * A genuine spot frame carries the resulting `user_balances` row and its
20
- * producer-owned `version`, scoped to the authenticated user/application and
21
- * token. Higher is newer; equal is idempotent. A collateral transfer that
22
- * moves the spot wallet row emits a genuine versioned spot frame for that leg.
23
- * Margin collateral frames — a parent to risk-bucket allocation, which moves
24
- * no wallet balance — and margin-routed deposit notifications omit `version`:
25
- * they are not spot rows, and a deposit notification can carry a delta rather
26
- * than whole-row state.
27
- * They cannot be reconciled against a spot snapshot or summed as separate
28
- * credits; refresh authoritative margin-account state instead.
19
+ * Margin collateral is not a spot row and is not sent on this channel: a
20
+ * margin-routed deposit, a perp fill, a funding settlement, a liquidation and
21
+ * an auto-deleveraging close send no `balance_update`. Read margin collateral
22
+ * from the `account` channel. `margin_deposit`, `funding`, `liquidation` and
23
+ * `adl` stay in this union so existing code that names them still compiles;
24
+ * the server does not send them.
29
25
  */
30
26
  export type BalanceUpdateReason = "lock" | "unlock" | "deposit" | "margin_deposit" | "withdrawal" | "trade" | "fee" | "rebate" | "funding" | "liquidation" | "adl" | "margin_transfer_in" | "margin_transfer_out";
31
27
  /**
@@ -36,7 +32,7 @@ export interface UserBalanceEventData {
36
32
  tokenAddress: Address;
37
33
  /** Token symbol */
38
34
  tokenSymbol: string | null;
39
- /** Available balance for trading (normalized) */
35
+ /** Available spot balance (normalized) */
40
36
  available: string;
41
37
  /** Available balance in raw format (wei) */
42
38
  availableRaw: string;
@@ -49,8 +45,8 @@ export interface UserBalanceEventData {
49
45
  /** Total balance in raw format (wei) */
50
46
  totalRaw: string;
51
47
  /**
52
- * Opaque durable spot-row version. Present only for genuine `user_balances`
53
- * state; absent on legacy frames and margin collateral notifications.
48
+ * Opaque durable spot-row version. Absent on frames from a producer that
49
+ * does not stamp versions yet.
54
50
  *
55
51
  * Only a POSITIVE version is rankable. `0` is the legacy sentinel and means
56
52
  * exactly what an absent field means — unranked — so normalize the two
@@ -8639,9 +8639,12 @@ export interface components {
8639
8639
  * reducing, reduce-only, or opposite-side order sheltered by a larger
8640
8640
  * resting ladder needs less or none of it (and can be admitted even when
8641
8641
  * this field is zero), while an order crossing a losing position can need
8642
- * more than its own margin-plus-fee. Divide by a market's initial margin
8643
- * rate for indicative notional capacity; the authoritative per-order answer
8644
- * remains `simulate_risk_bucket_order_risk`.
8642
+ * more than its own margin-plus-fee. A bucket below its initial margin pays
8643
+ * that gap out of the parent headroom first: its next order that opens,
8644
+ * adds to or flips a position draws the gap with its own requirement, so
8645
+ * the figure there is the headroom less the gap. Divide by a market's
8646
+ * initial margin rate for indicative notional capacity; the authoritative
8647
+ * per-order answer remains `simulate_risk_bucket_order_risk`.
8645
8648
  *
8646
8649
  * Present only on risk-bucket summary rows served from a live risk engine
8647
8650
  * snapshot; absent on parent rows and on persisted-fallback reads, where
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.0.99",
3
+ "version": "1.1.0",
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.99",
19
+ "@0xmonaco/contracts": "1.1.0",
20
20
  "zod": "^4.6.7"
21
21
  },
22
22
  "peerDependencies": {