@metaflux-dex/client 0.0.1

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/dist/client.d.ts +32 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +344 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/http.d.ts +17 -0
  8. package/dist/http.d.ts.map +1 -0
  9. package/dist/http.js +106 -0
  10. package/dist/http.js.map +1 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +26 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/info-types.d.ts +380 -0
  16. package/dist/info-types.d.ts.map +1 -0
  17. package/dist/info-types.js +16 -0
  18. package/dist/info-types.js.map +1 -0
  19. package/dist/info.d.ts +65 -0
  20. package/dist/info.d.ts.map +1 -0
  21. package/dist/info.js +252 -0
  22. package/dist/info.js.map +1 -0
  23. package/dist/native.d.ts +10 -0
  24. package/dist/native.d.ts.map +1 -0
  25. package/dist/native.js +252 -0
  26. package/dist/native.js.map +1 -0
  27. package/dist/types.d.ts +143 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +13 -0
  30. package/dist/types.js.map +1 -0
  31. package/dist/wasm.d.ts +28 -0
  32. package/dist/wasm.d.ts.map +1 -0
  33. package/dist/wasm.js +279 -0
  34. package/dist/wasm.js.map +1 -0
  35. package/dist/ws.d.ts +43 -0
  36. package/dist/ws.d.ts.map +1 -0
  37. package/dist/ws.js +221 -0
  38. package/dist/ws.js.map +1 -0
  39. package/package.json +65 -0
  40. package/src/client.ts +454 -0
  41. package/src/http.ts +153 -0
  42. package/src/index.ts +144 -0
  43. package/src/info-types.ts +783 -0
  44. package/src/info.ts +355 -0
  45. package/src/native.ts +307 -0
  46. package/src/types.ts +305 -0
  47. package/src/wasm.ts +384 -0
  48. package/src/ws.ts +279 -0
@@ -0,0 +1,783 @@
1
+ // Response interfaces for the MTF-native `POST /info` read surface.
2
+ //
3
+ // Source of truth (read these, do not guess): the node handlers
4
+ // metaflux/crates/api-node/src/rest/info/{reads,markets,hl_parity}.rs
5
+ // and the KB spec metaflux-knowledges/api/rest/info.md. Every field name here
6
+ // is the EXACT snake_case key the node emits inside the `{type, data}`
7
+ // envelope's `data` object (the envelope itself is unwrapped by `InfoApi`).
8
+ //
9
+ // Money-magnitude convention: any value that can exceed JS
10
+ // `Number.MAX_SAFE_INTEGER` (2^53) — u128 / i128 / decimal magnitudes — is
11
+ // typed `string` to match the node's decimal-string encoding and avoid silent
12
+ // precision loss. Ids / counts / bps / leverage that the node emits as JSON
13
+ // numbers within safe range stay `number`. Optional fields the node only emits
14
+ // conditionally (e.g. echoed `account_id`) are `?`.
15
+
16
+ /// `node_info` — static node identity + protocol version.
17
+ export interface NodeInfo {
18
+ /// Network variant: `"devnet"`, `"testnet"`, or `"mainnet"`.
19
+ network: string;
20
+ /// EIP-712 chain id this node is pinned to.
21
+ chain_id: number;
22
+ /// Wire-protocol version (semver string).
23
+ protocol_version: string;
24
+ /// This node's index in the active validator set; `null` until published.
25
+ validator_index: number | null;
26
+ /// Operator-published build identifier (short hex).
27
+ build_commit: string;
28
+ /// Process uptime in seconds.
29
+ uptime_seconds: number;
30
+ }
31
+
32
+ /// Account liquidation tier — see `concepts/tiered-liquidation.md`.
33
+ export type Tier = 'Safe' | 'T0' | 'T1' | 'T2' | 'T3';
34
+
35
+ /// Account margin mode label.
36
+ export type MarginMode = 'Cross' | 'Isolated' | 'StrictIso';
37
+
38
+ /// One open position inside an `AccountState`.
39
+ export interface AccountPosition {
40
+ /// Asset id.
41
+ asset: number;
42
+ /// Signed position size, fixed-point as a decimal string.
43
+ size: string;
44
+ /// Volume-weighted entry price, decimal string (whole-USDC plane).
45
+ entry_px: string;
46
+ /// Unrealised PnL (signed), decimal string (same unit as `account_value`).
47
+ unrealised_pnl: string;
48
+ /// Whether this position uses isolated margin.
49
+ isolated: boolean;
50
+ /// Per-asset leverage multiple.
51
+ leverage: number;
52
+ }
53
+
54
+ /// Per-account balances inside an `AccountState`. `usdc` is the cross USDC
55
+ /// collateral; `spot` maps spot-asset symbol → balance, both decimal strings.
56
+ export interface Balances {
57
+ /// USDC collateral (cross account value), decimal string.
58
+ usdc: string;
59
+ /// Spot balances keyed by asset symbol, decimal strings.
60
+ spot: Record<string, string>;
61
+ }
62
+
63
+ /// `account_state` — rich per-account snapshot keyed by `address`.
64
+ export interface AccountState {
65
+ /// Echo of the requested 0x address.
66
+ address: string;
67
+ /// Equity including unrealised PnL, USDC base units (u128 string).
68
+ account_value: string;
69
+ /// Equity minus initial margin held by open positions (u128 string).
70
+ free_collateral: string;
71
+ /// Maintenance margin requirement (u128 string).
72
+ maint_margin: string;
73
+ /// Initial margin requirement (u128 string).
74
+ init_margin: string;
75
+ /// `account_value - maint_margin` (i128 string; can be negative).
76
+ health: string;
77
+ /// Liquidation tier.
78
+ tier: Tier;
79
+ /// Margin mode.
80
+ margin_mode: MarginMode;
81
+ /// Portfolio-margin opt-in state.
82
+ pm_enabled: boolean;
83
+ /// Per-asset open positions.
84
+ positions: AccountPosition[];
85
+ /// Account balances.
86
+ balances: Balances;
87
+ }
88
+
89
+ /// Per-market funding parameters inside a `MarketInfo`.
90
+ export interface Funding {
91
+ /// Latest funding premium sample, bps string.
92
+ rate_per_hr: string;
93
+ /// Per-hour funding cap, bps string.
94
+ cap_per_hr: string;
95
+ /// Funding interval in milliseconds.
96
+ interval_ms: number;
97
+ /// Next funding payment timestamp (unix ms; `0` until a sample exists).
98
+ next_payment_ts: number;
99
+ }
100
+
101
+ /// `market_info` / `markets` element — rich per-market metadata.
102
+ ///
103
+ /// `mark_px` is the on-book mark in the 1e8 fixed-point plane; `oracle_px` is
104
+ /// the index price in the whole-USDC plane. Both are `"0"` when unset. (These
105
+ /// two price fields are emitted by the node `market_record` builder; they are
106
+ /// not yet listed in the KB field table but are part of the live wire shape.)
107
+ export interface MarketInfo {
108
+ /// Canonical asset id.
109
+ asset_id: number;
110
+ /// Human-readable market name (e.g. `"BTC"`).
111
+ name: string;
112
+ /// Market kind — currently always `"Perp"`.
113
+ kind: string;
114
+ /// On-book mark price, 1e8 fixed-point as a decimal string.
115
+ mark_px: string;
116
+ /// Oracle/index price, whole-USDC plane as a decimal string.
117
+ oracle_px: string;
118
+ /// Tick size (smallest price increment), fixed-point string.
119
+ tick_size: string;
120
+ /// Step size (smallest size increment / lot size), fixed-point string.
121
+ step_size: string;
122
+ /// Minimum order size, fixed-point string.
123
+ min_order: string;
124
+ /// Maximum leverage multiple.
125
+ max_leverage: number;
126
+ /// Maintenance margin ratio, bps string.
127
+ maint_margin_ratio: string;
128
+ /// Initial margin ratio, bps string.
129
+ init_margin_ratio: string;
130
+ /// Funding parameters.
131
+ funding: Funding;
132
+ /// Mark-price source descriptor.
133
+ mark_source: string;
134
+ /// Whether frequent-batch-auction matching is enabled for this market.
135
+ fba_enabled: boolean;
136
+ /// Open interest, fixed-point as a decimal string.
137
+ open_interest: string;
138
+ }
139
+
140
+ /// `vault_state` — per-vault snapshot keyed by vault `address`.
141
+ export interface VaultState {
142
+ /// Vault on-chain address (0x).
143
+ vault: string;
144
+ /// Vault display name (derived `vault:<id>` today).
145
+ name: string;
146
+ /// TVL = high-water-mark NAV proxy, USD cents as a decimal string.
147
+ tvl: string;
148
+ /// Share price (NAV / total shares), decimal string.
149
+ share_price: string;
150
+ /// Distinct depositor count.
151
+ depositor_count: number;
152
+ /// High-water mark, USD cents as a decimal string.
153
+ high_water_mark: string;
154
+ /// Leader management/performance fee in bps.
155
+ performance_fee_bps: number;
156
+ /// Follower withdrawal lock in ms.
157
+ lock_period_ms: number;
158
+ /// Vault strategy / kind label (`"User"` / `"Metaliquidity"`).
159
+ strategy: string;
160
+ }
161
+
162
+ /// One delegation entry inside a `StakingState`.
163
+ export interface Delegation {
164
+ /// Validator address (0x).
165
+ validator: string;
166
+ /// Staked amount, decimal string.
167
+ amount: string;
168
+ /// Last-claim / since timestamp (unix ms).
169
+ since_ts: number;
170
+ /// Accrued but unclaimed rewards, decimal string.
171
+ pending_rewards: string;
172
+ }
173
+
174
+ /// One pending-unstake entry inside a `StakingState`.
175
+ export interface PendingUnstake {
176
+ /// Amount being unbonded, decimal string.
177
+ amount: string;
178
+ /// Earliest claim / maturity timestamp (unix ms).
179
+ matures_at_ts: number;
180
+ }
181
+
182
+ /// `staking_state` — per-account staking snapshot keyed by `address`.
183
+ export interface StakingState {
184
+ /// Echo of the requested 0x address.
185
+ address: string;
186
+ /// Total staked across all delegations, decimal string.
187
+ total_staked: string;
188
+ /// Active per-validator delegations.
189
+ delegations: Delegation[];
190
+ /// Pending unbond entries.
191
+ pending_unstakes: PendingUnstake[];
192
+ }
193
+
194
+ /// One fee tier inside a `FeeSchedule`.
195
+ export interface FeeTier {
196
+ /// 30-day volume threshold for this tier, decimal string.
197
+ volume_30d: string;
198
+ /// Maker fee, decimal bps string (e.g. `"2.0"`).
199
+ maker_bps: string;
200
+ /// Taker fee, decimal bps string.
201
+ taker_bps: string;
202
+ }
203
+
204
+ /// `fee_schedule` — protocol fee schedule. Fee rates are decimal bps strings;
205
+ /// `burn_ratio` is a decimal fraction string (`"0.30"` = 30%).
206
+ export interface FeeSchedule {
207
+ /// Volume-tier ladder.
208
+ tiers: FeeTier[];
209
+ /// Builder rebate, decimal bps string.
210
+ builder_rebate_bps: string;
211
+ /// Fraction of fees burned, decimal fraction string.
212
+ burn_ratio: string;
213
+ /// Referrer share, decimal bps string.
214
+ referrer_share_bps: string;
215
+ }
216
+
217
+ /// One resting order inside an `OpenOrders` response.
218
+ export interface OpenOrder {
219
+ /// Server order id.
220
+ oid: number;
221
+ /// Asset / market id the order rests on.
222
+ market_id: number;
223
+ /// Order side.
224
+ side: 'bid' | 'ask';
225
+ /// Resting price, fixed-point decimal string.
226
+ px: string;
227
+ /// Remaining size, fixed-point decimal string.
228
+ size: string;
229
+ /// Insertion timestamp (consensus ms).
230
+ inserted_at_ms: number;
231
+ }
232
+
233
+ /// `open_orders` — account-scoped resting orders across every perp book.
234
+ export interface OpenOrders {
235
+ /// Resolved account address (0x).
236
+ address: string;
237
+ /// Echoed only when the request used `account_id`.
238
+ account_id?: number;
239
+ /// Resting orders.
240
+ orders: OpenOrder[];
241
+ }
242
+
243
+ /// One aggregated L2 book level.
244
+ export interface L2Level {
245
+ /// Level price, fixed-point decimal string.
246
+ px: string;
247
+ /// Summed size at the level, fixed-point decimal string.
248
+ size: string;
249
+ /// Resting orders at the level.
250
+ n_orders: number;
251
+ }
252
+
253
+ /// `l2_book` — market-scoped aggregated bid/ask levels.
254
+ export interface L2Book {
255
+ /// Echoed market id.
256
+ market_id: number;
257
+ /// Bid side (best-first, descending price).
258
+ bids: L2Level[];
259
+ /// Ask side (ascending price).
260
+ asks: L2Level[];
261
+ }
262
+
263
+ /// `recent_trades` — market-scoped trade tape (honest-empty today).
264
+ export interface RecentTrades {
265
+ /// Echoed market id.
266
+ market_id: number;
267
+ /// Timestamp of the last trade (`0` if none).
268
+ last_trade_ms: number;
269
+ /// Empty until the trade indexer lands.
270
+ trades: unknown[];
271
+ }
272
+
273
+ /// `user_fills` — account-scoped fill history (honest-empty today).
274
+ export interface UserFills {
275
+ /// Resolved account address (0x).
276
+ address: string;
277
+ /// Echoed only when the request used `account_id`.
278
+ account_id?: number;
279
+ /// Empty until the fill indexer lands.
280
+ fills: unknown[];
281
+ }
282
+
283
+ /// One funding premium sample.
284
+ export interface FundingSample {
285
+ /// Sample timestamp (consensus ms).
286
+ ts_ms: number;
287
+ /// Funding premium sample (signed), decimal string.
288
+ premium: string;
289
+ }
290
+
291
+ /// `funding_history` — market-scoped funding premium samples.
292
+ export interface FundingHistory {
293
+ /// Echoed market id.
294
+ market_id: number;
295
+ /// Ordered ring of `(ts_ms, premium)` samples.
296
+ samples: FundingSample[];
297
+ }
298
+
299
+ /// `block_info` — committed block metadata.
300
+ export interface BlockInfo {
301
+ /// Latest committed block height.
302
+ height: number;
303
+ /// Consensus round of that block.
304
+ round: number;
305
+ /// Current epoch.
306
+ epoch: number;
307
+ /// Block timestamp (consensus ms).
308
+ timestamp_ms: number;
309
+ /// Block hash (0x + 32 bytes); all-zero until plumbed into read state.
310
+ block_hash: string;
311
+ }
312
+
313
+ /// One approved agent inside an `Agents` response.
314
+ export interface AgentEntry {
315
+ /// Approved agent wallet address (0x).
316
+ agent: string;
317
+ /// Agent approval expiry (consensus ms).
318
+ expires_at_ms: number;
319
+ }
320
+
321
+ /// `agents` — approved agent / API wallets for an account.
322
+ export interface Agents {
323
+ /// Resolved master address (0x).
324
+ address: string;
325
+ /// Echoed only when the request used `account_id`.
326
+ account_id?: number;
327
+ /// Approved agents.
328
+ agents: AgentEntry[];
329
+ }
330
+
331
+ /// One sub-account inside a `SubAccounts` response.
332
+ export interface SubAccountEntry {
333
+ /// Sub-account index under the parent.
334
+ index: number;
335
+ /// Sub-account address (0x).
336
+ address: string;
337
+ }
338
+
339
+ /// `sub_accounts` — sub-accounts of an account.
340
+ export interface SubAccounts {
341
+ /// Resolved parent address (0x).
342
+ address: string;
343
+ /// Echoed only when the request used `account_id`.
344
+ account_id?: number;
345
+ /// Sub-accounts.
346
+ sub_accounts: SubAccountEntry[];
347
+ }
348
+
349
+ /// One MIP-3 auction bid.
350
+ export interface Mip3Bid {
351
+ /// Bidder address (0x).
352
+ bidder: string;
353
+ /// Bid amount, decimal string.
354
+ amount: string;
355
+ /// Bid submission timestamp (consensus ms).
356
+ submitted_at_ms: number;
357
+ /// Bid tag (e.g. the proposed market name).
358
+ tag: string;
359
+ }
360
+
361
+ /// `mip3_active_bids` — MIP-3 permissionless perp-deploy auction snapshot.
362
+ export interface Mip3ActiveBids {
363
+ /// Current auction round.
364
+ auction_round: number;
365
+ /// Leading bid amount, decimal string.
366
+ current_bid: string;
367
+ /// Current winning bidder (0x), or `null` if none.
368
+ current_winner: string | null;
369
+ /// Auction close timestamp (consensus ms).
370
+ auction_end_ms: number;
371
+ /// Auction start timestamp (consensus ms).
372
+ started_at_ms: number;
373
+ /// Bids.
374
+ bids: Mip3Bid[];
375
+ }
376
+
377
+ // ── HL-node parity query types ──────────────────────────────────────────────
378
+
379
+ /// One spot pair inside `SpotMeta`.
380
+ export interface SpotPair {
381
+ /// Pair id.
382
+ id: number;
383
+ /// Pair name (e.g. `"BTC/USDC"`).
384
+ name: string;
385
+ /// Base asset id.
386
+ base: number;
387
+ /// Quote asset id.
388
+ quote: number;
389
+ /// Taker fee (bps); `0` if unset.
390
+ taker_fee_bps: number;
391
+ /// Min notional (USDC cents), decimal string; `"0"` if unset.
392
+ min_notional: string;
393
+ /// Whether the pair is active for trading.
394
+ active: boolean;
395
+ }
396
+
397
+ /// `spot_meta` — spot pair universe.
398
+ export interface SpotMeta {
399
+ /// Registered spot pairs.
400
+ pairs: SpotPair[];
401
+ }
402
+
403
+ /// One spot balance inside `SpotClearinghouseState`.
404
+ export interface SpotBalance {
405
+ /// Spot asset id.
406
+ asset: number;
407
+ /// Token / pair name, else `asset:<id>`.
408
+ name: string;
409
+ /// Balance, decimal string (truncated toward zero).
410
+ balance: string;
411
+ }
412
+
413
+ /// `spot_clearinghouse_state` — per-account spot token balances.
414
+ export interface SpotClearinghouseState {
415
+ /// Echo of the requested 0x address.
416
+ address: string;
417
+ /// Spot balances.
418
+ balances: SpotBalance[];
419
+ }
420
+
421
+ /// `exchange_status` — global trading status.
422
+ export interface ExchangeStatus {
423
+ /// Spot trading globally disabled.
424
+ spot_disabled: boolean;
425
+ /// Post-only window end (consensus ms); `0` = none.
426
+ post_only_until_time_ms: number;
427
+ /// Post-only window end (height); `0` = none.
428
+ post_only_until_height: number;
429
+ /// Scheduled upgrade-halt height, or `null` if none.
430
+ scheduled_freeze_height: number | null;
431
+ /// `true` once any MIP-3 market/pair spec is registered.
432
+ mip3_enabled: boolean;
433
+ }
434
+
435
+ /// A trigger detail attached to a `FrontendOpenOrder`.
436
+ export interface OrderTrigger {
437
+ /// Trigger price, fixed-point decimal string.
438
+ trigger_px: string;
439
+ /// Whether the trigger fires above (`true`) or below the price.
440
+ trigger_above: boolean;
441
+ }
442
+
443
+ /// One order inside `FrontendOpenOrders` — `open_orders` plus frontend detail.
444
+ export interface FrontendOpenOrder {
445
+ /// On-chain order id.
446
+ oid: number;
447
+ /// Asset id.
448
+ market_id: number;
449
+ /// Order side.
450
+ side: 'bid' | 'ask';
451
+ /// Resting price, fixed-point decimal string.
452
+ px: string;
453
+ /// Remaining size, fixed-point decimal string.
454
+ size: string;
455
+ /// Time-in-force.
456
+ tif: 'alo' | 'ioc' | 'gtc';
457
+ /// Client order id (0x), or `null` if none.
458
+ cloid: string | null;
459
+ /// Trigger detail if registered for the oid, else `null`.
460
+ trigger: OrderTrigger | null;
461
+ /// Insertion timestamp (consensus ms).
462
+ inserted_at_ms: number;
463
+ }
464
+
465
+ /// `frontend_open_orders` — resting orders with tif / cloid / trigger detail.
466
+ export interface FrontendOpenOrders {
467
+ /// Echo of the requested 0x address.
468
+ address: string;
469
+ /// Orders.
470
+ orders: FrontendOpenOrder[];
471
+ }
472
+
473
+ /// One account flagged for liquidation.
474
+ export interface LiquidatableAccount {
475
+ /// Needs-action account address (0x).
476
+ address: string;
477
+ /// BOLE tier.
478
+ tier: 'YellowCard' | 'PartialMarket50' | 'FullMarket' | 'BackstopTakeover';
479
+ }
480
+
481
+ /// `liquidatable` — accounts currently flagged for liquidation.
482
+ export interface Liquidatable {
483
+ /// Flagged accounts.
484
+ accounts: LiquidatableAccount[];
485
+ }
486
+
487
+ /// `active_asset_data` — a user's per-asset leverage / margin-mode / max trade.
488
+ export interface ActiveAssetData {
489
+ /// Echo of the requested 0x address.
490
+ address: string;
491
+ /// Echo of the requested asset id.
492
+ asset_id: number;
493
+ /// Effective leverage (position, else account default, else market max).
494
+ leverage: number;
495
+ /// Effective margin mode.
496
+ margin_mode: 'cross' | 'isolated' | 'strict_iso';
497
+ /// Per-asset max-order ceiling (size units), decimal string.
498
+ max_trade_size: string;
499
+ /// Whether the user has a non-zero position on this asset.
500
+ has_position: boolean;
501
+ }
502
+
503
+ /// One per-asset max market-order notional entry.
504
+ export interface MaxMarketOrderNtl {
505
+ /// Asset id.
506
+ asset_id: number;
507
+ /// OI-cap-derived size ceiling, decimal string.
508
+ max_market_order_ntl: string;
509
+ }
510
+
511
+ /// `max_market_order_ntls` — per-asset max market-order notional.
512
+ export interface MaxMarketOrderNtls {
513
+ /// Per-asset ceilings.
514
+ ntls: MaxMarketOrderNtl[];
515
+ }
516
+
517
+ /// One vault summary row (shared by `vault_summaries` / `leading_vaults`).
518
+ export interface VaultSummary {
519
+ /// Vault id.
520
+ id: number;
521
+ /// Vault on-chain address (0x).
522
+ address: string;
523
+ /// Vault leader address (0x).
524
+ leader: string;
525
+ /// NAV proxy (high-water mark, USD cents), decimal string.
526
+ tvl: string;
527
+ /// Number of share holders.
528
+ follower_count: number;
529
+ /// Vault kind.
530
+ kind: 'user' | 'metaliquidity';
531
+ }
532
+
533
+ /// `vault_summaries` — all vaults summary.
534
+ export interface VaultSummaries {
535
+ /// Vault summary rows.
536
+ vaults: VaultSummary[];
537
+ }
538
+
539
+ /// One vault equity entry inside `UserVaultEquities`.
540
+ export interface VaultEquity {
541
+ /// Vault id.
542
+ vault_id: number;
543
+ /// Vault address (0x).
544
+ vault_address: string;
545
+ /// Caller's share count (18-dec), decimal string.
546
+ shares: string;
547
+ /// `shares × share_price`, decimal string (truncated).
548
+ equity: string;
549
+ }
550
+
551
+ /// `user_vault_equities` — vaults a user has deposited into + share / equity.
552
+ export interface UserVaultEquities {
553
+ /// Echo of the requested 0x address.
554
+ address: string;
555
+ /// Per-vault equities.
556
+ equities: VaultEquity[];
557
+ }
558
+
559
+ /// `leading_vaults` — vaults led by the user (reuses `VaultSummary` rows).
560
+ export interface LeadingVaults {
561
+ /// Echo of the requested 0x address.
562
+ address: string;
563
+ /// Vault summary rows led by the user.
564
+ vaults: VaultSummary[];
565
+ }
566
+
567
+ /// `user_rate_limit` — a user's action stats / rate-limit budget.
568
+ export interface UserRateLimit {
569
+ /// Echo of the requested 0x address.
570
+ address: string;
571
+ /// Last accepted action nonce.
572
+ last_nonce: number;
573
+ /// Pending (in-flight) action count.
574
+ pending_count: number;
575
+ /// Lifetime actions submitted.
576
+ lifetime_count: number;
577
+ }
578
+
579
+ /// `spot_deploy_state` — MIP-1 spot-pair-deploy gas-auction state.
580
+ export interface SpotDeployState {
581
+ /// Current round.
582
+ auction_round: number;
583
+ /// Leading bid, decimal string.
584
+ current_bid: string;
585
+ /// Current high bidder (0x), or `null`.
586
+ current_winner: string | null;
587
+ /// Auction close timestamp (consensus ms).
588
+ auction_end_ms: number;
589
+ /// Auction start timestamp (consensus ms).
590
+ started_at_ms: number;
591
+ /// Cumulative burned winning-bid notional, decimal string.
592
+ total_burned: string;
593
+ /// Total escrowed deposit (base units), decimal string.
594
+ deposit: string;
595
+ }
596
+
597
+ /// `delegator_summary` — staking summary for an address.
598
+ export interface DelegatorSummary {
599
+ /// Echo of the requested 0x address.
600
+ address: string;
601
+ /// Sum of active delegations, decimal string.
602
+ total_delegated: string;
603
+ /// Sum of pending undelegations, decimal string.
604
+ pending_withdrawal: string;
605
+ /// Accumulated delegator rewards, decimal string.
606
+ claimable_rewards: string;
607
+ /// Number of active delegations.
608
+ n_delegations: number;
609
+ }
610
+
611
+ /// `max_builder_fee` — approved builder-fee ceiling for `(address, builder)`.
612
+ export interface MaxBuilderFee {
613
+ /// Echo of the requested 0x address.
614
+ address: string;
615
+ /// Echo of the requested builder 0x address.
616
+ builder: string;
617
+ /// Approved bps ceiling; `0` if not approved.
618
+ max_fee_bps: number;
619
+ /// Whether `(address, builder)` is an approved pair.
620
+ approved: boolean;
621
+ }
622
+
623
+ /// `user_to_multi_sig_signers` — multisig config for an address.
624
+ export interface UserToMultiSigSigners {
625
+ /// Echo of the requested 0x address.
626
+ address: string;
627
+ /// Whether the account is multisig.
628
+ is_multi_sig: boolean;
629
+ /// M-of-N threshold; `0` if not multisig.
630
+ threshold: number;
631
+ /// Signer set (0x addresses); empty if not multisig.
632
+ signers: string[];
633
+ }
634
+
635
+ /// `user_role` — derived account role.
636
+ export interface UserRole {
637
+ /// Echo of the requested 0x address.
638
+ address: string;
639
+ /// Derived role.
640
+ role: 'missing' | 'user' | 'agent' | 'vault' | 'sub_account';
641
+ }
642
+
643
+ /// `perps_at_open_interest_cap` — assets whose OI is at/over the cap.
644
+ export interface PerpsAtOpenInterestCap {
645
+ /// Asset ids at/over their `oi_cap`, ascending.
646
+ assets: number[];
647
+ }
648
+
649
+ /// One validator L1 vote.
650
+ export interface ValidatorL1Vote {
651
+ /// Vote round.
652
+ round: number;
653
+ /// Casting validator address (0x).
654
+ validator: string;
655
+ /// Submission timestamp (consensus ms).
656
+ submitted_at_ms: number;
657
+ }
658
+
659
+ /// `validator_l1_votes` — current validator L1 votes.
660
+ export interface ValidatorL1Votes {
661
+ /// Latest accepted vote round.
662
+ latest_round: number;
663
+ /// Votes.
664
+ votes: ValidatorL1Vote[];
665
+ }
666
+
667
+ /// One margin-tier row.
668
+ export interface MarginTier {
669
+ /// Asset id.
670
+ asset_id: number;
671
+ /// Effective max leverage.
672
+ max_leverage: number;
673
+ /// Maintenance margin ratio, bps string.
674
+ maint_margin_ratio: string;
675
+ /// Initial margin ratio, bps string.
676
+ init_margin_ratio: string;
677
+ }
678
+
679
+ /// `margin_table` — the margin-tier table (one effective tier per market).
680
+ export interface MarginTable {
681
+ /// Per-market tiers.
682
+ tiers: MarginTier[];
683
+ }
684
+
685
+ /// One perp DEX entry.
686
+ export interface PerpDex {
687
+ /// DEX index in `Exchange.perp_dexs`.
688
+ index: number;
689
+ /// Number of asset books in the DEX.
690
+ n_assets: number;
691
+ /// Asset ids in the DEX.
692
+ assets: number[];
693
+ }
694
+
695
+ /// `perp_dexs` — list the perp DEX(es).
696
+ export interface PerpDexs {
697
+ /// Perp DEXes.
698
+ dexs: PerpDex[];
699
+ }
700
+
701
+ /// One validator summary row.
702
+ export interface ValidatorSummary {
703
+ /// Validator primary address (0x).
704
+ validator: string;
705
+ /// Operational signer / hot key (0x).
706
+ signer: string;
707
+ /// Consensus index.
708
+ validator_index: number;
709
+ /// Total delegated stake, decimal string.
710
+ stake: string;
711
+ /// Validator's own contribution, decimal string.
712
+ self_stake: string;
713
+ /// Commission (basis points).
714
+ commission_bps: number;
715
+ /// In the active set this epoch.
716
+ is_active: boolean;
717
+ /// Currently jailed.
718
+ is_jailed: boolean;
719
+ /// Jail start ts (consensus ms), or `null` if not jailed.
720
+ jailed_at_ms: number | null;
721
+ /// Earliest unjail ts (consensus ms), or `null` if not jailed.
722
+ unjail_at_ms: number | null;
723
+ /// First epoch the validator was active.
724
+ first_active_epoch: number;
725
+ }
726
+
727
+ /// `validator_summaries` — per-validator snapshot.
728
+ export interface ValidatorSummaries {
729
+ /// Current staking epoch.
730
+ epoch: number;
731
+ /// Σ stake across all validators, decimal string.
732
+ total_stake: string;
733
+ /// Size of the active set.
734
+ n_active: number;
735
+ /// Validator rows.
736
+ validators: ValidatorSummary[];
737
+ }
738
+
739
+ /// `gossip_root_ips` — configured gossip root/seed peer endpoints.
740
+ export interface GossipRootIps {
741
+ /// Configured gossip peer endpoints (`host:port`); empty on a solo node.
742
+ root_ips: string[];
743
+ }
744
+
745
+ /// One position row inside `WebData2.clearinghouse`.
746
+ export interface WebData2Position {
747
+ /// Asset id.
748
+ asset: number;
749
+ /// Signed position size, decimal string.
750
+ size: string;
751
+ /// Entry notional, decimal string.
752
+ entry_notional: string;
753
+ /// Effective margin mode.
754
+ margin_mode: 'cross' | 'isolated' | 'strict_iso';
755
+ /// Per-asset leverage multiple.
756
+ leverage: number;
757
+ }
758
+
759
+ /// The clearinghouse summary inside `WebData2`.
760
+ export interface WebData2Clearinghouse {
761
+ /// Cross account value, decimal string.
762
+ account_value: string;
763
+ /// Σ per-asset margin used, decimal string.
764
+ margin_used: string;
765
+ /// Per-asset open positions.
766
+ positions: WebData2Position[];
767
+ }
768
+
769
+ /// `web_data2` — composite "everything for the frontend" snapshot.
770
+ export interface WebData2 {
771
+ /// Echo of the requested 0x address.
772
+ address: string;
773
+ /// Perp clearinghouse summary.
774
+ clearinghouse: WebData2Clearinghouse;
775
+ /// Spot balances (reuses `spot_clearinghouse_state.balances`).
776
+ spot_balances: SpotBalance[];
777
+ /// Open orders (reuses `frontend_open_orders.orders`).
778
+ open_orders: FrontendOpenOrder[];
779
+ /// Vault equities (reuses `user_vault_equities.equities`).
780
+ vault_equities: VaultEquity[];
781
+ /// Global exchange status (reuses `exchange_status.data`).
782
+ exchange_status: ExchangeStatus;
783
+ }