@lifi/perps-sdk-provider-hyperliquid 6.0.0 → 6.0.2

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 (203) hide show
  1. package/dist/cjs/HyperliquidProvider.d.ts.map +1 -1
  2. package/dist/cjs/HyperliquidProvider.js.map +1 -1
  3. package/dist/cjs/services/getActivity.d.ts.map +1 -1
  4. package/dist/cjs/services/getActivity.js.map +1 -1
  5. package/dist/cjs/services/getFills.d.ts.map +1 -1
  6. package/dist/cjs/services/getFills.js.map +1 -1
  7. package/dist/cjs/services/getOrders.d.ts.map +1 -1
  8. package/dist/cjs/services/getOrders.js.map +1 -1
  9. package/dist/cjs/signers/HyperliquidAgentStore.d.ts.map +1 -1
  10. package/dist/cjs/signers/HyperliquidAgentStore.js.map +1 -1
  11. package/dist/cjs/signers/signActions.d.ts.map +1 -1
  12. package/dist/cjs/signers/signActions.js.map +1 -1
  13. package/dist/cjs/types/account.d.ts.map +1 -1
  14. package/dist/cjs/types/account.js.map +1 -1
  15. package/dist/cjs/types/action.d.ts.map +1 -1
  16. package/dist/cjs/types/action.js.map +1 -1
  17. package/dist/cjs/types/asset.d.ts.map +1 -1
  18. package/dist/cjs/types/fill.d.ts.map +1 -1
  19. package/dist/cjs/types/ledger.d.ts.map +1 -1
  20. package/dist/cjs/types/ledger.js.map +1 -1
  21. package/dist/cjs/types/order.d.ts.map +1 -1
  22. package/dist/cjs/types/ws.d.ts.map +1 -1
  23. package/dist/cjs/utils/assetId.d.ts.map +1 -1
  24. package/dist/cjs/utils/assetId.js.map +1 -1
  25. package/dist/cjs/utils/assetLogo.d.ts.map +1 -1
  26. package/dist/cjs/utils/assetLogo.js.map +1 -1
  27. package/dist/cjs/utils/decodeFastAssetCtxs.d.ts.map +1 -1
  28. package/dist/cjs/utils/decodeFastAssetCtxs.js.map +1 -1
  29. package/dist/cjs/utils/infoClient.d.ts.map +1 -1
  30. package/dist/cjs/utils/infoClient.js.map +1 -1
  31. package/dist/cjs/utils/mapActivity.d.ts.map +1 -1
  32. package/dist/cjs/utils/mapActivity.js +13 -10
  33. package/dist/cjs/utils/mapActivity.js.map +1 -1
  34. package/dist/cjs/utils/mapFill.d.ts.map +1 -1
  35. package/dist/cjs/utils/mapFill.js.map +1 -1
  36. package/dist/cjs/utils/mapOrder.d.ts.map +1 -1
  37. package/dist/cjs/utils/mapOrder.js.map +1 -1
  38. package/dist/cjs/utils/mapPosition.d.ts.map +1 -1
  39. package/dist/cjs/utils/mapPosition.js.map +1 -1
  40. package/dist/cjs/utils/spotBalance.d.ts.map +1 -1
  41. package/dist/cjs/utils/spotBalance.js.map +1 -1
  42. package/dist/cjs/utils/spotCollateral.d.ts.map +1 -1
  43. package/dist/cjs/utils/spotCollateral.js.map +1 -1
  44. package/dist/cjs/utils/transferMargin.d.ts.map +1 -1
  45. package/dist/cjs/utils/transferMargin.js +1 -2
  46. package/dist/cjs/utils/transferMargin.js.map +1 -1
  47. package/dist/esm/HyperliquidProvider.d.ts +14 -4
  48. package/dist/esm/HyperliquidProvider.d.ts.map +1 -1
  49. package/dist/esm/HyperliquidProvider.js.map +1 -1
  50. package/dist/esm/services/getActivity.d.ts +5 -1
  51. package/dist/esm/services/getActivity.d.ts.map +1 -1
  52. package/dist/esm/services/getActivity.js.map +1 -1
  53. package/dist/esm/services/getFills.d.ts +4 -3
  54. package/dist/esm/services/getFills.d.ts.map +1 -1
  55. package/dist/esm/services/getFills.js.map +1 -1
  56. package/dist/esm/services/getOrders.d.ts +2 -1
  57. package/dist/esm/services/getOrders.d.ts.map +1 -1
  58. package/dist/esm/services/getOrders.js.map +1 -1
  59. package/dist/esm/services/getPositions.d.ts +2 -2
  60. package/dist/esm/services/getPositions.d.ts.map +1 -1
  61. package/dist/esm/signers/HyperliquidAgentStore.d.ts +3 -3
  62. package/dist/esm/signers/HyperliquidAgentStore.d.ts.map +1 -1
  63. package/dist/esm/signers/HyperliquidAgentStore.js +1 -0
  64. package/dist/esm/signers/HyperliquidAgentStore.js.map +1 -1
  65. package/dist/esm/signers/signActions.d.ts +8 -6
  66. package/dist/esm/signers/signActions.d.ts.map +1 -1
  67. package/dist/esm/signers/signActions.js +8 -6
  68. package/dist/esm/signers/signActions.js.map +1 -1
  69. package/dist/esm/types/account.d.ts +51 -8
  70. package/dist/esm/types/account.d.ts.map +1 -1
  71. package/dist/esm/types/account.js.map +1 -1
  72. package/dist/esm/types/action.d.ts +28 -10
  73. package/dist/esm/types/action.d.ts.map +1 -1
  74. package/dist/esm/types/action.js +7 -7
  75. package/dist/esm/types/action.js.map +1 -1
  76. package/dist/esm/types/asset.d.ts +60 -15
  77. package/dist/esm/types/asset.d.ts.map +1 -1
  78. package/dist/esm/types/fill.d.ts +9 -3
  79. package/dist/esm/types/fill.d.ts.map +1 -1
  80. package/dist/esm/types/ledger.d.ts +24 -6
  81. package/dist/esm/types/ledger.d.ts.map +1 -1
  82. package/dist/esm/types/ledger.js.map +1 -1
  83. package/dist/esm/types/order.d.ts +19 -5
  84. package/dist/esm/types/order.d.ts.map +1 -1
  85. package/dist/esm/types/ws.d.ts +43 -14
  86. package/dist/esm/types/ws.d.ts.map +1 -1
  87. package/dist/esm/utils/assetId.d.ts +7 -7
  88. package/dist/esm/utils/assetId.d.ts.map +1 -1
  89. package/dist/esm/utils/assetId.js +7 -7
  90. package/dist/esm/utils/assetId.js.map +1 -1
  91. package/dist/esm/utils/assetLogo.d.ts +15 -13
  92. package/dist/esm/utils/assetLogo.d.ts.map +1 -1
  93. package/dist/esm/utils/assetLogo.js +15 -13
  94. package/dist/esm/utils/assetLogo.js.map +1 -1
  95. package/dist/esm/utils/decodeFastAssetCtxs.d.ts +7 -1
  96. package/dist/esm/utils/decodeFastAssetCtxs.d.ts.map +1 -1
  97. package/dist/esm/utils/decodeFastAssetCtxs.js +7 -1
  98. package/dist/esm/utils/decodeFastAssetCtxs.js.map +1 -1
  99. package/dist/esm/utils/infoClient.d.ts +6 -1
  100. package/dist/esm/utils/infoClient.d.ts.map +1 -1
  101. package/dist/esm/utils/infoClient.js.map +1 -1
  102. package/dist/esm/utils/mapActivity.d.ts +10 -1
  103. package/dist/esm/utils/mapActivity.d.ts.map +1 -1
  104. package/dist/esm/utils/mapActivity.js +23 -11
  105. package/dist/esm/utils/mapActivity.js.map +1 -1
  106. package/dist/esm/utils/mapFill.d.ts +1 -0
  107. package/dist/esm/utils/mapFill.d.ts.map +1 -1
  108. package/dist/esm/utils/mapFill.js +1 -0
  109. package/dist/esm/utils/mapFill.js.map +1 -1
  110. package/dist/esm/utils/mapOrder.d.ts +15 -4
  111. package/dist/esm/utils/mapOrder.d.ts.map +1 -1
  112. package/dist/esm/utils/mapOrder.js +15 -4
  113. package/dist/esm/utils/mapOrder.js.map +1 -1
  114. package/dist/esm/utils/mapPosition.d.ts +6 -1
  115. package/dist/esm/utils/mapPosition.d.ts.map +1 -1
  116. package/dist/esm/utils/mapPosition.js +6 -1
  117. package/dist/esm/utils/mapPosition.js.map +1 -1
  118. package/dist/esm/utils/spotBalance.d.ts +9 -10
  119. package/dist/esm/utils/spotBalance.d.ts.map +1 -1
  120. package/dist/esm/utils/spotBalance.js +9 -10
  121. package/dist/esm/utils/spotBalance.js.map +1 -1
  122. package/dist/esm/utils/spotCollateral.d.ts +9 -5
  123. package/dist/esm/utils/spotCollateral.d.ts.map +1 -1
  124. package/dist/esm/utils/spotCollateral.js +4 -4
  125. package/dist/esm/utils/spotCollateral.js.map +1 -1
  126. package/dist/esm/utils/transferMargin.d.ts.map +1 -1
  127. package/dist/esm/utils/transferMargin.js +2 -3
  128. package/dist/esm/utils/transferMargin.js.map +1 -1
  129. package/dist/types/HyperliquidProvider.d.ts +14 -4
  130. package/dist/types/HyperliquidProvider.d.ts.map +1 -1
  131. package/dist/types/services/getActivity.d.ts +5 -1
  132. package/dist/types/services/getActivity.d.ts.map +1 -1
  133. package/dist/types/services/getFills.d.ts +4 -3
  134. package/dist/types/services/getFills.d.ts.map +1 -1
  135. package/dist/types/services/getOrders.d.ts +2 -1
  136. package/dist/types/services/getOrders.d.ts.map +1 -1
  137. package/dist/types/services/getPositions.d.ts +2 -2
  138. package/dist/types/services/getPositions.d.ts.map +1 -1
  139. package/dist/types/signers/HyperliquidAgentStore.d.ts +3 -3
  140. package/dist/types/signers/HyperliquidAgentStore.d.ts.map +1 -1
  141. package/dist/types/signers/signActions.d.ts +8 -6
  142. package/dist/types/signers/signActions.d.ts.map +1 -1
  143. package/dist/types/types/account.d.ts +51 -8
  144. package/dist/types/types/account.d.ts.map +1 -1
  145. package/dist/types/types/action.d.ts +28 -10
  146. package/dist/types/types/action.d.ts.map +1 -1
  147. package/dist/types/types/asset.d.ts +60 -15
  148. package/dist/types/types/asset.d.ts.map +1 -1
  149. package/dist/types/types/fill.d.ts +9 -3
  150. package/dist/types/types/fill.d.ts.map +1 -1
  151. package/dist/types/types/ledger.d.ts +24 -6
  152. package/dist/types/types/ledger.d.ts.map +1 -1
  153. package/dist/types/types/order.d.ts +19 -5
  154. package/dist/types/types/order.d.ts.map +1 -1
  155. package/dist/types/types/ws.d.ts +43 -14
  156. package/dist/types/types/ws.d.ts.map +1 -1
  157. package/dist/types/utils/assetId.d.ts +7 -7
  158. package/dist/types/utils/assetId.d.ts.map +1 -1
  159. package/dist/types/utils/assetLogo.d.ts +15 -13
  160. package/dist/types/utils/assetLogo.d.ts.map +1 -1
  161. package/dist/types/utils/decodeFastAssetCtxs.d.ts +7 -1
  162. package/dist/types/utils/decodeFastAssetCtxs.d.ts.map +1 -1
  163. package/dist/types/utils/infoClient.d.ts +6 -1
  164. package/dist/types/utils/infoClient.d.ts.map +1 -1
  165. package/dist/types/utils/mapActivity.d.ts +10 -1
  166. package/dist/types/utils/mapActivity.d.ts.map +1 -1
  167. package/dist/types/utils/mapFill.d.ts +1 -0
  168. package/dist/types/utils/mapFill.d.ts.map +1 -1
  169. package/dist/types/utils/mapOrder.d.ts +15 -4
  170. package/dist/types/utils/mapOrder.d.ts.map +1 -1
  171. package/dist/types/utils/mapPosition.d.ts +6 -1
  172. package/dist/types/utils/mapPosition.d.ts.map +1 -1
  173. package/dist/types/utils/spotBalance.d.ts +9 -10
  174. package/dist/types/utils/spotBalance.d.ts.map +1 -1
  175. package/dist/types/utils/spotCollateral.d.ts +9 -5
  176. package/dist/types/utils/spotCollateral.d.ts.map +1 -1
  177. package/dist/types/utils/transferMargin.d.ts.map +1 -1
  178. package/package.json +3 -3
  179. package/src/HyperliquidProvider.ts +14 -4
  180. package/src/services/getActivity.ts +5 -1
  181. package/src/services/getFills.ts +4 -3
  182. package/src/services/getOrders.ts +2 -1
  183. package/src/services/getPositions.ts +2 -2
  184. package/src/signers/HyperliquidAgentStore.ts +3 -3
  185. package/src/signers/signActions.ts +8 -6
  186. package/src/types/account.ts +51 -8
  187. package/src/types/action.ts +28 -10
  188. package/src/types/asset.ts +60 -15
  189. package/src/types/fill.ts +9 -3
  190. package/src/types/ledger.ts +24 -6
  191. package/src/types/order.ts +19 -5
  192. package/src/types/ws.ts +43 -14
  193. package/src/utils/assetId.ts +7 -7
  194. package/src/utils/assetLogo.ts +15 -13
  195. package/src/utils/decodeFastAssetCtxs.ts +7 -1
  196. package/src/utils/infoClient.ts +6 -1
  197. package/src/utils/mapActivity.ts +23 -11
  198. package/src/utils/mapFill.ts +1 -0
  199. package/src/utils/mapOrder.ts +15 -4
  200. package/src/utils/mapPosition.ts +6 -1
  201. package/src/utils/spotBalance.ts +9 -10
  202. package/src/utils/spotCollateral.ts +9 -5
  203. package/src/utils/transferMargin.ts +2 -6
@@ -1,4 +1,8 @@
1
- /** @public */
1
+ /**
2
+ * Perpetual market metadata from Hyperliquid `meta.universe`.
3
+ * `szDecimals` is the lot-size precision; `maxLeverage` is the venue cap.
4
+ * @public
5
+ */
2
6
  export type HlUniverseItem = {
3
7
  name: string;
4
8
  szDecimals: number;
@@ -8,11 +12,19 @@ export type HlUniverseItem = {
8
12
  marginMode?: 'strictIsolated' | 'noCross';
9
13
  isDelisted?: boolean;
10
14
  };
11
- /** @public */
15
+ /**
16
+ * Perpetual metadata envelope returned by the Hyperliquid `meta` info query.
17
+ * @public
18
+ */
12
19
  export type HlMeta = {
13
20
  universe: HlUniverseItem[];
14
21
  };
15
- /** @public */
22
+ /**
23
+ * Live perpetual market context from Hyperliquid `metaAndAssetCtxs`.
24
+ * Prices, funding, open interest, and volume are decimal strings; `funding`
25
+ * is a rate and `dayNtlVlm` is 24-hour notional volume.
26
+ * @public
27
+ */
16
28
  export type HlAssetCtx = {
17
29
  funding: string;
18
30
  openInterest: string;
@@ -20,11 +32,19 @@ export type HlAssetCtx = {
20
32
  prevDayPx: string;
21
33
  markPx: string;
22
34
  };
23
- /** @public */
35
+ /**
36
+ * Tuple returned by `metaAndAssetCtxs`: static universe metadata followed by
37
+ * one live context per universe entry.
38
+ * @public
39
+ */
24
40
  export type HlMetaAndAssetCtxs = [HlMeta, HlAssetCtx[]];
25
- /** @public */
41
+ /** Alias for the perpetual universe array in {@link HlMeta}. @public */
26
42
  export type HlUniverse = HlMeta['universe'];
27
- /** @public */
43
+ /**
44
+ * OHLCV candle from Hyperliquid's candle feed. `t` is the opening timestamp
45
+ * in milliseconds; prices and volume are decimal strings.
46
+ * @public
47
+ */
28
48
  export type HlCandle = {
29
49
  t: number;
30
50
  o: string;
@@ -33,43 +53,68 @@ export type HlCandle = {
33
53
  c: string;
34
54
  v: string;
35
55
  };
36
- /** @public */
56
+ /** Snapshot array of {@link HlCandle} values, ordered by the upstream feed. @public */
37
57
  export type HlCandleSnapshot = HlCandle[];
38
- /** @public */
58
+ /**
59
+ * One L2 order-book level. `px` is price, `sz` is aggregate size, and `n` is
60
+ * the number of orders at that price; numeric values are wire strings except
61
+ * for the order count.
62
+ * @public
63
+ */
39
64
  export type HlLevel = {
40
65
  px: string;
41
66
  sz: string;
42
67
  n: number;
43
68
  };
44
- /** @public */
69
+ /**
70
+ * L2 order-book snapshot with bid levels at index 0 and ask levels at index 1.
71
+ * `time` is the snapshot timestamp in milliseconds.
72
+ * @public
73
+ */
45
74
  export type HlL2Book = {
46
75
  levels: [HlLevel[], HlLevel[]];
47
76
  time: number;
48
77
  };
49
- /** @public */
78
+ /**
79
+ * Perpetual DEX descriptors from Hyperliquid `perpDexs`; `null` represents the
80
+ * main DEX and named entries represent HIP-3 sub-DEXes.
81
+ * @public
82
+ */
50
83
  export type HlPerpDexs = (null | {
51
84
  name: string;
52
85
  })[];
53
- /** @public */
86
+ /**
87
+ * Spot token metadata. `index` is the numeric token index used by spot
88
+ * clearinghouse balances; `tokenId` is the venue's wire identifier.
89
+ * @public
90
+ */
54
91
  export type HlSpotToken = {
55
92
  name: string;
56
93
  index: number;
57
94
  tokenId: string;
58
95
  szDecimals: number;
59
96
  };
60
- /** @public */
97
+ /**
98
+ * Spot universe entry describing a trading pair. `tokens` contains the two
99
+ * numeric token indexes used by the pair.
100
+ * @public
101
+ */
61
102
  export type HlSpotUniverseEntry = {
62
103
  name: string;
63
104
  tokens: [number, number];
64
105
  index: number;
65
106
  isCanonical: boolean;
66
107
  };
67
- /** @public */
108
+ /** Spot metadata envelope containing token definitions and trading pairs. @public */
68
109
  export type HlSpotMeta = {
69
110
  tokens: HlSpotToken[];
70
111
  universe: HlSpotUniverseEntry[];
71
112
  };
72
- /** @public */
113
+ /**
114
+ * Live spot token context. Prices and 24-hour volume are decimal strings;
115
+ * `midPx` is `null` when the venue has no midpoint for the pair.
116
+ * @public
117
+ */
73
118
  export type HlSpotAssetCtx = {
74
119
  coin: string;
75
120
  prevDayPx: string;
@@ -77,6 +122,6 @@ export type HlSpotAssetCtx = {
77
122
  markPx: string;
78
123
  midPx: string | null;
79
124
  };
80
- /** @public */
125
+ /** Tuple returned by the spot metadata/context info query. @public */
81
126
  export type HlSpotMetaAndAssetCtxs = [HlSpotMeta, HlSpotAssetCtx[]];
82
127
  //# sourceMappingURL=asset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../../src/types/asset.ts"],"names":[],"mappings":"AAEA,c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,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAAA;AAEpD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,CAAC,CAAA"}
@@ -1,4 +1,10 @@
1
- /** @public */
1
+ /**
2
+ * One user trade fill returned by Hyperliquid `userFills` or
3
+ * `userFillsByTime`. Prices, size, fee, PnL, and starting position are decimal
4
+ * strings; `time` is milliseconds since the Unix epoch and `tid`/`oid` are
5
+ * numeric trade and order IDs.
6
+ * @public
7
+ */
2
8
  export type HlUserFill = {
3
9
  tid: number;
4
10
  oid: number;
@@ -14,8 +20,8 @@ export type HlUserFill = {
14
20
  time: number;
15
21
  startPosition: string;
16
22
  };
17
- /** @public */
23
+ /** All fills returned by the unbounded `userFills` query. @public */
18
24
  export type HlUserFills = HlUserFill[];
19
- /** @public */
25
+ /** Fills returned by the time-bounded `userFillsByTime` query. @public */
20
26
  export type HlUserFillsByTime = HlUserFill[];
21
27
  //# sourceMappingURL=fill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../src/types/fill.ts"],"names":[],"mappings":"AAEA,cAAc;AACd,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,UAAU,EAAE,CAAA;AAEtC,cAAc;AACd,MAAM,MAAM,iBAAiB,GAAG,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../src/types/fill.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,UAAU,EAAE,CAAA;AAEtC,0EAA0E;AAC1E,MAAM,MAAM,iBAAiB,GAAG,UAAU,EAAE,CAAA"}
@@ -45,7 +45,11 @@ export type HlSendAssetDelta = {
45
45
  nonce: number;
46
46
  feeToken: string;
47
47
  };
48
- /** @public */
48
+ /**
49
+ * Union of known Hyperliquid non-funding ledger deltas plus an open fallback
50
+ * for endpoint variants the provider does not map.
51
+ * @public
52
+ */
49
53
  export type HlLedgerDelta = HlSpotTransferDelta | HlSendAssetDelta | {
50
54
  type: string;
51
55
  usdc?: string;
@@ -66,15 +70,24 @@ export declare const isSpotTransferDelta: (delta: HlLedgerDelta) => delta is HlS
66
70
  * @public
67
71
  */
68
72
  export declare const isSendAssetDelta: (delta: HlLedgerDelta) => delta is HlSendAssetDelta;
69
- /** @public */
73
+ /**
74
+ * One timestamped non-funding ledger update. `time` is milliseconds since
75
+ * epoch and `hash` is the upstream transaction identifier.
76
+ * @public
77
+ */
70
78
  export type HlLedgerUpdate = {
71
79
  time: number;
72
80
  hash: string;
73
81
  delta: HlLedgerDelta;
74
82
  };
75
- /** @public */
83
+ /** Array returned by `userNonFundingLedgerUpdates`. @public */
76
84
  export type HlUserNonFundingLedgerUpdates = HlLedgerUpdate[];
77
- /** @public */
85
+ /**
86
+ * Funding ledger delta returned by Hyperliquid `userFunding`. `usdc` is the
87
+ * funding payment, `szi` is signed position size, and `fundingRate` is a
88
+ * decimal fraction; all are decimal strings.
89
+ * @public
90
+ */
78
91
  export type HlFundingDelta = {
79
92
  type: 'funding';
80
93
  coin: string;
@@ -82,12 +95,17 @@ export type HlFundingDelta = {
82
95
  szi: string;
83
96
  fundingRate: string;
84
97
  };
85
- /** @public */
98
+ /**
99
+ * Timestamped funding update. `time` is milliseconds since epoch; `hash` is
100
+ * always the zero hash — funding is a system ledger event with no venue
101
+ * transaction behind it.
102
+ * @public
103
+ */
86
104
  export type HlFundingUpdate = {
87
105
  time: number;
88
106
  hash: string;
89
107
  delta: HlFundingDelta;
90
108
  };
91
- /** @public */
109
+ /** Array returned by the `userFunding` info query. @public */
92
110
  export type HlUserFunding = HlFundingUpdate[];
93
111
  //# sourceMappingURL=ledger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/types/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAInC;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,cAAc,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,cAAc;AACd,MAAM,MAAM,aAAa,GACrB,mBAAmB,GACnB,gBAAgB,GAChB;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,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AA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,cAAc,CAAA;CACtB,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,eAAe,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/types/ledger.ts"],"names":[],"mappings":"AA8DA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAoB,EACU,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AAEhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAoB,EACO,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAA"}
1
+ {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/types/ledger.ts"],"names":[],"mappings":"AAkEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAoB,EACU,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AAEhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAoB,EACO,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAA"}
@@ -1,4 +1,9 @@
1
- /** @public */
1
+ /**
2
+ * Open order payload returned by Hyperliquid `frontendOpenOrders`.
3
+ * Sizes/prices are decimal strings; timestamps are milliseconds. Trigger
4
+ * flags and optional `children` describe attached TP/SL orders.
5
+ * @public
6
+ */
2
7
  export type HlFrontendOpenOrder = {
3
8
  oid: number;
4
9
  coin: string;
@@ -17,9 +22,14 @@ export type HlFrontendOpenOrder = {
17
22
  tif: string | null;
18
23
  cloid: string | null;
19
24
  };
20
- /** @public */
25
+ /** Array returned by the `frontendOpenOrders` info query. @public */
21
26
  export type HlFrontendOpenOrders = HlFrontendOpenOrder[];
22
- /** @public */
27
+ /**
28
+ * Order detail nested in an `orderStatus` response. `statusTimestamp` is the
29
+ * last status-change time in milliseconds; `triggerPx` is nullable for orders
30
+ * without a trigger.
31
+ * @public
32
+ */
23
33
  export type HlOrderDetail = {
24
34
  order: {
25
35
  oid: number;
@@ -39,12 +49,16 @@ export type HlOrderDetail = {
39
49
  status: string;
40
50
  statusTimestamp: number;
41
51
  };
42
- /** @public */
52
+ /** Successful `orderStatus` response containing the requested order. @public */
43
53
  export type HlOrderStatusFound = {
44
54
  status: 'order';
45
55
  order: HlOrderDetail;
46
56
  };
47
- /** @public */
57
+ /**
58
+ * Result of `orderStatus`: either a found order or the exact `'unknownOid'`
59
+ * sentinel when Hyperliquid has no record for the numeric order ID.
60
+ * @public
61
+ */
48
62
  export type HlOrderStatusResponse = HlOrderStatusFound | {
49
63
  status: 'unknownOid';
50
64
  };
@@ -1 +1 @@
1
- {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/types/order.ts"],"names":[],"mappings":"AAEA,cAAc;AACd,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,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AE,CAAA"}
@@ -18,7 +18,11 @@ export type HlWsPerpAssetCtx = {
18
18
  midPx: string | null;
19
19
  oraclePx: string;
20
20
  };
21
- /** @public */
21
+ /**
22
+ * Partial perp context carried by compressed (`pac`) updates. Omitted fields
23
+ * are unchanged from the prior context and must be merged by the consumer.
24
+ * @public
25
+ */
22
26
  export type HlWsPerpAssetCtxPayload = Partial<HlWsPerpAssetCtx>;
23
27
  /**
24
28
  * `allDexsAssetCtxs` carries one `[dex, ctxs]` pair per perp sub-DEX, mirroring
@@ -36,7 +40,7 @@ export type HlWsAllDexsAssetCtxsData = {
36
40
  * @public
37
41
  */
38
42
  export type HlWsPacData = [string, HlWsPerpAssetCtxPayload[]][];
39
- /** @public */
43
+ /** Generic Hyperliquid WS envelope; `channel` identifies the subscription and `data` is channel-specific. @public */
40
44
  export type HlWsMessage = {
41
45
  channel: string;
42
46
  data: unknown;
@@ -51,7 +55,12 @@ export type HlWsFastAssetCtx = {
51
55
  markPx?: string;
52
56
  midPx?: string | null;
53
57
  };
54
- /** @public */
58
+ /**
59
+ * Incremental spot asset context. Hyperliquid may encode numeric fields as
60
+ * strings or numbers and omits unchanged fields; `midPx: null` means no book
61
+ * midpoint is available.
62
+ * @public
63
+ */
55
64
  export type HlWsSpotAssetCtx = {
56
65
  dayNtlVlm?: HlWsNumberString;
57
66
  prevDayPx?: HlWsNumberString;
@@ -60,12 +69,12 @@ export type HlWsSpotAssetCtx = {
60
69
  dayBaseVlm?: HlWsNumberString;
61
70
  circulatingSupply?: HlWsNumberString;
62
71
  };
63
- /** @public */
72
+ /** Active perp context event keyed by its Hyperliquid wire coin. @public */
64
73
  export type HlWsActiveAssetCtxData = {
65
74
  coin: string;
66
75
  ctx: Partial<Record<keyof HlWsPerpAssetCtx, HlWsNumberString | null>>;
67
76
  };
68
- /** @public */
77
+ /** Active spot context event keyed by its Hyperliquid wire coin. @public */
69
78
  export type HlWsActiveSpotAssetCtxData = {
70
79
  coin: string;
71
80
  ctx: HlWsSpotAssetCtx;
@@ -76,11 +85,15 @@ export type HlWsActiveSpotAssetCtxData = {
76
85
  * @public
77
86
  */
78
87
  export type HlWsSacData = Record<string, HlWsSpotAssetCtx>;
79
- /** @public */
88
+ /** L2 snapshot envelope with the wire coin attached to {@link HlL2Book}. @public */
80
89
  export type HlWsL2BookData = HlL2Book & {
81
90
  coin: string;
82
91
  };
83
- /** @public */
92
+ /**
93
+ * L2 channel payload. `s` is a full snapshot, while `u` is a compressed delta;
94
+ * `c` carries the checksum/control value when present.
95
+ * @public
96
+ */
84
97
  export type HlWsL2Data = {
85
98
  s?: HlL2Book & {
86
99
  coin: string;
@@ -88,12 +101,16 @@ export type HlWsL2Data = {
88
101
  c?: string;
89
102
  u?: HlWsCompressedL2Data;
90
103
  };
91
- /** @public */
104
+ /** One level in a compressed L2 update: `p` is price and `s` is size. @public */
92
105
  export type HlWsCompressedL2Level = {
93
106
  p: string;
94
107
  s: string;
95
108
  };
96
- /** @public */
109
+ /**
110
+ * Compressed L2 delta. `t` is the update timestamp in milliseconds, `l` holds
111
+ * bid/ask levels, and optional `r` describes removals.
112
+ * @public
113
+ */
97
114
  export type HlWsCompressedL2Data = {
98
115
  c: string;
99
116
  t: number;
@@ -107,14 +124,22 @@ export type HlWsCompressedL2Data = {
107
124
  }>
108
125
  ];
109
126
  };
110
- /** @public */
127
+ /**
128
+ * Candle event payload. Inherited `t` is candle-open time; `T` is close time,
129
+ * `s` is the symbol, `i` is interval, and `n` is the trade count.
130
+ * @public
131
+ */
111
132
  export type HlWsCandleData = HlCandle & {
112
133
  T: number;
113
134
  s: string;
114
135
  i: string;
115
136
  n: number;
116
137
  };
117
- /** @public */
138
+ /**
139
+ * Public trade event. Prices and size are decimal strings; `time` is
140
+ * milliseconds since epoch, with optional trade ID and transaction hash.
141
+ * @public
142
+ */
118
143
  export type HlWsTrade = {
119
144
  coin: string;
120
145
  side: string;
@@ -124,13 +149,17 @@ export type HlWsTrade = {
124
149
  tid?: number;
125
150
  hash?: string;
126
151
  };
127
- /** @public */
152
+ /** User fills event; `isSnapshot` distinguishes the initial snapshot from updates. @public */
128
153
  export type HlWsUserFillsData = {
129
154
  isSnapshot: boolean;
130
155
  user: string;
131
156
  fills: HlUserFill[];
132
157
  };
133
- /** @public */
158
+ /**
159
+ * Per-dex clearinghouse event for one user. Each tuple contains a wire DEX name
160
+ * and the perp positions/equity fields supplied by that DEX.
161
+ * @public
162
+ */
134
163
  export type HlWsAllDexsClearinghouseStateData = {
135
164
  user: string;
136
165
  clearinghouseStates: [
@@ -138,7 +167,7 @@ export type HlWsAllDexsClearinghouseStateData = {
138
167
  Pick<HlClearinghouseState, 'assetPositions' | 'marginSummary'>
139
168
  ][];
140
169
  };
141
- /** @public */
170
+ /** User spot clearinghouse event containing the current spot balances. @public */
142
171
  export type HlWsSpotStateData = {
143
172
  user: string;
144
173
  spotState: {
@@ -1 +1 @@
1
- {"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../../src/types/ws.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBA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,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,EAAE;QACnB,MAAM;QACN,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,GAAG,eAAe,CAAC;KAC/D,EAAE,CAAA;CACJ,CAAA;AAED,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE,CAAA;CACzC,CAAA"}
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Spot asset IDs use the @pairIndex format (e.g. "@230").
3
- *
2
+ * Return whether a Hyperliquid asset ID identifies spot (`@<pairIndex>`).
3
+ * @param assetId - Raw Hyperliquid asset ID.
4
4
  * @public
5
5
  */
6
6
  export declare const assetIsSpot: (assetId: string) => boolean;
7
7
  /**
8
- * Calculate the asset ID for a given provider index and asset index.
9
- *
10
- * Main provider (provider = ''): assetId = indexInProvider
11
- * HIP-3 providers (provider = 'xyz'): assetId = 100_000 + perpDexIndex * 10_000 + indexInProvider
8
+ * Calculate Hyperliquid's numeric asset ID from a perp DEX index and the
9
+ * asset's zero-based index within that DEX. The main DEX uses the index
10
+ * directly; HIP-3 DEXes use `100000 + dexIndex * 10000 + assetIndex`.
12
11
  * @public
13
12
  */
14
13
  export declare const calculateAssetId: (providerIndex: number, indexInProvider: number) => number;
15
14
  /**
16
- * Get the provider index from the given list of provider names.
15
+ * Find a sub-DEX's zero-based index in the names returned by Hyperliquid.
16
+ * @throws If `provider` is absent from `providerNames`.
17
17
  * @public
18
18
  */
19
19
  export declare const getProviderIndex: (provider: string, providerNames: string[]) => number;
@@ -1 +1 @@
1
- {"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,OAAkC,CAAA;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,MAAM,EACrB,iBAAiB,MAAM,KACtB,MAKF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,eAAe,MAAM,EAAE,KACtB,MAMF,CAAA"}
1
+ {"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,OAAkC,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,MAAM,EACrB,iBAAiB,MAAM,KACtB,MAKF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,eAAe,MAAM,EAAE,KACtB,MAMF,CAAA"}
@@ -1,14 +1,13 @@
1
1
  /**
2
- * Spot asset IDs use the @pairIndex format (e.g. "@230").
3
- *
2
+ * Return whether a Hyperliquid asset ID identifies spot (`@<pairIndex>`).
3
+ * @param assetId - Raw Hyperliquid asset ID.
4
4
  * @public
5
5
  */
6
6
  export const assetIsSpot = (assetId) => assetId.startsWith('@');
7
7
  /**
8
- * Calculate the asset ID for a given provider index and asset index.
9
- *
10
- * Main provider (provider = ''): assetId = indexInProvider
11
- * HIP-3 providers (provider = 'xyz'): assetId = 100_000 + perpDexIndex * 10_000 + indexInProvider
8
+ * Calculate Hyperliquid's numeric asset ID from a perp DEX index and the
9
+ * asset's zero-based index within that DEX. The main DEX uses the index
10
+ * directly; HIP-3 DEXes use `100000 + dexIndex * 10000 + assetIndex`.
12
11
  * @public
13
12
  */
14
13
  export const calculateAssetId = (providerIndex, indexInProvider) => {
@@ -18,7 +17,8 @@ export const calculateAssetId = (providerIndex, indexInProvider) => {
18
17
  return 100_000 + providerIndex * 10_000 + indexInProvider;
19
18
  };
20
19
  /**
21
- * Get the provider index from the given list of provider names.
20
+ * Find a sub-DEX's zero-based index in the names returned by Hyperliquid.
21
+ * @throws If `provider` is absent from `providerNames`.
22
22
  * @public
23
23
  */
24
24
  export const getProviderIndex = (provider, providerNames) => {
@@ -1 +1 @@
1
- {"version":3,"file":"assetId.js","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,aAAqB,EACrB,eAAuB,EACf,EAAE;IACV,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,OAAO,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,eAAe,CAAA;AAC3D,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAgB,EAChB,aAAuB,EACf,EAAE;IACV,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC7C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
1
+ {"version":3,"file":"assetId.js","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,aAAqB,EACrB,eAAuB,EACf,EAAE;IACV,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,OAAO,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,eAAe,CAAA;AAC3D,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAgB,EAChB,aAAuB,EACf,EAAE;IACV,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC7C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -1,20 +1,22 @@
1
1
  import type { Asset } from '@lifi/perps-types';
2
- /** Token `name`s of the Unit-bridged HL spot assets. */
2
+ /**
3
+ * Names of Unit-bridged Hyperliquid spot tokens recognized by the logo
4
+ * resolver. The set is read-only and is intended for callers that need to
5
+ * distinguish Unit balances before resolving their icons.
6
+ * @public
7
+ */
3
8
  export declare const UNIT_TOKEN_NAMES: ReadonlySet<string>;
4
- /** Return `asset` with its `logoURI` replaced when a display-symbol override exists. */
9
+ /**
10
+ * Apply the provider's known symbol-specific logo corrections to an asset.
11
+ * Returns the original object when no override exists.
12
+ * @public
13
+ */
5
14
  export declare const applyLogoOverride: (asset: Asset) => Asset;
6
15
  /**
7
- * Override-aware logo URI for a Hyperliquid spot token. Base rule is
8
- * `coins/${name}_spot.svg`; a Unit-bridged token (`fullName` starts with
9
- * "Unit") resolves to its underlying's icon instead; the override table wins
10
- * over both.
11
- *
12
- * When `fullName` is absent — spot *balances* (`HlSpotBalance`) carry no
13
- * `fullName` and this issue deliberately does not fetch `spotMeta` on the
14
- * account path — the derivation degrades to the symbol-keyed override + base
15
- * `_spot` rule, so a Unit-bridged balance uses the base rule rather than its
16
- * underlying's icon. The registry path (which has `fullName`) keeps full Unit
17
- * resolution.
16
+ * Resolve the logo URI for a Hyperliquid spot token. Unit-bridged tokens use
17
+ * the underlying symbol's icon when `fullName` starts with `'Unit'`; otherwise
18
+ * the base URI is `coins/${name}_spot.svg`. Known symbol overrides win.
19
+ * @public
18
20
  */
19
21
  export declare const spotLogoURI: (name: string, fullName?: string | null) => string;
20
22
  //# sourceMappingURL=assetLogo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assetLogo.d.ts","sourceRoot":"","sources":["../../../src/utils/assetLogo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAiD9C,wDAAwD;AACxD,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAEhD,CAAA;AAQD,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,KAAG,KAGhD,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAKpE,CAAA"}
1
+ {"version":3,"file":"assetLogo.d.ts","sourceRoot":"","sources":["../../../src/utils/assetLogo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAiD9C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAEhD,CAAA;AAQD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,KAAG,KAGhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAKpE,CAAA"}
@@ -40,30 +40,32 @@ const UNIT_UNDERLYING_SYMBOL = {
40
40
  UMEGA: 'MEGA',
41
41
  UANSEM: 'ANSEM',
42
42
  };
43
- /** Token `name`s of the Unit-bridged HL spot assets. */
43
+ /**
44
+ * Names of Unit-bridged Hyperliquid spot tokens recognized by the logo
45
+ * resolver. The set is read-only and is intended for callers that need to
46
+ * distinguish Unit balances before resolving their icons.
47
+ * @public
48
+ */
44
49
  export const UNIT_TOKEN_NAMES = new Set(Object.keys(UNIT_UNDERLYING_SYMBOL));
45
50
  /** Logo URI for a Unit-bridged spot token; '' when the underlying is unmapped. */
46
51
  const unitSpotLogoURI = (name) => {
47
52
  const underlying = UNIT_UNDERLYING_SYMBOL[name];
48
53
  return underlying === undefined ? '' : `${HL_COIN_CDN}/${underlying}.svg`;
49
54
  };
50
- /** Return `asset` with its `logoURI` replaced when a display-symbol override exists. */
55
+ /**
56
+ * Apply the provider's known symbol-specific logo corrections to an asset.
57
+ * Returns the original object when no override exists.
58
+ * @public
59
+ */
51
60
  export const applyLogoOverride = (asset) => {
52
61
  const override = BASE_ASSET_LOGO_OVERRIDES[asset.displaySymbol];
53
62
  return override === undefined ? asset : { ...asset, logoURI: override };
54
63
  };
55
64
  /**
56
- * Override-aware logo URI for a Hyperliquid spot token. Base rule is
57
- * `coins/${name}_spot.svg`; a Unit-bridged token (`fullName` starts with
58
- * "Unit") resolves to its underlying's icon instead; the override table wins
59
- * over both.
60
- *
61
- * When `fullName` is absent — spot *balances* (`HlSpotBalance`) carry no
62
- * `fullName` and this issue deliberately does not fetch `spotMeta` on the
63
- * account path — the derivation degrades to the symbol-keyed override + base
64
- * `_spot` rule, so a Unit-bridged balance uses the base rule rather than its
65
- * underlying's icon. The registry path (which has `fullName`) keeps full Unit
66
- * resolution.
65
+ * Resolve the logo URI for a Hyperliquid spot token. Unit-bridged tokens use
66
+ * the underlying symbol's icon when `fullName` starts with `'Unit'`; otherwise
67
+ * the base URI is `coins/${name}_spot.svg`. Known symbol overrides win.
68
+ * @public
67
69
  */
68
70
  export const spotLogoURI = (name, fullName) => {
69
71
  const base = fullName?.startsWith('Unit')
@@ -1 +1 @@
1
- {"version":3,"file":"assetLogo.js","sourceRoot":"","sources":["../../../src/utils/assetLogo.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,mCAAmC,CAAA;AAEvD,MAAM,aAAa,GACjB,iGAAiG,CAAA;AAEnG;;;GAGG;AACH,MAAM,yBAAyB,GAAqC;IAClE,mFAAmF;IACnF,IAAI,EAAE,aAAa;IACnB,4EAA4E;IAC5E,yEAAyE;IACzE,IAAI,EAAE,GAAG,WAAW,WAAW;IAC/B,6EAA6E;IAC7E,4EAA4E;IAC5E,KAAK,EAAE,GAAG,WAAW,WAAW;CACjC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAqC;IAC/D,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO;CAChB,CAAA;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAC1D,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CACpC,CAAA;AAED,kFAAkF;AAClF,MAAM,eAAe,GAAG,CAAC,IAAY,EAAU,EAAE;IAC/C,MAAM,UAAU,GAAG,sBAAsB,CA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