@nktkas/hyperliquid 0.25.0-beta.1 → 0.25.0-beta.3

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 (284) hide show
  1. package/README.md +64 -16
  2. package/esm/bin/cli.d.ts +3 -0
  3. package/esm/bin/cli.d.ts.map +1 -0
  4. package/esm/bin/cli.js +452 -0
  5. package/esm/bin/cli.js.map +1 -0
  6. package/{script/src/errors.d.ts → esm/src/_errors.d.ts} +1 -1
  7. package/esm/src/_errors.d.ts.map +1 -0
  8. package/esm/src/{errors.js → _errors.js} +1 -0
  9. package/esm/src/_errors.js.map +1 -0
  10. package/esm/src/clients/exchange.d.ts +4 -11
  11. package/esm/src/clients/exchange.d.ts.map +1 -1
  12. package/esm/src/clients/exchange.js +8 -9
  13. package/esm/src/clients/exchange.js.map +1 -0
  14. package/esm/src/clients/info.d.ts +86 -2
  15. package/esm/src/clients/info.d.ts.map +1 -1
  16. package/esm/src/clients/info.js +103 -1
  17. package/esm/src/clients/info.js.map +1 -0
  18. package/esm/src/clients/multiSign.d.ts +1 -1
  19. package/esm/src/clients/multiSign.d.ts.map +1 -1
  20. package/esm/src/clients/multiSign.js +3 -2
  21. package/esm/src/clients/multiSign.js.map +1 -0
  22. package/esm/src/clients/subscription.js +1 -0
  23. package/esm/src/clients/subscription.js.map +1 -0
  24. package/esm/src/mod.d.ts +21 -0
  25. package/esm/src/mod.d.ts.map +1 -0
  26. package/esm/src/mod.js +14 -0
  27. package/esm/src/mod.js.map +1 -0
  28. package/esm/src/schemas/_base.d.ts +11 -3
  29. package/esm/src/schemas/_base.d.ts.map +1 -1
  30. package/esm/src/schemas/_base.js +30 -2
  31. package/esm/src/schemas/_base.js.map +1 -0
  32. package/esm/src/schemas/exchange/requests.d.ts +1872 -1872
  33. package/esm/src/schemas/exchange/requests.d.ts.map +1 -1
  34. package/esm/src/schemas/exchange/requests.js +277 -281
  35. package/esm/src/schemas/exchange/requests.js.map +1 -0
  36. package/esm/src/schemas/exchange/responses.d.ts +51 -51
  37. package/esm/src/schemas/exchange/responses.js +55 -54
  38. package/esm/src/schemas/exchange/responses.js.map +1 -0
  39. package/esm/src/schemas/explorer/requests.d.ts +5 -5
  40. package/esm/src/schemas/explorer/requests.js +6 -5
  41. package/esm/src/schemas/explorer/requests.js.map +1 -0
  42. package/esm/src/schemas/explorer/responses.d.ts +10 -10
  43. package/esm/src/schemas/explorer/responses.js +12 -11
  44. package/esm/src/schemas/explorer/responses.js.map +1 -0
  45. package/esm/src/schemas/info/accounts.d.ts +1042 -296
  46. package/esm/src/schemas/info/accounts.d.ts.map +1 -1
  47. package/esm/src/schemas/info/accounts.js +154 -109
  48. package/esm/src/schemas/info/accounts.js.map +1 -0
  49. package/esm/src/schemas/info/assets.d.ts +130 -101
  50. package/esm/src/schemas/info/assets.d.ts.map +1 -1
  51. package/esm/src/schemas/info/assets.js +69 -49
  52. package/esm/src/schemas/info/assets.js.map +1 -0
  53. package/esm/src/schemas/info/markets.d.ts +35 -18
  54. package/esm/src/schemas/info/markets.d.ts.map +1 -1
  55. package/esm/src/schemas/info/markets.js +27 -15
  56. package/esm/src/schemas/info/markets.js.map +1 -0
  57. package/esm/src/schemas/info/orders.d.ts +151 -151
  58. package/esm/src/schemas/info/orders.js +37 -36
  59. package/esm/src/schemas/info/orders.js.map +1 -0
  60. package/esm/src/schemas/info/requests.d.ts +145 -88
  61. package/esm/src/schemas/info/requests.d.ts.map +1 -1
  62. package/esm/src/schemas/info/requests.js +116 -73
  63. package/esm/src/schemas/info/requests.js.map +1 -0
  64. package/esm/src/schemas/info/validators.d.ts +60 -39
  65. package/esm/src/schemas/info/validators.d.ts.map +1 -1
  66. package/esm/src/schemas/info/validators.js +40 -26
  67. package/esm/src/schemas/info/validators.js.map +1 -0
  68. package/esm/src/schemas/info/vaults.d.ts +59 -59
  69. package/esm/src/schemas/info/vaults.js +20 -19
  70. package/esm/src/schemas/info/vaults.js.map +1 -0
  71. package/esm/src/schemas/mod.d.ts +4 -3
  72. package/esm/src/schemas/mod.d.ts.map +1 -1
  73. package/esm/src/schemas/mod.js +5 -3
  74. package/esm/src/schemas/mod.js.map +1 -0
  75. package/esm/src/schemas/subscriptions/requests.d.ts +23 -23
  76. package/esm/src/schemas/subscriptions/requests.d.ts.map +1 -1
  77. package/esm/src/schemas/subscriptions/requests.js +25 -24
  78. package/esm/src/schemas/subscriptions/requests.js.map +1 -0
  79. package/esm/src/schemas/subscriptions/responses.d.ts +547 -547
  80. package/esm/src/schemas/subscriptions/responses.js +41 -40
  81. package/esm/src/schemas/subscriptions/responses.js.map +1 -0
  82. package/esm/src/signing/mod.d.ts +1 -1
  83. package/esm/src/signing/mod.d.ts.map +1 -1
  84. package/esm/src/signing/mod.js +3 -2
  85. package/esm/src/signing/mod.js.map +1 -0
  86. package/esm/src/signing/signTypedData/ethers.d.ts.map +1 -0
  87. package/esm/src/signing/{_signTypedData → signTypedData}/ethers.js +1 -0
  88. package/esm/src/signing/signTypedData/ethers.js.map +1 -0
  89. package/esm/src/signing/signTypedData/mod.d.ts.map +1 -0
  90. package/esm/src/signing/{_signTypedData → signTypedData}/mod.js +1 -0
  91. package/esm/src/signing/signTypedData/mod.js.map +1 -0
  92. package/esm/src/signing/signTypedData/private_key.d.ts.map +1 -0
  93. package/esm/src/signing/{_signTypedData → signTypedData}/private_key.js +10 -8
  94. package/esm/src/signing/signTypedData/private_key.js.map +1 -0
  95. package/esm/src/signing/signTypedData/viem.d.ts.map +1 -0
  96. package/esm/src/signing/{_signTypedData → signTypedData}/viem.js +1 -0
  97. package/esm/src/signing/signTypedData/viem.js.map +1 -0
  98. package/esm/src/transports/base.d.ts +4 -4
  99. package/esm/src/transports/base.d.ts.map +1 -1
  100. package/esm/src/transports/base.js +3 -2
  101. package/esm/src/transports/base.js.map +1 -0
  102. package/esm/src/transports/http/http_transport.d.ts +1 -1
  103. package/esm/src/transports/http/http_transport.js +1 -0
  104. package/esm/src/transports/http/http_transport.js.map +1 -0
  105. package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -0
  106. package/esm/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
  107. package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
  108. package/esm/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
  109. package/esm/src/transports/websocket/_websocket_async_request.js +1 -0
  110. package/esm/src/transports/websocket/_websocket_async_request.js.map +1 -0
  111. package/esm/src/transports/websocket/websocket_transport.d.ts +7 -0
  112. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  113. package/esm/src/transports/websocket/websocket_transport.js +4 -0
  114. package/esm/src/transports/websocket/websocket_transport.js.map +1 -0
  115. package/package.json +15 -7
  116. package/script/bin/cli.d.ts +3 -0
  117. package/script/bin/cli.d.ts.map +1 -0
  118. package/script/bin/cli.js +490 -0
  119. package/script/bin/cli.js.map +1 -0
  120. package/{esm/src/errors.d.ts → script/src/_errors.d.ts} +1 -1
  121. package/script/src/_errors.d.ts.map +1 -0
  122. package/script/src/{errors.js → _errors.js} +1 -0
  123. package/script/src/_errors.js.map +1 -0
  124. package/script/src/clients/exchange.d.ts +4 -11
  125. package/script/src/clients/exchange.d.ts.map +1 -1
  126. package/script/src/clients/exchange.js +9 -10
  127. package/script/src/clients/exchange.js.map +1 -0
  128. package/script/src/clients/info.d.ts +86 -2
  129. package/script/src/clients/info.d.ts.map +1 -1
  130. package/script/src/clients/info.js +102 -0
  131. package/script/src/clients/info.js.map +1 -0
  132. package/script/src/clients/multiSign.d.ts +1 -1
  133. package/script/src/clients/multiSign.d.ts.map +1 -1
  134. package/script/src/clients/multiSign.js +3 -2
  135. package/script/src/clients/multiSign.js.map +1 -0
  136. package/script/src/clients/subscription.js +1 -0
  137. package/script/src/clients/subscription.js.map +1 -0
  138. package/script/src/mod.d.ts +21 -0
  139. package/script/src/mod.d.ts.map +1 -0
  140. package/script/{mod.js → src/mod.js} +13 -8
  141. package/script/src/mod.js.map +1 -0
  142. package/script/src/schemas/_base.d.ts +11 -3
  143. package/script/src/schemas/_base.d.ts.map +1 -1
  144. package/script/src/schemas/_base.js +31 -3
  145. package/script/src/schemas/_base.js.map +1 -0
  146. package/script/src/schemas/exchange/requests.d.ts +1872 -1872
  147. package/script/src/schemas/exchange/requests.d.ts.map +1 -1
  148. package/script/src/schemas/exchange/requests.js +276 -280
  149. package/script/src/schemas/exchange/requests.js.map +1 -0
  150. package/script/src/schemas/exchange/responses.d.ts +51 -51
  151. package/script/src/schemas/exchange/responses.js +54 -53
  152. package/script/src/schemas/exchange/responses.js.map +1 -0
  153. package/script/src/schemas/explorer/requests.d.ts +5 -5
  154. package/script/src/schemas/explorer/requests.js +5 -4
  155. package/script/src/schemas/explorer/requests.js.map +1 -0
  156. package/script/src/schemas/explorer/responses.d.ts +10 -10
  157. package/script/src/schemas/explorer/responses.js +11 -10
  158. package/script/src/schemas/explorer/responses.js.map +1 -0
  159. package/script/src/schemas/info/accounts.d.ts +1042 -296
  160. package/script/src/schemas/info/accounts.d.ts.map +1 -1
  161. package/script/src/schemas/info/accounts.js +154 -109
  162. package/script/src/schemas/info/accounts.js.map +1 -0
  163. package/script/src/schemas/info/assets.d.ts +130 -101
  164. package/script/src/schemas/info/assets.d.ts.map +1 -1
  165. package/script/src/schemas/info/assets.js +69 -49
  166. package/script/src/schemas/info/assets.js.map +1 -0
  167. package/script/src/schemas/info/markets.d.ts +35 -18
  168. package/script/src/schemas/info/markets.d.ts.map +1 -1
  169. package/script/src/schemas/info/markets.js +27 -15
  170. package/script/src/schemas/info/markets.js.map +1 -0
  171. package/script/src/schemas/info/orders.d.ts +151 -151
  172. package/script/src/schemas/info/orders.js +36 -35
  173. package/script/src/schemas/info/orders.js.map +1 -0
  174. package/script/src/schemas/info/requests.d.ts +145 -88
  175. package/script/src/schemas/info/requests.d.ts.map +1 -1
  176. package/script/src/schemas/info/requests.js +116 -73
  177. package/script/src/schemas/info/requests.js.map +1 -0
  178. package/script/src/schemas/info/validators.d.ts +60 -39
  179. package/script/src/schemas/info/validators.d.ts.map +1 -1
  180. package/script/src/schemas/info/validators.js +40 -26
  181. package/script/src/schemas/info/validators.js.map +1 -0
  182. package/script/src/schemas/info/vaults.d.ts +59 -59
  183. package/script/src/schemas/info/vaults.js +19 -18
  184. package/script/src/schemas/info/vaults.js.map +1 -0
  185. package/script/src/schemas/mod.d.ts +4 -3
  186. package/script/src/schemas/mod.d.ts.map +1 -1
  187. package/script/src/schemas/mod.js +8 -5
  188. package/script/src/schemas/mod.js.map +1 -0
  189. package/script/src/schemas/subscriptions/requests.d.ts +23 -23
  190. package/script/src/schemas/subscriptions/requests.d.ts.map +1 -1
  191. package/script/src/schemas/subscriptions/requests.js +24 -23
  192. package/script/src/schemas/subscriptions/requests.js.map +1 -0
  193. package/script/src/schemas/subscriptions/responses.d.ts +547 -547
  194. package/script/src/schemas/subscriptions/responses.js +40 -39
  195. package/script/src/schemas/subscriptions/responses.js.map +1 -0
  196. package/script/src/signing/mod.d.ts +1 -1
  197. package/script/src/signing/mod.d.ts.map +1 -1
  198. package/script/src/signing/mod.js +4 -3
  199. package/script/src/signing/mod.js.map +1 -0
  200. package/script/src/signing/signTypedData/ethers.d.ts.map +1 -0
  201. package/script/src/signing/{_signTypedData → signTypedData}/ethers.js +1 -0
  202. package/script/src/signing/signTypedData/ethers.js.map +1 -0
  203. package/script/src/signing/signTypedData/mod.d.ts.map +1 -0
  204. package/script/src/signing/{_signTypedData → signTypedData}/mod.js +1 -0
  205. package/script/src/signing/signTypedData/mod.js.map +1 -0
  206. package/script/src/signing/signTypedData/private_key.d.ts.map +1 -0
  207. package/script/src/signing/{_signTypedData → signTypedData}/private_key.js +17 -15
  208. package/script/src/signing/signTypedData/private_key.js.map +1 -0
  209. package/script/src/signing/signTypedData/viem.d.ts.map +1 -0
  210. package/script/src/signing/{_signTypedData → signTypedData}/viem.js +1 -0
  211. package/script/src/signing/signTypedData/viem.js.map +1 -0
  212. package/script/src/transports/base.d.ts +4 -4
  213. package/script/src/transports/base.d.ts.map +1 -1
  214. package/script/src/transports/base.js +4 -3
  215. package/script/src/transports/base.js.map +1 -0
  216. package/script/src/transports/http/http_transport.d.ts +1 -1
  217. package/script/src/transports/http/http_transport.js +1 -0
  218. package/script/src/transports/http/http_transport.js.map +1 -0
  219. package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -0
  220. package/script/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
  221. package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
  222. package/script/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
  223. package/script/src/transports/websocket/_websocket_async_request.js +1 -0
  224. package/script/src/transports/websocket/_websocket_async_request.js.map +1 -0
  225. package/script/src/transports/websocket/websocket_transport.d.ts +7 -0
  226. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  227. package/script/src/transports/websocket/websocket_transport.js +4 -0
  228. package/script/src/transports/websocket/websocket_transport.js.map +1 -0
  229. package/src/bin/cli.ts +481 -0
  230. package/src/src/_errors.ts +7 -0
  231. package/src/src/clients/exchange.ts +2246 -0
  232. package/src/src/clients/info.ts +2110 -0
  233. package/src/src/clients/multiSign.ts +183 -0
  234. package/src/src/clients/subscription.ts +841 -0
  235. package/src/src/mod.ts +29 -0
  236. package/src/src/schemas/_base.ts +82 -0
  237. package/src/src/schemas/exchange/requests.ts +3052 -0
  238. package/src/src/schemas/exchange/responses.ts +540 -0
  239. package/src/src/schemas/explorer/requests.ts +65 -0
  240. package/src/src/schemas/explorer/responses.ts +138 -0
  241. package/src/src/schemas/info/accounts.ts +1598 -0
  242. package/src/src/schemas/info/assets.ts +693 -0
  243. package/src/src/schemas/info/markets.ts +171 -0
  244. package/src/src/schemas/info/orders.ts +597 -0
  245. package/src/src/schemas/info/requests.ts +1401 -0
  246. package/src/src/schemas/info/validators.ts +297 -0
  247. package/src/src/schemas/info/vaults.ts +262 -0
  248. package/src/src/schemas/mod.ts +121 -0
  249. package/src/src/schemas/subscriptions/requests.ts +514 -0
  250. package/src/src/schemas/subscriptions/responses.ts +576 -0
  251. package/src/src/signing/mod.ts +572 -0
  252. package/src/src/signing/signTypedData/ethers.ts +59 -0
  253. package/src/src/signing/signTypedData/mod.ts +121 -0
  254. package/src/src/signing/signTypedData/private_key.ts +234 -0
  255. package/src/src/signing/signTypedData/viem.ts +55 -0
  256. package/src/src/transports/base.ts +54 -0
  257. package/src/src/transports/http/http_transport.ts +208 -0
  258. package/src/src/transports/websocket/_hyperliquid_event_target.ts +118 -0
  259. package/src/src/transports/websocket/_reconnecting_websocket.ts +404 -0
  260. package/src/src/transports/websocket/_websocket_async_request.ts +229 -0
  261. package/src/src/transports/websocket/websocket_transport.ts +394 -0
  262. package/esm/mod.d.ts +0 -20
  263. package/esm/mod.d.ts.map +0 -1
  264. package/esm/mod.js +0 -11
  265. package/esm/src/errors.d.ts.map +0 -1
  266. package/esm/src/signing/_signTypedData/ethers.d.ts.map +0 -1
  267. package/esm/src/signing/_signTypedData/mod.d.ts.map +0 -1
  268. package/esm/src/signing/_signTypedData/private_key.d.ts.map +0 -1
  269. package/esm/src/signing/_signTypedData/viem.d.ts.map +0 -1
  270. package/script/mod.d.ts +0 -20
  271. package/script/mod.d.ts.map +0 -1
  272. package/script/src/errors.d.ts.map +0 -1
  273. package/script/src/signing/_signTypedData/ethers.d.ts.map +0 -1
  274. package/script/src/signing/_signTypedData/mod.d.ts.map +0 -1
  275. package/script/src/signing/_signTypedData/private_key.d.ts.map +0 -1
  276. package/script/src/signing/_signTypedData/viem.d.ts.map +0 -1
  277. /package/esm/src/signing/{_signTypedData → signTypedData}/ethers.d.ts +0 -0
  278. /package/esm/src/signing/{_signTypedData → signTypedData}/mod.d.ts +0 -0
  279. /package/esm/src/signing/{_signTypedData → signTypedData}/private_key.d.ts +0 -0
  280. /package/esm/src/signing/{_signTypedData → signTypedData}/viem.d.ts +0 -0
  281. /package/script/src/signing/{_signTypedData → signTypedData}/ethers.d.ts +0 -0
  282. /package/script/src/signing/{_signTypedData → signTypedData}/mod.d.ts +0 -0
  283. /package/script/src/signing/{_signTypedData → signTypedData}/private_key.d.ts +0 -0
  284. /package/script/src/signing/{_signTypedData → signTypedData}/viem.d.ts +0 -0
@@ -0,0 +1,2110 @@
1
+ import type { IRequestTransport } from "../transports/base.js";
2
+ import {
3
+ type ActiveAssetData,
4
+ ActiveAssetDataRequest,
5
+ type AllMids,
6
+ AllMidsRequest,
7
+ type BlockDetails,
8
+ BlockDetailsRequest,
9
+ type BlockDetailsResponse,
10
+ type Book,
11
+ type Candle,
12
+ CandleSnapshotRequest,
13
+ ClearinghouseStateRequest,
14
+ type Delegation,
15
+ DelegationsRequest,
16
+ DelegatorHistoryRequest,
17
+ type DelegatorReward,
18
+ DelegatorRewardsRequest,
19
+ type DelegatorSummary,
20
+ DelegatorSummaryRequest,
21
+ type DelegatorUpdate,
22
+ type DeployAuctionStatus,
23
+ type ExchangeStatus,
24
+ ExchangeStatusRequest,
25
+ type ExtraAgent,
26
+ ExtraAgentsRequest,
27
+ type Fill,
28
+ FrontendOpenOrdersRequest,
29
+ type FrontendOrder,
30
+ type FrontendOrderStatus,
31
+ type FundingHistory,
32
+ FundingHistoryRequest,
33
+ type GossipRootIps,
34
+ GossipRootIpsRequest,
35
+ HistoricalOrdersRequest,
36
+ IsVipRequest,
37
+ L2BookRequest,
38
+ LeadingVaultsRequest,
39
+ type LegalCheck,
40
+ LegalCheckRequest,
41
+ LiquidatableRequest,
42
+ type MarginTable,
43
+ MarginTableRequest,
44
+ MaxBuilderFeeRequest,
45
+ MaxMarketOrderNtlsRequest,
46
+ MetaAndAssetCtxsRequest,
47
+ MetaRequest,
48
+ type MultiSigSigners,
49
+ OpenOrdersRequest,
50
+ type Order,
51
+ type OrderLookup,
52
+ OrderStatusRequest,
53
+ parser,
54
+ PerpDeployAuctionStatusRequest,
55
+ type PerpDex,
56
+ type PerpDexLimits,
57
+ PerpDexLimitsRequest,
58
+ PerpDexsRequest,
59
+ PerpsAtOpenInterestCapRequest,
60
+ type PerpsClearinghouseState,
61
+ type PerpsMeta,
62
+ type PerpsMetaAndAssetCtxs,
63
+ type PortfolioPeriods,
64
+ PortfolioRequest,
65
+ type PredictedFunding,
66
+ PredictedFundingsRequest,
67
+ type PreTransferCheck,
68
+ PreTransferCheckRequest,
69
+ RecentTradesRequest,
70
+ type Referral,
71
+ ReferralRequest,
72
+ type SpotClearinghouseState,
73
+ SpotClearinghouseStateRequest,
74
+ type SpotDeployState,
75
+ SpotDeployStateRequest,
76
+ type SpotMeta,
77
+ type SpotMetaAndAssetCtxs,
78
+ SpotMetaAndAssetCtxsRequest,
79
+ SpotMetaRequest,
80
+ SpotPairDeployAuctionStatusRequest,
81
+ type SubAccount,
82
+ SubAccountsRequest,
83
+ type TokenDetails,
84
+ TokenDetailsRequest,
85
+ type Trade,
86
+ type TwapHistory,
87
+ TwapHistoryRequest,
88
+ type TwapSliceFill,
89
+ type TxDetails,
90
+ TxDetailsRequest,
91
+ type TxDetailsResponse,
92
+ UserDetailsRequest,
93
+ type UserDetailsResponse,
94
+ type UserFees,
95
+ UserFeesRequest,
96
+ UserFillsByTimeRequest,
97
+ UserFillsRequest,
98
+ UserFundingRequest,
99
+ type UserFundingUpdate,
100
+ type UserNonFundingLedgerUpdate,
101
+ UserNonFundingLedgerUpdatesRequest,
102
+ type UserRateLimit,
103
+ UserRateLimitRequest,
104
+ type UserRole,
105
+ UserRoleRequest,
106
+ UserToMultiSigSignersRequest,
107
+ UserTwapSliceFillsByTimeRequest,
108
+ UserTwapSliceFillsRequest,
109
+ UserVaultEquitiesRequest,
110
+ type ValidatorL1Vote,
111
+ ValidatorL1VotesRequest,
112
+ ValidatorSummariesRequest,
113
+ type ValidatorSummary,
114
+ type VaultDetails,
115
+ VaultDetailsRequest,
116
+ type VaultEquity,
117
+ type VaultLeading,
118
+ VaultSummariesRequest,
119
+ type VaultSummary,
120
+ type WebData2,
121
+ WebData2Request,
122
+ } from "../schemas/mod.js";
123
+
124
+ /** @see https://github.com/microsoft/TypeScript/issues/13923#issuecomment-2191862501 */
125
+ type DeepImmutable<T> = {
126
+ readonly [K in keyof T]: DeepImmutable<T[K]>;
127
+ };
128
+
129
+ /** Parameters for the {@linkcode InfoClient} constructor. */
130
+ export interface InfoClientParameters<T extends IRequestTransport = IRequestTransport> {
131
+ /** The transport used to connect to the Hyperliquid API. */
132
+ transport: T;
133
+ }
134
+
135
+ /** Request parameters for the {@linkcode InfoClient.activeAssetData} method. */
136
+ export type ActiveAssetDataParameters = Omit<ActiveAssetDataRequest, "type">;
137
+ /** Request parameters for the {@linkcode InfoClient.allMids} method. */
138
+ export type AllMidsParameters = Omit<AllMidsRequest, "type">;
139
+ /** Request parameters for the {@linkcode InfoClient.blockDetails} method. */
140
+ export type BlockDetailsParameters = Omit<BlockDetailsRequest, "type">;
141
+ /** Request parameters for the {@linkcode InfoClient.candleSnapshot} method. */
142
+ export type CandleSnapshotParameters = CandleSnapshotRequest["req"];
143
+ /** Request parameters for the {@linkcode InfoClient.clearinghouseState} method. */
144
+ export type ClearinghouseStateParameters = Omit<ClearinghouseStateRequest, "type">;
145
+ /** Request parameters for the {@linkcode InfoClient.delegations} method. */
146
+ export type DelegationsParameters = Omit<DelegationsRequest, "type">;
147
+ /** Request parameters for the {@linkcode InfoClient.delegatorHistory} method. */
148
+ export type DelegatorHistoryParameters = Omit<DelegatorHistoryRequest, "type">;
149
+ /** Request parameters for the {@linkcode InfoClient.delegatorRewards} method. */
150
+ export type DelegatorRewardsParameters = Omit<DelegatorRewardsRequest, "type">;
151
+ /** Request parameters for the {@linkcode InfoClient.delegatorSummary} method. */
152
+ export type DelegatorSummaryParameters = Omit<DelegatorSummaryRequest, "type">;
153
+ /** Request parameters for the {@linkcode InfoClient.extraAgents} method. */
154
+ export type ExtraAgentsParameters = Omit<ExtraAgentsRequest, "type">;
155
+ /** Request parameters for the {@linkcode InfoClient.frontendOpenOrders} method. */
156
+ export type FrontendOpenOrdersParameters = Omit<FrontendOpenOrdersRequest, "type">;
157
+ /** Request parameters for the {@linkcode InfoClient.fundingHistory} method. */
158
+ export type FundingHistoryParameters = Omit<FundingHistoryRequest, "type">;
159
+ /** Request parameters for the {@linkcode InfoClient.historicalOrders} method. */
160
+ export type HistoricalOrdersParameters = Omit<HistoricalOrdersRequest, "type">;
161
+ /** Request parameters for the {@linkcode InfoClient.isVip} method. */
162
+ export type IsVipParameters = Omit<IsVipRequest, "type">;
163
+ /** Request parameters for the {@linkcode InfoClient.l2Book} method. */
164
+ export type L2BookParameters = Omit<L2BookRequest, "type">;
165
+ /** Request parameters for the {@linkcode InfoClient.leadingVaults} method. */
166
+ export type LeadingVaultsParameters = Omit<LeadingVaultsRequest, "type">;
167
+ /** Request parameters for the {@linkcode InfoClient.legalCheck} method. */
168
+ export type LegalCheckParameters = Omit<LegalCheckRequest, "type">;
169
+ /** Request parameters for the {@linkcode InfoClient.marginTable} method. */
170
+ export type MarginTableParameters = Omit<MarginTableRequest, "type">;
171
+ /** Request parameters for the {@linkcode InfoClient.maxBuilderFee} method. */
172
+ export type MaxBuilderFeeParameters = Omit<MaxBuilderFeeRequest, "type">;
173
+ /** Request parameters for the {@linkcode InfoClient.meta} method. */
174
+ export type MetaParameters = Omit<MetaRequest, "type">;
175
+ /** Request parameters for the {@linkcode InfoClient.metaAndAssetCtxs} method. */
176
+ export type MetaAndAssetCtxsParameters = Omit<MetaAndAssetCtxsRequest, "type">;
177
+ /** Request parameters for the {@linkcode InfoClient.openOrders} method. */
178
+ export type OpenOrdersParameters = Omit<OpenOrdersRequest, "type">;
179
+ /** Request parameters for the {@linkcode InfoClient.orderStatus} method. */
180
+ export type OrderStatusParameters = Omit<OrderStatusRequest, "type">;
181
+ /** Request parameters for the {@linkcode InfoClient.perpDexLimits} method. */
182
+ export type PerpDexLimitsParameters = Omit<PerpDexLimitsRequest, "type">;
183
+ /** Request parameters for the {@linkcode InfoClient.perpsAtOpenInterestCap} method. */
184
+ export type PerpsAtOpenInterestCapParameters = Omit<PerpsAtOpenInterestCapRequest, "type">;
185
+ /** Request parameters for the {@linkcode InfoClient.portfolio} method. */
186
+ export type PortfolioParameters = Omit<PortfolioRequest, "type">;
187
+ /** Request parameters for the {@linkcode InfoClient.preTransferCheck} method. */
188
+ export type PreTransferCheckParameters = Omit<PreTransferCheckRequest, "type">;
189
+ /** Request parameters for the {@linkcode InfoClient.recentTrades} method. */
190
+ export type RecentTradesParameters = Omit<RecentTradesRequest, "type">;
191
+ /** Request parameters for the {@linkcode InfoClient.referral} method. */
192
+ export type ReferralParameters = Omit<ReferralRequest, "type">;
193
+ /** Request parameters for the {@linkcode InfoClient.spotClearinghouseState} method. */
194
+ export type SpotClearinghouseStateParameters = Omit<SpotClearinghouseStateRequest, "type">;
195
+ /** Request parameters for the {@linkcode InfoClient.spotDeployState} method. */
196
+ export type SpotDeployStateParameters = Omit<SpotDeployStateRequest, "type">;
197
+ /** Request parameters for the {@linkcode InfoClient.subAccounts} method. */
198
+ export type SubAccountsParameters = Omit<SubAccountsRequest, "type">;
199
+ /** Request parameters for the {@linkcode InfoClient.tokenDetails} method. */
200
+ export type TokenDetailsParameters = Omit<TokenDetailsRequest, "type">;
201
+ /** Request parameters for the {@linkcode InfoClient.twapHistory} method. */
202
+ export type TwapHistoryParameters = Omit<TwapHistoryRequest, "type">;
203
+ /** Request parameters for the {@linkcode InfoClient.txDetails} method. */
204
+ export type TxDetailsParameters = Omit<TxDetailsRequest, "type">;
205
+ /** Request parameters for the {@linkcode InfoClient.userDetails} method. */
206
+ export type UserDetailsParameters = Omit<UserDetailsRequest, "type">;
207
+ /** Request parameters for the {@linkcode InfoClient.userFees} method. */
208
+ export type UserFeesParameters = Omit<UserFeesRequest, "type">;
209
+ /** Request parameters for the {@linkcode InfoClient.userFills} method. */
210
+ export type UserFillsParameters = Omit<UserFillsRequest, "type">;
211
+ /** Request parameters for the {@linkcode InfoClient.userFillsByTime} method. */
212
+ export type UserFillsByTimeParameters = Omit<UserFillsByTimeRequest, "type">;
213
+ /** Request parameters for the {@linkcode InfoClient.userFunding} method. */
214
+ export type UserFundingParameters = Omit<UserFundingRequest, "type">;
215
+ /** Request parameters for the {@linkcode InfoClient.userNonFundingLedgerUpdates} method. */
216
+ export type UserNonFundingLedgerUpdatesParameters = Omit<UserNonFundingLedgerUpdatesRequest, "type">;
217
+ /** Request parameters for the {@linkcode InfoClient.userRateLimit} method. */
218
+ export type UserRateLimitParameters = Omit<UserRateLimitRequest, "type">;
219
+ /** Request parameters for the {@linkcode InfoClient.userRole} method. */
220
+ export type UserRoleParameters = Omit<UserRoleRequest, "type">;
221
+ /** Request parameters for the {@linkcode InfoClient.userToMultiSigSigners} method. */
222
+ export type UserToMultiSigSignersParameters = Omit<UserToMultiSigSignersRequest, "type">;
223
+ /** Request parameters for the {@linkcode InfoClient.userTwapSliceFills} method. */
224
+ export type UserTwapSliceFillsParameters = Omit<UserTwapSliceFillsRequest, "type">;
225
+ /** Request parameters for the {@linkcode InfoClient.userTwapSliceFillsByTime} method. */
226
+ export type UserTwapSliceFillsByTimeParameters = Omit<UserTwapSliceFillsByTimeRequest, "type">;
227
+ /** Request parameters for the {@linkcode InfoClient.userVaultEquities} method. */
228
+ export type UserVaultEquitiesParameters = Omit<UserVaultEquitiesRequest, "type">;
229
+ /** Request parameters for the {@linkcode InfoClient.vaultDetails} method. */
230
+ export type VaultDetailsParameters = Omit<VaultDetailsRequest, "type">;
231
+ /** Request parameters for the {@linkcode InfoClient.webData2} method. */
232
+ export type WebData2Parameters = Omit<WebData2Request, "type">;
233
+
234
+ /**
235
+ * Info client for interacting with the Hyperliquid API.
236
+ * @typeParam T The type of transport used to connect to the Hyperliquid API.
237
+ */
238
+ export class InfoClient<
239
+ T extends IRequestTransport = IRequestTransport,
240
+ > implements InfoClientParameters<T>, AsyncDisposable {
241
+ transport: T;
242
+
243
+ /**
244
+ * Initialises a new instance.
245
+ * @param args - The arguments for initialisation.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * import * as hl from "@nktkas/hyperliquid";
250
+ *
251
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
252
+ * const infoClient = new hl.InfoClient({ transport });
253
+ * ```
254
+ */
255
+ constructor(args: InfoClientParameters<T>) {
256
+ this.transport = args.transport;
257
+ }
258
+
259
+ /**
260
+ * Request user active asset data.
261
+ * @param params - An optional request-specific parameters.
262
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
263
+ * @returns User active asset data.
264
+ *
265
+ * @throws {TransportError} When the transport layer throws an error.
266
+ *
267
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
268
+ * @example
269
+ * ```ts
270
+ * import * as hl from "@nktkas/hyperliquid";
271
+ *
272
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
273
+ * const infoClient = new hl.InfoClient({ transport });
274
+ *
275
+ * const data = await infoClient.activeAssetData({ user: "0x...", coin: "ETH" });
276
+ * ```
277
+ */
278
+ activeAssetData(
279
+ params: DeepImmutable<ActiveAssetDataParameters>,
280
+ signal?: AbortSignal,
281
+ ): Promise<ActiveAssetData> {
282
+ const request = parser(ActiveAssetDataRequest)({
283
+ type: "activeAssetData",
284
+ ...params,
285
+ });
286
+ return this.transport.request("info", request, signal);
287
+ }
288
+
289
+ /**
290
+ * Request mid coin prices.
291
+ * @param params - An optional request-specific parameters.
292
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
293
+ * @returns Mapping of coin symbols to mid prices.
294
+ *
295
+ * @throws {TransportError} When the transport layer throws an error.
296
+ *
297
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
298
+ * @example
299
+ * ```ts
300
+ * import * as hl from "@nktkas/hyperliquid";
301
+ *
302
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
303
+ * const infoClient = new hl.InfoClient({ transport });
304
+ *
305
+ * const data = await infoClient.allMids();
306
+ * ```
307
+ */
308
+ allMids(params?: DeepImmutable<AllMidsParameters>, signal?: AbortSignal): Promise<AllMids>;
309
+ allMids(signal?: AbortSignal): Promise<AllMids>;
310
+ allMids(
311
+ params_or_signal?: DeepImmutable<AllMidsParameters> | AbortSignal,
312
+ maybeSignal?: AbortSignal,
313
+ ): Promise<AllMids> {
314
+ const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
315
+ const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
316
+
317
+ const request = parser(AllMidsRequest)({
318
+ type: "allMids",
319
+ ...params,
320
+ });
321
+ return this.transport.request("info", request, signal);
322
+ }
323
+
324
+ /**
325
+ * Block details by block height.
326
+ * @param params - Request-specific parameters.
327
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
328
+ * @returns Block details.
329
+ *
330
+ * @throws {TransportError} When the transport layer throws an error.
331
+ *
332
+ * @see null
333
+ * @example
334
+ * ```ts
335
+ * import * as hl from "@nktkas/hyperliquid";
336
+ *
337
+ * const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
338
+ * const infoClient = new hl.InfoClient({ transport });
339
+ *
340
+ * const data = await infoClient.blockDetails({ height: 123 });
341
+ * ```
342
+ */
343
+ blockDetails(
344
+ // allow only those transports that support `explorer` requests
345
+ this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
346
+ params: DeepImmutable<BlockDetailsParameters>,
347
+ signal?: AbortSignal,
348
+ ): Promise<BlockDetails> {
349
+ const request = parser(BlockDetailsRequest)({
350
+ type: "blockDetails",
351
+ ...params,
352
+ });
353
+ return this.transport.request<BlockDetailsResponse>("explorer", request, signal)
354
+ .then(({ blockDetails }) => blockDetails);
355
+ }
356
+
357
+ /**
358
+ * Request candlestick snapshots.
359
+ * @param params - Request-specific parameters.
360
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
361
+ * @returns Array of candlestick data points.
362
+ *
363
+ * @throws {TransportError} When the transport layer throws an error.
364
+ *
365
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot
366
+ * @example
367
+ * ```ts
368
+ * import * as hl from "@nktkas/hyperliquid";
369
+ *
370
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
371
+ * const infoClient = new hl.InfoClient({ transport });
372
+ *
373
+ * const data = await infoClient.candleSnapshot({
374
+ * coin: "ETH",
375
+ * interval: "1h",
376
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
377
+ * });
378
+ * ```
379
+ */
380
+ candleSnapshot(
381
+ params: DeepImmutable<CandleSnapshotParameters>,
382
+ signal?: AbortSignal,
383
+ ): Promise<Candle[]> {
384
+ const request = parser(CandleSnapshotRequest)({
385
+ type: "candleSnapshot",
386
+ req: params,
387
+ });
388
+ return this.transport.request("info", request, signal);
389
+ }
390
+
391
+ /**
392
+ * Request clearinghouse state.
393
+ * @param params - Request-specific parameters.
394
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
395
+ * @returns Account summary for perpetual trading.
396
+ *
397
+ * @throws {TransportError} When the transport layer throws an error.
398
+ *
399
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
400
+ * @example
401
+ * ```ts
402
+ * import * as hl from "@nktkas/hyperliquid";
403
+ *
404
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
405
+ * const infoClient = new hl.InfoClient({ transport });
406
+ *
407
+ * const data = await infoClient.clearinghouseState({ user: "0x..." });
408
+ * ```
409
+ */
410
+ clearinghouseState(
411
+ params: DeepImmutable<ClearinghouseStateParameters>,
412
+ signal?: AbortSignal,
413
+ ): Promise<PerpsClearinghouseState> {
414
+ const request = parser(ClearinghouseStateRequest)({
415
+ type: "clearinghouseState",
416
+ ...params,
417
+ });
418
+ return this.transport.request("info", request, signal);
419
+ }
420
+
421
+ /**
422
+ * Request user staking delegations.
423
+ * @param params - Request-specific parameters.
424
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
425
+ * @returns Array of user's delegations to validators.
426
+ *
427
+ * @throws {TransportError} When the transport layer throws an error.
428
+ *
429
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-delegations
430
+ * @example
431
+ * ```ts
432
+ * import * as hl from "@nktkas/hyperliquid";
433
+ *
434
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
435
+ * const infoClient = new hl.InfoClient({ transport });
436
+ *
437
+ * const data = await infoClient.delegations({ user: "0x..." });
438
+ * ```
439
+ */
440
+ delegations(
441
+ params: DeepImmutable<DelegationsParameters>,
442
+ signal?: AbortSignal,
443
+ ): Promise<Delegation[]> {
444
+ const request = parser(DelegationsRequest)({
445
+ type: "delegations",
446
+ ...params,
447
+ });
448
+ return this.transport.request("info", request, signal);
449
+ }
450
+
451
+ /**
452
+ * Request user staking history.
453
+ * @param params - Request-specific parameters.
454
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
455
+ * @returns Array of user's staking updates.
456
+ *
457
+ * @throws {TransportError} When the transport layer throws an error.
458
+ *
459
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-history
460
+ * @example
461
+ * ```ts
462
+ * import * as hl from "@nktkas/hyperliquid";
463
+ *
464
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
465
+ * const infoClient = new hl.InfoClient({ transport });
466
+ *
467
+ * const data = await infoClient.delegatorHistory({ user: "0x..." });
468
+ * ```
469
+ */
470
+ delegatorHistory(
471
+ params: DeepImmutable<DelegatorHistoryParameters>,
472
+ signal?: AbortSignal,
473
+ ): Promise<DelegatorUpdate[]> {
474
+ const request = parser(DelegatorHistoryRequest)({
475
+ type: "delegatorHistory",
476
+ ...params,
477
+ });
478
+ return this.transport.request("info", request, signal);
479
+ }
480
+
481
+ /**
482
+ * Request user staking rewards.
483
+ * @param params - Request-specific parameters.
484
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
485
+ * @returns Array of user's staking rewards.
486
+ *
487
+ * @throws {TransportError} When the transport layer throws an error.
488
+ *
489
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-rewards
490
+ * @example
491
+ * ```ts
492
+ * import * as hl from "@nktkas/hyperliquid";
493
+ *
494
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
495
+ * const infoClient = new hl.InfoClient({ transport });
496
+ *
497
+ * const data = await infoClient.delegatorRewards({ user: "0x..." });
498
+ * ```
499
+ */
500
+ delegatorRewards(
501
+ params: DeepImmutable<DelegatorRewardsParameters>,
502
+ signal?: AbortSignal,
503
+ ): Promise<DelegatorReward[]> {
504
+ const request = parser(DelegatorRewardsRequest)({
505
+ type: "delegatorRewards",
506
+ ...params,
507
+ });
508
+ return this.transport.request("info", request, signal);
509
+ }
510
+
511
+ /**
512
+ * Request user staking summary.
513
+ * @param params - Request-specific parameters.
514
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
515
+ * @returns Summary of a user's staking delegations.
516
+ *
517
+ * @throws {TransportError} When the transport layer throws an error.
518
+ *
519
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary
520
+ * @example
521
+ * ```ts
522
+ * import * as hl from "@nktkas/hyperliquid";
523
+ *
524
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
525
+ * const infoClient = new hl.InfoClient({ transport });
526
+ *
527
+ * const data = await infoClient.delegatorSummary({ user: "0x..." });
528
+ * ```
529
+ */
530
+ delegatorSummary(
531
+ params: DeepImmutable<DelegatorSummaryParameters>,
532
+ signal?: AbortSignal,
533
+ ): Promise<DelegatorSummary> {
534
+ const request = parser(DelegatorSummaryRequest)({
535
+ type: "delegatorSummary",
536
+ ...params,
537
+ });
538
+ return this.transport.request("info", request, signal);
539
+ }
540
+
541
+ /**
542
+ * Request exchange status information.
543
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
544
+ * @returns Exchange system status information.
545
+ *
546
+ * @throws {TransportError} When the transport layer throws an error.
547
+ *
548
+ * @see null
549
+ * @example
550
+ * ```ts
551
+ * import * as hl from "@nktkas/hyperliquid";
552
+ *
553
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
554
+ * const infoClient = new hl.InfoClient({ transport });
555
+ *
556
+ * const data = await infoClient.exchangeStatus();
557
+ * ```
558
+ */
559
+ exchangeStatus(signal?: AbortSignal): Promise<ExchangeStatus> {
560
+ const request = parser(ExchangeStatusRequest)({
561
+ type: "exchangeStatus",
562
+ });
563
+ return this.transport.request("info", request, signal);
564
+ }
565
+
566
+ /**
567
+ * Request user's extra agents.
568
+ * @param params - Request-specific parameters.
569
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
570
+ * @returns User's extra agents.
571
+ *
572
+ * @throws {TransportError} When the transport layer throws an error.
573
+ *
574
+ * @see null
575
+ * @example
576
+ * ```ts
577
+ * import * as hl from "@nktkas/hyperliquid";
578
+ *
579
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
580
+ * const infoClient = new hl.InfoClient({ transport });
581
+ *
582
+ * const data = await infoClient.extraAgents({ user: "0x..." });
583
+ * ```
584
+ */
585
+ extraAgents(
586
+ params: DeepImmutable<ExtraAgentsParameters>,
587
+ signal?: AbortSignal,
588
+ ): Promise<ExtraAgent[]> {
589
+ const request = parser(ExtraAgentsRequest)({
590
+ type: "extraAgents",
591
+ ...params,
592
+ });
593
+ return this.transport.request("info", request, signal);
594
+ }
595
+
596
+ /**
597
+ * Request frontend open orders.
598
+ * @param params - Request-specific parameters.
599
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
600
+ * @returns Array of open orders with additional frontend information.
601
+ *
602
+ * @throws {TransportError} When the transport layer throws an error.
603
+ *
604
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info
605
+ * @example
606
+ * ```ts
607
+ * import * as hl from "@nktkas/hyperliquid";
608
+ *
609
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
610
+ * const infoClient = new hl.InfoClient({ transport });
611
+ *
612
+ * const data = await infoClient.frontendOpenOrders({ user: "0x..." });
613
+ * ```
614
+ */
615
+ frontendOpenOrders(
616
+ params: DeepImmutable<FrontendOpenOrdersParameters>,
617
+ signal?: AbortSignal,
618
+ ): Promise<FrontendOrder[]> {
619
+ const request = parser(FrontendOpenOrdersRequest)({
620
+ type: "frontendOpenOrders",
621
+ ...params,
622
+ });
623
+ return this.transport.request("info", request, signal);
624
+ }
625
+
626
+ /**
627
+ * Request funding history.
628
+ * @param params - Request-specific parameters.
629
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
630
+ * @returns Array of historical funding rate data for an asset.
631
+ *
632
+ * @throws {TransportError} When the transport layer throws an error.
633
+ *
634
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates
635
+ * @example
636
+ * ```ts
637
+ * import * as hl from "@nktkas/hyperliquid";
638
+ *
639
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
640
+ * const infoClient = new hl.InfoClient({ transport });
641
+ *
642
+ * const data = await infoClient.fundingHistory({
643
+ * coin: "ETH",
644
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
645
+ * });
646
+ * ```
647
+ */
648
+ fundingHistory(
649
+ params: DeepImmutable<FundingHistoryParameters>,
650
+ signal?: AbortSignal,
651
+ ): Promise<FundingHistory[]> {
652
+ const request = parser(FundingHistoryRequest)({
653
+ type: "fundingHistory",
654
+ ...params,
655
+ });
656
+ return this.transport.request("info", request, signal);
657
+ }
658
+
659
+ /**
660
+ * Request gossip root IPs.
661
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
662
+ * @returns Array of gossip root IPs.
663
+ *
664
+ * @throws {TransportError} When the transport layer throws an error.
665
+ *
666
+ * @see null
667
+ * @example
668
+ * ```ts
669
+ * import * as hl from "@nktkas/hyperliquid";
670
+ *
671
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
672
+ * const infoClient = new hl.InfoClient({ transport });
673
+ *
674
+ * const data = await infoClient.gossipRootIps();
675
+ * ```
676
+ */
677
+ gossipRootIps(
678
+ signal?: AbortSignal,
679
+ ): Promise<GossipRootIps> {
680
+ const request = parser(GossipRootIpsRequest)({
681
+ type: "gossipRootIps",
682
+ });
683
+ return this.transport.request("info", request, signal);
684
+ }
685
+
686
+ /**
687
+ * Request user's historical orders.
688
+ * @param params - Request-specific parameters.
689
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
690
+ * @returns Array of user's historical orders.
691
+ *
692
+ * @throws {TransportError} When the transport layer throws an error.
693
+ *
694
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders
695
+ * @example
696
+ * ```ts
697
+ * import * as hl from "@nktkas/hyperliquid";
698
+ *
699
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
700
+ * const infoClient = new hl.InfoClient({ transport });
701
+ *
702
+ * const data = await infoClient.historicalOrders({ user: "0x..." });
703
+ * ```
704
+ */
705
+ historicalOrders(
706
+ params: DeepImmutable<HistoricalOrdersParameters>,
707
+ signal?: AbortSignal,
708
+ ): Promise<FrontendOrderStatus[]> {
709
+ const request = parser(HistoricalOrdersRequest)({
710
+ type: "historicalOrders",
711
+ ...params,
712
+ });
713
+ return this.transport.request("info", request, signal);
714
+ }
715
+
716
+ /**
717
+ * Request to check if a user is a VIP.
718
+ * @param params - Request-specific parameters.
719
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
720
+ * @returns Boolean indicating user's VIP status.
721
+ *
722
+ * @throws {TransportError} When the transport layer throws an error.
723
+ *
724
+ * @see null
725
+ * @example
726
+ * ```ts
727
+ * import * as hl from "@nktkas/hyperliquid";
728
+ *
729
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
730
+ * const infoClient = new hl.InfoClient({ transport });
731
+ *
732
+ * const data = await infoClient.isVip({ user: "0x..." });
733
+ * ```
734
+ */
735
+ isVip(
736
+ params: DeepImmutable<IsVipParameters>,
737
+ signal?: AbortSignal,
738
+ ): Promise<boolean | null> {
739
+ const request = parser(IsVipRequest)({
740
+ type: "isVip",
741
+ ...params,
742
+ });
743
+ return this.transport.request("info", request, signal);
744
+ }
745
+
746
+ /**
747
+ * Request L2 order book.
748
+ * @param params - Request-specific parameters.
749
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
750
+ * @returns L2 order book snapshot.
751
+ *
752
+ * @throws {TransportError} When the transport layer throws an error.
753
+ *
754
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot
755
+ * @example
756
+ * ```ts
757
+ * import * as hl from "@nktkas/hyperliquid";
758
+ *
759
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
760
+ * const infoClient = new hl.InfoClient({ transport });
761
+ *
762
+ * const data = await infoClient.l2Book({ coin: "ETH", nSigFigs: 2 });
763
+ * ```
764
+ */
765
+ l2Book(
766
+ params: DeepImmutable<L2BookParameters>,
767
+ signal?: AbortSignal,
768
+ ): Promise<Book> {
769
+ const request = parser(L2BookRequest)({
770
+ type: "l2Book",
771
+ ...params,
772
+ });
773
+ return this.transport.request("info", request, signal);
774
+ }
775
+
776
+ /**
777
+ * Request leading vaults for a user.
778
+ * @param params - Request-specific parameters.
779
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
780
+ * @returns
781
+ *
782
+ * @throws {TransportError} When the transport layer throws an error.
783
+ *
784
+ * @see null
785
+ * @example
786
+ * ```ts
787
+ * import * as hl from "@nktkas/hyperliquid";
788
+ *
789
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
790
+ * const infoClient = new hl.InfoClient({ transport });
791
+ *
792
+ * const data = await infoClient.leadingVaults({ user: "0x..." });
793
+ * ```
794
+ */
795
+ leadingVaults(
796
+ params: DeepImmutable<LeadingVaultsParameters>,
797
+ signal?: AbortSignal,
798
+ ): Promise<VaultLeading[]> {
799
+ const request = parser(LeadingVaultsRequest)({
800
+ type: "leadingVaults",
801
+ ...params,
802
+ });
803
+ return this.transport.request("info", request, signal);
804
+ }
805
+
806
+ /**
807
+ * Request legal verification status of a user.
808
+ * @param params - Request-specific parameters.
809
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
810
+ * @returns Legal verification status for a user.
811
+ *
812
+ * @throws {TransportError} When the transport layer throws an error.
813
+ *
814
+ * @see null
815
+ * @example
816
+ * ```ts
817
+ * import * as hl from "@nktkas/hyperliquid";
818
+ *
819
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
820
+ * const infoClient = new hl.InfoClient({ transport });
821
+ *
822
+ * const data = await infoClient.legalCheck({ user: "0x..." });
823
+ * ```
824
+ */
825
+ legalCheck(
826
+ params: DeepImmutable<LegalCheckParameters>,
827
+ signal?: AbortSignal,
828
+ ): Promise<LegalCheck> {
829
+ const request = parser(LegalCheckRequest)({
830
+ type: "legalCheck",
831
+ ...params,
832
+ });
833
+ return this.transport.request("info", request, signal);
834
+ }
835
+
836
+ /**
837
+ * Request liquidatable.
838
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
839
+ * @returns
840
+ *
841
+ * @throws {TransportError} When the transport layer throws an error.
842
+ *
843
+ * @see null
844
+ * @example
845
+ * ```ts
846
+ * import * as hl from "@nktkas/hyperliquid";
847
+ *
848
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
849
+ * const infoClient = new hl.InfoClient({ transport });
850
+ *
851
+ * const data = await infoClient.liquidatable();
852
+ * ```
853
+ */
854
+ liquidatable(signal?: AbortSignal): Promise<unknown[]> {
855
+ const request = parser(LiquidatableRequest)({
856
+ type: "liquidatable",
857
+ });
858
+ return this.transport.request("info", request, signal);
859
+ }
860
+
861
+ /**
862
+ * Request margin table data.
863
+ * @param params - Request-specific parameters.
864
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
865
+ * @returns Margin requirements table with multiple tiers.
866
+ *
867
+ * @throws {TransportError} When the transport layer throws an error.
868
+ *
869
+ * @see null
870
+ * @example
871
+ * ```ts
872
+ * import * as hl from "@nktkas/hyperliquid";
873
+ *
874
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
875
+ * const infoClient = new hl.InfoClient({ transport });
876
+ *
877
+ * const data = await infoClient.marginTable({ id: 1 });
878
+ * ```
879
+ */
880
+ marginTable(
881
+ params: DeepImmutable<MarginTableParameters>,
882
+ signal?: AbortSignal,
883
+ ): Promise<MarginTable> {
884
+ const request = parser(MarginTableRequest)({
885
+ type: "marginTable",
886
+ ...params,
887
+ });
888
+ return this.transport.request("info", request, signal);
889
+ }
890
+
891
+ /**
892
+ * Request builder fee approval.
893
+ * @param params - Request-specific parameters.
894
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
895
+ * @returns Maximum builder fee approval.
896
+ *
897
+ * @throws {TransportError} When the transport layer throws an error.
898
+ *
899
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval
900
+ * @example
901
+ * ```ts
902
+ * import * as hl from "@nktkas/hyperliquid";
903
+ *
904
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
905
+ * const infoClient = new hl.InfoClient({ transport });
906
+ *
907
+ * const data = await infoClient.maxBuilderFee({ user: "0x...", builder: "0x..." });
908
+ * ```
909
+ */
910
+ maxBuilderFee(
911
+ params: DeepImmutable<MaxBuilderFeeParameters>,
912
+ signal?: AbortSignal,
913
+ ): Promise<number> {
914
+ const request = parser(MaxBuilderFeeRequest)({
915
+ type: "maxBuilderFee",
916
+ ...params,
917
+ });
918
+ return this.transport.request("info", request, signal);
919
+ }
920
+
921
+ /**
922
+ * Request maximum market order notionals.
923
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
924
+ * @returns
925
+ *
926
+ * @throws {TransportError} When the transport layer throws an error.
927
+ *
928
+ * @see null
929
+ * @example
930
+ * ```ts
931
+ * import * as hl from "@nktkas/hyperliquid";
932
+ *
933
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
934
+ * const infoClient = new hl.InfoClient({ transport });
935
+ *
936
+ * const data = await infoClient.maxMarketOrderNtls();
937
+ * ```
938
+ */
939
+ maxMarketOrderNtls(signal?: AbortSignal): Promise<[number, string][]> {
940
+ const request = parser(MaxMarketOrderNtlsRequest)({
941
+ type: "maxMarketOrderNtls",
942
+ });
943
+ return this.transport.request("info", request, signal);
944
+ }
945
+
946
+ /**
947
+ * Request trading metadata.
948
+ * @param params - An optional request-specific parameters.
949
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
950
+ * @returns Metadata for perpetual assets.
951
+ *
952
+ * @throws {TransportError} When the transport layer throws an error.
953
+ *
954
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
955
+ * @example
956
+ * ```ts
957
+ * import * as hl from "@nktkas/hyperliquid";
958
+ *
959
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
960
+ * const infoClient = new hl.InfoClient({ transport });
961
+ *
962
+ * const data = await infoClient.meta();
963
+ * ```
964
+ */
965
+ meta(params?: DeepImmutable<MetaParameters>, signal?: AbortSignal): Promise<PerpsMeta>;
966
+ meta(signal?: AbortSignal): Promise<PerpsMeta>;
967
+ meta(
968
+ params_or_signal?: DeepImmutable<MetaParameters> | AbortSignal,
969
+ maybeSignal?: AbortSignal,
970
+ ): Promise<PerpsMeta> {
971
+ const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
972
+ const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
973
+
974
+ const request = parser(MetaRequest)({
975
+ type: "meta",
976
+ ...params,
977
+ });
978
+ return this.transport.request("info", request, signal);
979
+ }
980
+
981
+ /**
982
+ * Request metadata and asset contexts.
983
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
984
+ * @returns Metadata and context for perpetual assets.
985
+ *
986
+ * @throws {TransportError} When the transport layer throws an error.
987
+ *
988
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
989
+ * @example
990
+ * ```ts
991
+ * import * as hl from "@nktkas/hyperliquid";
992
+ *
993
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
994
+ * const infoClient = new hl.InfoClient({ transport });
995
+ *
996
+ * const data = await infoClient.metaAndAssetCtxs();
997
+ * ```
998
+ */
999
+ metaAndAssetCtxs(
1000
+ params?: DeepImmutable<MetaAndAssetCtxsParameters>,
1001
+ signal?: AbortSignal,
1002
+ ): Promise<PerpsMetaAndAssetCtxs>;
1003
+ metaAndAssetCtxs(signal?: AbortSignal): Promise<PerpsMetaAndAssetCtxs>;
1004
+ metaAndAssetCtxs(
1005
+ params_or_signal?: DeepImmutable<MetaAndAssetCtxsParameters> | AbortSignal,
1006
+ maybeSignal?: AbortSignal,
1007
+ ): Promise<PerpsMetaAndAssetCtxs> {
1008
+ const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
1009
+ const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
1010
+
1011
+ const request = parser(MetaAndAssetCtxsRequest)({
1012
+ type: "metaAndAssetCtxs",
1013
+ ...params,
1014
+ });
1015
+ return this.transport.request("info", request, signal);
1016
+ }
1017
+
1018
+ /**
1019
+ * Request open orders.
1020
+ * @param params - Request-specific parameters.
1021
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1022
+ * @returns Array of open order.
1023
+ *
1024
+ * @throws {TransportError} When the transport layer throws an error.
1025
+ *
1026
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders
1027
+ * @example
1028
+ * ```ts
1029
+ * import * as hl from "@nktkas/hyperliquid";
1030
+ *
1031
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1032
+ * const infoClient = new hl.InfoClient({ transport });
1033
+ *
1034
+ * const data = await infoClient.openOrders({ user: "0x..." });
1035
+ * ```
1036
+ */
1037
+ openOrders(
1038
+ params: DeepImmutable<OpenOrdersParameters>,
1039
+ signal?: AbortSignal,
1040
+ ): Promise<Order[]> {
1041
+ const request = parser(OpenOrdersRequest)({
1042
+ type: "openOrders",
1043
+ ...params,
1044
+ });
1045
+ return this.transport.request("info", request, signal);
1046
+ }
1047
+
1048
+ /**
1049
+ * Request order status.
1050
+ * @param params - Request-specific parameters.
1051
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1052
+ * @returns Result of an order status lookup.
1053
+ *
1054
+ * @throws {TransportError} When the transport layer throws an error.
1055
+ *
1056
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
1057
+ * @example
1058
+ * ```ts
1059
+ * import * as hl from "@nktkas/hyperliquid";
1060
+ *
1061
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1062
+ * const infoClient = new hl.InfoClient({ transport });
1063
+ *
1064
+ * const data = await infoClient.orderStatus({ user: "0x...", oid: 12345 });
1065
+ * ```
1066
+ */
1067
+ orderStatus(
1068
+ params: DeepImmutable<OrderStatusParameters>,
1069
+ signal?: AbortSignal,
1070
+ ): Promise<OrderLookup> {
1071
+ const request = parser(OrderStatusRequest)({
1072
+ type: "orderStatus",
1073
+ ...params,
1074
+ });
1075
+ return this.transport.request("info", request, signal);
1076
+ }
1077
+
1078
+ /**
1079
+ * Request for the status of the perpetual deploy auction.
1080
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1081
+ * @returns Status of the perpetual deploy auction.
1082
+ *
1083
+ * @throws {TransportError} When the transport layer throws an error.
1084
+ *
1085
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-information-about-the-perp-deploy-auction
1086
+ * @example
1087
+ * ```ts
1088
+ * import * as hl from "@nktkas/hyperliquid";
1089
+ *
1090
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1091
+ * const infoClient = new hl.InfoClient({ transport });
1092
+ *
1093
+ * const data = await infoClient.perpDeployAuctionStatus();
1094
+ * ```
1095
+ */
1096
+ perpDeployAuctionStatus(signal?: AbortSignal): Promise<DeployAuctionStatus> {
1097
+ const request = parser(PerpDeployAuctionStatusRequest)({
1098
+ type: "perpDeployAuctionStatus",
1099
+ });
1100
+ return this.transport.request("info", request, signal);
1101
+ }
1102
+
1103
+ /**
1104
+ * Request builder deployed perpetual market limits.
1105
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1106
+ * @returns Status of the perpetual deploy auction.
1107
+ *
1108
+ * @throws {TransportError} When the transport layer throws an error.
1109
+ *
1110
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-builder-deployed-perp-market-limits
1111
+ * @example
1112
+ * ```ts
1113
+ * import * as hl from "@nktkas/hyperliquid";
1114
+ *
1115
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1116
+ * const infoClient = new hl.InfoClient({ transport });
1117
+ *
1118
+ * const data = await infoClient.perpDexLimits({ dex: "test" });
1119
+ * ```
1120
+ */
1121
+ perpDexLimits(
1122
+ params: DeepImmutable<PerpDexLimitsParameters>,
1123
+ signal?: AbortSignal,
1124
+ ): Promise<PerpDexLimits | null> {
1125
+ const request = parser(PerpDexLimitsRequest)({
1126
+ type: "perpDexLimits",
1127
+ ...params,
1128
+ });
1129
+ return this.transport.request("info", request, signal);
1130
+ }
1131
+
1132
+ /**
1133
+ * Request all perpetual dexs.
1134
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1135
+ * @returns Array of perpetual dexes (null is main dex).
1136
+ *
1137
+ * @throws {TransportError} When the transport layer throws an error.
1138
+ *
1139
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetual-dexs
1140
+ * @example
1141
+ * ```ts
1142
+ * import * as hl from "@nktkas/hyperliquid";
1143
+ *
1144
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1145
+ * const infoClient = new hl.InfoClient({ transport });
1146
+ *
1147
+ * const data = await infoClient.perpDexs();
1148
+ * ```
1149
+ */
1150
+ perpDexs(signal?: AbortSignal): Promise<(PerpDex | null)[]> {
1151
+ const request = parser(PerpDexsRequest)({
1152
+ type: "perpDexs",
1153
+ });
1154
+ return this.transport.request("info", request, signal);
1155
+ }
1156
+
1157
+ /**
1158
+ * Request perpetuals at open interest cap.
1159
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1160
+ * @returns Array of perpetuals at open interest caps.
1161
+ *
1162
+ * @throws {TransportError} When the transport layer throws an error.
1163
+ *
1164
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#query-perps-at-open-interest-caps
1165
+ * @example
1166
+ * ```ts
1167
+ * import * as hl from "@nktkas/hyperliquid";
1168
+ *
1169
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1170
+ * const infoClient = new hl.InfoClient({ transport });
1171
+ *
1172
+ * const data = await infoClient.perpsAtOpenInterestCap();
1173
+ * ```
1174
+ */
1175
+ perpsAtOpenInterestCap(
1176
+ params?: DeepImmutable<PerpsAtOpenInterestCapParameters>,
1177
+ signal?: AbortSignal,
1178
+ ): Promise<string[]>;
1179
+ perpsAtOpenInterestCap(signal?: AbortSignal): Promise<string[]>;
1180
+ perpsAtOpenInterestCap(
1181
+ params_or_signal?: DeepImmutable<PerpsAtOpenInterestCapParameters> | AbortSignal,
1182
+ maybeSignal?: AbortSignal,
1183
+ ): Promise<string[]> {
1184
+ const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
1185
+ const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
1186
+
1187
+ const request = parser(PerpsAtOpenInterestCapRequest)({
1188
+ type: "perpsAtOpenInterestCap",
1189
+ ...params,
1190
+ });
1191
+ return this.transport.request("info", request, signal);
1192
+ }
1193
+
1194
+ /**
1195
+ * Request user portfolio.
1196
+ * @param params - Request-specific parameters.
1197
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1198
+ * @returns Portfolio metrics grouped by time periods.
1199
+ *
1200
+ * @throws {TransportError} When the transport layer throws an error.
1201
+ *
1202
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-portfolio
1203
+ * @example
1204
+ * ```ts
1205
+ * import * as hl from "@nktkas/hyperliquid";
1206
+ *
1207
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1208
+ * const infoClient = new hl.InfoClient({ transport });
1209
+ *
1210
+ * const data = await infoClient.portfolio({ user: "0x..." });
1211
+ * ```
1212
+ */
1213
+ portfolio(
1214
+ params: DeepImmutable<PortfolioParameters>,
1215
+ signal?: AbortSignal,
1216
+ ): Promise<PortfolioPeriods> {
1217
+ const request = parser(PortfolioRequest)({
1218
+ type: "portfolio",
1219
+ ...params,
1220
+ });
1221
+ return this.transport.request("info", request, signal);
1222
+ }
1223
+
1224
+ /**
1225
+ * Request predicted funding rates.
1226
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1227
+ * @returns Array of predicted funding rates.
1228
+ *
1229
+ * @throws {TransportError} When the transport layer throws an error.
1230
+ *
1231
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-predicted-funding-rates-for-different-venues
1232
+ * @example
1233
+ * ```ts
1234
+ * import * as hl from "@nktkas/hyperliquid";
1235
+ *
1236
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1237
+ * const infoClient = new hl.InfoClient({ transport });
1238
+ *
1239
+ * const data = await infoClient.predictedFundings();
1240
+ * ```
1241
+ */
1242
+ predictedFundings(signal?: AbortSignal): Promise<PredictedFunding[]> {
1243
+ const request = parser(PredictedFundingsRequest)({
1244
+ type: "predictedFundings",
1245
+ });
1246
+ return this.transport.request("info", request, signal);
1247
+ }
1248
+
1249
+ /**
1250
+ * Request user's existence check before transfer.
1251
+ * @param params - Request-specific parameters.
1252
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1253
+ * @returns Pre-transfer user existence check result.
1254
+ *
1255
+ * @throws {TransportError} When the transport layer throws an error.
1256
+ *
1257
+ * @see null
1258
+ * @example
1259
+ * ```ts
1260
+ * import * as hl from "@nktkas/hyperliquid";
1261
+ *
1262
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1263
+ * const infoClient = new hl.InfoClient({ transport });
1264
+ *
1265
+ * const data = await infoClient.preTransferCheck({ user: "0x...", source: "0x..." });
1266
+ * ```
1267
+ */
1268
+ preTransferCheck(
1269
+ params: DeepImmutable<PreTransferCheckParameters>,
1270
+ signal?: AbortSignal,
1271
+ ): Promise<PreTransferCheck> {
1272
+ const request = parser(PreTransferCheckRequest)({
1273
+ type: "preTransferCheck",
1274
+ ...params,
1275
+ });
1276
+ return this.transport.request("info", request, signal);
1277
+ }
1278
+
1279
+ /**
1280
+ * Request recent trades.
1281
+ * @param params - Request-specific parameters.
1282
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1283
+ * @returns Array of recent trades.
1284
+ *
1285
+ * @throws {TransportError} When the transport layer throws an error.
1286
+ *
1287
+ * @see null
1288
+ * @example
1289
+ * ```ts
1290
+ * import * as hl from "@nktkas/hyperliquid";
1291
+ *
1292
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1293
+ * const infoClient = new hl.InfoClient({ transport });
1294
+ *
1295
+ * const data = await infoClient.recentTrades({ coin: "ETH" });
1296
+ * ```
1297
+ */
1298
+ recentTrades(
1299
+ params: DeepImmutable<RecentTradesParameters>,
1300
+ signal?: AbortSignal,
1301
+ ): Promise<Trade[]> {
1302
+ const request = parser(RecentTradesRequest)({
1303
+ type: "recentTrades",
1304
+ ...params,
1305
+ });
1306
+ return this.transport.request("info", request, signal);
1307
+ }
1308
+
1309
+ /**
1310
+ * Request user referral.
1311
+ * @param params - Request-specific parameters.
1312
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1313
+ * @returns Referral information for a user.
1314
+ *
1315
+ * @throws {TransportError} When the transport layer throws an error.
1316
+ *
1317
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-referral-information
1318
+ * @example
1319
+ * ```ts
1320
+ * import * as hl from "@nktkas/hyperliquid";
1321
+ *
1322
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1323
+ * const infoClient = new hl.InfoClient({ transport });
1324
+ *
1325
+ * const data = await infoClient.referral({ user: "0x..." });
1326
+ * ```
1327
+ */
1328
+ referral(
1329
+ params: DeepImmutable<ReferralParameters>,
1330
+ signal?: AbortSignal,
1331
+ ): Promise<Referral> {
1332
+ const request = parser(ReferralRequest)({
1333
+ type: "referral",
1334
+ ...params,
1335
+ });
1336
+ return this.transport.request("info", request, signal);
1337
+ }
1338
+
1339
+ /**
1340
+ * Request spot clearinghouse state.
1341
+ * @param params - Request-specific parameters.
1342
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1343
+ * @returns Account summary for spot trading.
1344
+ *
1345
+ * @throws {TransportError} When the transport layer throws an error.
1346
+ *
1347
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances
1348
+ * @example
1349
+ * ```ts
1350
+ * import * as hl from "@nktkas/hyperliquid";
1351
+ *
1352
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1353
+ * const infoClient = new hl.InfoClient({ transport });
1354
+ *
1355
+ * const data = await infoClient.spotClearinghouseState({ user: "0x..." });
1356
+ * ```
1357
+ */
1358
+ spotClearinghouseState(
1359
+ params: DeepImmutable<SpotClearinghouseStateParameters>,
1360
+ signal?: AbortSignal,
1361
+ ): Promise<SpotClearinghouseState> {
1362
+ const request = parser(SpotClearinghouseStateRequest)({
1363
+ type: "spotClearinghouseState",
1364
+ ...params,
1365
+ });
1366
+ return this.transport.request("info", request, signal);
1367
+ }
1368
+
1369
+ /**
1370
+ * Request spot deploy state.
1371
+ * @param params - Request-specific parameters.
1372
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1373
+ * @returns Deploy state for spot tokens.
1374
+ *
1375
+ * @throws {TransportError} When the transport layer throws an error.
1376
+ *
1377
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-deploy-auction
1378
+ * @example
1379
+ * ```ts
1380
+ * import * as hl from "@nktkas/hyperliquid";
1381
+ *
1382
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1383
+ * const infoClient = new hl.InfoClient({ transport });
1384
+ *
1385
+ * const data = await infoClient.spotDeployState({ user: "0x..." });
1386
+ * ```
1387
+ */
1388
+ spotDeployState(
1389
+ params: DeepImmutable<SpotDeployStateParameters>,
1390
+ signal?: AbortSignal,
1391
+ ): Promise<SpotDeployState> {
1392
+ const request = parser(SpotDeployStateRequest)({
1393
+ type: "spotDeployState",
1394
+ ...params,
1395
+ });
1396
+ return this.transport.request("info", request, signal);
1397
+ }
1398
+
1399
+ /**
1400
+ * Request spot trading metadata.
1401
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1402
+ * @returns Metadata for spot assets.
1403
+ *
1404
+ * @throws {TransportError} When the transport layer throws an error.
1405
+ *
1406
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-metadata
1407
+ * @example
1408
+ * ```ts
1409
+ * import * as hl from "@nktkas/hyperliquid";
1410
+ *
1411
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1412
+ * const infoClient = new hl.InfoClient({ transport });
1413
+ *
1414
+ * const data = await infoClient.spotMeta();
1415
+ * ```
1416
+ */
1417
+ spotMeta(signal?: AbortSignal): Promise<SpotMeta> {
1418
+ const request = parser(SpotMetaRequest)({
1419
+ type: "spotMeta",
1420
+ });
1421
+ return this.transport.request("info", request, signal);
1422
+ }
1423
+
1424
+ /**
1425
+ * Request spot metadata and asset contexts.
1426
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1427
+ * @returns Metadata and context for spot assets.
1428
+ *
1429
+ * @throws {TransportError} When the transport layer throws an error.
1430
+ *
1431
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
1432
+ * @example
1433
+ * ```ts
1434
+ * import * as hl from "@nktkas/hyperliquid";
1435
+ *
1436
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1437
+ * const infoClient = new hl.InfoClient({ transport });
1438
+ *
1439
+ * const data = await infoClient.spotMetaAndAssetCtxs();
1440
+ * ```
1441
+ */
1442
+ spotMetaAndAssetCtxs(signal?: AbortSignal): Promise<SpotMetaAndAssetCtxs> {
1443
+ const request = parser(SpotMetaAndAssetCtxsRequest)({
1444
+ type: "spotMetaAndAssetCtxs",
1445
+ });
1446
+ return this.transport.request("info", request, signal);
1447
+ }
1448
+
1449
+ /**
1450
+ * Request for the status of the spot deploy auction.
1451
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1452
+ * @returns Status of the spot deploy auction.
1453
+ *
1454
+ * @throws {TransportError} When the transport layer throws an error.
1455
+ *
1456
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-pair-deploy-auction
1457
+ * @example
1458
+ * ```ts
1459
+ * import * as hl from "@nktkas/hyperliquid";
1460
+ *
1461
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1462
+ * const infoClient = new hl.InfoClient({ transport });
1463
+ *
1464
+ * const data = await infoClient.spotPairDeployAuctionStatus();
1465
+ * ```
1466
+ */
1467
+ spotPairDeployAuctionStatus(signal?: AbortSignal): Promise<DeployAuctionStatus> {
1468
+ const request = parser(SpotPairDeployAuctionStatusRequest)({
1469
+ type: "spotPairDeployAuctionStatus",
1470
+ });
1471
+ return this.transport.request("info", request, signal);
1472
+ }
1473
+
1474
+ /**
1475
+ * Request user sub-accounts.
1476
+ * @param params - Request-specific parameters.
1477
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1478
+ * @returns Array of user sub-account or null if the user does not have any sub-accounts.
1479
+ *
1480
+ * @throws {TransportError} When the transport layer throws an error.
1481
+ *
1482
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-subaccounts
1483
+ * @example
1484
+ * ```ts
1485
+ * import * as hl from "@nktkas/hyperliquid";
1486
+ *
1487
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1488
+ * const infoClient = new hl.InfoClient({ transport });
1489
+ *
1490
+ * const data = await infoClient.subAccounts({ user: "0x..." });
1491
+ * ```
1492
+ */
1493
+ subAccounts(
1494
+ params: DeepImmutable<SubAccountsParameters>,
1495
+ signal?: AbortSignal,
1496
+ ): Promise<SubAccount[] | null> {
1497
+ const request = parser(SubAccountsRequest)({
1498
+ type: "subAccounts",
1499
+ ...params,
1500
+ });
1501
+ return this.transport.request("info", request, signal);
1502
+ }
1503
+
1504
+ /**
1505
+ * Request token details.
1506
+ * @param params - Request-specific parameters.
1507
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1508
+ * @returns Details of a token.
1509
+ *
1510
+ * @throws {TransportError} When the transport layer throws an error.
1511
+ *
1512
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-token
1513
+ * @example
1514
+ * ```ts
1515
+ * import * as hl from "@nktkas/hyperliquid";
1516
+ *
1517
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1518
+ * const infoClient = new hl.InfoClient({ transport });
1519
+ *
1520
+ * const data = await infoClient.tokenDetails({ tokenId: "0x..." });
1521
+ * ```
1522
+ */
1523
+ tokenDetails(
1524
+ params: DeepImmutable<TokenDetailsParameters>,
1525
+ signal?: AbortSignal,
1526
+ ): Promise<TokenDetails> {
1527
+ const request = parser(TokenDetailsRequest)({
1528
+ type: "tokenDetails",
1529
+ ...params,
1530
+ });
1531
+ return this.transport.request("info", request, signal);
1532
+ }
1533
+
1534
+ /**
1535
+ * Request twap history of a user.
1536
+ * @param params - Request-specific parameters.
1537
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1538
+ * @returns Array of user's TWAP history.
1539
+ *
1540
+ * @throws {TransportError} When the transport layer throws an error.
1541
+ *
1542
+ * @see null
1543
+ * @example
1544
+ * ```ts
1545
+ * import * as hl from "@nktkas/hyperliquid";
1546
+ *
1547
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1548
+ * const infoClient = new hl.InfoClient({ transport });
1549
+ *
1550
+ * const data = await infoClient.twapHistory({ user: "0x..." });
1551
+ * ```
1552
+ */
1553
+ twapHistory(
1554
+ params: DeepImmutable<TwapHistoryParameters>,
1555
+ signal?: AbortSignal,
1556
+ ): Promise<TwapHistory[]> {
1557
+ const request = parser(TwapHistoryRequest)({
1558
+ type: "twapHistory",
1559
+ ...params,
1560
+ });
1561
+ return this.transport.request("info", request, signal);
1562
+ }
1563
+
1564
+ /**
1565
+ * Request transaction details by transaction hash.
1566
+ * @param params - Request-specific parameters.
1567
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1568
+ * @returns Transaction details.
1569
+ *
1570
+ * @throws {TransportError} When the transport layer throws an error.
1571
+ *
1572
+ * @see null
1573
+ * @example
1574
+ * ```ts
1575
+ * import * as hl from "@nktkas/hyperliquid";
1576
+ *
1577
+ * const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
1578
+ * const infoClient = new hl.InfoClient({ transport });
1579
+ *
1580
+ * const data = await infoClient.txDetails({ hash: "0x..." });
1581
+ * ```
1582
+ */
1583
+ txDetails(
1584
+ // allow only those transports that support `explorer` requests
1585
+ this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
1586
+ params: DeepImmutable<TxDetailsParameters>,
1587
+ signal?: AbortSignal,
1588
+ ): Promise<TxDetails> {
1589
+ const request = parser(TxDetailsRequest)({
1590
+ type: "txDetails",
1591
+ ...params,
1592
+ });
1593
+ return this.transport.request<TxDetailsResponse>("explorer", request, signal)
1594
+ .then(({ tx }) => tx);
1595
+ }
1596
+
1597
+ /**
1598
+ * Request user details by user's address.
1599
+ * @param params - Request-specific parameters.
1600
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1601
+ * @returns User details.
1602
+ *
1603
+ * @throws {TransportError} When the transport layer throws an error.
1604
+ *
1605
+ * @see null
1606
+ * @example
1607
+ * ```ts
1608
+ * import * as hl from "@nktkas/hyperliquid";
1609
+ *
1610
+ * const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
1611
+ * const infoClient = new hl.InfoClient({ transport });
1612
+ *
1613
+ * const data = await infoClient.userDetails({ user: "0x..." });
1614
+ * ```
1615
+ */
1616
+ userDetails(
1617
+ // allow only those transports that support `explorer` requests
1618
+ this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
1619
+ params: DeepImmutable<UserDetailsParameters>,
1620
+ signal?: AbortSignal,
1621
+ ): Promise<TxDetails[]> {
1622
+ const request = parser(UserDetailsRequest)({
1623
+ type: "userDetails",
1624
+ ...params,
1625
+ });
1626
+ return this.transport.request<UserDetailsResponse>("explorer", request, signal)
1627
+ .then(({ txs }) => txs);
1628
+ }
1629
+
1630
+ /**
1631
+ * Request user fees.
1632
+ * @param params - Request-specific parameters.
1633
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1634
+ * @returns User fees.
1635
+ *
1636
+ * @throws {TransportError} When the transport layer throws an error.
1637
+ *
1638
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-fees
1639
+ * @example
1640
+ * ```ts
1641
+ * import * as hl from "@nktkas/hyperliquid";
1642
+ *
1643
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1644
+ * const infoClient = new hl.InfoClient({ transport });
1645
+ *
1646
+ * const data = await infoClient.userFees({ user: "0x..." });
1647
+ * ```
1648
+ */
1649
+ userFees(
1650
+ params: DeepImmutable<UserFeesParameters>,
1651
+ signal?: AbortSignal,
1652
+ ): Promise<UserFees> {
1653
+ const request = parser(UserFeesRequest)({
1654
+ type: "userFees",
1655
+ ...params,
1656
+ });
1657
+ return this.transport.request("info", request, signal);
1658
+ }
1659
+
1660
+ /**
1661
+ * Request user fills.
1662
+ * @param params - Request-specific parameters.
1663
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1664
+ * @returns Array of user's trade fill.
1665
+ *
1666
+ * @throws {TransportError} When the transport layer throws an error.
1667
+ *
1668
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
1669
+ * @example
1670
+ * ```ts
1671
+ * import * as hl from "@nktkas/hyperliquid";
1672
+ *
1673
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1674
+ * const infoClient = new hl.InfoClient({ transport });
1675
+ *
1676
+ * const data = await infoClient.userFills({ user: "0x..." });
1677
+ * ```
1678
+ */
1679
+ userFills(
1680
+ params: DeepImmutable<UserFillsParameters>,
1681
+ signal?: AbortSignal,
1682
+ ): Promise<Fill[]> {
1683
+ const request = parser(UserFillsRequest)({
1684
+ type: "userFills",
1685
+ ...params,
1686
+ });
1687
+ return this.transport.request("info", request, signal);
1688
+ }
1689
+
1690
+ /**
1691
+ * Request user fills by time.
1692
+ * @param params - Request-specific parameters.
1693
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1694
+ * @returns Array of user's trade fill.
1695
+ *
1696
+ * @throws {TransportError} When the transport layer throws an error.
1697
+ *
1698
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
1699
+ * @example
1700
+ * ```ts
1701
+ * import * as hl from "@nktkas/hyperliquid";
1702
+ *
1703
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1704
+ * const infoClient = new hl.InfoClient({ transport });
1705
+ *
1706
+ * const data = await infoClient.userFillsByTime({
1707
+ * user: "0x...",
1708
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
1709
+ * });
1710
+ * ```
1711
+ */
1712
+ userFillsByTime(
1713
+ params: DeepImmutable<UserFillsByTimeParameters>,
1714
+ signal?: AbortSignal,
1715
+ ): Promise<Fill[]> {
1716
+ const request = parser(UserFillsByTimeRequest)({
1717
+ type: "userFillsByTime",
1718
+ ...params,
1719
+ });
1720
+ return this.transport.request("info", request, signal);
1721
+ }
1722
+
1723
+ /**
1724
+ * Request user funding.
1725
+ * @param params - Request-specific parameters.
1726
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1727
+ * @returns Array of user's funding ledger update.
1728
+ *
1729
+ * @throws {TransportError} When the transport layer throws an error.
1730
+ *
1731
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
1732
+ * @example
1733
+ * ```ts
1734
+ * import * as hl from "@nktkas/hyperliquid";
1735
+ *
1736
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1737
+ * const infoClient = new hl.InfoClient({ transport });
1738
+ *
1739
+ * const data = await infoClient.userFunding({
1740
+ * user: "0x...",
1741
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
1742
+ * });
1743
+ * ```
1744
+ */
1745
+ userFunding(
1746
+ params: DeepImmutable<UserFundingParameters>,
1747
+ signal?: AbortSignal,
1748
+ ): Promise<UserFundingUpdate[]> {
1749
+ const request = parser(UserFundingRequest)({
1750
+ type: "userFunding",
1751
+ ...params,
1752
+ });
1753
+ return this.transport.request("info", request, signal);
1754
+ }
1755
+
1756
+ /**
1757
+ * Request user non-funding ledger updates.
1758
+ * @param params - Request-specific parameters.
1759
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1760
+ * @returns Array of user's non-funding ledger update.
1761
+ *
1762
+ * @throws {TransportError} When the transport layer throws an error.
1763
+ *
1764
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
1765
+ * @example
1766
+ * ```ts
1767
+ * import * as hl from "@nktkas/hyperliquid";
1768
+ *
1769
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1770
+ * const infoClient = new hl.InfoClient({ transport });
1771
+ *
1772
+ * const data = await infoClient.userNonFundingLedgerUpdates({
1773
+ * user: "0x...",
1774
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
1775
+ * });
1776
+ * ```
1777
+ */
1778
+ userNonFundingLedgerUpdates(
1779
+ params: DeepImmutable<UserNonFundingLedgerUpdatesParameters>,
1780
+ signal?: AbortSignal,
1781
+ ): Promise<UserNonFundingLedgerUpdate[]> {
1782
+ const request = parser(UserNonFundingLedgerUpdatesRequest)({
1783
+ type: "userNonFundingLedgerUpdates",
1784
+ ...params,
1785
+ });
1786
+ return this.transport.request("info", request, signal);
1787
+ }
1788
+
1789
+ /**
1790
+ * Request user rate limits.
1791
+ * @param params - Request-specific parameters.
1792
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1793
+ * @returns User's rate limits.
1794
+ *
1795
+ * @throws {TransportError} When the transport layer throws an error.
1796
+ *
1797
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits
1798
+ * @example
1799
+ * ```ts
1800
+ * import * as hl from "@nktkas/hyperliquid";
1801
+ *
1802
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1803
+ * const infoClient = new hl.InfoClient({ transport });
1804
+ *
1805
+ * const data = await infoClient.userRateLimit({ user: "0x..." });
1806
+ * ```
1807
+ */
1808
+ userRateLimit(
1809
+ params: DeepImmutable<UserRateLimitParameters>,
1810
+ signal?: AbortSignal,
1811
+ ): Promise<UserRateLimit> {
1812
+ const request = parser(UserRateLimitRequest)({
1813
+ type: "userRateLimit",
1814
+ ...params,
1815
+ });
1816
+ return this.transport.request("info", request, signal);
1817
+ }
1818
+
1819
+ /**
1820
+ * Request user role.
1821
+ * @param params - Request-specific parameters.
1822
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1823
+ * @returns User's role.
1824
+ *
1825
+ * @throws {TransportError} When the transport layer throws an error.
1826
+ *
1827
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-role
1828
+ * @example
1829
+ * ```ts
1830
+ * import * as hl from "@nktkas/hyperliquid";
1831
+ *
1832
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1833
+ * const infoClient = new hl.InfoClient({ transport });
1834
+ *
1835
+ * const data = await infoClient.userRole({ user: "0x..." });
1836
+ * ```
1837
+ */
1838
+ userRole(
1839
+ params: DeepImmutable<UserRoleParameters>,
1840
+ signal?: AbortSignal,
1841
+ ): Promise<UserRole> {
1842
+ const request = parser(UserRoleRequest)({
1843
+ type: "userRole",
1844
+ ...params,
1845
+ });
1846
+ return this.transport.request("info", request, signal);
1847
+ }
1848
+
1849
+ /**
1850
+ * Request multi-sig signers for a user.
1851
+ * @param params - Request-specific parameters.
1852
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1853
+ * @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
1854
+ *
1855
+ * @throws {TransportError} When the transport layer throws an error.
1856
+ *
1857
+ * @see null
1858
+ * @example
1859
+ * ```ts
1860
+ * import * as hl from "@nktkas/hyperliquid";
1861
+ *
1862
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1863
+ * const infoClient = new hl.InfoClient({ transport });
1864
+ *
1865
+ * const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
1866
+ * ```
1867
+ */
1868
+ userToMultiSigSigners(
1869
+ params: DeepImmutable<UserToMultiSigSignersParameters>,
1870
+ signal?: AbortSignal,
1871
+ ): Promise<MultiSigSigners | null> {
1872
+ const request = parser(UserToMultiSigSignersRequest)({
1873
+ type: "userToMultiSigSigners",
1874
+ ...params,
1875
+ });
1876
+ return this.transport.request("info", request, signal);
1877
+ }
1878
+
1879
+ /**
1880
+ * Request user twap slice fills.
1881
+ * @param params - Request-specific parameters.
1882
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1883
+ * @returns Array of user's twap slice fill.
1884
+ *
1885
+ * @throws {TransportError} When the transport layer throws an error.
1886
+ *
1887
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-twap-slice-fills
1888
+ * @example
1889
+ * ```ts
1890
+ * import * as hl from "@nktkas/hyperliquid";
1891
+ *
1892
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1893
+ * const infoClient = new hl.InfoClient({ transport });
1894
+ *
1895
+ * const data = await infoClient.userTwapSliceFills({ user: "0x..." });
1896
+ * ```
1897
+ */
1898
+ userTwapSliceFills(
1899
+ params: DeepImmutable<UserTwapSliceFillsParameters>,
1900
+ signal?: AbortSignal,
1901
+ ): Promise<TwapSliceFill[]> {
1902
+ const request = parser(UserTwapSliceFillsRequest)({
1903
+ type: "userTwapSliceFills",
1904
+ ...params,
1905
+ });
1906
+ return this.transport.request("info", request, signal);
1907
+ }
1908
+
1909
+ /**
1910
+ * Request user twap slice fills by time.
1911
+ * @param params - Request-specific parameters.
1912
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1913
+ * @returns Array of user's twap slice fill.
1914
+ *
1915
+ * @throws {TransportError} When the transport layer throws an error.
1916
+ *
1917
+ * @see null
1918
+ * @example
1919
+ * ```ts
1920
+ * import * as hl from "@nktkas/hyperliquid";
1921
+ *
1922
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1923
+ * const infoClient = new hl.InfoClient({ transport });
1924
+ *
1925
+ * const data = await infoClient.userTwapSliceFillsByTime({
1926
+ * user: "0x...",
1927
+ * startTime: Date.now() - 1000 * 60 * 60 * 24
1928
+ * });
1929
+ * ```
1930
+ */
1931
+ userTwapSliceFillsByTime(
1932
+ params: DeepImmutable<UserTwapSliceFillsByTimeParameters>,
1933
+ signal?: AbortSignal,
1934
+ ): Promise<TwapSliceFill[]> {
1935
+ const request = parser(UserTwapSliceFillsByTimeRequest)({
1936
+ type: "userTwapSliceFillsByTime",
1937
+ ...params,
1938
+ });
1939
+ return this.transport.request("info", request, signal);
1940
+ }
1941
+
1942
+ /**
1943
+ * Request user vault deposits.
1944
+ * @param params - Request-specific parameters.
1945
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1946
+ * @returns Array of user's vault deposits.
1947
+ *
1948
+ * @throws {TransportError} When the transport layer throws an error.
1949
+ *
1950
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-vault-deposits
1951
+ * @example
1952
+ * ```ts
1953
+ * import * as hl from "@nktkas/hyperliquid";
1954
+ *
1955
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1956
+ * const infoClient = new hl.InfoClient({ transport });
1957
+ *
1958
+ * const data = await infoClient.userVaultEquities({ user: "0x..." });
1959
+ * ```
1960
+ */
1961
+ userVaultEquities(
1962
+ params: DeepImmutable<UserVaultEquitiesParameters>,
1963
+ signal?: AbortSignal,
1964
+ ): Promise<VaultEquity[]> {
1965
+ const request = parser(UserVaultEquitiesRequest)({
1966
+ type: "userVaultEquities",
1967
+ ...params,
1968
+ });
1969
+ return this.transport.request("info", request, signal);
1970
+ }
1971
+
1972
+ /**
1973
+ * Request validator L1 votes.
1974
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
1975
+ * @returns
1976
+ *
1977
+ * @throws {TransportError} When the transport layer throws an error.
1978
+ *
1979
+ * @see null
1980
+ * @example
1981
+ * ```ts
1982
+ * import * as hl from "@nktkas/hyperliquid";
1983
+ *
1984
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1985
+ * const infoClient = new hl.InfoClient({ transport });
1986
+ *
1987
+ * const data = await infoClient.validatorL1Votes();
1988
+ * ```
1989
+ */
1990
+ validatorL1Votes(signal?: AbortSignal): Promise<ValidatorL1Vote[]> {
1991
+ const request = parser(ValidatorL1VotesRequest)({
1992
+ type: "validatorL1Votes",
1993
+ });
1994
+ return this.transport.request("info", request, signal);
1995
+ }
1996
+
1997
+ /**
1998
+ * Request validator summaries.
1999
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
2000
+ * @returns Array of validator summaries.
2001
+ *
2002
+ * @throws {TransportError} When the transport layer throws an error.
2003
+ *
2004
+ * @see null
2005
+ * @example
2006
+ * ```ts
2007
+ * import * as hl from "@nktkas/hyperliquid";
2008
+ *
2009
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
2010
+ * const infoClient = new hl.InfoClient({ transport });
2011
+ *
2012
+ * const data = await infoClient.validatorSummaries();
2013
+ * ```
2014
+ */
2015
+ validatorSummaries(signal?: AbortSignal): Promise<ValidatorSummary[]> {
2016
+ const request = parser(ValidatorSummariesRequest)({
2017
+ type: "validatorSummaries",
2018
+ });
2019
+ return this.transport.request("info", request, signal);
2020
+ }
2021
+
2022
+ /**
2023
+ * Request details of a vault.
2024
+ * @param params - Request-specific parameters.
2025
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
2026
+ * @returns Details of a vault or null if the vault does not exist.
2027
+ *
2028
+ * @throws {TransportError} When the transport layer throws an error.
2029
+ *
2030
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-details-for-a-vault
2031
+ * @example
2032
+ * ```ts
2033
+ * import * as hl from "@nktkas/hyperliquid";
2034
+ *
2035
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
2036
+ * const infoClient = new hl.InfoClient({ transport });
2037
+ *
2038
+ * const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
2039
+ * ```
2040
+ */
2041
+ vaultDetails(
2042
+ params: DeepImmutable<VaultDetailsParameters>,
2043
+ signal?: AbortSignal,
2044
+ ): Promise<VaultDetails | null> {
2045
+ const request = parser(VaultDetailsRequest)({
2046
+ type: "vaultDetails",
2047
+ ...params,
2048
+ });
2049
+ return this.transport.request("info", request, signal);
2050
+ }
2051
+
2052
+ /**
2053
+ * Request a list of vaults less than 2 hours old.
2054
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
2055
+ * @returns Array of vault summaries.
2056
+ *
2057
+ * @throws {TransportError} When the transport layer throws an error.
2058
+ *
2059
+ * @see null
2060
+ * @example
2061
+ * ```ts
2062
+ * import * as hl from "@nktkas/hyperliquid";
2063
+ *
2064
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
2065
+ * const infoClient = new hl.InfoClient({ transport });
2066
+ *
2067
+ * const data = await infoClient.vaultSummaries();
2068
+ * ```
2069
+ */
2070
+ vaultSummaries(signal?: AbortSignal): Promise<VaultSummary[]> {
2071
+ const request = parser(VaultSummariesRequest)({
2072
+ type: "vaultSummaries",
2073
+ });
2074
+ return this.transport.request("info", request, signal);
2075
+ }
2076
+
2077
+ /**
2078
+ * Request comprehensive user and market data.
2079
+ * @param params - Request-specific parameters.
2080
+ * @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
2081
+ * @returns Comprehensive user and market data.
2082
+ *
2083
+ * @throws {TransportError} When the transport layer throws an error.
2084
+ *
2085
+ * @see null
2086
+ * @example
2087
+ * ```ts
2088
+ * import * as hl from "@nktkas/hyperliquid";
2089
+ *
2090
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
2091
+ * const infoClient = new hl.InfoClient({ transport });
2092
+ *
2093
+ * const data = await infoClient.webData2({ user: "0x..." });
2094
+ * ```
2095
+ */
2096
+ webData2(
2097
+ params: DeepImmutable<WebData2Parameters>,
2098
+ signal?: AbortSignal,
2099
+ ): Promise<WebData2> {
2100
+ const request = parser(WebData2Request)({
2101
+ type: "webData2",
2102
+ ...params,
2103
+ });
2104
+ return this.transport.request("info", request, signal);
2105
+ }
2106
+
2107
+ async [Symbol.asyncDispose](): Promise<void> {
2108
+ await this.transport[Symbol.asyncDispose]?.();
2109
+ }
2110
+ }