@nktkas/hyperliquid 0.25.6 → 0.25.7

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 (74) hide show
  1. package/README.md +53 -8
  2. package/esm/src/api/info/webData2.d.ts +146 -23
  3. package/esm/src/api/info/webData2.d.ts.map +1 -1
  4. package/esm/src/api/info/webData2.js +3 -54
  5. package/esm/src/api/info/webData2.js.map +1 -1
  6. package/esm/src/api/info/~client.d.ts +2 -2
  7. package/esm/src/api/subscription/webData2.d.ts +4 -4
  8. package/esm/src/api/subscription/webData2.js +1 -1
  9. package/esm/src/api/subscription/webData2.js.map +1 -1
  10. package/esm/src/api/subscription/webData3.d.ts +541 -0
  11. package/esm/src/api/subscription/webData3.d.ts.map +1 -0
  12. package/esm/src/api/subscription/webData3.js +94 -0
  13. package/esm/src/api/subscription/webData3.js.map +1 -0
  14. package/esm/src/api/subscription/~client.d.ts +22 -0
  15. package/esm/src/api/subscription/~client.d.ts.map +1 -1
  16. package/esm/src/api/subscription/~client.js +23 -0
  17. package/esm/src/api/subscription/~client.js.map +1 -1
  18. package/esm/src/api/subscription/~mod.d.ts +1 -0
  19. package/esm/src/api/subscription/~mod.d.ts.map +1 -1
  20. package/esm/src/api/subscription/~mod.js +1 -0
  21. package/esm/src/api/subscription/~mod.js.map +1 -1
  22. package/esm/src/utils/_format.d.ts +29 -0
  23. package/esm/src/utils/_format.d.ts.map +1 -0
  24. package/esm/src/utils/_format.js +147 -0
  25. package/esm/src/utils/_format.js.map +1 -0
  26. package/esm/src/utils/_symbolConverter.d.ts +13 -0
  27. package/esm/src/utils/_symbolConverter.d.ts.map +1 -1
  28. package/esm/src/utils/_symbolConverter.js +17 -0
  29. package/esm/src/utils/_symbolConverter.js.map +1 -1
  30. package/esm/src/utils/mod.d.ts +1 -0
  31. package/esm/src/utils/mod.d.ts.map +1 -1
  32. package/esm/src/utils/mod.js +1 -0
  33. package/esm/src/utils/mod.js.map +1 -1
  34. package/package.json +1 -1
  35. package/script/src/api/info/webData2.d.ts +146 -23
  36. package/script/src/api/info/webData2.d.ts.map +1 -1
  37. package/script/src/api/info/webData2.js +2 -53
  38. package/script/src/api/info/webData2.js.map +1 -1
  39. package/script/src/api/info/~client.d.ts +2 -2
  40. package/script/src/api/subscription/webData2.d.ts +4 -4
  41. package/script/src/api/subscription/webData2.js +1 -1
  42. package/script/src/api/subscription/webData2.js.map +1 -1
  43. package/script/src/api/subscription/webData3.d.ts +541 -0
  44. package/script/src/api/subscription/webData3.d.ts.map +1 -0
  45. package/script/src/api/subscription/webData3.js +131 -0
  46. package/script/src/api/subscription/webData3.js.map +1 -0
  47. package/script/src/api/subscription/~client.d.ts +22 -0
  48. package/script/src/api/subscription/~client.d.ts.map +1 -1
  49. package/script/src/api/subscription/~client.js +23 -0
  50. package/script/src/api/subscription/~client.js.map +1 -1
  51. package/script/src/api/subscription/~mod.d.ts +1 -0
  52. package/script/src/api/subscription/~mod.d.ts.map +1 -1
  53. package/script/src/api/subscription/~mod.js +1 -0
  54. package/script/src/api/subscription/~mod.js.map +1 -1
  55. package/script/src/utils/_format.d.ts +29 -0
  56. package/script/src/utils/_format.d.ts.map +1 -0
  57. package/script/src/utils/_format.js +151 -0
  58. package/script/src/utils/_format.js.map +1 -0
  59. package/script/src/utils/_symbolConverter.d.ts +13 -0
  60. package/script/src/utils/_symbolConverter.d.ts.map +1 -1
  61. package/script/src/utils/_symbolConverter.js +17 -0
  62. package/script/src/utils/_symbolConverter.js.map +1 -1
  63. package/script/src/utils/mod.d.ts +1 -0
  64. package/script/src/utils/mod.d.ts.map +1 -1
  65. package/script/src/utils/mod.js +1 -0
  66. package/script/src/utils/mod.js.map +1 -1
  67. package/src/src/api/info/webData2.ts +3 -104
  68. package/src/src/api/subscription/webData2.ts +1 -1
  69. package/src/src/api/subscription/webData3.ts +179 -0
  70. package/src/src/api/subscription/~client.ts +25 -0
  71. package/src/src/api/subscription/~mod.ts +1 -0
  72. package/src/src/utils/_format.ts +172 -0
  73. package/src/src/utils/_symbolConverter.ts +18 -0
  74. package/src/src/utils/mod.ts +1 -0
package/README.md CHANGED
@@ -594,6 +594,7 @@ class SubscriptionClient {
594
594
  listener: (data: WsUserNonFundingLedgerUpdatesEvent) => void,
595
595
  );
596
596
  webData2(params: WsWebData2Parameters, listener: (data: WsWebData2Event) => void);
597
+ webData3(params: WsWebData3Parameters, listener: (data: WsWebData3Event) => void);
597
598
 
598
599
  // Order
599
600
  openOrders(params: WsOpenOrdersParameters, listener: (data: WsOpenOrdersEvent) => void);
@@ -953,8 +954,8 @@ This module contains helper functions for interacting with the HyperLiquid API.
953
954
 
954
955
  #### `SymbolConverter`
955
956
 
956
- Utility class for converting asset symbols to their corresponding IDs and size decimals. See
957
- [docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids).
957
+ Helper class for converting asset symbols to asset IDs and size decimals. See
958
+ [hyperliquid docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids).
958
959
 
959
960
  ```ts
960
961
  import { HttpTransport } from "@nktkas/hyperliquid";
@@ -963,13 +964,57 @@ import { SymbolConverter } from "@nktkas/hyperliquid/utils";
963
964
  const transport = new HttpTransport(); // or `WebSocketTransport`
964
965
  const converter = await SymbolConverter.create({ transport });
965
966
 
966
- const btcId = converter.getAssetId("BTC"); // perpetual 0
967
- const hypeUsdcId = converter.getAssetId("HYPE/USDC"); // spot market → 10107
968
- const dexAbcId = converter.getAssetId("test:ABC"); // builder dex (if enabled) → 110000
967
+ // By default, dexs are not loaded; specify them when creating an instance
968
+ const converter = await SymbolConverter.create({ transport, dexs: ["test"] });
969
+ ```
970
+
971
+ ##### `getAssetId` - Get asset ID for a coin
972
+
973
+ ```ts
974
+ // For Perpetuals, use the coin name
975
+ const btcId = converter.getAssetId("BTC"); // → 0
976
+
977
+ // For Spot markets, use the "BASE/QUOTE" format
978
+ const hypeUsdcId = converter.getAssetId("HYPE/USDC"); // → 10107
979
+
980
+ // For Builder Dex assets, use the "DEX_NAME:ASSET_NAME" format
981
+ const dexAbcId = converter.getAssetId("test:ABC"); // → 110000
982
+ ```
983
+
984
+ ##### `getSzDecimals` - Get size decimals for a coin.
985
+
986
+ ```ts
987
+ // For Perpetuals, use the coin name
988
+ const btcSzDecimals = converter.getSzDecimals("BTC"); // → 5
989
+
990
+ // For Spot markets, use the "BASE/QUOTE" format
991
+ const hypeUsdcSzDecimals = converter.getSzDecimals("HYPE/USDC"); // → 2
992
+
993
+ // For Builder Dex assets, use the "DEX_NAME:ASSET_NAME" format
994
+ const dexAbcSzDecimals = converter.getSzDecimals("test:ABC"); // → 0
995
+ ```
996
+
997
+ ##### `getSpotPairId` - Get spot pair ID for info endpoints and subscriptions
998
+
999
+ ```ts
1000
+ // Accepts spot markets in the "BASE/QUOTE" format
1001
+ const spotPairId = converter.getSpotPairId("HFUN/USDC"); // → "@2"
1002
+ ```
1003
+
1004
+ #### `formatPrice` and `formatSize`
1005
+
1006
+ Helper functions for formatting price and size based on `szDecimals`. See
1007
+ [hyperliquid docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/tick-and-lot-size).
1008
+
1009
+ ```ts
1010
+ import { formatPrice, formatSize } from "@nktkas/hyperliquid/utils";
1011
+
1012
+ // `true` for perp (default), `false` for spot
1013
+ // Format price (PUMP/USDC, szDecimals=0) ⌄⌄⌄⌄⌄
1014
+ const price = formatPrice("0.0000123456789", 0, false); // → "0.00001234"
969
1015
 
970
- const btcSzDecimals = converter.getSzDecimals("BTC"); // perpetual → 5
971
- const hypeUsdcSzDecimals = converter.getSzDecimals("HYPE/USDC"); // spot market 2
972
- const dexAbcSzDecimals = converter.getSzDecimals("test:ABC"); // builder dex (if enabled) → 0
1016
+ // Format size (BTC, szDecimals=5)
1017
+ const size = formatSize("1.23456789", 5); // → "1.23456"
973
1018
  ```
974
1019
 
975
1020
  ## FAQ
@@ -19,8 +19,7 @@ export type WebData2Request = v.InferOutput<typeof WebData2Request>;
19
19
  * Comprehensive user and market data.
20
20
  * @see null
21
21
  */
22
- export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
- /** Account summary for perpetual trading. */
22
+ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.ObjectSchema<{
24
23
  readonly clearinghouseState: v.SchemaWithPipe<readonly [v.ObjectSchema<{
25
24
  readonly marginSummary: v.SchemaWithPipe<readonly [v.ObjectSchema<{
26
25
  readonly accountValue: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Total account value.">]>;
@@ -204,11 +203,8 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
204
203
  }[];
205
204
  time: number;
206
205
  }, "Account summary for perpetual trading.">]>;
207
- /** Array of leading vaults. */
208
206
  readonly leadingVaults: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
209
- /** Address of the vault. */
210
207
  readonly address: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "Address of the vault.">]>;
211
- /** Name of the vault. */
212
208
  readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the vault.">]>;
213
209
  }, undefined>, v.DescriptionAction<{
214
210
  address: `0x${string}`;
@@ -217,9 +213,7 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
217
213
  address: `0x${string}`;
218
214
  name: string;
219
215
  }[], "Array of leading vaults.">]>;
220
- /** Total equity in vaults. */
221
216
  readonly totalVaultEquity: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Total equity in vaults.">]>;
222
- /** Array of user open orders with frontend information. */
223
217
  readonly openOrders: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
224
218
  readonly coin: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Asset symbol.">]>;
225
219
  readonly side: v.SchemaWithPipe<readonly [v.UnionSchema<[v.LiteralSchema<"B", undefined>, v.LiteralSchema<"A", undefined>], undefined>, v.DescriptionAction<"B" | "A", "Order side (\"B\" = Bid/Buy, \"A\" = Ask/Sell).">]>;
@@ -272,13 +266,9 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
272
266
  tif: "Gtc" | "Ioc" | "Alo" | "FrontendMarket" | "LiquidationMarket" | null;
273
267
  cloid: `0x${string}` | null;
274
268
  }[], "User open orders with frontend information.">]>;
275
- /** Agent address if one exists. */
276
269
  readonly agentAddress: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, undefined>, v.DescriptionAction<`0x${string}` | null, "Agent address if one exists.">]>;
277
- /** Timestamp until which the agent is valid. */
278
270
  readonly agentValidUntil: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, v.DescriptionAction<number | null, "Timestamp until which the agent is valid.">]>;
279
- /** Cumulative ledger value. */
280
271
  readonly cumLedger: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Cumulative ledger value.">]>;
281
- /** Metadata for perpetual assets. */
282
272
  readonly meta: v.SchemaWithPipe<readonly [v.ObjectSchema<{
283
273
  readonly universe: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
284
274
  readonly szDecimals: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Minimum decimal places for order sizes.">]>;
@@ -352,7 +342,6 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
352
342
  }][];
353
343
  collateralToken: number;
354
344
  }, "Metadata for perpetual assets.">]>;
355
- /** Context for each perpetual asset. */
356
345
  readonly assetCtxs: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
357
346
  readonly prevDayPx: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Previous day's closing price.">]>;
358
347
  readonly dayNtlVlm: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Daily notional volume.">]>;
@@ -387,13 +376,9 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
387
376
  impactPxs: string[] | null;
388
377
  dayBaseVlm: string;
389
378
  }[], "Array of contexts for each perpetual asset.">]>;
390
- /** Server timestamp (in ms since epoch). */
391
379
  readonly serverTime: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Server timestamp (in ms since epoch).">]>;
392
- /** Whether this account is a vault. */
393
380
  readonly isVault: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this account is a vault.">]>;
394
- /** User address. */
395
381
  readonly user: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "User address.">]>;
396
- /** Array of TWAP states. */
397
382
  readonly twapStates: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.TupleSchema<[v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
398
383
  readonly coin: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Asset symbol.">]>;
399
384
  readonly executedNtl: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Executed notional value.">]>;
@@ -439,8 +424,7 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
439
424
  timestamp: number;
440
425
  user: `0x${string}`;
441
426
  }][], "Array of TWAP states.">]>;
442
- /** Account summary for spot trading. */
443
- readonly spotState: v.SchemaWithPipe<readonly [v.ObjectSchema<{
427
+ readonly spotState: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
444
428
  readonly balances: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
445
429
  readonly coin: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Asset symbol.">]>;
446
430
  readonly token: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Unique identifier for the token.">]>;
@@ -486,8 +470,7 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
486
470
  token: number;
487
471
  total: string;
488
472
  }[] | undefined;
489
- }, "Account summary for spot trading.">]>;
490
- /** Context for each spot asset. */
473
+ }, "Account summary for spot trading.">]>, undefined>;
491
474
  readonly spotAssetCtxs: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
492
475
  readonly prevDayPx: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Previous day's closing price.">]>;
493
476
  readonly dayNtlVlm: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Daily notional volume.">]>;
@@ -516,9 +499,7 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
516
499
  totalSupply: string;
517
500
  dayBaseVlm: string;
518
501
  }[], "Context for each spot asset.">]>;
519
- /** Whether the user has opted out of spot dusting. */
520
502
  readonly optOutOfSpotDusting: v.SchemaWithPipe<readonly [v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>, v.DescriptionAction<true | undefined, "Whether the user has opted out of spot dusting.">]>;
521
- /** Assets currently at their open interest cap. */
522
503
  readonly perpsAtOpenInterestCap: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, v.DescriptionAction<string[] | undefined, "Assets currently at their open interest cap.">]>;
523
504
  }, undefined>, v.DescriptionAction<{
524
505
  clearinghouseState: {
@@ -636,7 +617,7 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
636
617
  timestamp: number;
637
618
  user: `0x${string}`;
638
619
  }][];
639
- spotState: {
620
+ spotState?: {
640
621
  balances: {
641
622
  coin: string;
642
623
  token: number;
@@ -649,7 +630,149 @@ export declare const WebData2Response: v.SchemaWithPipe<readonly [v.ObjectSchema
649
630
  token: number;
650
631
  total: string;
651
632
  }[] | undefined;
633
+ } | undefined;
634
+ spotAssetCtxs: {
635
+ prevDayPx: string;
636
+ dayNtlVlm: string;
637
+ markPx: string;
638
+ midPx: string | null;
639
+ circulatingSupply: string;
640
+ coin: string;
641
+ totalSupply: string;
642
+ dayBaseVlm: string;
643
+ }[];
644
+ optOutOfSpotDusting?: true | undefined;
645
+ perpsAtOpenInterestCap?: string[] | undefined;
646
+ }, "Comprehensive user and market data.">]>, v.DescriptionAction<{
647
+ clearinghouseState: {
648
+ marginSummary: {
649
+ accountValue: string;
650
+ totalNtlPos: string;
651
+ totalRawUsd: string;
652
+ totalMarginUsed: string;
653
+ };
654
+ crossMarginSummary: {
655
+ accountValue: string;
656
+ totalNtlPos: string;
657
+ totalRawUsd: string;
658
+ totalMarginUsed: string;
659
+ };
660
+ crossMaintenanceMarginUsed: string;
661
+ withdrawable: string;
662
+ assetPositions: {
663
+ type: "oneWay";
664
+ position: {
665
+ coin: string;
666
+ szi: string;
667
+ leverage: {
668
+ type: "isolated";
669
+ value: number;
670
+ rawUsd: string;
671
+ } | {
672
+ type: "cross";
673
+ value: number;
674
+ };
675
+ entryPx: string;
676
+ positionValue: string;
677
+ unrealizedPnl: string;
678
+ returnOnEquity: string;
679
+ liquidationPx: string | null;
680
+ marginUsed: string;
681
+ maxLeverage: number;
682
+ cumFunding: {
683
+ allTime: string;
684
+ sinceOpen: string;
685
+ sinceChange: string;
686
+ };
687
+ };
688
+ }[];
689
+ time: number;
652
690
  };
691
+ leadingVaults: {
692
+ address: `0x${string}`;
693
+ name: string;
694
+ }[];
695
+ totalVaultEquity: string;
696
+ openOrders: {
697
+ coin: string;
698
+ side: "B" | "A";
699
+ limitPx: string;
700
+ sz: string;
701
+ oid: number;
702
+ timestamp: number;
703
+ origSz: string;
704
+ triggerCondition: string;
705
+ isTrigger: boolean;
706
+ triggerPx: string;
707
+ children: any[];
708
+ isPositionTpsl: boolean;
709
+ reduceOnly: boolean;
710
+ orderType: "Market" | "Limit" | "Stop Market" | "Stop Limit" | "Take Profit Market" | "Take Profit Limit";
711
+ tif: "Gtc" | "Ioc" | "Alo" | "FrontendMarket" | "LiquidationMarket" | null;
712
+ cloid: `0x${string}` | null;
713
+ }[];
714
+ agentAddress: `0x${string}` | null;
715
+ agentValidUntil: number | null;
716
+ cumLedger: string;
717
+ meta: {
718
+ universe: {
719
+ szDecimals: number;
720
+ name: string;
721
+ maxLeverage: number;
722
+ marginTableId: number;
723
+ onlyIsolated?: true | undefined;
724
+ isDelisted?: true | undefined;
725
+ }[];
726
+ marginTables: [number, {
727
+ description: string;
728
+ marginTiers: {
729
+ lowerBound: string;
730
+ maxLeverage: number;
731
+ }[];
732
+ }][];
733
+ collateralToken: number;
734
+ };
735
+ assetCtxs: {
736
+ prevDayPx: string;
737
+ dayNtlVlm: string;
738
+ markPx: string;
739
+ midPx: string | null;
740
+ funding: string;
741
+ openInterest: string;
742
+ premium: string | null;
743
+ oraclePx: string;
744
+ impactPxs: string[] | null;
745
+ dayBaseVlm: string;
746
+ }[];
747
+ serverTime: number;
748
+ isVault: boolean;
749
+ user: `0x${string}`;
750
+ twapStates: [number, {
751
+ coin: string;
752
+ executedNtl: string;
753
+ executedSz: string;
754
+ minutes: number;
755
+ randomize: boolean;
756
+ reduceOnly: boolean;
757
+ side: "B" | "A";
758
+ sz: string;
759
+ timestamp: number;
760
+ user: `0x${string}`;
761
+ }][];
762
+ spotState?: {
763
+ balances: {
764
+ coin: string;
765
+ token: number;
766
+ total: string;
767
+ hold: string;
768
+ entryNtl: string;
769
+ }[];
770
+ evmEscrows?: {
771
+ coin: string;
772
+ token: number;
773
+ total: string;
774
+ }[] | undefined;
775
+ } | undefined;
653
776
  spotAssetCtxs: {
654
777
  prevDayPx: string;
655
778
  dayNtlVlm: string;
@@ -1 +1 @@
1
- {"version":3,"file":"webData2.d.ts","sourceRoot":"","sources":["../../../../src/src/api/info/webData2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAW,KAAK,aAAa,EAA4C,MAAM,aAAa,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUrD;;;GAGG;AACH,eAAO,MAAM,eAAe;IAGtB,uBAAuB;;IAKvB,oBAAoB;;;;;mDAQtB,CAAC;AACL,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAGvB,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAKzB,CAAC;AACL,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAItE,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAM3B"}
@@ -1,10 +1,6 @@
1
1
  import * as v from "valibot";
2
- import { Address, parser, UnsignedDecimal, UnsignedInteger } from "../_base.js";
3
- import { DetailedOrderSchema, TwapStateSchema } from "../_common_schemas.js";
4
- import { MetaAndAssetCtxsResponse } from "./metaAndAssetCtxs.js";
5
- import { ClearinghouseStateResponse } from "./clearinghouseState.js";
6
- import { SpotClearinghouseStateResponse } from "./spotClearinghouseState.js";
7
- import { SpotMetaAndAssetCtxsResponse } from "./spotMetaAndAssetCtxs.js";
2
+ import { Address, parser } from "../_base.js";
3
+ import { WebData2Event } from "../subscription/webData2.js";
8
4
  // -------------------- Schemas --------------------
9
5
  /**
10
6
  * Request comprehensive user and market data.
@@ -23,54 +19,7 @@ export const WebData2Request = /* @__PURE__ */ (() => {
23
19
  * @see null
24
20
  */
25
21
  export const WebData2Response = /* @__PURE__ */ (() => {
26
- return v.pipe(v.object({
27
- /** Account summary for perpetual trading. */
28
- clearinghouseState: ClearinghouseStateResponse,
29
- /** Array of leading vaults. */
30
- leadingVaults: v.pipe(v.array(
31
- /** Vault that a user is leading. */
32
- v.pipe(v.object({
33
- /** Address of the vault. */
34
- address: v.pipe(Address, v.description("Address of the vault.")),
35
- /** Name of the vault. */
36
- name: v.pipe(v.string(), v.description("Name of the vault.")),
37
- }), v.description("Vault that a user is leading."))), v.description("Array of leading vaults.")),
38
- /** Total equity in vaults. */
39
- totalVaultEquity: v.pipe(UnsignedDecimal, v.description("Total equity in vaults.")),
40
- /** Array of user open orders with frontend information. */
41
- openOrders: v.pipe(v.array(DetailedOrderSchema), v.description("User open orders with frontend information.")),
42
- /** Agent address if one exists. */
43
- agentAddress: v.pipe(v.nullable(Address), v.description("Agent address if one exists.")),
44
- /** Timestamp until which the agent is valid. */
45
- agentValidUntil: v.pipe(v.nullable(UnsignedInteger), v.description("Timestamp until which the agent is valid.")),
46
- /** Cumulative ledger value. */
47
- cumLedger: v.pipe(UnsignedDecimal, v.description("Cumulative ledger value.")),
48
- /** Metadata for perpetual assets. */
49
- meta: MetaAndAssetCtxsResponse.items[0],
50
- /** Context for each perpetual asset. */
51
- assetCtxs: MetaAndAssetCtxsResponse.items[1],
52
- /** Server timestamp (in ms since epoch). */
53
- serverTime: v.pipe(UnsignedInteger, v.description("Server timestamp (in ms since epoch).")),
54
- /** Whether this account is a vault. */
55
- isVault: v.pipe(v.boolean(), v.description("Whether this account is a vault.")),
56
- /** User address. */
57
- user: v.pipe(Address, v.description("User address.")),
58
- /** Array of TWAP states. */
59
- twapStates: v.pipe(v.array(
60
- /** TWAP ID and state. */
61
- v.pipe(v.tuple([
62
- UnsignedInteger,
63
- TwapStateSchema,
64
- ]), v.description("TWAP ID and state."))), v.description("Array of TWAP states.")),
65
- /** Account summary for spot trading. */
66
- spotState: SpotClearinghouseStateResponse,
67
- /** Context for each spot asset. */
68
- spotAssetCtxs: SpotMetaAndAssetCtxsResponse.items[1],
69
- /** Whether the user has opted out of spot dusting. */
70
- optOutOfSpotDusting: v.pipe(v.optional(v.literal(true)), v.description("Whether the user has opted out of spot dusting.")),
71
- /** Assets currently at their open interest cap. */
72
- perpsAtOpenInterestCap: v.pipe(v.optional(v.array(v.string())), v.description("Assets currently at their open interest cap.")),
73
- }), v.description("Comprehensive user and market data."));
22
+ return v.pipe(WebData2Event, v.description("Comprehensive user and market data."));
74
23
  })();
75
24
  /**
76
25
  * Request comprehensive user and market data.
@@ -1 +1 @@
1
- {"version":3,"file":"webData2.js","sourceRoot":"","sources":["../../../../src/src/api/info/webData2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAsB,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGpG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAEzE,oDAAoD;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACnD,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,uBAAuB;QACvB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAClC;QACD,oBAAoB;QACpB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,OAAO,EACP,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAC/B;KACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,6CAA6C,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAGL;;;GAGG;AACH,MAAM,CA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;AACJ,CAAC,CAAC,EAAE,CAAC;AAGL;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACpD,OAAO,CAAC,CAAC,IAAI,CACX,aAAa,EACb,CAAC,CAAC,WAAW,CAAC,qCAAqC,CAAC,CACrD,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAQL;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAyB,EACzB,MAAyC,EACzC,MAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QACtC,IAAI,EAAE,UAAU;QAChB,GAAG,MAAM;KACV,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC"}
@@ -2655,7 +2655,7 @@ export declare class InfoClient<T extends IRequestTransport = IRequestTransport>
2655
2655
  timestamp: number;
2656
2656
  user: `0x${string}`;
2657
2657
  }][];
2658
- spotState: {
2658
+ spotState?: {
2659
2659
  balances: {
2660
2660
  coin: string;
2661
2661
  token: number;
@@ -2668,7 +2668,7 @@ export declare class InfoClient<T extends IRequestTransport = IRequestTransport>
2668
2668
  token: number;
2669
2669
  total: string;
2670
2670
  }[] | undefined;
2671
- };
2671
+ } | undefined;
2672
2672
  spotAssetCtxs: {
2673
2673
  prevDayPx: string;
2674
2674
  dayNtlVlm: string;
@@ -435,7 +435,7 @@ export declare const WebData2Event: v.SchemaWithPipe<readonly [v.ObjectSchema<{
435
435
  user: `0x${string}`;
436
436
  }][], "Array of TWAP states.">]>;
437
437
  /** Account summary for spot trading. */
438
- readonly spotState: v.SchemaWithPipe<readonly [v.ObjectSchema<{
438
+ readonly spotState: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
439
439
  readonly balances: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
440
440
  readonly coin: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Asset symbol.">]>;
441
441
  readonly token: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Unique identifier for the token.">]>;
@@ -481,7 +481,7 @@ export declare const WebData2Event: v.SchemaWithPipe<readonly [v.ObjectSchema<{
481
481
  token: number;
482
482
  total: string;
483
483
  }[] | undefined;
484
- }, "Account summary for spot trading.">]>;
484
+ }, "Account summary for spot trading.">]>, undefined>;
485
485
  /** Context for each spot asset. */
486
486
  readonly spotAssetCtxs: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
487
487
  readonly prevDayPx: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Previous day's closing price.">]>;
@@ -631,7 +631,7 @@ export declare const WebData2Event: v.SchemaWithPipe<readonly [v.ObjectSchema<{
631
631
  timestamp: number;
632
632
  user: `0x${string}`;
633
633
  }][];
634
- spotState: {
634
+ spotState?: {
635
635
  balances: {
636
636
  coin: string;
637
637
  token: number;
@@ -644,7 +644,7 @@ export declare const WebData2Event: v.SchemaWithPipe<readonly [v.ObjectSchema<{
644
644
  token: number;
645
645
  total: string;
646
646
  }[] | undefined;
647
- };
647
+ } | undefined;
648
648
  spotAssetCtxs: {
649
649
  prevDayPx: string;
650
650
  dayNtlVlm: string;
@@ -57,7 +57,7 @@ export const WebData2Event = /* @__PURE__ */ (() => {
57
57
  TwapStateSchema,
58
58
  ]), v.description("TWAP ID and state."))), v.description("Array of TWAP states.")),
59
59
  /** Account summary for spot trading. */
60
- spotState: SpotClearinghouseStateResponse,
60
+ spotState: v.optional(SpotClearinghouseStateResponse),
61
61
  /** Context for each spot asset. */
62
62
  spotAssetCtxs: SpotMetaAndAssetCtxsResponse.items[1],
63
63
  /** Whether the user has opted out of spot dusting. */
@@ -1 +1 @@
1
- {"version":3,"file":"webData2.js","sourceRoot":"","sources":["../../../../src/src/api/subscription/webData2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAsB,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIpG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,oDAAoD;AAEpD,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACnD,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,4BAA4B;QAC5B,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CACvC;QACD,oBAAoB;QACpB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,OAAO,EACP,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAC/B;KACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,4DAA4D,CAAC,CAC5E,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAGL,mDAAmD;AACnD,MAAM,CAAC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