@nktkas/hyperliquid 0.17.3 → 0.18.0

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 (126) hide show
  1. package/README.md +49 -36
  2. package/{script/deps/jsr.io/@noble/hashes/1.7.1 → esm/deps/jsr.io/@noble/hashes/1.8.0}/src/_u64.d.ts +1 -1
  3. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +1 -0
  4. package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/_u64.js +5 -4
  5. package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.d.ts.map +1 -1
  6. package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/sha3.d.ts +6 -5
  7. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/sha3.js +63 -52
  9. package/{script/deps/jsr.io/@noble/hashes/1.7.1 → esm/deps/jsr.io/@noble/hashes/1.8.0}/src/utils.d.ts +60 -19
  10. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/utils.js +94 -25
  12. package/esm/deps/jsr.io/@std/async/1.0.12/delay.d.ts +43 -0
  13. package/esm/deps/jsr.io/@std/async/1.0.12/delay.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/async/1.0.12/delay.js +63 -0
  15. package/{script/deps/jsr.io/@std/encoding/1.0.9 → esm/deps/jsr.io/@std/encoding/1.0.10}/_common16.d.ts +1 -1
  16. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common16.js +1 -1
  18. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
  21. package/esm/src/clients/wallet.d.ts +22 -12
  22. package/esm/src/clients/wallet.d.ts.map +1 -1
  23. package/esm/src/clients/wallet.js +85 -62
  24. package/esm/src/signing.d.ts +4 -1
  25. package/esm/src/signing.d.ts.map +1 -1
  26. package/esm/src/signing.js +47 -24
  27. package/esm/src/transports/http/http_transport.d.ts +18 -8
  28. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  29. package/esm/src/transports/http/http_transport.js +17 -18
  30. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +3 -12
  31. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  32. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +20 -42
  33. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  34. package/esm/src/transports/websocket/_reconnecting_websocket.js +127 -193
  35. package/esm/src/transports/websocket/websocket_transport.d.ts +6 -0
  36. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  37. package/esm/src/transports/websocket/websocket_transport.js +23 -21
  38. package/esm/src/types/exchange/requests.d.ts +26 -2
  39. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  40. package/esm/src/types/exchange/responses.d.ts +6 -6
  41. package/esm/src/types/exchange/responses.d.ts.map +1 -1
  42. package/esm/src/types/info/accounts.d.ts +14 -0
  43. package/esm/src/types/info/accounts.d.ts.map +1 -1
  44. package/esm/src/types/info/assets.d.ts +20 -0
  45. package/esm/src/types/info/assets.d.ts.map +1 -1
  46. package/package.json +1 -1
  47. package/{esm/deps/jsr.io/@noble/hashes/1.7.1 → script/deps/jsr.io/@noble/hashes/1.8.0}/src/_u64.d.ts +1 -1
  48. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +1 -0
  49. package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/_u64.js +6 -5
  50. package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.d.ts.map +1 -1
  51. package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/sha3.d.ts +6 -5
  52. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +1 -0
  53. package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/sha3.js +69 -58
  54. package/{esm/deps/jsr.io/@noble/hashes/1.7.1 → script/deps/jsr.io/@noble/hashes/1.8.0}/src/utils.d.ts +60 -19
  55. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +1 -0
  56. package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/utils.js +111 -34
  57. package/script/deps/jsr.io/@std/async/1.0.12/delay.d.ts +43 -0
  58. package/script/deps/jsr.io/@std/async/1.0.12/delay.d.ts.map +1 -0
  59. package/script/deps/jsr.io/@std/async/1.0.12/delay.js +76 -0
  60. package/{esm/deps/jsr.io/@std/encoding/1.0.9 → script/deps/jsr.io/@std/encoding/1.0.10}/_common16.d.ts +1 -1
  61. package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
  62. package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common16.js +1 -1
  63. package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
  64. package/script/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
  65. package/script/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
  66. package/script/src/clients/wallet.d.ts +22 -12
  67. package/script/src/clients/wallet.d.ts.map +1 -1
  68. package/script/src/clients/wallet.js +85 -62
  69. package/script/src/signing.d.ts +4 -1
  70. package/script/src/signing.d.ts.map +1 -1
  71. package/script/src/signing.js +47 -24
  72. package/script/src/transports/http/http_transport.d.ts +18 -8
  73. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  74. package/script/src/transports/http/http_transport.js +17 -18
  75. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +3 -12
  76. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  77. package/script/src/transports/websocket/_reconnecting_websocket.d.ts +20 -42
  78. package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  79. package/script/src/transports/websocket/_reconnecting_websocket.js +129 -195
  80. package/script/src/transports/websocket/websocket_transport.d.ts +6 -0
  81. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  82. package/script/src/transports/websocket/websocket_transport.js +23 -21
  83. package/script/src/types/exchange/requests.d.ts +26 -2
  84. package/script/src/types/exchange/requests.d.ts.map +1 -1
  85. package/script/src/types/exchange/responses.d.ts +6 -6
  86. package/script/src/types/exchange/responses.d.ts.map +1 -1
  87. package/script/src/types/info/accounts.d.ts +14 -0
  88. package/script/src/types/info/accounts.d.ts.map +1 -1
  89. package/script/src/types/info/assets.d.ts +20 -0
  90. package/script/src/types/info/assets.d.ts.map +1 -1
  91. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts +0 -23
  92. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts.map +0 -1
  93. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +0 -43
  94. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts.map +0 -1
  95. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts.map +0 -1
  96. package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts.map +0 -1
  97. package/esm/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts.map +0 -1
  98. package/esm/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts.map +0 -1
  99. package/esm/deps/jsr.io/@std/encoding/1.0.9/_types.d.ts.map +0 -1
  100. package/esm/deps/jsr.io/@std/encoding/1.0.9/hex.d.ts.map +0 -1
  101. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts +0 -23
  102. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts.map +0 -1
  103. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +0 -59
  104. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts.map +0 -1
  105. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts.map +0 -1
  106. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts.map +0 -1
  107. package/script/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts.map +0 -1
  108. package/script/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts.map +0 -1
  109. package/script/deps/jsr.io/@std/encoding/1.0.9/_types.d.ts.map +0 -1
  110. package/script/deps/jsr.io/@std/encoding/1.0.9/hex.d.ts.map +0 -1
  111. /package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.d.ts +0 -0
  112. /package/esm/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.js +0 -0
  113. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common_detach.d.ts +0 -0
  114. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common_detach.js +0 -0
  115. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_types.d.ts +0 -0
  116. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_types.js +0 -0
  117. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/hex.d.ts +0 -0
  118. /package/esm/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/hex.js +0 -0
  119. /package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.d.ts +0 -0
  120. /package/script/deps/jsr.io/@noble/hashes/{1.7.1 → 1.8.0}/src/crypto.js +0 -0
  121. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common_detach.d.ts +0 -0
  122. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_common_detach.js +0 -0
  123. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_types.d.ts +0 -0
  124. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/_types.js +0 -0
  125. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/hex.d.ts +0 -0
  126. /package/script/deps/jsr.io/@std/encoding/{1.0.9 → 1.0.10}/hex.js +0 -0
package/README.md CHANGED
@@ -20,24 +20,21 @@ runtimes, written in TypeScript and provided with tests.
20
20
 
21
21
  ## Installation
22
22
 
23
- ```bash
23
+ ```
24
24
  # npm
25
25
  npm i @nktkas/hyperliquid
26
26
 
27
- # yarn
28
- yarn add @nktkas/hyperliquid
27
+ # deno
28
+ deno add jsr:@nktkas/hyperliquid
29
+
30
+ # pnpm >=10.9.0
31
+ pnpm i jsr:@nktkas/hyperliquid
29
32
 
30
- # pnpm
31
- pnpm add @nktkas/hyperliquid
33
+ # yarn >=4.9.0
34
+ yarn add jsr:@nktkas/hyperliquid
32
35
 
33
36
  # bun
34
37
  bun i @nktkas/hyperliquid
35
-
36
- # deno
37
- deno add jsr:@nktkas/hyperliquid
38
-
39
- # web (import directly)
40
- import * as hl from "https://esm.sh/jsr/@nktkas/hyperliquid";
41
38
  ```
42
39
 
43
40
  ## Quick Start
@@ -46,21 +43,21 @@ import * as hl from "https://esm.sh/jsr/@nktkas/hyperliquid";
46
43
  import * as hl from "@nktkas/hyperliquid";
47
44
 
48
45
  const transport = new hl.HttpTransport();
49
- const publicClient = new hl.PublicClient({ transport });
46
+ const client = new hl.PublicClient({ transport });
50
47
 
51
- const openOrders = await publicClient.openOrders({ user: "0x..." });
48
+ const openOrders = await client.openOrders({ user: "0x..." }); // Change to your address
52
49
  ```
53
50
 
54
51
  ```ts
55
52
  import * as hl from "@nktkas/hyperliquid";
56
53
  import { privateKeyToAccount } from "viem/accounts";
57
54
 
58
- const account = privateKeyToAccount("0x..."); // Change to your private key
55
+ const wallet = privateKeyToAccount("0x..."); // Change to your private key
59
56
 
60
57
  const transport = new hl.HttpTransport();
61
- const walletClient = new hl.WalletClient({ wallet: account, transport });
58
+ const client = new hl.WalletClient({ wallet, transport });
62
59
 
63
- const result = await walletClient.order({
60
+ const result = await client.order({
64
61
  orders: [{
65
62
  a: 0, // Asset index
66
63
  b: true, // Buy order
@@ -73,8 +70,23 @@ const result = await walletClient.order({
73
70
  },
74
71
  },
75
72
  }],
76
- grouping: "na", // No grouping
73
+ grouping: "na", // No grouping orders
74
+ });
75
+ ```
76
+
77
+ ```ts
78
+ import * as hl from "@nktkas/hyperliquid";
79
+
80
+ const transport = new hl.WebSocketTransport();
81
+ const client = new hl.EventClient({ transport });
82
+
83
+ // Subscribe to events
84
+ const sub = await client.allMids((event) => {
85
+ // Handle the event
86
+ console.log(event);
77
87
  });
88
+
89
+ await sub.unsubscribe(); // Unsubscribe from the event
78
90
  ```
79
91
 
80
92
  ## Usage
@@ -84,7 +96,7 @@ const result = await walletClient.order({
84
96
  First, choose and configure your transport layer (more details in the [API Reference](#transports)):
85
97
 
86
98
  ```ts
87
- import * as hl from "@nktkas/hyperliquid"; // ESM & Common.js
99
+ import * as hl from "@nktkas/hyperliquid"; // support ESM & Common.js
88
100
 
89
101
  // HTTP Transport
90
102
  const httpTransport = new hl.HttpTransport(); // Accepts optional parameters
@@ -100,7 +112,7 @@ Next, initialize a client with the transport layer (more details in the [API Ref
100
112
  #### Create PublicClient
101
113
 
102
114
  ```ts
103
- import * as hl from "@nktkas/hyperliquid"; // ESM & Common.js
115
+ import * as hl from "@nktkas/hyperliquid"; // support ESM & Common.js
104
116
 
105
117
  const transport = new hl.HttpTransport(); // or WebSocketTransport
106
118
  const client = new hl.PublicClient({ transport });
@@ -109,7 +121,7 @@ const client = new hl.PublicClient({ transport });
109
121
  #### Create WalletClient
110
122
 
111
123
  ```ts
112
- import * as hl from "@nktkas/hyperliquid"; // ESM & Common.js
124
+ import * as hl from "@nktkas/hyperliquid"; // support ESM & Common.js
113
125
  import { createWalletClient, custom } from "viem";
114
126
  import { privateKeyToAccount } from "viem/accounts";
115
127
  import { ethers } from "ethers";
@@ -136,9 +148,9 @@ const windowMetamaskClient = new hl.WalletClient({ wallet: window.ethereum, tran
136
148
  #### Create EventClient
137
149
 
138
150
  ```ts
139
- import * as hl from "@nktkas/hyperliquid"; // ESM & Common.js
151
+ import * as hl from "@nktkas/hyperliquid"; // support ESM & Common.js
140
152
 
141
- const transport = new hl.WebSocketTransport(); // Only WebSocketTransport
153
+ const transport = new hl.WebSocketTransport(); // only WebSocketTransport
142
154
  const client = new hl.EventClient({ transport });
143
155
  ```
144
156
 
@@ -177,18 +189,18 @@ const client = new hl.WalletClient({ wallet: account, transport });
177
189
  // Place an orders
178
190
  const result = await client.order({
179
191
  orders: [{
180
- a: 0, // Asset index
181
- b: true, // Buy order
182
- p: "30000", // Price
183
- s: "0.1", // Size
184
- r: false, // Not reduce-only
192
+ a: 0,
193
+ b: true,
194
+ p: "30000",
195
+ s: "0.1",
196
+ r: false,
185
197
  t: {
186
198
  limit: {
187
- tif: "Gtc", // Good-til-cancelled
199
+ tif: "Gtc",
188
200
  },
189
201
  },
190
202
  }],
191
- grouping: "na", // No grouping
203
+ grouping: "na",
192
204
  });
193
205
 
194
206
  // Approve an agent
@@ -199,8 +211,8 @@ const result = await client.approveAgent({
199
211
 
200
212
  // Withdraw funds
201
213
  const result = await client.withdraw3({
202
- destination: account.address, // Withdraw funds to your address
203
- amount: "100", // 100 USD
214
+ destination: account.address,
215
+ amount: "100",
204
216
  });
205
217
  ```
206
218
 
@@ -216,19 +228,19 @@ const client = new hl.EventClient({ transport });
216
228
  const sub = await client.l2Book({ coin: "BTC" }, (data) => {
217
229
  console.log(data);
218
230
  });
219
- await sub.unsubscribe(); // Unsubscribe from the event
231
+ await sub.unsubscribe();
220
232
 
221
233
  // User fills
222
234
  const sub = await client.userFills({ user: "0x..." }, (data) => {
223
235
  console.log(data);
224
236
  });
225
- await sub.unsubscribe(); // Unsubscribe from the event
237
+ await sub.unsubscribe();
226
238
 
227
239
  // Explorer block updates
228
240
  const sub = await client.explorerBlock((data) => {
229
241
  console.log(data);
230
242
  });
231
- await sub.unsubscribe(); // Unsubscribe from the event
243
+ await sub.unsubscribe();
232
244
  ```
233
245
 
234
246
  ## API Reference
@@ -448,6 +460,7 @@ class HttpTransport {
448
460
  constructor(options?: {
449
461
  isTestnet?: boolean; // Whether to use testnet url (default: false)
450
462
  timeout?: number; // Request timeout in ms (default: 10_000)
463
+ server?: "api" | "api2" | "api-ui"; // Server URL (default: "api" = "https://api.hyperliquid.xyz")
451
464
  fetchOptions?: RequestInit; // A custom fetch options
452
465
  onRequest?: (request: Request) => MaybePromise<Request | void | null | undefined>; // A callback before request is sent
453
466
  onResponse?: (response: Response) => MaybePromise<Response | void | null | undefined>; // A callback after response is received
@@ -522,7 +535,7 @@ const wallet = privateKeyToAccount("0x..."); // Change to your private key
522
535
  const action = {
523
536
  type: "cancel",
524
537
  cancels: [
525
- { a: 0, o: 12345 }, // Asset index and order ID
538
+ { a: 0, o: 12345 },
526
539
  ],
527
540
  };
528
541
  const nonce = Date.now();
@@ -555,7 +568,7 @@ const action = {
555
568
  hyperliquidChain: "Testnet", // "Mainnet" or "Testnet"
556
569
  signatureChainId: "0x66eee",
557
570
  nonce: Date.now(),
558
- agentAddress: "0x...", // Change to your agent address
571
+ agentAddress: "0x...",
559
572
  agentName: "Agent",
560
573
  };
561
574
 
@@ -26,7 +26,7 @@ declare const add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number;
26
26
  declare const add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number;
27
27
  declare const add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number;
28
28
  declare const add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number;
29
- export { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };
29
+ export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };
30
30
  declare const u64: {
31
31
  fromBig: typeof fromBig;
32
32
  split: typeof split;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_u64.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.ts"],"names":[],"mappings":"AAQA,iBAAS,OAAO,CACd,CAAC,EAAE,MAAM,EACT,EAAE,UAAQ,GACT;IACD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAGA;AAED,iBAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,UAAQ,GAAG,WAAW,EAAE,CASvD;AAED,QAAA,MAAM,KAAK,MAAO,MAAM,KAAK,MAAM,KAAG,MAAqD,CAAC;AAE5F,QAAA,MAAM,KAAK,MAAO,MAAM,MAAM,MAAM,KAAK,MAAM,KAAG,MAAiB,CAAC;AACpE,QAAA,MAAM,KAAK,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,MAAqC,CAAC;AAEvF,QAAA,MAAM,MAAM,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,MAAqC,CAAC;AACxF,QAAA,MAAM,MAAM,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,MAAqC,CAAC;AAExF,QAAA,MAAM,MAAM,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,MAA4C,CAAC;AAC/F,QAAA,MAAM,MAAM,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,MAA4C,CAAC;AAE/F,QAAA,MAAM,OAAO,OAAQ,MAA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AM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAOrpC,CAAC;AACF,eAAe,GAAG,CAAC"}
@@ -11,9 +11,10 @@ function fromBig(n, le = false) {
11
11
  return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
12
12
  }
13
13
  function split(lst, le = false) {
14
- let Ah = new Uint32Array(lst.length);
15
- let Al = new Uint32Array(lst.length);
16
- for (let i = 0; i < lst.length; i++) {
14
+ const len = lst.length;
15
+ let Ah = new Uint32Array(len);
16
+ let Al = new Uint32Array(len);
17
+ for (let i = 0; i < len; i++) {
17
18
  const { h, l } = fromBig(lst[i], le);
18
19
  [Ah[i], Al[i]] = [h, l];
19
20
  }
@@ -52,7 +53,7 @@ const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0
52
53
  const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
53
54
  const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
54
55
  // prettier-ignore
55
- export { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };
56
+ export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };
56
57
  // prettier-ignore
57
58
  const u64 = {
58
59
  fromBig, split, toBig,
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,EAAE,GACqE,CAAC"}
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,EAAE,GACqE,CAAC"}
@@ -3,18 +3,19 @@ import { Hash, type CHash, type CHashXO, type HashXOF, type Input } from './util
3
3
  export declare function keccakP(s: Uint32Array, rounds?: number): void;
4
4
  /** Keccak sponge function. */
5
5
  export declare class Keccak extends Hash<Keccak> implements HashXOF<Keccak> {
6
- blockLen: number;
7
- suffix: number;
8
- outputLen: number;
9
- protected enableXOF: boolean;
10
- protected rounds: number;
11
6
  protected state: Uint8Array;
12
7
  protected pos: number;
13
8
  protected posOut: number;
14
9
  protected finished: boolean;
15
10
  protected state32: Uint32Array;
16
11
  protected destroyed: boolean;
12
+ blockLen: number;
13
+ suffix: number;
14
+ outputLen: number;
15
+ protected enableXOF: boolean;
16
+ protected rounds: number;
17
17
  constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number);
18
+ clone(): Keccak;
18
19
  protected keccak(): void;
19
20
  update(data: Input): this;
20
21
  protected finish(): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.ts"],"names":[],"mappings":"AAaA,OAAO,EAE6B,IAAI,EAGtC,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EACnD,MAAM,YAAY,CAAC;AAoCpB,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAyCjE;AAED,8BAA8B;AAC9B,qBAAa,MAAO,SAAQ,IAAI,CAAC,MAAM,CAAE,YAAW,OAAO,CAAC,MAAM,CAA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,UAAU,EAAE,KAAyD,CAAC;AACnF,yDAAyD;AACzD,eAAO,MAAM,UAAU,EAAE,KAAyD,CAAC;AACnF,gCAAgC;AAChC,eAAO,MAAM,UAAU,EAAE,KAAyD,CAAC;AACnF,gCAAgC;AAChC,eAAO,MAAM,UAAU,EAAE,KAAwD,CAAC;AAElF,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ3C,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,EAAE,OAAgE,CAAC;AACxF,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,EAAE,OAAgE,CAAC"}
@@ -9,19 +9,21 @@
9
9
  * Check out `sha3-addons` module for cSHAKE, k12, and others.
10
10
  * @module
11
11
  */
12
- import { abytes, aexists, anumber, aoutput } from './_assert.js';
13
12
  import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';
14
- import { byteSwap32, Hash, isLE, toBytes, u32, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';
13
+ // prettier-ignore
14
+ import { abytes, aexists, anumber, aoutput, clean, createHasher, createXOFer, Hash, swap32IfBE, toBytes, u32 } from './utils.js';
15
+ // No __PURE__ annotations in sha3 header:
16
+ // EVERYTHING is in fact used on every export.
15
17
  // Various per round constants calculations
18
+ const _0n = BigInt(0);
19
+ const _1n = BigInt(1);
20
+ const _2n = BigInt(2);
21
+ const _7n = BigInt(7);
22
+ const _256n = BigInt(256);
23
+ const _0x71n = BigInt(0x71);
16
24
  const SHA3_PI = [];
17
25
  const SHA3_ROTL = [];
18
26
  const _SHA3_IOTA = [];
19
- const _0n = /* @__PURE__ */ BigInt(0);
20
- const _1n = /* @__PURE__ */ BigInt(1);
21
- const _2n = /* @__PURE__ */ BigInt(2);
22
- const _7n = /* @__PURE__ */ BigInt(7);
23
- const _256n = /* @__PURE__ */ BigInt(256);
24
- const _0x71n = /* @__PURE__ */ BigInt(0x71);
25
27
  for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
26
28
  // Pi
27
29
  [x, y] = [y, (2 * x + 3 * y) % 5];
@@ -37,7 +39,9 @@ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
37
39
  }
38
40
  _SHA3_IOTA.push(t);
39
41
  }
40
- const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
42
+ const IOTAS = split(_SHA3_IOTA, true);
43
+ const SHA3_IOTA_H = IOTAS[0];
44
+ const SHA3_IOTA_L = IOTAS[1];
41
45
  // Left rotation (without 0, 32, 64)
42
46
  const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
43
47
  const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
@@ -85,101 +89,108 @@ export function keccakP(s, rounds = 24) {
85
89
  s[0] ^= SHA3_IOTA_H[round];
86
90
  s[1] ^= SHA3_IOTA_L[round];
87
91
  }
88
- B.fill(0);
92
+ clean(B);
89
93
  }
90
94
  /** Keccak sponge function. */
91
95
  export class Keccak extends Hash {
92
96
  // NOTE: we accept arguments in bytes instead of bits here.
93
97
  constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
94
98
  super();
95
- Object.defineProperty(this, "blockLen", {
99
+ Object.defineProperty(this, "state", {
96
100
  enumerable: true,
97
101
  configurable: true,
98
102
  writable: true,
99
- value: blockLen
103
+ value: void 0
100
104
  });
101
- Object.defineProperty(this, "suffix", {
105
+ Object.defineProperty(this, "pos", {
102
106
  enumerable: true,
103
107
  configurable: true,
104
108
  writable: true,
105
- value: suffix
109
+ value: 0
106
110
  });
107
- Object.defineProperty(this, "outputLen", {
111
+ Object.defineProperty(this, "posOut", {
108
112
  enumerable: true,
109
113
  configurable: true,
110
114
  writable: true,
111
- value: outputLen
115
+ value: 0
112
116
  });
113
- Object.defineProperty(this, "enableXOF", {
117
+ Object.defineProperty(this, "finished", {
114
118
  enumerable: true,
115
119
  configurable: true,
116
120
  writable: true,
117
- value: enableXOF
121
+ value: false
118
122
  });
119
- Object.defineProperty(this, "rounds", {
123
+ Object.defineProperty(this, "state32", {
120
124
  enumerable: true,
121
125
  configurable: true,
122
126
  writable: true,
123
- value: rounds
127
+ value: void 0
124
128
  });
125
- Object.defineProperty(this, "state", {
129
+ Object.defineProperty(this, "destroyed", {
126
130
  enumerable: true,
127
131
  configurable: true,
128
132
  writable: true,
129
- value: void 0
133
+ value: false
130
134
  });
131
- Object.defineProperty(this, "pos", {
135
+ Object.defineProperty(this, "blockLen", {
132
136
  enumerable: true,
133
137
  configurable: true,
134
138
  writable: true,
135
- value: 0
139
+ value: void 0
136
140
  });
137
- Object.defineProperty(this, "posOut", {
141
+ Object.defineProperty(this, "suffix", {
138
142
  enumerable: true,
139
143
  configurable: true,
140
144
  writable: true,
141
- value: 0
145
+ value: void 0
142
146
  });
143
- Object.defineProperty(this, "finished", {
147
+ Object.defineProperty(this, "outputLen", {
144
148
  enumerable: true,
145
149
  configurable: true,
146
150
  writable: true,
147
- value: false
151
+ value: void 0
148
152
  });
149
- Object.defineProperty(this, "state32", {
153
+ Object.defineProperty(this, "enableXOF", {
150
154
  enumerable: true,
151
155
  configurable: true,
152
156
  writable: true,
153
- value: void 0
157
+ value: false
154
158
  });
155
- Object.defineProperty(this, "destroyed", {
159
+ Object.defineProperty(this, "rounds", {
156
160
  enumerable: true,
157
161
  configurable: true,
158
162
  writable: true,
159
- value: false
163
+ value: void 0
160
164
  });
165
+ this.blockLen = blockLen;
166
+ this.suffix = suffix;
167
+ this.outputLen = outputLen;
168
+ this.enableXOF = enableXOF;
169
+ this.rounds = rounds;
161
170
  // Can be passed from user as dkLen
162
171
  anumber(outputLen);
163
172
  // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
164
173
  // 0 < blockLen < 200
165
- if (0 >= this.blockLen || this.blockLen >= 200)
166
- throw new Error('Sha3 supports only keccak-f1600 function');
174
+ if (!(0 < blockLen && blockLen < 200))
175
+ throw new Error('only keccak-f1600 function is supported');
167
176
  this.state = new Uint8Array(200);
168
177
  this.state32 = u32(this.state);
169
178
  }
179
+ clone() {
180
+ return this._cloneInto();
181
+ }
170
182
  keccak() {
171
- if (!isLE)
172
- byteSwap32(this.state32);
183
+ swap32IfBE(this.state32);
173
184
  keccakP(this.state32, this.rounds);
174
- if (!isLE)
175
- byteSwap32(this.state32);
185
+ swap32IfBE(this.state32);
176
186
  this.posOut = 0;
177
187
  this.pos = 0;
178
188
  }
179
189
  update(data) {
180
190
  aexists(this);
181
- const { blockLen, state } = this;
182
191
  data = toBytes(data);
192
+ abytes(data);
193
+ const { blockLen, state } = this;
183
194
  const len = data.length;
184
195
  for (let pos = 0; pos < len;) {
185
196
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -241,7 +252,7 @@ export class Keccak extends Hash {
241
252
  }
242
253
  destroy() {
243
254
  this.destroyed = true;
244
- this.state.fill(0);
255
+ clean(this.state);
245
256
  }
246
257
  _cloneInto(to) {
247
258
  const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
@@ -259,25 +270,25 @@ export class Keccak extends Hash {
259
270
  return to;
260
271
  }
261
272
  }
262
- const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
273
+ const gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
263
274
  /** SHA3-224 hash function. */
264
- export const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);
275
+ export const sha3_224 = /* @__PURE__ */ (() => gen(0x06, 144, 224 / 8))();
265
276
  /** SHA3-256 hash function. Different from keccak-256. */
266
- export const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);
277
+ export const sha3_256 = /* @__PURE__ */ (() => gen(0x06, 136, 256 / 8))();
267
278
  /** SHA3-384 hash function. */
268
- export const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);
279
+ export const sha3_384 = /* @__PURE__ */ (() => gen(0x06, 104, 384 / 8))();
269
280
  /** SHA3-512 hash function. */
270
- export const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
281
+ export const sha3_512 = /* @__PURE__ */ (() => gen(0x06, 72, 512 / 8))();
271
282
  /** keccak-224 hash function. */
272
- export const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);
283
+ export const keccak_224 = /* @__PURE__ */ (() => gen(0x01, 144, 224 / 8))();
273
284
  /** keccak-256 hash function. Different from SHA3-256. */
274
- export const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
285
+ export const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))();
275
286
  /** keccak-384 hash function. */
276
- export const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);
287
+ export const keccak_384 = /* @__PURE__ */ (() => gen(0x01, 104, 384 / 8))();
277
288
  /** keccak-512 hash function. */
278
- export const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);
279
- const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
289
+ export const keccak_512 = /* @__PURE__ */ (() => gen(0x01, 72, 512 / 8))();
290
+ const genShake = (suffix, blockLen, outputLen) => createXOFer((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
280
291
  /** SHAKE128 XOF with 128-bit security. */
281
- export const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);
292
+ export const shake128 = /* @__PURE__ */ (() => genShake(0x1f, 168, 128 / 8))();
282
293
  /** SHAKE256 XOF with 256-bit security. */
283
- export const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);
294
+ export const shake256 = /* @__PURE__ */ (() => genShake(0x1f, 136, 256 / 8))();