@nktkas/hyperliquid 0.19.1 → 0.20.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 (136) hide show
  1. package/CONTRIBUTING.md +4 -2
  2. package/README.md +36 -35
  3. package/esm/_dnt.polyfills.d.ts +20 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -0
  5. package/esm/_dnt.polyfills.js +12 -0
  6. package/esm/mod.d.ts +3 -0
  7. package/esm/mod.d.ts.map +1 -1
  8. package/esm/mod.js +2 -0
  9. package/esm/src/base.d.ts +1 -47
  10. package/esm/src/base.d.ts.map +1 -1
  11. package/esm/src/base.js +1 -8
  12. package/esm/src/clients/event.d.ts +6 -4
  13. package/esm/src/clients/event.d.ts.map +1 -1
  14. package/esm/src/clients/event.js +58 -77
  15. package/esm/src/clients/public.d.ts +26 -5
  16. package/esm/src/clients/public.d.ts.map +1 -1
  17. package/esm/src/clients/public.js +29 -41
  18. package/esm/src/clients/wallet.d.ts +200 -26
  19. package/esm/src/clients/wallet.d.ts.map +1 -1
  20. package/esm/src/clients/wallet.js +306 -284
  21. package/esm/src/signing.d.ts +80 -5
  22. package/esm/src/signing.d.ts.map +1 -1
  23. package/esm/src/signing.js +96 -7
  24. package/esm/src/transports/base.d.ts +49 -0
  25. package/esm/src/transports/base.d.ts.map +1 -0
  26. package/esm/src/transports/base.js +8 -0
  27. package/esm/src/transports/http/http_transport.d.ts +8 -5
  28. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  29. package/esm/src/transports/http/http_transport.js +15 -62
  30. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +36 -39
  31. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  32. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +18 -25
  33. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  34. package/esm/src/transports/websocket/_reconnecting_websocket.js +80 -179
  35. package/{script/src/transports/websocket/_websocket_request_dispatcher.d.ts → esm/src/transports/websocket/_websocket_async_request.d.ts} +14 -18
  36. package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -0
  37. package/esm/src/transports/websocket/{_websocket_request_dispatcher.js → _websocket_async_request.js} +42 -75
  38. package/esm/src/transports/websocket/websocket_transport.d.ts +38 -28
  39. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  40. package/esm/src/transports/websocket/websocket_transport.js +61 -76
  41. package/esm/src/types/exchange/requests.d.ts +278 -66
  42. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  43. package/esm/src/types/info/assets.d.ts +0 -48
  44. package/esm/src/types/info/assets.d.ts.map +1 -1
  45. package/esm/src/types/info/markets.d.ts +52 -0
  46. package/esm/src/types/info/markets.d.ts.map +1 -0
  47. package/esm/src/types/info/markets.js +1 -0
  48. package/esm/src/types/info/orders.d.ts +1 -1
  49. package/esm/src/types/info/orders.d.ts.map +1 -1
  50. package/esm/src/types/info/requests.d.ts +14 -5
  51. package/esm/src/types/info/requests.d.ts.map +1 -1
  52. package/esm/src/types/mod.d.ts +4 -0
  53. package/esm/src/types/mod.d.ts.map +1 -1
  54. package/esm/src/types/mod.js +3 -1
  55. package/esm/src/types/subscriptions/requests.d.ts +2 -0
  56. package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
  57. package/package.json +12 -9
  58. package/script/_dnt.polyfills.d.ts +20 -0
  59. package/script/_dnt.polyfills.d.ts.map +1 -0
  60. package/script/_dnt.polyfills.js +23 -0
  61. package/script/mod.d.ts +3 -0
  62. package/script/mod.d.ts.map +1 -1
  63. package/script/mod.js +3 -1
  64. package/script/src/base.d.ts +1 -47
  65. package/script/src/base.d.ts.map +1 -1
  66. package/script/src/base.js +2 -10
  67. package/script/src/clients/event.d.ts +6 -4
  68. package/script/src/clients/event.d.ts.map +1 -1
  69. package/script/src/clients/event.js +58 -77
  70. package/script/src/clients/public.d.ts +26 -5
  71. package/script/src/clients/public.d.ts.map +1 -1
  72. package/script/src/clients/public.js +29 -41
  73. package/script/src/clients/wallet.d.ts +200 -26
  74. package/script/src/clients/wallet.d.ts.map +1 -1
  75. package/script/src/clients/wallet.js +305 -283
  76. package/script/src/signing.d.ts +80 -5
  77. package/script/src/signing.d.ts.map +1 -1
  78. package/script/src/signing.js +148 -58
  79. package/script/src/transports/base.d.ts +49 -0
  80. package/script/src/transports/base.d.ts.map +1 -0
  81. package/script/src/transports/base.js +22 -0
  82. package/script/src/transports/http/http_transport.d.ts +8 -5
  83. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  84. package/script/src/transports/http/http_transport.js +16 -63
  85. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +36 -39
  86. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  87. package/script/src/transports/websocket/_reconnecting_websocket.d.ts +18 -25
  88. package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  89. package/script/src/transports/websocket/_reconnecting_websocket.js +81 -180
  90. package/{esm/src/transports/websocket/_websocket_request_dispatcher.d.ts → script/src/transports/websocket/_websocket_async_request.d.ts} +14 -18
  91. package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -0
  92. package/script/src/transports/websocket/{_websocket_request_dispatcher.js → _websocket_async_request.js} +45 -78
  93. package/script/src/transports/websocket/websocket_transport.d.ts +38 -28
  94. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  95. package/script/src/transports/websocket/websocket_transport.js +63 -78
  96. package/script/src/types/exchange/requests.d.ts +278 -66
  97. package/script/src/types/exchange/requests.d.ts.map +1 -1
  98. package/script/src/types/info/assets.d.ts +0 -48
  99. package/script/src/types/info/assets.d.ts.map +1 -1
  100. package/script/src/types/info/markets.d.ts +52 -0
  101. package/script/src/types/info/markets.d.ts.map +1 -0
  102. package/script/{deps/jsr.io/@noble/hashes/1.8.0/src/crypto.js → src/types/info/markets.js} +0 -2
  103. package/script/src/types/info/orders.d.ts +1 -1
  104. package/script/src/types/info/orders.d.ts.map +1 -1
  105. package/script/src/types/info/requests.d.ts +14 -5
  106. package/script/src/types/info/requests.d.ts.map +1 -1
  107. package/script/src/types/mod.d.ts +4 -0
  108. package/script/src/types/mod.d.ts.map +1 -1
  109. package/script/src/types/mod.js +25 -22
  110. package/script/src/types/subscriptions/requests.d.ts +2 -0
  111. package/script/src/types/subscriptions/requests.d.ts.map +1 -1
  112. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts +0 -55
  113. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +0 -1
  114. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.js +0 -66
  115. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts +0 -2
  116. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts.map +0 -1
  117. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.js +0 -1
  118. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts +0 -53
  119. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +0 -1
  120. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.js +0 -294
  121. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts +0 -161
  122. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +0 -1
  123. package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.js +0 -280
  124. package/esm/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +0 -1
  125. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts +0 -55
  126. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +0 -1
  127. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.js +0 -99
  128. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts +0 -2
  129. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts.map +0 -1
  130. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts +0 -53
  131. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +0 -1
  132. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.js +0 -309
  133. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts +0 -161
  134. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +0 -1
  135. package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.js +0 -322
  136. package/script/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +0 -1
@@ -1,322 +0,0 @@
1
- /**
2
- * Utilities for hex, bytes, CSPRNG.
3
- * @module
4
- */
5
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
- (function (factory) {
7
- if (typeof module === "object" && typeof module.exports === "object") {
8
- var v = factory(require, exports);
9
- if (v !== undefined) module.exports = v;
10
- }
11
- else if (typeof define === "function" && define.amd) {
12
- define(["require", "exports", "./crypto.js"], factory);
13
- }
14
- })(function (require, exports) {
15
- "use strict";
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
18
- exports.isBytes = isBytes;
19
- exports.anumber = anumber;
20
- exports.abytes = abytes;
21
- exports.ahash = ahash;
22
- exports.aexists = aexists;
23
- exports.aoutput = aoutput;
24
- exports.u8 = u8;
25
- exports.u32 = u32;
26
- exports.clean = clean;
27
- exports.createView = createView;
28
- exports.rotr = rotr;
29
- exports.rotl = rotl;
30
- exports.byteSwap = byteSwap;
31
- exports.byteSwap32 = byteSwap32;
32
- exports.bytesToHex = bytesToHex;
33
- exports.hexToBytes = hexToBytes;
34
- exports.asyncLoop = asyncLoop;
35
- exports.utf8ToBytes = utf8ToBytes;
36
- exports.bytesToUtf8 = bytesToUtf8;
37
- exports.toBytes = toBytes;
38
- exports.kdfInputToBytes = kdfInputToBytes;
39
- exports.concatBytes = concatBytes;
40
- exports.checkOpts = checkOpts;
41
- exports.createHasher = createHasher;
42
- exports.createOptHasher = createOptHasher;
43
- exports.createXOFer = createXOFer;
44
- exports.randomBytes = randomBytes;
45
- // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
46
- // node.js versions earlier than v19 don't declare it in global scope.
47
- // For node.js, package.json#exports field mapping rewrites import
48
- // from `crypto` to `cryptoNode`, which imports native module.
49
- // Makes the utils un-importable in browsers without a bundler.
50
- // Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
51
- const crypto_js_1 = require("./crypto.js");
52
- /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
53
- function isBytes(a) {
54
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
55
- }
56
- /** Asserts something is positive integer. */
57
- function anumber(n) {
58
- if (!Number.isSafeInteger(n) || n < 0)
59
- throw new Error('positive integer expected, got ' + n);
60
- }
61
- /** Asserts something is Uint8Array. */
62
- function abytes(b, ...lengths) {
63
- if (!isBytes(b))
64
- throw new Error('Uint8Array expected');
65
- if (lengths.length > 0 && !lengths.includes(b.length))
66
- throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
67
- }
68
- /** Asserts something is hash */
69
- function ahash(h) {
70
- if (typeof h !== 'function' || typeof h.create !== 'function')
71
- throw new Error('Hash should be wrapped by utils.createHasher');
72
- anumber(h.outputLen);
73
- anumber(h.blockLen);
74
- }
75
- /** Asserts a hash instance has not been destroyed / finished */
76
- function aexists(instance, checkFinished = true) {
77
- if (instance.destroyed)
78
- throw new Error('Hash instance has been destroyed');
79
- if (checkFinished && instance.finished)
80
- throw new Error('Hash#digest() has already been called');
81
- }
82
- /** Asserts output is properly-sized byte array */
83
- function aoutput(out, instance) {
84
- abytes(out);
85
- const min = instance.outputLen;
86
- if (out.length < min) {
87
- throw new Error('digestInto() expects output buffer of length at least ' + min);
88
- }
89
- }
90
- /** Cast u8 / u16 / u32 to u8. */
91
- function u8(arr) {
92
- return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
93
- }
94
- /** Cast u8 / u16 / u32 to u32. */
95
- function u32(arr) {
96
- return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
97
- }
98
- /** Zeroize a byte array. Warning: JS provides no guarantees. */
99
- function clean(...arrays) {
100
- for (let i = 0; i < arrays.length; i++) {
101
- arrays[i].fill(0);
102
- }
103
- }
104
- /** Create DataView of an array for easy byte-level manipulation. */
105
- function createView(arr) {
106
- return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
107
- }
108
- /** The rotate right (circular right shift) operation for uint32 */
109
- function rotr(word, shift) {
110
- return (word << (32 - shift)) | (word >>> shift);
111
- }
112
- /** The rotate left (circular left shift) operation for uint32 */
113
- function rotl(word, shift) {
114
- return (word << shift) | ((word >>> (32 - shift)) >>> 0);
115
- }
116
- /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
117
- exports.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
118
- /** The byte swap operation for uint32 */
119
- function byteSwap(word) {
120
- return (((word << 24) & 0xff000000) |
121
- ((word << 8) & 0xff0000) |
122
- ((word >>> 8) & 0xff00) |
123
- ((word >>> 24) & 0xff));
124
- }
125
- /** Conditionally byte swap if on a big-endian platform */
126
- exports.swap8IfBE = exports.isLE
127
- ? (n) => n
128
- : (n) => byteSwap(n);
129
- /** @deprecated */
130
- exports.byteSwapIfBE = exports.swap8IfBE;
131
- /** In place byte swap for Uint32Array */
132
- function byteSwap32(arr) {
133
- for (let i = 0; i < arr.length; i++) {
134
- arr[i] = byteSwap(arr[i]);
135
- }
136
- return arr;
137
- }
138
- exports.swap32IfBE = exports.isLE
139
- ? (u) => u
140
- : byteSwap32;
141
- // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
142
- const hasHexBuiltin = /* @__PURE__ */ (() =>
143
- // @ts-ignore
144
- typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
145
- // Array where index 0xf0 (240) is mapped to string 'f0'
146
- const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
147
- /**
148
- * Convert byte array to hex string. Uses built-in function, when available.
149
- * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
150
- */
151
- function bytesToHex(bytes) {
152
- abytes(bytes);
153
- // @ts-ignore
154
- if (hasHexBuiltin)
155
- return bytes.toHex();
156
- // pre-caching improves the speed 6x
157
- let hex = '';
158
- for (let i = 0; i < bytes.length; i++) {
159
- hex += hexes[bytes[i]];
160
- }
161
- return hex;
162
- }
163
- // We use optimized technique to convert hex string to byte array
164
- const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
165
- function asciiToBase16(ch) {
166
- if (ch >= asciis._0 && ch <= asciis._9)
167
- return ch - asciis._0; // '2' => 50-48
168
- if (ch >= asciis.A && ch <= asciis.F)
169
- return ch - (asciis.A - 10); // 'B' => 66-(65-10)
170
- if (ch >= asciis.a && ch <= asciis.f)
171
- return ch - (asciis.a - 10); // 'b' => 98-(97-10)
172
- return;
173
- }
174
- /**
175
- * Convert hex string to byte array. Uses built-in function, when available.
176
- * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
177
- */
178
- function hexToBytes(hex) {
179
- if (typeof hex !== 'string')
180
- throw new Error('hex string expected, got ' + typeof hex);
181
- // @ts-ignore
182
- if (hasHexBuiltin)
183
- return Uint8Array.fromHex(hex);
184
- const hl = hex.length;
185
- const al = hl / 2;
186
- if (hl % 2)
187
- throw new Error('hex string expected, got unpadded hex of length ' + hl);
188
- const array = new Uint8Array(al);
189
- for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
190
- const n1 = asciiToBase16(hex.charCodeAt(hi));
191
- const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
192
- if (n1 === undefined || n2 === undefined) {
193
- const char = hex[hi] + hex[hi + 1];
194
- throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
195
- }
196
- array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
197
- }
198
- return array;
199
- }
200
- /**
201
- * There is no setImmediate in browser and setTimeout is slow.
202
- * Call of async fn will return Promise, which will be fullfiled only on
203
- * next scheduler queue processing step and this is exactly what we need.
204
- */
205
- const nextTick = async () => { };
206
- exports.nextTick = nextTick;
207
- /** Returns control to thread each 'tick' ms to avoid blocking. */
208
- async function asyncLoop(iters, tick, cb) {
209
- let ts = Date.now();
210
- for (let i = 0; i < iters; i++) {
211
- cb(i);
212
- // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
213
- const diff = Date.now() - ts;
214
- if (diff >= 0 && diff < tick)
215
- continue;
216
- await (0, exports.nextTick)();
217
- ts += diff;
218
- }
219
- }
220
- /**
221
- * Converts string to bytes using UTF8 encoding.
222
- * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
223
- */
224
- function utf8ToBytes(str) {
225
- if (typeof str !== 'string')
226
- throw new Error('string expected');
227
- return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
228
- }
229
- /**
230
- * Converts bytes to string using UTF8 encoding.
231
- * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
232
- */
233
- function bytesToUtf8(bytes) {
234
- return new TextDecoder().decode(bytes);
235
- }
236
- /**
237
- * Normalizes (non-hex) string or Uint8Array to Uint8Array.
238
- * Warning: when Uint8Array is passed, it would NOT get copied.
239
- * Keep in mind for future mutable operations.
240
- */
241
- function toBytes(data) {
242
- if (typeof data === 'string')
243
- data = utf8ToBytes(data);
244
- abytes(data);
245
- return data;
246
- }
247
- /**
248
- * Helper for KDFs: consumes uint8array or string.
249
- * When string is passed, does utf8 decoding, using TextDecoder.
250
- */
251
- function kdfInputToBytes(data) {
252
- if (typeof data === 'string')
253
- data = utf8ToBytes(data);
254
- abytes(data);
255
- return data;
256
- }
257
- /** Copies several Uint8Arrays into one. */
258
- function concatBytes(...arrays) {
259
- let sum = 0;
260
- for (let i = 0; i < arrays.length; i++) {
261
- const a = arrays[i];
262
- abytes(a);
263
- sum += a.length;
264
- }
265
- const res = new Uint8Array(sum);
266
- for (let i = 0, pad = 0; i < arrays.length; i++) {
267
- const a = arrays[i];
268
- res.set(a, pad);
269
- pad += a.length;
270
- }
271
- return res;
272
- }
273
- function checkOpts(defaults, opts) {
274
- if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
275
- throw new Error('options should be object or undefined');
276
- const merged = Object.assign(defaults, opts);
277
- return merged;
278
- }
279
- /** For runtime check if class implements interface */
280
- class Hash {
281
- }
282
- exports.Hash = Hash;
283
- /** Wraps hash function, creating an interface on top of it */
284
- function createHasher(hashCons) {
285
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
286
- const tmp = hashCons();
287
- hashC.outputLen = tmp.outputLen;
288
- hashC.blockLen = tmp.blockLen;
289
- hashC.create = () => hashCons();
290
- return hashC;
291
- }
292
- function createOptHasher(hashCons) {
293
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
294
- const tmp = hashCons({});
295
- hashC.outputLen = tmp.outputLen;
296
- hashC.blockLen = tmp.blockLen;
297
- hashC.create = (opts) => hashCons(opts);
298
- return hashC;
299
- }
300
- function createXOFer(hashCons) {
301
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
302
- const tmp = hashCons({});
303
- hashC.outputLen = tmp.outputLen;
304
- hashC.blockLen = tmp.blockLen;
305
- hashC.create = (opts) => hashCons(opts);
306
- return hashC;
307
- }
308
- exports.wrapConstructor = createHasher;
309
- exports.wrapConstructorWithOpts = createOptHasher;
310
- exports.wrapXOFConstructorWithOpts = createXOFer;
311
- /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
312
- function randomBytes(bytesLength = 32) {
313
- if (crypto_js_1.crypto && typeof crypto_js_1.crypto.getRandomValues === 'function') {
314
- return crypto_js_1.crypto.getRandomValues(new Uint8Array(bytesLength));
315
- }
316
- // Legacy Node.js compatibility
317
- if (crypto_js_1.crypto && typeof crypto_js_1.crypto.randomBytes === 'function') {
318
- return Uint8Array.from(crypto_js_1.crypto.randomBytes(bytesLength));
319
- }
320
- throw new Error('crypto.getRandomValues must be defined');
321
- }
322
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"_websocket_request_dispatcher.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/_websocket_request_dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAY7E;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;gBACzC,OAAO,EAAE,MAAM;CAI9B;AAED;;;GAGG;AACH,qBAAa,0BAA0B;IAkBvB,OAAO,CAAC,MAAM;IAjB1B,gCAAgC;IAChC,OAAO,CAAC,MAAM,CAAa;IAE3B,oDAAoD;IACpD,OAAO,CAAC,OAAO,CAMD;IAEd;;;;OAIG;gBACiB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB;IAwDvE;;;;;;OAMG;IACG,OAAO,CACT,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,EAC5C,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC;IAoCnB;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAK7C"}