@nktkas/hyperliquid 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +42 -17
  3. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  4. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  5. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.js +2 -0
  6. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  7. package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.js +1 -1
  9. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  10. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.js +2 -0
  12. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  13. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.js +1 -1
  14. package/{script/deps/jsr.io/@std/encoding/1.0.6 → esm/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  15. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/hex.js +1 -1
  17. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  18. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.js +2 -0
  20. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  21. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.js +2 -2
  23. package/esm/mod.d.ts +15 -14
  24. package/esm/mod.d.ts.map +1 -1
  25. package/esm/src/clients/event.d.ts +64 -21
  26. package/esm/src/clients/event.d.ts.map +1 -1
  27. package/esm/src/clients/event.js +76 -18
  28. package/esm/src/clients/public.d.ts +244 -52
  29. package/esm/src/clients/public.d.ts.map +1 -1
  30. package/esm/src/clients/public.js +243 -47
  31. package/esm/src/clients/wallet.d.ts +122 -53
  32. package/esm/src/clients/wallet.d.ts.map +1 -1
  33. package/esm/src/clients/wallet.js +201 -65
  34. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  35. package/esm/src/transports/http/http_transport.js +4 -1
  36. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
  37. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
  38. package/esm/src/transports/websocket/hyperliquid_event_target.js +37 -0
  39. package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
  40. package/esm/src/transports/websocket/websocket_request_dispatcher.js +4 -4
  41. package/esm/src/transports/websocket/websocket_transport.d.ts +7 -10
  42. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  43. package/esm/src/transports/websocket/websocket_transport.js +41 -35
  44. package/esm/src/types/common.d.ts +3 -0
  45. package/esm/src/types/common.d.ts.map +1 -0
  46. package/esm/src/types/common.js +1 -0
  47. package/esm/src/types/exchange/common.d.ts +36 -0
  48. package/esm/src/types/exchange/common.d.ts.map +1 -0
  49. package/esm/src/types/exchange/common.js +1 -0
  50. package/esm/src/types/exchange/requests.d.ts +502 -0
  51. package/esm/src/types/exchange/requests.d.ts.map +1 -0
  52. package/esm/src/types/exchange/requests.js +1 -0
  53. package/esm/src/types/exchange/responses.d.ts +141 -0
  54. package/esm/src/types/exchange/responses.d.ts.map +1 -0
  55. package/esm/src/types/exchange/responses.js +1 -0
  56. package/esm/src/types/explorer/common.d.ts +37 -0
  57. package/esm/src/types/explorer/common.d.ts.map +1 -0
  58. package/esm/src/types/explorer/common.js +1 -0
  59. package/esm/src/types/explorer/requests.d.ts +35 -0
  60. package/esm/src/types/explorer/requests.d.ts.map +1 -0
  61. package/esm/src/types/explorer/requests.js +1 -0
  62. package/esm/src/types/explorer/responses.d.ts +23 -0
  63. package/esm/src/types/explorer/responses.d.ts.map +1 -0
  64. package/esm/src/types/explorer/responses.js +1 -0
  65. package/esm/src/types/info/accounts.d.ts +489 -0
  66. package/esm/src/types/info/accounts.d.ts.map +1 -0
  67. package/esm/src/types/info/accounts.js +1 -0
  68. package/esm/src/types/info/assets.d.ts +275 -0
  69. package/esm/src/types/info/assets.d.ts.map +1 -0
  70. package/esm/src/types/info/assets.js +1 -0
  71. package/esm/src/types/info/delegations.d.ts +117 -0
  72. package/esm/src/types/info/delegations.d.ts.map +1 -0
  73. package/esm/src/types/info/delegations.js +1 -0
  74. package/esm/src/types/info/orders.d.ts +209 -0
  75. package/esm/src/types/info/orders.d.ts.map +1 -0
  76. package/esm/src/types/info/orders.js +1 -0
  77. package/esm/src/types/info/requests.d.ts +445 -0
  78. package/esm/src/types/info/requests.d.ts.map +1 -0
  79. package/esm/src/types/info/requests.js +1 -0
  80. package/esm/src/types/info/vaults.d.ts +90 -0
  81. package/esm/src/types/info/vaults.d.ts.map +1 -0
  82. package/esm/src/types/info/vaults.js +1 -0
  83. package/esm/src/types/subscriptions/common.d.ts +208 -0
  84. package/esm/src/types/subscriptions/common.d.ts.map +1 -0
  85. package/esm/src/types/subscriptions/common.js +1 -0
  86. package/esm/src/types/subscriptions/requests.d.ts +134 -0
  87. package/esm/src/types/subscriptions/requests.d.ts.map +1 -0
  88. package/esm/src/types/subscriptions/requests.js +1 -0
  89. package/esm/src/utils/key_sort.d.ts +3 -3
  90. package/esm/src/utils/key_sort.d.ts.map +1 -1
  91. package/esm/src/utils/signing.d.ts +1 -1
  92. package/esm/src/utils/signing.js +2 -2
  93. package/package.json +2 -2
  94. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +13 -3
  95. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +23 -13
  96. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +55 -45
  97. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +97 -87
  98. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +14 -4
  99. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +288 -278
  100. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +238 -228
  101. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  102. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  103. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.js +13 -0
  104. package/script/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  105. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.js +45 -0
  107. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  108. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  109. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.js +13 -0
  110. package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  111. package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +39 -0
  112. package/{esm/deps/jsr.io/@std/encoding/1.0.6 → script/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  113. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  114. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +123 -0
  115. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  116. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  117. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.js +13 -0
  118. package/script/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  119. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  120. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.js +250 -0
  121. package/script/mod.d.ts +15 -14
  122. package/script/mod.d.ts.map +1 -1
  123. package/script/mod.js +23 -13
  124. package/script/src/clients/event.d.ts +64 -21
  125. package/script/src/clients/event.d.ts.map +1 -1
  126. package/script/src/clients/event.js +551 -483
  127. package/script/src/clients/public.d.ts +244 -52
  128. package/script/src/clients/public.d.ts.map +1 -1
  129. package/script/src/clients/public.js +914 -708
  130. package/script/src/clients/wallet.d.ts +122 -53
  131. package/script/src/clients/wallet.d.ts.map +1 -1
  132. package/script/src/clients/wallet.js +1121 -975
  133. package/script/src/transports/base.js +25 -15
  134. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  135. package/script/src/transports/http/http_transport.js +174 -161
  136. package/script/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
  137. package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
  138. package/script/src/transports/websocket/hyperliquid_event_target.js +80 -33
  139. package/script/src/transports/websocket/reconnecting_websocket.js +364 -354
  140. package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
  141. package/script/src/transports/websocket/websocket_request_dispatcher.js +196 -186
  142. package/script/src/transports/websocket/websocket_transport.d.ts +7 -10
  143. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  144. package/script/src/transports/websocket/websocket_transport.js +236 -220
  145. package/script/src/types/common.d.ts +3 -0
  146. package/script/src/types/common.d.ts.map +1 -0
  147. package/script/src/types/common.js +12 -0
  148. package/script/src/types/exchange/common.d.ts +36 -0
  149. package/script/src/types/exchange/common.d.ts.map +1 -0
  150. package/script/src/types/exchange/common.js +12 -0
  151. package/script/src/types/exchange/requests.d.ts +502 -0
  152. package/script/src/types/exchange/requests.d.ts.map +1 -0
  153. package/script/src/types/exchange/requests.js +12 -0
  154. package/script/src/types/exchange/responses.d.ts +141 -0
  155. package/script/src/types/exchange/responses.d.ts.map +1 -0
  156. package/script/src/types/exchange/responses.js +12 -0
  157. package/script/src/types/explorer/common.d.ts +37 -0
  158. package/script/src/types/explorer/common.d.ts.map +1 -0
  159. package/script/src/types/explorer/common.js +12 -0
  160. package/script/src/types/explorer/requests.d.ts +35 -0
  161. package/script/src/types/explorer/requests.d.ts.map +1 -0
  162. package/script/src/types/explorer/requests.js +12 -0
  163. package/script/src/types/explorer/responses.d.ts +23 -0
  164. package/script/src/types/explorer/responses.d.ts.map +1 -0
  165. package/script/src/types/explorer/responses.js +12 -0
  166. package/script/src/types/info/accounts.d.ts +489 -0
  167. package/script/src/types/info/accounts.d.ts.map +1 -0
  168. package/script/src/types/info/accounts.js +12 -0
  169. package/script/src/types/info/assets.d.ts +275 -0
  170. package/script/src/types/info/assets.d.ts.map +1 -0
  171. package/script/src/types/info/assets.js +12 -0
  172. package/script/src/types/info/delegations.d.ts +117 -0
  173. package/script/src/types/info/delegations.d.ts.map +1 -0
  174. package/script/src/types/info/delegations.js +12 -0
  175. package/script/src/types/info/orders.d.ts +209 -0
  176. package/script/src/types/info/orders.d.ts.map +1 -0
  177. package/script/src/types/info/orders.js +12 -0
  178. package/script/src/types/info/requests.d.ts +445 -0
  179. package/script/src/types/info/requests.d.ts.map +1 -0
  180. package/script/src/types/info/requests.js +12 -0
  181. package/script/src/types/info/vaults.d.ts +90 -0
  182. package/script/src/types/info/vaults.d.ts.map +1 -0
  183. package/script/src/types/info/vaults.js +12 -0
  184. package/script/src/types/subscriptions/common.d.ts +208 -0
  185. package/script/src/types/subscriptions/common.d.ts.map +1 -0
  186. package/script/src/types/subscriptions/common.js +12 -0
  187. package/script/src/types/subscriptions/requests.d.ts +134 -0
  188. package/script/src/types/subscriptions/requests.d.ts.map +1 -0
  189. package/script/src/types/subscriptions/requests.js +12 -0
  190. package/script/src/utils/key_sort.d.ts +3 -3
  191. package/script/src/utils/key_sort.d.ts.map +1 -1
  192. package/script/src/utils/key_sort.js +133 -123
  193. package/script/src/utils/signing.d.ts +1 -1
  194. package/script/src/utils/signing.js +172 -162
  195. package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  196. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  197. package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  198. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  199. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.js +0 -35
  200. package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +0 -29
  201. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  202. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.js +0 -113
  203. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  204. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.js +0 -240
  205. /package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
  206. /package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
@@ -0,0 +1,208 @@
1
+ import type { Hex } from "../common.js";
2
+ import type { BlockDetails } from "../explorer/common.js";
3
+ import type { FundingUpdate, PerpsClearinghouseState, SpotClearinghouseState, UserFundingUpdate, UserNonFundingLedgerUpdate } from "../info/accounts.js";
4
+ import type { AllMids, PerpsAssetCtx, PerpsMeta, SpotAssetCtx } from "../info/assets.js";
5
+ import type { Fill, FrontendOrder, Order, OrderProcessingStatus, TwapHistory, TwapSliceFill, TwapState } from "../info/orders.js";
6
+ /** WebSocket message containing active perpetual asset context. */
7
+ export interface WsActiveAssetCtx {
8
+ /** Asset symbol. */
9
+ coin: string;
10
+ /** Context information for the perpetual asset. */
11
+ ctx: PerpsAssetCtx;
12
+ }
13
+ /** WebSocket message containing active asset trading data. */
14
+ export interface WsActiveAssetData {
15
+ /** Available to trade range [min, max]. */
16
+ availableToTrade: [string, string];
17
+ /** Asset symbol. */
18
+ coin: string;
19
+ /** Leverage configuration. */
20
+ leverage: {
21
+ /** Leverage type. */
22
+ type: "isolated";
23
+ /** Leverage value used. */
24
+ value: number;
25
+ /** Amount of raw USD used. */
26
+ rawUsd: string;
27
+ } | {
28
+ /** Leverage type. */
29
+ type: "cross";
30
+ /** Leverage value used. */
31
+ value: number;
32
+ };
33
+ /** Maximum trade size range [min, max]. */
34
+ maxTradeSzs: [string, string];
35
+ /** User's address. */
36
+ user: Hex;
37
+ }
38
+ /** WebSocket message containing active spot asset context. */
39
+ export interface WsActiveSpotAssetCtx {
40
+ /** Asset symbol. */
41
+ coin: string;
42
+ /** Context information for the spot asset. */
43
+ ctx: SpotAssetCtx;
44
+ }
45
+ /** WebSocket message containing mid prices for all assets. */
46
+ export interface WsAllMids {
47
+ /** Mid prices for all assets. */
48
+ mids: AllMids;
49
+ }
50
+ /** WebSocket message containing block details. */
51
+ export type WsBlockDetails = Omit<BlockDetails, "txs">;
52
+ /** WebSocket message containing user notifications. */
53
+ export interface WsNotification {
54
+ /** Notification content. */
55
+ notification: string;
56
+ }
57
+ /** WebSocket message containing order information. */
58
+ export interface WsOrder {
59
+ /** Order details. */
60
+ order: Order;
61
+ /** Order processing status. */
62
+ status: OrderProcessingStatus;
63
+ /** Status timestamp (in ms since epoch). */
64
+ statusTimestamp: number;
65
+ }
66
+ /** WebSocket message containing trade information. */
67
+ export interface WsTrade {
68
+ /** Asset symbol. */
69
+ coin: string;
70
+ /** Transaction hash. */
71
+ hash: string;
72
+ /** Trade price. */
73
+ px: string;
74
+ /** Trade side. */
75
+ side: string;
76
+ /** Trade size. */
77
+ sz: string;
78
+ /** Trade ID. */
79
+ tid: number;
80
+ /** Trade timestamp (in ms since epoch). */
81
+ time: number;
82
+ /** Addresses of users involved in the trade. */
83
+ users: [Hex, Hex];
84
+ }
85
+ /** WebSocket message containing user event. */
86
+ export type WsUserEvent = WsUserEventFill | WsUserEventFunding | WsUserEventLiquidation | WsUserEventNonUserCancel;
87
+ /** WebSocket message containing fill event information. */
88
+ export interface WsUserEventFill {
89
+ /** Array of trade fills. */
90
+ fills: Fill[];
91
+ }
92
+ /** WebSocket message containing funding event information. */
93
+ export interface WsUserEventFunding {
94
+ /** Funding update details. */
95
+ funding: Omit<FundingUpdate, "type">;
96
+ }
97
+ /** WebSocket message containing liquidation event information. */
98
+ export interface WsUserEventLiquidation {
99
+ /** Liquidation event details. */
100
+ liquidation: {
101
+ /** Unique liquidation ID. */
102
+ lid: number;
103
+ /** Address of the liquidator. */
104
+ liquidator: Hex;
105
+ /** Address of the liquidated user. */
106
+ liquidated_user: Hex;
107
+ /** Notional position size that was liquidated. */
108
+ liquidated_ntl_pos: string;
109
+ /** Account value at time of liquidation. */
110
+ liquidated_account_value: string;
111
+ };
112
+ }
113
+ /** WebSocket message containing non-user initiated order cancellation information. */
114
+ export interface WsUserEventNonUserCancel {
115
+ /** Array of cancelled orders not initiated by the user. */
116
+ nonUserCancel: {
117
+ /** Asset symbol. */
118
+ coin: string;
119
+ /** Order ID. */
120
+ oid: number;
121
+ }[];
122
+ }
123
+ /** WebSocket message containing user's fills. */
124
+ export interface WsUserFills {
125
+ /** User's address. */
126
+ user: Hex;
127
+ /** Array of fill events. */
128
+ fills: Fill[];
129
+ /** Whether this is an initial snapshot. */
130
+ isSnapshot?: true;
131
+ }
132
+ /** WebSocket message containing user's fundings. */
133
+ export interface WsUserFundings {
134
+ /** User's address. */
135
+ user: Hex;
136
+ /** Array of funding events. */
137
+ fundings: (Omit<FundingUpdate, "type"> & Pick<UserFundingUpdate, "time">)[];
138
+ /** Whether this is an initial snapshot. */
139
+ isSnapshot?: true;
140
+ }
141
+ /** WebSocket message containing user's non-funding ledger updates. */
142
+ export interface WsUserNonFundingLedgerUpdates {
143
+ /** User's address. */
144
+ user: Hex;
145
+ /** Array of non-funding ledger updates. */
146
+ nonFundingLedgerUpdates: UserNonFundingLedgerUpdate[];
147
+ /** Whether this is an initial snapshot. */
148
+ isSnapshot?: true;
149
+ }
150
+ /** WebSocket message containing user's TWAP history. */
151
+ export interface WsUserTwapHistory {
152
+ /** User's address. */
153
+ user: Hex;
154
+ /** Array of historical TWAP fills. */
155
+ history: TwapHistory[];
156
+ /** Whether this is an initial snapshot. */
157
+ isSnapshot?: true;
158
+ }
159
+ /** WebSocket message containing user's TWAP slice fills. */
160
+ export interface WsUserTwapSliceFills {
161
+ /** User's address. */
162
+ user: Hex;
163
+ /** Array of TWAP slice fills. */
164
+ twapSliceFills: TwapSliceFill[];
165
+ /** Whether this is an initial snapshot. */
166
+ isSnapshot?: true;
167
+ }
168
+ /** WebSocket message containing comprehensive user and market data. */
169
+ export interface WsWebData2 {
170
+ /** Account summary for perpetual trading. */
171
+ clearinghouseState: PerpsClearinghouseState;
172
+ /** Leading vaults information. */
173
+ leadingVaults: {
174
+ /** Address of the vault. */
175
+ address: Hex;
176
+ /** Name of the vault. */
177
+ name: string;
178
+ }[];
179
+ /** Total equity in vaults. */
180
+ totalVaultEquity: string;
181
+ /** User's open orders with frontend information. */
182
+ openOrders: FrontendOrder[];
183
+ /** Agent's address if one exists. */
184
+ agentAddress: Hex | null;
185
+ /** Timestamp until which the agent is valid. */
186
+ agentValidUntil: number | null;
187
+ /** Cumulative ledger value. */
188
+ cumLedger: string;
189
+ /** Metadata for perpetual assets. */
190
+ meta: PerpsMeta;
191
+ /** Context information for perpetual assets. */
192
+ assetCtxs: PerpsAssetCtx[];
193
+ /** Server timestamp (in ms since epoch). */
194
+ serverTime: number;
195
+ /** Whether this account is a vault. */
196
+ isVault: boolean;
197
+ /** User's address. */
198
+ user: Hex;
199
+ /** TWAP states. */
200
+ twapStates: [number, TwapState][];
201
+ /** Account summary for spot trading. */
202
+ spotState: SpotClearinghouseState;
203
+ /** Context information for spot assets. */
204
+ spotAssetCtxs: SpotAssetCtx[];
205
+ /** Assets currently at their open interest cap. */
206
+ perpsAtOpenInterestCap?: string[];
207
+ }
208
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACR,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EACR,IAAI,EACJ,aAAa,EACb,KAAK,EACL,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,SAAS,EACZ,MAAM,mBAAmB,CAAC;AAE3B,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC7B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,GAAG,EAAE,aAAa,CAAC;CACtB;AAED,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAC9B,2CAA2C;IAC3C,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,QAAQ,EACF;QACE,qBAAqB;QACrB,IAAI,EAAE,UAAU,CAAC;QACjB,2BAA2B;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,8BAA8B;QAC9B,MAAM,EAAE,MAAM,CAAC;KAClB,GACC;QACE,qBAAqB;QACrB,IAAI,EAAE,OAAO,C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CAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,mBAAmB;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IAClC,wCAAwC;IACxC,SAAS,EAAE,sBAAsB,CAAC;IAClC,2CAA2C;IAC3C,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,134 @@
1
+ import type { Hex } from "../common.js";
2
+ /** Subscribe to context updates for a specific perpetual asset. */
3
+ export interface WsActiveAssetCtxRequest {
4
+ /** Type of subscription. */
5
+ type: "activeAssetCtx";
6
+ /** Asset symbol. */
7
+ coin: string;
8
+ }
9
+ /** Subscribe to trading data updates for a specific asset and user. */
10
+ export interface WsActiveAssetDataRequest {
11
+ /** Type of subscription. */
12
+ type: "activeAssetData";
13
+ /** Asset symbol. */
14
+ coin: string;
15
+ /** User's address. */
16
+ user: Hex;
17
+ }
18
+ /** Subscribe to mid prices for all actively traded assets. */
19
+ export interface WsAllMidsRequest {
20
+ /** Type of subscription. */
21
+ type: "allMids";
22
+ }
23
+ /** Subscribe to candlestick data updates for a specific asset. */
24
+ export interface WsCandleRequest {
25
+ /** Type of subscription. */
26
+ type: "candle";
27
+ /** Asset symbol. */
28
+ coin: string;
29
+ /** Time interval (e.g., "15m"). */
30
+ interval: string;
31
+ }
32
+ /** Subscribe to explorer block updates. */
33
+ export interface WsExplorerBlockRequest {
34
+ /** Type of subscription. */
35
+ type: "explorerBlock";
36
+ }
37
+ /** Subscribe to explorer transaction updates. */
38
+ export interface WsExplorerTxsRequest {
39
+ /** Type of subscription. */
40
+ type: "explorerTxs";
41
+ }
42
+ /** Subscribe to L2 order book updates for a specific asset. */
43
+ export interface WsL2BookRequest {
44
+ /** Type of subscription. */
45
+ type: "l2Book";
46
+ /** Asset symbol. */
47
+ coin: string;
48
+ /**
49
+ * Number of significant figures.
50
+ * @defaultValue `null`
51
+ */
52
+ nSigFigs?: 2 | 3 | 4 | 5 | null;
53
+ /**
54
+ * Mantissa for aggregation.
55
+ * @defaultValue `null`
56
+ */
57
+ mantissa?: 2 | 5 | null;
58
+ }
59
+ /** Subscribe to notification updates for a specific user. */
60
+ export interface WsNotificationRequest {
61
+ /** Type of subscription. */
62
+ type: "notification";
63
+ /** User's address. */
64
+ user: Hex;
65
+ }
66
+ /** Subscribe to order status updates for a specific user. */
67
+ export interface WsOrderUpdatesRequest {
68
+ /** Type of subscription. */
69
+ type: "orderUpdates";
70
+ /** User's address. */
71
+ user: Hex;
72
+ }
73
+ /** Subscribe to real-time trade updates for a specific asset. */
74
+ export interface WsTradesRequest {
75
+ /** Type of subscription. */
76
+ type: "trades";
77
+ /** Asset symbol. */
78
+ coin: string;
79
+ }
80
+ /** Subscribe to non-order events for a specific user. */
81
+ export interface WsUserEventsRequest {
82
+ /** Type of subscription. */
83
+ type: "userEvents";
84
+ /** User's address. */
85
+ user: Hex;
86
+ }
87
+ /** Subscribe to trade fill updates for a specific user. */
88
+ export interface WsUserFillsRequest {
89
+ /** Type of subscription. */
90
+ type: "userFills";
91
+ /** User's address. */
92
+ user: Hex;
93
+ /**
94
+ * Whether to aggregate fills by time.
95
+ * @defaultValue `false`
96
+ */
97
+ aggregateByTime?: boolean;
98
+ }
99
+ /** Subscribe to funding payment updates for a specific user. */
100
+ export interface WsUserFundingsRequest {
101
+ /** Type of subscription. */
102
+ type: "userFundings";
103
+ /** User's address. */
104
+ user: Hex;
105
+ }
106
+ /** Subscribe to non-funding ledger updates for a specific user. */
107
+ export interface WsUserNonFundingLedgerUpdatesRequest {
108
+ /** Type of subscription. */
109
+ type: "userNonFundingLedgerUpdates";
110
+ /** User's address. */
111
+ user: Hex;
112
+ }
113
+ /** Subscribe to TWAP order history updates for a specific user. */
114
+ export interface WsUserTwapHistoryRequest {
115
+ /** Type of subscription. */
116
+ type: "userTwapHistory";
117
+ /** User's address. */
118
+ user: Hex;
119
+ }
120
+ /** Subscribe to TWAP execution updates for a specific user. */
121
+ export interface WsUserTwapSliceFillsRequest {
122
+ /** Type of subscription. */
123
+ type: "userTwapSliceFills";
124
+ /** User's address. */
125
+ user: Hex;
126
+ }
127
+ /** Subscribe to comprehensive user and market data updates. */
128
+ export interface WsWebData2Request {
129
+ /** Type of subscription. */
130
+ type: "webData2";
131
+ /** User's address. */
132
+ user: Hex;
133
+ }
134
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACpC,4BAA4B;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,uEAAuE;AACvE,MAAM,WAAW,wBAAwB;IACrC,4BAA4B;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC7B,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC5B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACnC,4BAA4B;IAC5B,IAAI,EAAE,eAAe,CAAC;CACzB;AAED,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACjC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;AACnE,MAAM,WAAW,oCAAoC;IACjD,4BAA4B;IAC5B,IAAI,EAAE,6BAA6B,CAAC;IACpC,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,mEAAmE;AACnE,MAAM,WAAW,wBAAwB;IACrC,4BAA4B;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,2BAA2B;IACxC,4BAA4B;IAC5B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAC9B,4BAA4B;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import type { BatchModifyRequest, CancelByCloidRequest, CancelRequest, CreateSubAccountRequest, ModifyRequest, OrderRequest, ScheduleCancelRequest, SetReferrerRequest, SubAccountTransferRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, VaultTransferRequest } from "../types/exchange/requests";
2
- import type { OrderParms } from "../types/exchange/common";
1
+ import type { BatchModifyRequest, CancelByCloidRequest, CancelRequest, CreateSubAccountRequest, ModifyRequest, OrderRequest, ScheduleCancelRequest, SetReferrerRequest, SubAccountTransferRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, VaultTransferRequest } from "../types/exchange/requests.js";
2
+ import type { OrderParams } from "../types/exchange/common.js";
3
3
  /** Record of action types and their corresponding sorters. */
4
4
  export declare const sorters: {
5
5
  batchModify: (action: BatchModifyRequest["action"]) => BatchModifyRequest["action"];
@@ -16,6 +16,6 @@ export declare const sorters: {
16
16
  updateIsolatedMargin: (action: UpdateIsolatedMarginRequest["action"]) => UpdateIsolatedMarginRequest["action"];
17
17
  updateLeverage: (action: UpdateLeverageRequest["action"]) => UpdateLeverageRequest["action"];
18
18
  vaultTransfer: (action: VaultTransferRequest["action"]) => VaultTransferRequest["action"];
19
- _order: (order: OrderParms) => OrderParms;
19
+ _order: (order: OrderParams) => OrderParams;
20
20
  };
21
21
  //# sourceMappingURL=key_sort.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"key_sort.d.ts","sourceRoot":"","sources":["../../../src/src/utils/key_sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,8DAA8D;AAE9D,eAAO,MAAM,OAAO;0BACM,kBAAkB,CAAC,QAAQ,CAAC,KAAG,kBAAkB,CAAC,QAAQ,CAAC;qBAOhE,aAAa,CAAC,QAAQ,CAAC,KAAG,aAAa,CAAC,QAAQ,CAAC;4BAO1C,oBAAoB,CAAC,QAAQ,CAAC,KAAG,oBAAoB,CAAC,QAAQ,CAAC;+BAO5D,uBAAuB,CAAC,QAAQ,CAAC,KAAG,uBAAuB,CAAC,QAAQ,CAAC;qBAI/E,aAAa,CAAC,QAAQ,CAAC,KAAG,aAAa,CAAC,QAAQ,CAAC;oBAKlD,YAAY,CAAC,QAAQ,CAAC,KAAG,YAAY,CAAC,QAAQ,CAAC;6BAUtC,qBAAqB,CAAC,QAAQ,CAAC,KAAG,qBAAqB,CAAC,QAAQ,CAAC;0BAQpE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,kBAAkB,CAAC,QAAQ,CAAC;iCAIpD,yBAAyB,CAAC,QAAQ,C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C,QAAQ,CAAC;6BAUtC,qBAAqB,CAAC,QAAQ,CAAC,KAAG,qBAAqB,CAAC,QAAQ,CAAC;0BAQpE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,kBAAkB,CAAC,QAAQ,CAAC;iCAIpD,yBAAyB,CAAC,QAAQ,CAAC,KAAG,yBAAyB,CAAC,QAAQ,CAAC;yBAMjF,iBAAiB,CAAC,QAAQ,CAAC,KAAG,iBAAiB,CAAC,QAAQ,CAAC;wBAK1D,gBAAgB,CAAC,QAAQ,CAAC,KAAG,gBAAgB,CAAC,QAAQ,CAAC;mCAW5C,2BAA2B,CAAC,QAAQ,CAAC,KAAG,2BAA2B,CAAC,QAAQ,CAAC;6BAMnF,qBAAqB,CAAC,QAAQ,CAAC,KAAG,qBAAqB,CAAC,QAAQ,CAAC;4BAMlE,oBAAoB,CAAC,QAAQ,CAAC,KAAG,oBAAoB,CAAC,QAAQ,CAAC;oBAOvE,WAAW,KAAG,WAAW;CAyB5C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type ValueType } from "../../deps/jsr.io/@std/msgpack/1.0.2/encode.js";
1
+ import { type ValueType } from "../../deps/jsr.io/@std/msgpack/1.0.3/encode.js";
2
2
  type Hex = `0x${string}`;
3
3
  /** Abstract interface for a [ethers.js](https://docs.ethers.org/v6/api/providers/#Signer) signer. */
4
4
  export interface AbstractEthersSigner {
@@ -1,6 +1,6 @@
1
1
  import { keccak_256 } from "../../deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js";
2
- import { encode } from "../../deps/jsr.io/@std/msgpack/1.0.2/encode.js";
3
- import { decodeHex, encodeHex } from "../../deps/jsr.io/@std/encoding/1.0.6/hex.js";
2
+ import { encode } from "../../deps/jsr.io/@std/msgpack/1.0.3/encode.js";
3
+ import { decodeHex, encodeHex } from "../../deps/jsr.io/@std/encoding/1.0.7/hex.js";
4
4
  /**
5
5
  * Create a hash of the action.
6
6
  * @param action - The action to hash.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nktkas/hyperliquid",
3
- "version": "0.13.0",
4
- "description": "Unofficial Hyperliquid API SDK for all major JS runtimes",
3
+ "version": "0.13.2",
4
+ "description": "Unofficial Hyperliquid API SDK for all major JS runtimes, written in TypeScript and provided with tests",
5
5
  "keywords": [
6
6
  "api",
7
7
  "typescript",
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
2
  if (k2 === undefined) k2 = k;
4
3
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -13,5 +12,16 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
12
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
13
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
14
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/TypedEventTarget.js"), exports);
15
+ (function (factory) {
16
+ if (typeof module === "object" && typeof module.exports === "object") {
17
+ var v = factory(require, exports);
18
+ if (v !== undefined) module.exports = v;
19
+ }
20
+ else if (typeof define === "function" && define.amd) {
21
+ define(["require", "exports", "./src/TypedEventTarget.js"], factory);
22
+ }
23
+ })(function (require, exports) {
24
+ "use strict";
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ __exportStar(require("./src/TypedEventTarget.js"), exports);
27
+ });
@@ -1,14 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypedEventTarget = void 0;
4
- class TypedEventTarget extends EventTarget {
5
- /**
6
- * Dispatches a synthetic event event to target and returns true if either
7
- * event's cancelable attribute value is false or its preventDefault() method
8
- * was not invoked, and false otherwise.
9
- */
10
- dispatchTypedEvent(_type, event) {
11
- return super.dispatchEvent(event);
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
12
5
  }
13
- }
14
- exports.TypedEventTarget = TypedEventTarget;
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TypedEventTarget = void 0;
13
+ class TypedEventTarget extends EventTarget {
14
+ /**
15
+ * Dispatches a synthetic event event to target and returns true if either
16
+ * event's cancelable attribute value is false or its preventDefault() method
17
+ * was not invoked, and false otherwise.
18
+ */
19
+ dispatchTypedEvent(_type, event) {
20
+ return super.dispatchEvent(event);
21
+ }
22
+ }
23
+ exports.TypedEventTarget = TypedEventTarget;
24
+ });
@@ -1,49 +1,59 @@
1
- "use strict";
2
1
  /**
3
2
  * Internal assertion helpers.
4
3
  * @module
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.anumber = anumber;
8
- exports.abytes = abytes;
9
- exports.ahash = ahash;
10
- exports.aexists = aexists;
11
- exports.aoutput = aoutput;
12
- /** Asserts something is positive integer. */
13
- function anumber(n) {
14
- if (!Number.isSafeInteger(n) || n < 0)
15
- throw new Error('positive integer expected, got ' + n);
16
- }
17
- /** Is number an Uint8Array? Copied from utils for perf. */
18
- function isBytes(a) {
19
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
20
- }
21
- /** Asserts something is Uint8Array. */
22
- function abytes(b, ...lengths) {
23
- if (!isBytes(b))
24
- throw new Error('Uint8Array expected');
25
- if (lengths.length > 0 && !lengths.includes(b.length))
26
- throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
27
- }
28
- /** Asserts something is hash */
29
- function ahash(h) {
30
- if (typeof h !== 'function' || typeof h.create !== 'function')
31
- throw new Error('Hash should be wrapped by utils.wrapConstructor');
32
- anumber(h.outputLen);
33
- anumber(h.blockLen);
34
- }
35
- /** Asserts a hash instance has not been destroyed / finished */
36
- function aexists(instance, checkFinished = true) {
37
- if (instance.destroyed)
38
- throw new Error('Hash instance has been destroyed');
39
- if (checkFinished && instance.finished)
40
- throw new Error('Hash#digest() has already been called');
41
- }
42
- /** Asserts output is properly-sized byte array */
43
- function aoutput(out, instance) {
44
- abytes(out);
45
- const min = instance.outputLen;
46
- if (out.length < min) {
47
- throw new Error('digestInto() expects output buffer of length at least ' + min);
48
- }
49
- }
5
+ (function (factory) {
6
+ if (typeof module === "object" && typeof module.exports === "object") {
7
+ var v = factory(require, exports);
8
+ if (v !== undefined) module.exports = v;
9
+ }
10
+ else if (typeof define === "function" && define.amd) {
11
+ define(["require", "exports"], factory);
12
+ }
13
+ })(function (require, exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.anumber = anumber;
17
+ exports.abytes = abytes;
18
+ exports.ahash = ahash;
19
+ exports.aexists = aexists;
20
+ exports.aoutput = aoutput;
21
+ /** Asserts something is positive integer. */
22
+ function anumber(n) {
23
+ if (!Number.isSafeInteger(n) || n < 0)
24
+ throw new Error('positive integer expected, got ' + n);
25
+ }
26
+ /** Is number an Uint8Array? Copied from utils for perf. */
27
+ function isBytes(a) {
28
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
29
+ }
30
+ /** Asserts something is Uint8Array. */
31
+ function abytes(b, ...lengths) {
32
+ if (!isBytes(b))
33
+ throw new Error('Uint8Array expected');
34
+ if (lengths.length > 0 && !lengths.includes(b.length))
35
+ throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
36
+ }
37
+ /** Asserts something is hash */
38
+ function ahash(h) {
39
+ if (typeof h !== 'function' || typeof h.create !== 'function')
40
+ throw new Error('Hash should be wrapped by utils.wrapConstructor');
41
+ anumber(h.outputLen);
42
+ anumber(h.blockLen);
43
+ }
44
+ /** Asserts a hash instance has not been destroyed / finished */
45
+ function aexists(instance, checkFinished = true) {
46
+ if (instance.destroyed)
47
+ throw new Error('Hash instance has been destroyed');
48
+ if (checkFinished && instance.finished)
49
+ throw new Error('Hash#digest() has already been called');
50
+ }
51
+ /** Asserts output is properly-sized byte array */
52
+ function aoutput(out, instance) {
53
+ abytes(out);
54
+ const min = instance.outputLen;
55
+ if (out.length < min) {
56
+ throw new Error('digestInto() expects output buffer of length at least ' + min);
57
+ }
58
+ }
59
+ });