@solana/web3.js 1.54.0 → 1.54.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.
package/lib/index.esm.js CHANGED
@@ -1,1756 +1,67 @@
1
- import nacl from 'tweetnacl';
2
1
  import { Buffer } from 'buffer';
2
+ import { sha512 } from '@noble/hashes/sha512';
3
+ import * as ed25519 from '@noble/ed25519';
3
4
  import BN from 'bn.js';
4
5
  import bs58 from 'bs58';
6
+ import { sha256 } from '@noble/hashes/sha256';
5
7
  import { serialize, deserialize, deserializeUnchecked } from 'borsh';
6
8
  import * as BufferLayout from '@solana/buffer-layout';
7
9
  import { blob } from '@solana/buffer-layout';
8
10
  import { toBigIntLE, toBufferLE } from 'bigint-buffer';
9
- import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$7 } from 'superstruct';
11
+ import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$1 } from 'superstruct';
10
12
  import { Client } from 'rpc-websockets';
11
13
  import RpcClient from 'jayson/lib/client/browser';
12
14
  import http from 'http';
13
15
  import https from 'https';
14
16
  import * as nodeFetch from 'node-fetch';
15
- import secp256k1 from 'secp256k1';
16
17
  import sha3 from 'js-sha3';
18
+ import { hmac } from '@noble/hashes/hmac';
19
+ import * as secp256k1 from '@noble/secp256k1';
17
20
 
18
- const toBuffer = arr => {
19
- if (Buffer.isBuffer(arr)) {
20
- return arr;
21
- } else if (arr instanceof Uint8Array) {
22
- return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);
23
- } else {
24
- return Buffer.from(arr);
25
- }
26
- };
27
-
28
- var hash$1 = {};
29
-
30
- var utils$9 = {};
31
-
32
- var minimalisticAssert = assert$6;
21
+ /**
22
+ * A 64 byte secret key, the first 32 bytes of which is the
23
+ * private scalar and the last 32 bytes is the public key.
24
+ * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
25
+ */
33
26
 
34
- function assert$6(val, msg) {
35
- if (!val)
36
- throw new Error(msg || 'Assertion failed');
37
- }
27
+ ed25519.utils.sha512Sync = (...m) => sha512(ed25519.utils.concatBytes(...m));
38
28
 
39
- assert$6.equal = function assertEqual(l, r, msg) {
40
- if (l != r)
41
- throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
29
+ const generatePrivateKey = ed25519.utils.randomPrivateKey;
30
+ const generateKeypair = () => {
31
+ const privateScalar = ed25519.utils.randomPrivateKey();
32
+ const publicKey = getPublicKey(privateScalar);
33
+ const secretKey = new Uint8Array(64);
34
+ secretKey.set(privateScalar);
35
+ secretKey.set(publicKey, 32);
36
+ return {
37
+ publicKey,
38
+ secretKey
39
+ };
42
40
  };
43
-
44
- var inherits$1 = {exports: {}};
45
-
46
- var inherits_browser = {exports: {}};
47
-
48
- var hasRequiredInherits_browser;
49
-
50
- function requireInherits_browser () {
51
- if (hasRequiredInherits_browser) return inherits_browser.exports;
52
- hasRequiredInherits_browser = 1;
53
- if (typeof Object.create === 'function') {
54
- // implementation from standard node.js 'util' module
55
- inherits_browser.exports = function inherits(ctor, superCtor) {
56
- if (superCtor) {
57
- ctor.super_ = superCtor;
58
- ctor.prototype = Object.create(superCtor.prototype, {
59
- constructor: {
60
- value: ctor,
61
- enumerable: false,
62
- writable: true,
63
- configurable: true
64
- }
65
- });
66
- }
67
- };
68
- } else {
69
- // old school shim for old browsers
70
- inherits_browser.exports = function inherits(ctor, superCtor) {
71
- if (superCtor) {
72
- ctor.super_ = superCtor;
73
- var TempCtor = function () {};
74
- TempCtor.prototype = superCtor.prototype;
75
- ctor.prototype = new TempCtor();
76
- ctor.prototype.constructor = ctor;
77
- }
78
- };
79
- }
80
- return inherits_browser.exports;
81
- }
82
-
83
- (function (module) {
84
- try {
85
- var util = require('util');
86
- /* istanbul ignore next */
87
- if (typeof util.inherits !== 'function') throw '';
88
- module.exports = util.inherits;
89
- } catch (e) {
90
- /* istanbul ignore next */
91
- module.exports = requireInherits_browser();
92
- }
93
- } (inherits$1));
94
-
95
- var assert$5 = minimalisticAssert;
96
- var inherits = inherits$1.exports;
97
-
98
- utils$9.inherits = inherits;
99
-
100
- function isSurrogatePair(msg, i) {
101
- if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
102
- return false;
103
- }
104
- if (i < 0 || i + 1 >= msg.length) {
41
+ const getPublicKey = ed25519.sync.getPublicKey;
42
+ function isOnCurve(publicKey) {
43
+ try {
44
+ ed25519.Point.fromHex(publicKey, true
45
+ /* strict */
46
+ );
47
+ return true;
48
+ } catch {
105
49
  return false;
106
50
  }
107
- return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
108
- }
109
-
110
- function toArray(msg, enc) {
111
- if (Array.isArray(msg))
112
- return msg.slice();
113
- if (!msg)
114
- return [];
115
- var res = [];
116
- if (typeof msg === 'string') {
117
- if (!enc) {
118
- // Inspired by stringToUtf8ByteArray() in closure-library by Google
119
- // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
120
- // Apache License 2.0
121
- // https://github.com/google/closure-library/blob/master/LICENSE
122
- var p = 0;
123
- for (var i = 0; i < msg.length; i++) {
124
- var c = msg.charCodeAt(i);
125
- if (c < 128) {
126
- res[p++] = c;
127
- } else if (c < 2048) {
128
- res[p++] = (c >> 6) | 192;
129
- res[p++] = (c & 63) | 128;
130
- } else if (isSurrogatePair(msg, i)) {
131
- c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
132
- res[p++] = (c >> 18) | 240;
133
- res[p++] = ((c >> 12) & 63) | 128;
134
- res[p++] = ((c >> 6) & 63) | 128;
135
- res[p++] = (c & 63) | 128;
136
- } else {
137
- res[p++] = (c >> 12) | 224;
138
- res[p++] = ((c >> 6) & 63) | 128;
139
- res[p++] = (c & 63) | 128;
140
- }
141
- }
142
- } else if (enc === 'hex') {
143
- msg = msg.replace(/[^a-z0-9]+/ig, '');
144
- if (msg.length % 2 !== 0)
145
- msg = '0' + msg;
146
- for (i = 0; i < msg.length; i += 2)
147
- res.push(parseInt(msg[i] + msg[i + 1], 16));
148
- }
149
- } else {
150
- for (i = 0; i < msg.length; i++)
151
- res[i] = msg[i] | 0;
152
- }
153
- return res;
154
- }
155
- utils$9.toArray = toArray;
156
-
157
- function toHex(msg) {
158
- var res = '';
159
- for (var i = 0; i < msg.length; i++)
160
- res += zero2(msg[i].toString(16));
161
- return res;
162
- }
163
- utils$9.toHex = toHex;
164
-
165
- function htonl(w) {
166
- var res = (w >>> 24) |
167
- ((w >>> 8) & 0xff00) |
168
- ((w << 8) & 0xff0000) |
169
- ((w & 0xff) << 24);
170
- return res >>> 0;
171
- }
172
- utils$9.htonl = htonl;
173
-
174
- function toHex32(msg, endian) {
175
- var res = '';
176
- for (var i = 0; i < msg.length; i++) {
177
- var w = msg[i];
178
- if (endian === 'little')
179
- w = htonl(w);
180
- res += zero8(w.toString(16));
181
- }
182
- return res;
183
- }
184
- utils$9.toHex32 = toHex32;
185
-
186
- function zero2(word) {
187
- if (word.length === 1)
188
- return '0' + word;
189
- else
190
- return word;
191
- }
192
- utils$9.zero2 = zero2;
193
-
194
- function zero8(word) {
195
- if (word.length === 7)
196
- return '0' + word;
197
- else if (word.length === 6)
198
- return '00' + word;
199
- else if (word.length === 5)
200
- return '000' + word;
201
- else if (word.length === 4)
202
- return '0000' + word;
203
- else if (word.length === 3)
204
- return '00000' + word;
205
- else if (word.length === 2)
206
- return '000000' + word;
207
- else if (word.length === 1)
208
- return '0000000' + word;
209
- else
210
- return word;
211
- }
212
- utils$9.zero8 = zero8;
213
-
214
- function join32(msg, start, end, endian) {
215
- var len = end - start;
216
- assert$5(len % 4 === 0);
217
- var res = new Array(len / 4);
218
- for (var i = 0, k = start; i < res.length; i++, k += 4) {
219
- var w;
220
- if (endian === 'big')
221
- w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
222
- else
223
- w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
224
- res[i] = w >>> 0;
225
- }
226
- return res;
227
- }
228
- utils$9.join32 = join32;
229
-
230
- function split32(msg, endian) {
231
- var res = new Array(msg.length * 4);
232
- for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
233
- var m = msg[i];
234
- if (endian === 'big') {
235
- res[k] = m >>> 24;
236
- res[k + 1] = (m >>> 16) & 0xff;
237
- res[k + 2] = (m >>> 8) & 0xff;
238
- res[k + 3] = m & 0xff;
239
- } else {
240
- res[k + 3] = m >>> 24;
241
- res[k + 2] = (m >>> 16) & 0xff;
242
- res[k + 1] = (m >>> 8) & 0xff;
243
- res[k] = m & 0xff;
244
- }
245
- }
246
- return res;
247
51
  }
248
- utils$9.split32 = split32;
249
-
250
- function rotr32$1(w, b) {
251
- return (w >>> b) | (w << (32 - b));
252
- }
253
- utils$9.rotr32 = rotr32$1;
254
-
255
- function rotl32$2(w, b) {
256
- return (w << b) | (w >>> (32 - b));
257
- }
258
- utils$9.rotl32 = rotl32$2;
259
-
260
- function sum32$3(a, b) {
261
- return (a + b) >>> 0;
262
- }
263
- utils$9.sum32 = sum32$3;
264
-
265
- function sum32_3$1(a, b, c) {
266
- return (a + b + c) >>> 0;
267
- }
268
- utils$9.sum32_3 = sum32_3$1;
269
-
270
- function sum32_4$2(a, b, c, d) {
271
- return (a + b + c + d) >>> 0;
272
- }
273
- utils$9.sum32_4 = sum32_4$2;
274
-
275
- function sum32_5$2(a, b, c, d, e) {
276
- return (a + b + c + d + e) >>> 0;
277
- }
278
- utils$9.sum32_5 = sum32_5$2;
279
-
280
- function sum64$1(buf, pos, ah, al) {
281
- var bh = buf[pos];
282
- var bl = buf[pos + 1];
283
-
284
- var lo = (al + bl) >>> 0;
285
- var hi = (lo < al ? 1 : 0) + ah + bh;
286
- buf[pos] = hi >>> 0;
287
- buf[pos + 1] = lo;
288
- }
289
- utils$9.sum64 = sum64$1;
290
-
291
- function sum64_hi$1(ah, al, bh, bl) {
292
- var lo = (al + bl) >>> 0;
293
- var hi = (lo < al ? 1 : 0) + ah + bh;
294
- return hi >>> 0;
295
- }
296
- utils$9.sum64_hi = sum64_hi$1;
297
-
298
- function sum64_lo$1(ah, al, bh, bl) {
299
- var lo = al + bl;
300
- return lo >>> 0;
301
- }
302
- utils$9.sum64_lo = sum64_lo$1;
303
-
304
- function sum64_4_hi$1(ah, al, bh, bl, ch, cl, dh, dl) {
305
- var carry = 0;
306
- var lo = al;
307
- lo = (lo + bl) >>> 0;
308
- carry += lo < al ? 1 : 0;
309
- lo = (lo + cl) >>> 0;
310
- carry += lo < cl ? 1 : 0;
311
- lo = (lo + dl) >>> 0;
312
- carry += lo < dl ? 1 : 0;
313
-
314
- var hi = ah + bh + ch + dh + carry;
315
- return hi >>> 0;
316
- }
317
- utils$9.sum64_4_hi = sum64_4_hi$1;
318
-
319
- function sum64_4_lo$1(ah, al, bh, bl, ch, cl, dh, dl) {
320
- var lo = al + bl + cl + dl;
321
- return lo >>> 0;
322
- }
323
- utils$9.sum64_4_lo = sum64_4_lo$1;
324
-
325
- function sum64_5_hi$1(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
326
- var carry = 0;
327
- var lo = al;
328
- lo = (lo + bl) >>> 0;
329
- carry += lo < al ? 1 : 0;
330
- lo = (lo + cl) >>> 0;
331
- carry += lo < cl ? 1 : 0;
332
- lo = (lo + dl) >>> 0;
333
- carry += lo < dl ? 1 : 0;
334
- lo = (lo + el) >>> 0;
335
- carry += lo < el ? 1 : 0;
336
-
337
- var hi = ah + bh + ch + dh + eh + carry;
338
- return hi >>> 0;
339
- }
340
- utils$9.sum64_5_hi = sum64_5_hi$1;
341
-
342
- function sum64_5_lo$1(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
343
- var lo = al + bl + cl + dl + el;
344
-
345
- return lo >>> 0;
346
- }
347
- utils$9.sum64_5_lo = sum64_5_lo$1;
348
-
349
- function rotr64_hi$1(ah, al, num) {
350
- var r = (al << (32 - num)) | (ah >>> num);
351
- return r >>> 0;
352
- }
353
- utils$9.rotr64_hi = rotr64_hi$1;
354
-
355
- function rotr64_lo$1(ah, al, num) {
356
- var r = (ah << (32 - num)) | (al >>> num);
357
- return r >>> 0;
358
- }
359
- utils$9.rotr64_lo = rotr64_lo$1;
360
-
361
- function shr64_hi$1(ah, al, num) {
362
- return ah >>> num;
363
- }
364
- utils$9.shr64_hi = shr64_hi$1;
365
-
366
- function shr64_lo$1(ah, al, num) {
367
- var r = (ah << (32 - num)) | (al >>> num);
368
- return r >>> 0;
369
- }
370
- utils$9.shr64_lo = shr64_lo$1;
371
-
372
- var common$5 = {};
373
-
374
- var utils$8 = utils$9;
375
- var assert$4 = minimalisticAssert;
376
-
377
- function BlockHash$4() {
378
- this.pending = null;
379
- this.pendingTotal = 0;
380
- this.blockSize = this.constructor.blockSize;
381
- this.outSize = this.constructor.outSize;
382
- this.hmacStrength = this.constructor.hmacStrength;
383
- this.padLength = this.constructor.padLength / 8;
384
- this.endian = 'big';
385
-
386
- this._delta8 = this.blockSize / 8;
387
- this._delta32 = this.blockSize / 32;
388
- }
389
- common$5.BlockHash = BlockHash$4;
390
-
391
- BlockHash$4.prototype.update = function update(msg, enc) {
392
- // Convert message to array, pad it, and join into 32bit blocks
393
- msg = utils$8.toArray(msg, enc);
394
- if (!this.pending)
395
- this.pending = msg;
396
- else
397
- this.pending = this.pending.concat(msg);
398
- this.pendingTotal += msg.length;
399
-
400
- // Enough data, try updating
401
- if (this.pending.length >= this._delta8) {
402
- msg = this.pending;
403
-
404
- // Process pending data in blocks
405
- var r = msg.length % this._delta8;
406
- this.pending = msg.slice(msg.length - r, msg.length);
407
- if (this.pending.length === 0)
408
- this.pending = null;
409
-
410
- msg = utils$8.join32(msg, 0, msg.length - r, this.endian);
411
- for (var i = 0; i < msg.length; i += this._delta32)
412
- this._update(msg, i, i + this._delta32);
413
- }
414
-
415
- return this;
416
- };
417
-
418
- BlockHash$4.prototype.digest = function digest(enc) {
419
- this.update(this._pad());
420
- assert$4(this.pending === null);
421
-
422
- return this._digest(enc);
423
- };
52
+ const sign = (message, secretKey) => ed25519.sync.sign(message, secretKey.slice(0, 32));
53
+ const verify = ed25519.sync.verify;
424
54
 
425
- BlockHash$4.prototype._pad = function pad() {
426
- var len = this.pendingTotal;
427
- var bytes = this._delta8;
428
- var k = bytes - ((len + this.padLength) % bytes);
429
- var res = new Array(k + this.padLength);
430
- res[0] = 0x80;
431
- for (var i = 1; i < k; i++)
432
- res[i] = 0;
433
-
434
- // Append length
435
- len <<= 3;
436
- if (this.endian === 'big') {
437
- for (var t = 8; t < this.padLength; t++)
438
- res[i++] = 0;
439
-
440
- res[i++] = 0;
441
- res[i++] = 0;
442
- res[i++] = 0;
443
- res[i++] = 0;
444
- res[i++] = (len >>> 24) & 0xff;
445
- res[i++] = (len >>> 16) & 0xff;
446
- res[i++] = (len >>> 8) & 0xff;
447
- res[i++] = len & 0xff;
55
+ const toBuffer = arr => {
56
+ if (Buffer.isBuffer(arr)) {
57
+ return arr;
58
+ } else if (arr instanceof Uint8Array) {
59
+ return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);
448
60
  } else {
449
- res[i++] = len & 0xff;
450
- res[i++] = (len >>> 8) & 0xff;
451
- res[i++] = (len >>> 16) & 0xff;
452
- res[i++] = (len >>> 24) & 0xff;
453
- res[i++] = 0;
454
- res[i++] = 0;
455
- res[i++] = 0;
456
- res[i++] = 0;
457
-
458
- for (t = 8; t < this.padLength; t++)
459
- res[i++] = 0;
460
- }
461
-
462
- return res;
463
- };
464
-
465
- var sha = {};
466
-
467
- var common$4 = {};
468
-
469
- var utils$7 = utils$9;
470
- var rotr32 = utils$7.rotr32;
471
-
472
- function ft_1$1(s, x, y, z) {
473
- if (s === 0)
474
- return ch32$1(x, y, z);
475
- if (s === 1 || s === 3)
476
- return p32(x, y, z);
477
- if (s === 2)
478
- return maj32$1(x, y, z);
479
- }
480
- common$4.ft_1 = ft_1$1;
481
-
482
- function ch32$1(x, y, z) {
483
- return (x & y) ^ ((~x) & z);
484
- }
485
- common$4.ch32 = ch32$1;
486
-
487
- function maj32$1(x, y, z) {
488
- return (x & y) ^ (x & z) ^ (y & z);
489
- }
490
- common$4.maj32 = maj32$1;
491
-
492
- function p32(x, y, z) {
493
- return x ^ y ^ z;
494
- }
495
- common$4.p32 = p32;
496
-
497
- function s0_256$1(x) {
498
- return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
499
- }
500
- common$4.s0_256 = s0_256$1;
501
-
502
- function s1_256$1(x) {
503
- return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
504
- }
505
- common$4.s1_256 = s1_256$1;
506
-
507
- function g0_256$1(x) {
508
- return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
509
- }
510
- common$4.g0_256 = g0_256$1;
511
-
512
- function g1_256$1(x) {
513
- return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
514
- }
515
- common$4.g1_256 = g1_256$1;
516
-
517
- var utils$6 = utils$9;
518
- var common$3 = common$5;
519
- var shaCommon$1 = common$4;
520
-
521
- var rotl32$1 = utils$6.rotl32;
522
- var sum32$2 = utils$6.sum32;
523
- var sum32_5$1 = utils$6.sum32_5;
524
- var ft_1 = shaCommon$1.ft_1;
525
- var BlockHash$3 = common$3.BlockHash;
526
-
527
- var sha1_K = [
528
- 0x5A827999, 0x6ED9EBA1,
529
- 0x8F1BBCDC, 0xCA62C1D6
530
- ];
531
-
532
- function SHA1() {
533
- if (!(this instanceof SHA1))
534
- return new SHA1();
535
-
536
- BlockHash$3.call(this);
537
- this.h = [
538
- 0x67452301, 0xefcdab89, 0x98badcfe,
539
- 0x10325476, 0xc3d2e1f0 ];
540
- this.W = new Array(80);
541
- }
542
-
543
- utils$6.inherits(SHA1, BlockHash$3);
544
- var _1 = SHA1;
545
-
546
- SHA1.blockSize = 512;
547
- SHA1.outSize = 160;
548
- SHA1.hmacStrength = 80;
549
- SHA1.padLength = 64;
550
-
551
- SHA1.prototype._update = function _update(msg, start) {
552
- var W = this.W;
553
-
554
- for (var i = 0; i < 16; i++)
555
- W[i] = msg[start + i];
556
-
557
- for(; i < W.length; i++)
558
- W[i] = rotl32$1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
559
-
560
- var a = this.h[0];
561
- var b = this.h[1];
562
- var c = this.h[2];
563
- var d = this.h[3];
564
- var e = this.h[4];
565
-
566
- for (i = 0; i < W.length; i++) {
567
- var s = ~~(i / 20);
568
- var t = sum32_5$1(rotl32$1(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
569
- e = d;
570
- d = c;
571
- c = rotl32$1(b, 30);
572
- b = a;
573
- a = t;
574
- }
575
-
576
- this.h[0] = sum32$2(this.h[0], a);
577
- this.h[1] = sum32$2(this.h[1], b);
578
- this.h[2] = sum32$2(this.h[2], c);
579
- this.h[3] = sum32$2(this.h[3], d);
580
- this.h[4] = sum32$2(this.h[4], e);
581
- };
582
-
583
- SHA1.prototype._digest = function digest(enc) {
584
- if (enc === 'hex')
585
- return utils$6.toHex32(this.h, 'big');
586
- else
587
- return utils$6.split32(this.h, 'big');
588
- };
589
-
590
- var utils$5 = utils$9;
591
- var common$2 = common$5;
592
- var shaCommon = common$4;
593
- var assert$3 = minimalisticAssert;
594
-
595
- var sum32$1 = utils$5.sum32;
596
- var sum32_4$1 = utils$5.sum32_4;
597
- var sum32_5 = utils$5.sum32_5;
598
- var ch32 = shaCommon.ch32;
599
- var maj32 = shaCommon.maj32;
600
- var s0_256 = shaCommon.s0_256;
601
- var s1_256 = shaCommon.s1_256;
602
- var g0_256 = shaCommon.g0_256;
603
- var g1_256 = shaCommon.g1_256;
604
-
605
- var BlockHash$2 = common$2.BlockHash;
606
-
607
- var sha256_K = [
608
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
609
- 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
610
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
611
- 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
612
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
613
- 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
614
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
615
- 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
616
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
617
- 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
618
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
619
- 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
620
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
621
- 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
622
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
623
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
624
- ];
625
-
626
- function SHA256$1() {
627
- if (!(this instanceof SHA256$1))
628
- return new SHA256$1();
629
-
630
- BlockHash$2.call(this);
631
- this.h = [
632
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
633
- 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
634
- ];
635
- this.k = sha256_K;
636
- this.W = new Array(64);
637
- }
638
- utils$5.inherits(SHA256$1, BlockHash$2);
639
- var _256 = SHA256$1;
640
-
641
- SHA256$1.blockSize = 512;
642
- SHA256$1.outSize = 256;
643
- SHA256$1.hmacStrength = 192;
644
- SHA256$1.padLength = 64;
645
-
646
- SHA256$1.prototype._update = function _update(msg, start) {
647
- var W = this.W;
648
-
649
- for (var i = 0; i < 16; i++)
650
- W[i] = msg[start + i];
651
- for (; i < W.length; i++)
652
- W[i] = sum32_4$1(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
653
-
654
- var a = this.h[0];
655
- var b = this.h[1];
656
- var c = this.h[2];
657
- var d = this.h[3];
658
- var e = this.h[4];
659
- var f = this.h[5];
660
- var g = this.h[6];
661
- var h = this.h[7];
662
-
663
- assert$3(this.k.length === W.length);
664
- for (i = 0; i < W.length; i++) {
665
- var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
666
- var T2 = sum32$1(s0_256(a), maj32(a, b, c));
667
- h = g;
668
- g = f;
669
- f = e;
670
- e = sum32$1(d, T1);
671
- d = c;
672
- c = b;
673
- b = a;
674
- a = sum32$1(T1, T2);
675
- }
676
-
677
- this.h[0] = sum32$1(this.h[0], a);
678
- this.h[1] = sum32$1(this.h[1], b);
679
- this.h[2] = sum32$1(this.h[2], c);
680
- this.h[3] = sum32$1(this.h[3], d);
681
- this.h[4] = sum32$1(this.h[4], e);
682
- this.h[5] = sum32$1(this.h[5], f);
683
- this.h[6] = sum32$1(this.h[6], g);
684
- this.h[7] = sum32$1(this.h[7], h);
685
- };
686
-
687
- SHA256$1.prototype._digest = function digest(enc) {
688
- if (enc === 'hex')
689
- return utils$5.toHex32(this.h, 'big');
690
- else
691
- return utils$5.split32(this.h, 'big');
692
- };
693
-
694
- var utils$4 = utils$9;
695
- var SHA256 = _256;
696
-
697
- function SHA224() {
698
- if (!(this instanceof SHA224))
699
- return new SHA224();
700
-
701
- SHA256.call(this);
702
- this.h = [
703
- 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
704
- 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
705
- }
706
- utils$4.inherits(SHA224, SHA256);
707
- var _224 = SHA224;
708
-
709
- SHA224.blockSize = 512;
710
- SHA224.outSize = 224;
711
- SHA224.hmacStrength = 192;
712
- SHA224.padLength = 64;
713
-
714
- SHA224.prototype._digest = function digest(enc) {
715
- // Just truncate output
716
- if (enc === 'hex')
717
- return utils$4.toHex32(this.h.slice(0, 7), 'big');
718
- else
719
- return utils$4.split32(this.h.slice(0, 7), 'big');
720
- };
721
-
722
- var utils$3 = utils$9;
723
- var common$1 = common$5;
724
- var assert$2 = minimalisticAssert;
725
-
726
- var rotr64_hi = utils$3.rotr64_hi;
727
- var rotr64_lo = utils$3.rotr64_lo;
728
- var shr64_hi = utils$3.shr64_hi;
729
- var shr64_lo = utils$3.shr64_lo;
730
- var sum64 = utils$3.sum64;
731
- var sum64_hi = utils$3.sum64_hi;
732
- var sum64_lo = utils$3.sum64_lo;
733
- var sum64_4_hi = utils$3.sum64_4_hi;
734
- var sum64_4_lo = utils$3.sum64_4_lo;
735
- var sum64_5_hi = utils$3.sum64_5_hi;
736
- var sum64_5_lo = utils$3.sum64_5_lo;
737
-
738
- var BlockHash$1 = common$1.BlockHash;
739
-
740
- var sha512_K = [
741
- 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
742
- 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
743
- 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
744
- 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
745
- 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
746
- 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
747
- 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
748
- 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
749
- 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
750
- 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
751
- 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
752
- 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
753
- 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
754
- 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
755
- 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
756
- 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
757
- 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
758
- 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
759
- 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
760
- 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
761
- 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
762
- 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
763
- 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
764
- 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
765
- 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
766
- 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
767
- 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
768
- 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
769
- 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
770
- 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
771
- 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
772
- 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
773
- 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
774
- 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
775
- 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
776
- 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
777
- 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
778
- 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
779
- 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
780
- 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
781
- ];
782
-
783
- function SHA512$1() {
784
- if (!(this instanceof SHA512$1))
785
- return new SHA512$1();
786
-
787
- BlockHash$1.call(this);
788
- this.h = [
789
- 0x6a09e667, 0xf3bcc908,
790
- 0xbb67ae85, 0x84caa73b,
791
- 0x3c6ef372, 0xfe94f82b,
792
- 0xa54ff53a, 0x5f1d36f1,
793
- 0x510e527f, 0xade682d1,
794
- 0x9b05688c, 0x2b3e6c1f,
795
- 0x1f83d9ab, 0xfb41bd6b,
796
- 0x5be0cd19, 0x137e2179 ];
797
- this.k = sha512_K;
798
- this.W = new Array(160);
799
- }
800
- utils$3.inherits(SHA512$1, BlockHash$1);
801
- var _512 = SHA512$1;
802
-
803
- SHA512$1.blockSize = 1024;
804
- SHA512$1.outSize = 512;
805
- SHA512$1.hmacStrength = 192;
806
- SHA512$1.padLength = 128;
807
-
808
- SHA512$1.prototype._prepareBlock = function _prepareBlock(msg, start) {
809
- var W = this.W;
810
-
811
- // 32 x 32bit words
812
- for (var i = 0; i < 32; i++)
813
- W[i] = msg[start + i];
814
- for (; i < W.length; i += 2) {
815
- var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
816
- var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
817
- var c1_hi = W[i - 14]; // i - 7
818
- var c1_lo = W[i - 13];
819
- var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
820
- var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
821
- var c3_hi = W[i - 32]; // i - 16
822
- var c3_lo = W[i - 31];
823
-
824
- W[i] = sum64_4_hi(
825
- c0_hi, c0_lo,
826
- c1_hi, c1_lo,
827
- c2_hi, c2_lo,
828
- c3_hi, c3_lo);
829
- W[i + 1] = sum64_4_lo(
830
- c0_hi, c0_lo,
831
- c1_hi, c1_lo,
832
- c2_hi, c2_lo,
833
- c3_hi, c3_lo);
61
+ return Buffer.from(arr);
834
62
  }
835
63
  };
836
64
 
837
- SHA512$1.prototype._update = function _update(msg, start) {
838
- this._prepareBlock(msg, start);
839
-
840
- var W = this.W;
841
-
842
- var ah = this.h[0];
843
- var al = this.h[1];
844
- var bh = this.h[2];
845
- var bl = this.h[3];
846
- var ch = this.h[4];
847
- var cl = this.h[5];
848
- var dh = this.h[6];
849
- var dl = this.h[7];
850
- var eh = this.h[8];
851
- var el = this.h[9];
852
- var fh = this.h[10];
853
- var fl = this.h[11];
854
- var gh = this.h[12];
855
- var gl = this.h[13];
856
- var hh = this.h[14];
857
- var hl = this.h[15];
858
-
859
- assert$2(this.k.length === W.length);
860
- for (var i = 0; i < W.length; i += 2) {
861
- var c0_hi = hh;
862
- var c0_lo = hl;
863
- var c1_hi = s1_512_hi(eh, el);
864
- var c1_lo = s1_512_lo(eh, el);
865
- var c2_hi = ch64_hi(eh, el, fh, fl, gh);
866
- var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
867
- var c3_hi = this.k[i];
868
- var c3_lo = this.k[i + 1];
869
- var c4_hi = W[i];
870
- var c4_lo = W[i + 1];
871
-
872
- var T1_hi = sum64_5_hi(
873
- c0_hi, c0_lo,
874
- c1_hi, c1_lo,
875
- c2_hi, c2_lo,
876
- c3_hi, c3_lo,
877
- c4_hi, c4_lo);
878
- var T1_lo = sum64_5_lo(
879
- c0_hi, c0_lo,
880
- c1_hi, c1_lo,
881
- c2_hi, c2_lo,
882
- c3_hi, c3_lo,
883
- c4_hi, c4_lo);
884
-
885
- c0_hi = s0_512_hi(ah, al);
886
- c0_lo = s0_512_lo(ah, al);
887
- c1_hi = maj64_hi(ah, al, bh, bl, ch);
888
- c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
889
-
890
- var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
891
- var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
892
-
893
- hh = gh;
894
- hl = gl;
895
-
896
- gh = fh;
897
- gl = fl;
898
-
899
- fh = eh;
900
- fl = el;
901
-
902
- eh = sum64_hi(dh, dl, T1_hi, T1_lo);
903
- el = sum64_lo(dl, dl, T1_hi, T1_lo);
904
-
905
- dh = ch;
906
- dl = cl;
907
-
908
- ch = bh;
909
- cl = bl;
910
-
911
- bh = ah;
912
- bl = al;
913
-
914
- ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
915
- al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
916
- }
917
-
918
- sum64(this.h, 0, ah, al);
919
- sum64(this.h, 2, bh, bl);
920
- sum64(this.h, 4, ch, cl);
921
- sum64(this.h, 6, dh, dl);
922
- sum64(this.h, 8, eh, el);
923
- sum64(this.h, 10, fh, fl);
924
- sum64(this.h, 12, gh, gl);
925
- sum64(this.h, 14, hh, hl);
926
- };
927
-
928
- SHA512$1.prototype._digest = function digest(enc) {
929
- if (enc === 'hex')
930
- return utils$3.toHex32(this.h, 'big');
931
- else
932
- return utils$3.split32(this.h, 'big');
933
- };
934
-
935
- function ch64_hi(xh, xl, yh, yl, zh) {
936
- var r = (xh & yh) ^ ((~xh) & zh);
937
- if (r < 0)
938
- r += 0x100000000;
939
- return r;
940
- }
941
-
942
- function ch64_lo(xh, xl, yh, yl, zh, zl) {
943
- var r = (xl & yl) ^ ((~xl) & zl);
944
- if (r < 0)
945
- r += 0x100000000;
946
- return r;
947
- }
948
-
949
- function maj64_hi(xh, xl, yh, yl, zh) {
950
- var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
951
- if (r < 0)
952
- r += 0x100000000;
953
- return r;
954
- }
955
-
956
- function maj64_lo(xh, xl, yh, yl, zh, zl) {
957
- var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
958
- if (r < 0)
959
- r += 0x100000000;
960
- return r;
961
- }
962
-
963
- function s0_512_hi(xh, xl) {
964
- var c0_hi = rotr64_hi(xh, xl, 28);
965
- var c1_hi = rotr64_hi(xl, xh, 2); // 34
966
- var c2_hi = rotr64_hi(xl, xh, 7); // 39
967
-
968
- var r = c0_hi ^ c1_hi ^ c2_hi;
969
- if (r < 0)
970
- r += 0x100000000;
971
- return r;
972
- }
973
-
974
- function s0_512_lo(xh, xl) {
975
- var c0_lo = rotr64_lo(xh, xl, 28);
976
- var c1_lo = rotr64_lo(xl, xh, 2); // 34
977
- var c2_lo = rotr64_lo(xl, xh, 7); // 39
978
-
979
- var r = c0_lo ^ c1_lo ^ c2_lo;
980
- if (r < 0)
981
- r += 0x100000000;
982
- return r;
983
- }
984
-
985
- function s1_512_hi(xh, xl) {
986
- var c0_hi = rotr64_hi(xh, xl, 14);
987
- var c1_hi = rotr64_hi(xh, xl, 18);
988
- var c2_hi = rotr64_hi(xl, xh, 9); // 41
989
-
990
- var r = c0_hi ^ c1_hi ^ c2_hi;
991
- if (r < 0)
992
- r += 0x100000000;
993
- return r;
994
- }
995
-
996
- function s1_512_lo(xh, xl) {
997
- var c0_lo = rotr64_lo(xh, xl, 14);
998
- var c1_lo = rotr64_lo(xh, xl, 18);
999
- var c2_lo = rotr64_lo(xl, xh, 9); // 41
1000
-
1001
- var r = c0_lo ^ c1_lo ^ c2_lo;
1002
- if (r < 0)
1003
- r += 0x100000000;
1004
- return r;
1005
- }
1006
-
1007
- function g0_512_hi(xh, xl) {
1008
- var c0_hi = rotr64_hi(xh, xl, 1);
1009
- var c1_hi = rotr64_hi(xh, xl, 8);
1010
- var c2_hi = shr64_hi(xh, xl, 7);
1011
-
1012
- var r = c0_hi ^ c1_hi ^ c2_hi;
1013
- if (r < 0)
1014
- r += 0x100000000;
1015
- return r;
1016
- }
1017
-
1018
- function g0_512_lo(xh, xl) {
1019
- var c0_lo = rotr64_lo(xh, xl, 1);
1020
- var c1_lo = rotr64_lo(xh, xl, 8);
1021
- var c2_lo = shr64_lo(xh, xl, 7);
1022
-
1023
- var r = c0_lo ^ c1_lo ^ c2_lo;
1024
- if (r < 0)
1025
- r += 0x100000000;
1026
- return r;
1027
- }
1028
-
1029
- function g1_512_hi(xh, xl) {
1030
- var c0_hi = rotr64_hi(xh, xl, 19);
1031
- var c1_hi = rotr64_hi(xl, xh, 29); // 61
1032
- var c2_hi = shr64_hi(xh, xl, 6);
1033
-
1034
- var r = c0_hi ^ c1_hi ^ c2_hi;
1035
- if (r < 0)
1036
- r += 0x100000000;
1037
- return r;
1038
- }
1039
-
1040
- function g1_512_lo(xh, xl) {
1041
- var c0_lo = rotr64_lo(xh, xl, 19);
1042
- var c1_lo = rotr64_lo(xl, xh, 29); // 61
1043
- var c2_lo = shr64_lo(xh, xl, 6);
1044
-
1045
- var r = c0_lo ^ c1_lo ^ c2_lo;
1046
- if (r < 0)
1047
- r += 0x100000000;
1048
- return r;
1049
- }
1050
-
1051
- var utils$2 = utils$9;
1052
-
1053
- var SHA512 = _512;
1054
-
1055
- function SHA384() {
1056
- if (!(this instanceof SHA384))
1057
- return new SHA384();
1058
-
1059
- SHA512.call(this);
1060
- this.h = [
1061
- 0xcbbb9d5d, 0xc1059ed8,
1062
- 0x629a292a, 0x367cd507,
1063
- 0x9159015a, 0x3070dd17,
1064
- 0x152fecd8, 0xf70e5939,
1065
- 0x67332667, 0xffc00b31,
1066
- 0x8eb44a87, 0x68581511,
1067
- 0xdb0c2e0d, 0x64f98fa7,
1068
- 0x47b5481d, 0xbefa4fa4 ];
1069
- }
1070
- utils$2.inherits(SHA384, SHA512);
1071
- var _384 = SHA384;
1072
-
1073
- SHA384.blockSize = 1024;
1074
- SHA384.outSize = 384;
1075
- SHA384.hmacStrength = 192;
1076
- SHA384.padLength = 128;
1077
-
1078
- SHA384.prototype._digest = function digest(enc) {
1079
- if (enc === 'hex')
1080
- return utils$2.toHex32(this.h.slice(0, 12), 'big');
1081
- else
1082
- return utils$2.split32(this.h.slice(0, 12), 'big');
1083
- };
1084
-
1085
- sha.sha1 = _1;
1086
- sha.sha224 = _224;
1087
- sha.sha256 = _256;
1088
- sha.sha384 = _384;
1089
- sha.sha512 = _512;
1090
-
1091
- var ripemd = {};
1092
-
1093
- var utils$1 = utils$9;
1094
- var common = common$5;
1095
-
1096
- var rotl32 = utils$1.rotl32;
1097
- var sum32 = utils$1.sum32;
1098
- var sum32_3 = utils$1.sum32_3;
1099
- var sum32_4 = utils$1.sum32_4;
1100
- var BlockHash = common.BlockHash;
1101
-
1102
- function RIPEMD160() {
1103
- if (!(this instanceof RIPEMD160))
1104
- return new RIPEMD160();
1105
-
1106
- BlockHash.call(this);
1107
-
1108
- this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
1109
- this.endian = 'little';
1110
- }
1111
- utils$1.inherits(RIPEMD160, BlockHash);
1112
- ripemd.ripemd160 = RIPEMD160;
1113
-
1114
- RIPEMD160.blockSize = 512;
1115
- RIPEMD160.outSize = 160;
1116
- RIPEMD160.hmacStrength = 192;
1117
- RIPEMD160.padLength = 64;
1118
-
1119
- RIPEMD160.prototype._update = function update(msg, start) {
1120
- var A = this.h[0];
1121
- var B = this.h[1];
1122
- var C = this.h[2];
1123
- var D = this.h[3];
1124
- var E = this.h[4];
1125
- var Ah = A;
1126
- var Bh = B;
1127
- var Ch = C;
1128
- var Dh = D;
1129
- var Eh = E;
1130
- for (var j = 0; j < 80; j++) {
1131
- var T = sum32(
1132
- rotl32(
1133
- sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
1134
- s[j]),
1135
- E);
1136
- A = E;
1137
- E = D;
1138
- D = rotl32(C, 10);
1139
- C = B;
1140
- B = T;
1141
- T = sum32(
1142
- rotl32(
1143
- sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
1144
- sh[j]),
1145
- Eh);
1146
- Ah = Eh;
1147
- Eh = Dh;
1148
- Dh = rotl32(Ch, 10);
1149
- Ch = Bh;
1150
- Bh = T;
1151
- }
1152
- T = sum32_3(this.h[1], C, Dh);
1153
- this.h[1] = sum32_3(this.h[2], D, Eh);
1154
- this.h[2] = sum32_3(this.h[3], E, Ah);
1155
- this.h[3] = sum32_3(this.h[4], A, Bh);
1156
- this.h[4] = sum32_3(this.h[0], B, Ch);
1157
- this.h[0] = T;
1158
- };
1159
-
1160
- RIPEMD160.prototype._digest = function digest(enc) {
1161
- if (enc === 'hex')
1162
- return utils$1.toHex32(this.h, 'little');
1163
- else
1164
- return utils$1.split32(this.h, 'little');
1165
- };
1166
-
1167
- function f(j, x, y, z) {
1168
- if (j <= 15)
1169
- return x ^ y ^ z;
1170
- else if (j <= 31)
1171
- return (x & y) | ((~x) & z);
1172
- else if (j <= 47)
1173
- return (x | (~y)) ^ z;
1174
- else if (j <= 63)
1175
- return (x & z) | (y & (~z));
1176
- else
1177
- return x ^ (y | (~z));
1178
- }
1179
-
1180
- function K(j) {
1181
- if (j <= 15)
1182
- return 0x00000000;
1183
- else if (j <= 31)
1184
- return 0x5a827999;
1185
- else if (j <= 47)
1186
- return 0x6ed9eba1;
1187
- else if (j <= 63)
1188
- return 0x8f1bbcdc;
1189
- else
1190
- return 0xa953fd4e;
1191
- }
1192
-
1193
- function Kh(j) {
1194
- if (j <= 15)
1195
- return 0x50a28be6;
1196
- else if (j <= 31)
1197
- return 0x5c4dd124;
1198
- else if (j <= 47)
1199
- return 0x6d703ef3;
1200
- else if (j <= 63)
1201
- return 0x7a6d76e9;
1202
- else
1203
- return 0x00000000;
1204
- }
1205
-
1206
- var r = [
1207
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1208
- 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
1209
- 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
1210
- 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
1211
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
1212
- ];
1213
-
1214
- var rh = [
1215
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
1216
- 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
1217
- 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
1218
- 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
1219
- 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
1220
- ];
1221
-
1222
- var s = [
1223
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
1224
- 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
1225
- 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
1226
- 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
1227
- 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
1228
- ];
1229
-
1230
- var sh = [
1231
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
1232
- 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
1233
- 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
1234
- 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
1235
- 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
1236
- ];
1237
-
1238
- var utils = utils$9;
1239
- var assert$1 = minimalisticAssert;
1240
-
1241
- function Hmac(hash, key, enc) {
1242
- if (!(this instanceof Hmac))
1243
- return new Hmac(hash, key, enc);
1244
- this.Hash = hash;
1245
- this.blockSize = hash.blockSize / 8;
1246
- this.outSize = hash.outSize / 8;
1247
- this.inner = null;
1248
- this.outer = null;
1249
-
1250
- this._init(utils.toArray(key, enc));
1251
- }
1252
- var hmac = Hmac;
1253
-
1254
- Hmac.prototype._init = function init(key) {
1255
- // Shorten key, if needed
1256
- if (key.length > this.blockSize)
1257
- key = new this.Hash().update(key).digest();
1258
- assert$1(key.length <= this.blockSize);
1259
-
1260
- // Add padding to key
1261
- for (var i = key.length; i < this.blockSize; i++)
1262
- key.push(0);
1263
-
1264
- for (i = 0; i < key.length; i++)
1265
- key[i] ^= 0x36;
1266
- this.inner = new this.Hash().update(key);
1267
-
1268
- // 0x36 ^ 0x5c = 0x6a
1269
- for (i = 0; i < key.length; i++)
1270
- key[i] ^= 0x6a;
1271
- this.outer = new this.Hash().update(key);
1272
- };
1273
-
1274
- Hmac.prototype.update = function update(msg, enc) {
1275
- this.inner.update(msg, enc);
1276
- return this;
1277
- };
1278
-
1279
- Hmac.prototype.digest = function digest(enc) {
1280
- this.outer.update(this.inner.digest());
1281
- return this.outer.digest(enc);
1282
- };
1283
-
1284
- (function (exports) {
1285
- var hash = exports;
1286
-
1287
- hash.utils = utils$9;
1288
- hash.common = common$5;
1289
- hash.sha = sha;
1290
- hash.ripemd = ripemd;
1291
- hash.hmac = hmac;
1292
-
1293
- // Proxy hash functions to the main object
1294
- hash.sha1 = hash.sha.sha1;
1295
- hash.sha256 = hash.sha.sha256;
1296
- hash.sha224 = hash.sha.sha224;
1297
- hash.sha384 = hash.sha.sha384;
1298
- hash.sha512 = hash.sha.sha512;
1299
- hash.ripemd160 = hash.ripemd.ripemd160;
1300
- } (hash$1));
1301
-
1302
- var hash = hash$1;
1303
-
1304
- const version$2 = "logger/5.6.0";
1305
-
1306
- let _permanentCensorErrors = false;
1307
- let _censorErrors = false;
1308
- const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
1309
- let _logLevel = LogLevels["default"];
1310
- let _globalLogger = null;
1311
- function _checkNormalize() {
1312
- try {
1313
- const missing = [];
1314
- // Make sure all forms of normalization are supported
1315
- ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
1316
- try {
1317
- if ("test".normalize(form) !== "test") {
1318
- throw new Error("bad normalize");
1319
- }
1320
- ;
1321
- }
1322
- catch (error) {
1323
- missing.push(form);
1324
- }
1325
- });
1326
- if (missing.length) {
1327
- throw new Error("missing " + missing.join(", "));
1328
- }
1329
- if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) {
1330
- throw new Error("broken implementation");
1331
- }
1332
- }
1333
- catch (error) {
1334
- return error.message;
1335
- }
1336
- return null;
1337
- }
1338
- const _normalizeError = _checkNormalize();
1339
- var LogLevel;
1340
- (function (LogLevel) {
1341
- LogLevel["DEBUG"] = "DEBUG";
1342
- LogLevel["INFO"] = "INFO";
1343
- LogLevel["WARNING"] = "WARNING";
1344
- LogLevel["ERROR"] = "ERROR";
1345
- LogLevel["OFF"] = "OFF";
1346
- })(LogLevel || (LogLevel = {}));
1347
- var ErrorCode;
1348
- (function (ErrorCode) {
1349
- ///////////////////
1350
- // Generic Errors
1351
- // Unknown Error
1352
- ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
1353
- // Not Implemented
1354
- ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
1355
- // Unsupported Operation
1356
- // - operation
1357
- ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
1358
- // Network Error (i.e. Ethereum Network, such as an invalid chain ID)
1359
- // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown)
1360
- ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
1361
- // Some sort of bad response from the server
1362
- ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
1363
- // Timeout
1364
- ErrorCode["TIMEOUT"] = "TIMEOUT";
1365
- ///////////////////
1366
- // Operational Errors
1367
- // Buffer Overrun
1368
- ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
1369
- // Numeric Fault
1370
- // - operation: the operation being executed
1371
- // - fault: the reason this faulted
1372
- ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
1373
- ///////////////////
1374
- // Argument Errors
1375
- // Missing new operator to an object
1376
- // - name: The name of the class
1377
- ErrorCode["MISSING_NEW"] = "MISSING_NEW";
1378
- // Invalid argument (e.g. value is incompatible with type) to a function:
1379
- // - argument: The argument name that was invalid
1380
- // - value: The value of the argument
1381
- ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
1382
- // Missing argument to a function:
1383
- // - count: The number of arguments received
1384
- // - expectedCount: The number of arguments expected
1385
- ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
1386
- // Too many arguments
1387
- // - count: The number of arguments received
1388
- // - expectedCount: The number of arguments expected
1389
- ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
1390
- ///////////////////
1391
- // Blockchain Errors
1392
- // Call exception
1393
- // - transaction: the transaction
1394
- // - address?: the contract address
1395
- // - args?: The arguments passed into the function
1396
- // - method?: The Solidity method signature
1397
- // - errorSignature?: The EIP848 error signature
1398
- // - errorArgs?: The EIP848 error parameters
1399
- // - reason: The reason (only for EIP848 "Error(string)")
1400
- ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
1401
- // Insufficient funds (< value + gasLimit * gasPrice)
1402
- // - transaction: the transaction attempted
1403
- ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
1404
- // Nonce has already been used
1405
- // - transaction: the transaction attempted
1406
- ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
1407
- // The replacement fee for the transaction is too low
1408
- // - transaction: the transaction attempted
1409
- ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
1410
- // The gas limit could not be estimated
1411
- // - transaction: the transaction passed to estimateGas
1412
- ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
1413
- // The transaction was replaced by one with a higher gas price
1414
- // - reason: "cancelled", "replaced" or "repriced"
1415
- // - cancelled: true if reason == "cancelled" or reason == "replaced")
1416
- // - hash: original transaction hash
1417
- // - replacement: the full TransactionsResponse for the replacement
1418
- // - receipt: the receipt of the replacement
1419
- ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
1420
- })(ErrorCode || (ErrorCode = {}));
1421
- const HEX = "0123456789abcdef";
1422
- class Logger {
1423
- constructor(version) {
1424
- Object.defineProperty(this, "version", {
1425
- enumerable: true,
1426
- value: version,
1427
- writable: false
1428
- });
1429
- }
1430
- _log(logLevel, args) {
1431
- const level = logLevel.toLowerCase();
1432
- if (LogLevels[level] == null) {
1433
- this.throwArgumentError("invalid log level name", "logLevel", logLevel);
1434
- }
1435
- if (_logLevel > LogLevels[level]) {
1436
- return;
1437
- }
1438
- console.log.apply(console, args);
1439
- }
1440
- debug(...args) {
1441
- this._log(Logger.levels.DEBUG, args);
1442
- }
1443
- info(...args) {
1444
- this._log(Logger.levels.INFO, args);
1445
- }
1446
- warn(...args) {
1447
- this._log(Logger.levels.WARNING, args);
1448
- }
1449
- makeError(message, code, params) {
1450
- // Errors are being censored
1451
- if (_censorErrors) {
1452
- return this.makeError("censored error", code, {});
1453
- }
1454
- if (!code) {
1455
- code = Logger.errors.UNKNOWN_ERROR;
1456
- }
1457
- if (!params) {
1458
- params = {};
1459
- }
1460
- const messageDetails = [];
1461
- Object.keys(params).forEach((key) => {
1462
- const value = params[key];
1463
- try {
1464
- if (value instanceof Uint8Array) {
1465
- let hex = "";
1466
- for (let i = 0; i < value.length; i++) {
1467
- hex += HEX[value[i] >> 4];
1468
- hex += HEX[value[i] & 0x0f];
1469
- }
1470
- messageDetails.push(key + "=Uint8Array(0x" + hex + ")");
1471
- }
1472
- else {
1473
- messageDetails.push(key + "=" + JSON.stringify(value));
1474
- }
1475
- }
1476
- catch (error) {
1477
- messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
1478
- }
1479
- });
1480
- messageDetails.push(`code=${code}`);
1481
- messageDetails.push(`version=${this.version}`);
1482
- const reason = message;
1483
- let url = "";
1484
- switch (code) {
1485
- case ErrorCode.NUMERIC_FAULT: {
1486
- url = "NUMERIC_FAULT";
1487
- const fault = message;
1488
- switch (fault) {
1489
- case "overflow":
1490
- case "underflow":
1491
- case "division-by-zero":
1492
- url += "-" + fault;
1493
- break;
1494
- case "negative-power":
1495
- case "negative-width":
1496
- url += "-unsupported";
1497
- break;
1498
- case "unbound-bitwise-result":
1499
- url += "-unbound-result";
1500
- break;
1501
- }
1502
- break;
1503
- }
1504
- case ErrorCode.CALL_EXCEPTION:
1505
- case ErrorCode.INSUFFICIENT_FUNDS:
1506
- case ErrorCode.MISSING_NEW:
1507
- case ErrorCode.NONCE_EXPIRED:
1508
- case ErrorCode.REPLACEMENT_UNDERPRICED:
1509
- case ErrorCode.TRANSACTION_REPLACED:
1510
- case ErrorCode.UNPREDICTABLE_GAS_LIMIT:
1511
- url = code;
1512
- break;
1513
- }
1514
- if (url) {
1515
- message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]";
1516
- }
1517
- if (messageDetails.length) {
1518
- message += " (" + messageDetails.join(", ") + ")";
1519
- }
1520
- // @TODO: Any??
1521
- const error = new Error(message);
1522
- error.reason = reason;
1523
- error.code = code;
1524
- Object.keys(params).forEach(function (key) {
1525
- error[key] = params[key];
1526
- });
1527
- return error;
1528
- }
1529
- throwError(message, code, params) {
1530
- throw this.makeError(message, code, params);
1531
- }
1532
- throwArgumentError(message, name, value) {
1533
- return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
1534
- argument: name,
1535
- value: value
1536
- });
1537
- }
1538
- assert(condition, message, code, params) {
1539
- if (!!condition) {
1540
- return;
1541
- }
1542
- this.throwError(message, code, params);
1543
- }
1544
- assertArgument(condition, message, name, value) {
1545
- if (!!condition) {
1546
- return;
1547
- }
1548
- this.throwArgumentError(message, name, value);
1549
- }
1550
- checkNormalize(message) {
1551
- if (_normalizeError) {
1552
- this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
1553
- operation: "String.prototype.normalize", form: _normalizeError
1554
- });
1555
- }
1556
- }
1557
- checkSafeUint53(value, message) {
1558
- if (typeof (value) !== "number") {
1559
- return;
1560
- }
1561
- if (message == null) {
1562
- message = "value not safe";
1563
- }
1564
- if (value < 0 || value >= 0x1fffffffffffff) {
1565
- this.throwError(message, Logger.errors.NUMERIC_FAULT, {
1566
- operation: "checkSafeInteger",
1567
- fault: "out-of-safe-range",
1568
- value: value
1569
- });
1570
- }
1571
- if (value % 1) {
1572
- this.throwError(message, Logger.errors.NUMERIC_FAULT, {
1573
- operation: "checkSafeInteger",
1574
- fault: "non-integer",
1575
- value: value
1576
- });
1577
- }
1578
- }
1579
- checkArgumentCount(count, expectedCount, message) {
1580
- if (message) {
1581
- message = ": " + message;
1582
- }
1583
- else {
1584
- message = "";
1585
- }
1586
- if (count < expectedCount) {
1587
- this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
1588
- count: count,
1589
- expectedCount: expectedCount
1590
- });
1591
- }
1592
- if (count > expectedCount) {
1593
- this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
1594
- count: count,
1595
- expectedCount: expectedCount
1596
- });
1597
- }
1598
- }
1599
- checkNew(target, kind) {
1600
- if (target === Object || target == null) {
1601
- this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
1602
- }
1603
- }
1604
- checkAbstract(target, kind) {
1605
- if (target === kind) {
1606
- this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
1607
- }
1608
- else if (target === Object || target == null) {
1609
- this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
1610
- }
1611
- }
1612
- static globalLogger() {
1613
- if (!_globalLogger) {
1614
- _globalLogger = new Logger(version$2);
1615
- }
1616
- return _globalLogger;
1617
- }
1618
- static setCensorship(censorship, permanent) {
1619
- if (!censorship && permanent) {
1620
- this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, {
1621
- operation: "setCensorship"
1622
- });
1623
- }
1624
- if (_permanentCensorErrors) {
1625
- if (!censorship) {
1626
- return;
1627
- }
1628
- this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
1629
- operation: "setCensorship"
1630
- });
1631
- }
1632
- _censorErrors = !!censorship;
1633
- _permanentCensorErrors = !!permanent;
1634
- }
1635
- static setLogLevel(logLevel) {
1636
- const level = LogLevels[logLevel.toLowerCase()];
1637
- if (level == null) {
1638
- Logger.globalLogger().warn("invalid log level - " + logLevel);
1639
- return;
1640
- }
1641
- _logLevel = level;
1642
- }
1643
- static from(version) {
1644
- return new Logger(version);
1645
- }
1646
- }
1647
- Logger.errors = ErrorCode;
1648
- Logger.levels = LogLevel;
1649
-
1650
- const version$1 = "bytes/5.6.0";
1651
-
1652
- const logger = new Logger(version$1);
1653
- ///////////////////////////////
1654
- function isHexable(value) {
1655
- return !!(value.toHexString);
1656
- }
1657
- function addSlice(array) {
1658
- if (array.slice) {
1659
- return array;
1660
- }
1661
- array.slice = function () {
1662
- const args = Array.prototype.slice.call(arguments);
1663
- return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
1664
- };
1665
- return array;
1666
- }
1667
- function isInteger(value) {
1668
- return (typeof (value) === "number" && value == value && (value % 1) === 0);
1669
- }
1670
- function isBytes(value) {
1671
- if (value == null) {
1672
- return false;
1673
- }
1674
- if (value.constructor === Uint8Array) {
1675
- return true;
1676
- }
1677
- if (typeof (value) === "string") {
1678
- return false;
1679
- }
1680
- if (!isInteger(value.length) || value.length < 0) {
1681
- return false;
1682
- }
1683
- for (let i = 0; i < value.length; i++) {
1684
- const v = value[i];
1685
- if (!isInteger(v) || v < 0 || v >= 256) {
1686
- return false;
1687
- }
1688
- }
1689
- return true;
1690
- }
1691
- function arrayify(value, options) {
1692
- if (!options) {
1693
- options = {};
1694
- }
1695
- if (typeof (value) === "number") {
1696
- logger.checkSafeUint53(value, "invalid arrayify value");
1697
- const result = [];
1698
- while (value) {
1699
- result.unshift(value & 0xff);
1700
- value = parseInt(String(value / 256));
1701
- }
1702
- if (result.length === 0) {
1703
- result.push(0);
1704
- }
1705
- return addSlice(new Uint8Array(result));
1706
- }
1707
- if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
1708
- value = "0x" + value;
1709
- }
1710
- if (isHexable(value)) {
1711
- value = value.toHexString();
1712
- }
1713
- if (isHexString(value)) {
1714
- let hex = value.substring(2);
1715
- if (hex.length % 2) {
1716
- if (options.hexPad === "left") {
1717
- hex = "0x0" + hex.substring(2);
1718
- }
1719
- else if (options.hexPad === "right") {
1720
- hex += "0";
1721
- }
1722
- else {
1723
- logger.throwArgumentError("hex data is odd-length", "value", value);
1724
- }
1725
- }
1726
- const result = [];
1727
- for (let i = 0; i < hex.length; i += 2) {
1728
- result.push(parseInt(hex.substring(i, i + 2), 16));
1729
- }
1730
- return addSlice(new Uint8Array(result));
1731
- }
1732
- if (isBytes(value)) {
1733
- return addSlice(new Uint8Array(value));
1734
- }
1735
- return logger.throwArgumentError("invalid arrayify value", "value", value);
1736
- }
1737
- function isHexString(value, length) {
1738
- if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
1739
- return false;
1740
- }
1741
- if (length && value.length !== 2 + 2 * length) {
1742
- return false;
1743
- }
1744
- return true;
1745
- }
1746
-
1747
- const version = "sha2/5.6.0";
1748
-
1749
- new Logger(version);
1750
- function sha256(data) {
1751
- return "0x" + (hash.sha256().update(arrayify(data)).digest("hex"));
1752
- }
1753
-
1754
65
  class Struct {
1755
66
  constructor(properties) {
1756
67
  Object.assign(this, properties);
@@ -1908,8 +219,8 @@ class PublicKey extends Struct {
1908
219
 
1909
220
  static async createWithSeed(fromPublicKey, seed, programId) {
1910
221
  const buffer = Buffer.concat([fromPublicKey.toBuffer(), Buffer.from(seed), programId.toBuffer()]);
1911
- const hash = sha256(new Uint8Array(buffer)).slice(2);
1912
- return new PublicKey(Buffer.from(hash, 'hex'));
222
+ const publicKeyBytes = sha256(buffer);
223
+ return new PublicKey(publicKeyBytes);
1913
224
  }
1914
225
  /**
1915
226
  * Derive a program address from seeds and a program ID.
@@ -1928,10 +239,9 @@ class PublicKey extends Struct {
1928
239
  buffer = Buffer.concat([buffer, toBuffer(seed)]);
1929
240
  });
1930
241
  buffer = Buffer.concat([buffer, programId.toBuffer(), Buffer.from('ProgramDerivedAddress')]);
1931
- let hash = sha256(new Uint8Array(buffer)).slice(2);
1932
- let publicKeyBytes = new BN(hash, 16).toArray(undefined, 32);
242
+ const publicKeyBytes = sha256(buffer);
1933
243
 
1934
- if (is_on_curve(publicKeyBytes)) {
244
+ if (isOnCurve(publicKeyBytes)) {
1935
245
  throw new Error(`Invalid seeds, address must fall off the curve`);
1936
246
  }
1937
247
 
@@ -1995,7 +305,7 @@ class PublicKey extends Struct {
1995
305
 
1996
306
  static isOnCurve(pubkeyData) {
1997
307
  const pubkey = new PublicKey(pubkeyData);
1998
- return is_on_curve(pubkey.toBytes()) == 1;
308
+ return isOnCurve(pubkey.toBytes());
1999
309
  }
2000
310
 
2001
311
  }
@@ -2003,56 +313,7 @@ PublicKey.default = new PublicKey('11111111111111111111111111111111');
2003
313
  SOLANA_SCHEMA.set(PublicKey, {
2004
314
  kind: 'struct',
2005
315
  fields: [['_bn', 'u256']]
2006
- }); // @ts-ignore
2007
-
2008
- let naclLowLevel = nacl.lowlevel; // Check that a pubkey is on the curve.
2009
- // This function and its dependents were sourced from:
2010
- // https://github.com/dchest/tweetnacl-js/blob/f1ec050ceae0861f34280e62498b1d3ed9c350c6/nacl.js#L792
2011
-
2012
- function is_on_curve(p) {
2013
- var r = [naclLowLevel.gf(), naclLowLevel.gf(), naclLowLevel.gf(), naclLowLevel.gf()];
2014
- var t = naclLowLevel.gf(),
2015
- chk = naclLowLevel.gf(),
2016
- num = naclLowLevel.gf(),
2017
- den = naclLowLevel.gf(),
2018
- den2 = naclLowLevel.gf(),
2019
- den4 = naclLowLevel.gf(),
2020
- den6 = naclLowLevel.gf();
2021
- naclLowLevel.set25519(r[2], gf1);
2022
- naclLowLevel.unpack25519(r[1], p);
2023
- naclLowLevel.S(num, r[1]);
2024
- naclLowLevel.M(den, num, naclLowLevel.D);
2025
- naclLowLevel.Z(num, num, r[2]);
2026
- naclLowLevel.A(den, r[2], den);
2027
- naclLowLevel.S(den2, den);
2028
- naclLowLevel.S(den4, den2);
2029
- naclLowLevel.M(den6, den4, den2);
2030
- naclLowLevel.M(t, den6, num);
2031
- naclLowLevel.M(t, t, den);
2032
- naclLowLevel.pow2523(t, t);
2033
- naclLowLevel.M(t, t, num);
2034
- naclLowLevel.M(t, t, den);
2035
- naclLowLevel.M(t, t, den);
2036
- naclLowLevel.M(r[0], t, den);
2037
- naclLowLevel.S(chk, r[0]);
2038
- naclLowLevel.M(chk, chk, den);
2039
- if (neq25519(chk, num)) naclLowLevel.M(r[0], r[0], I);
2040
- naclLowLevel.S(chk, r[0]);
2041
- naclLowLevel.M(chk, chk, den);
2042
- if (neq25519(chk, num)) return 0;
2043
- return 1;
2044
- }
2045
-
2046
- let gf1 = naclLowLevel.gf([1]);
2047
- let I = naclLowLevel.gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
2048
-
2049
- function neq25519(a, b) {
2050
- var c = new Uint8Array(32),
2051
- d = new Uint8Array(32);
2052
- naclLowLevel.pack25519(c, a);
2053
- naclLowLevel.pack25519(d, b);
2054
- return naclLowLevel.crypto_verify_32(c, 0, d, 0);
2055
- }
316
+ });
2056
317
 
2057
318
  /**
2058
319
  * An account key pair (public and secret keys).
@@ -2063,6 +324,8 @@ function neq25519(a, b) {
2063
324
  class Account {
2064
325
  /** @internal */
2065
326
 
327
+ /** @internal */
328
+
2066
329
  /**
2067
330
  * Create a new Account object
2068
331
  *
@@ -2072,12 +335,21 @@ class Account {
2072
335
  * @param secretKey Secret key for the account
2073
336
  */
2074
337
  constructor(secretKey) {
2075
- this._keypair = void 0;
338
+ this._publicKey = void 0;
339
+ this._secretKey = void 0;
2076
340
 
2077
341
  if (secretKey) {
2078
- this._keypair = nacl.sign.keyPair.fromSecretKey(toBuffer(secretKey));
342
+ const secretKeyBuffer = toBuffer(secretKey);
343
+
344
+ if (secretKey.length !== 64) {
345
+ throw new Error('bad secret key size');
346
+ }
347
+
348
+ this._publicKey = secretKeyBuffer.slice(32, 64);
349
+ this._secretKey = secretKeyBuffer.slice(0, 32);
2079
350
  } else {
2080
- this._keypair = nacl.sign.keyPair();
351
+ this._secretKey = toBuffer(generatePrivateKey());
352
+ this._publicKey = toBuffer(getPublicKey(this._secretKey));
2081
353
  }
2082
354
  }
2083
355
  /**
@@ -2086,15 +358,17 @@ class Account {
2086
358
 
2087
359
 
2088
360
  get publicKey() {
2089
- return new PublicKey(this._keypair.publicKey);
361
+ return new PublicKey(this._publicKey);
2090
362
  }
2091
363
  /**
2092
- * The **unencrypted** secret key for this account
364
+ * The **unencrypted** secret key for this account. The first 32 bytes
365
+ * is the private scalar and the last 32 bytes is the public key.
366
+ * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
2093
367
  */
2094
368
 
2095
369
 
2096
370
  get secretKey() {
2097
- return toBuffer(this._keypair.secretKey);
371
+ return Buffer.concat([this._secretKey, this._publicKey], 64);
2098
372
  }
2099
373
 
2100
374
  }
@@ -2260,6 +534,44 @@ function encodeLength(bytes, len) {
2260
534
  }
2261
535
  }
2262
536
 
537
+ const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
538
+ /**
539
+ * Delegates to `Array#shift`, but throws if the array is zero-length.
540
+ */
541
+
542
+ function guardedShift(byteArray) {
543
+ if (byteArray.length === 0) {
544
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
545
+ }
546
+
547
+ return byteArray.shift();
548
+ }
549
+ /**
550
+ * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
551
+ * the array.
552
+ */
553
+
554
+ function guardedSplice(byteArray, ...args) {
555
+ var _args$;
556
+
557
+ const [start] = args;
558
+
559
+ if (args.length === 2 // Implies that `deleteCount` was supplied
560
+ ? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
561
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
562
+ }
563
+
564
+ return byteArray.splice(...args);
565
+ }
566
+
567
+ /**
568
+ * An instruction to execute by a program
569
+ *
570
+ * @property {number} programIdIndex
571
+ * @property {number[]} accounts
572
+ * @property {string} data
573
+ */
574
+
2263
575
  /**
2264
576
  * List of instructions to be processed atomically
2265
577
  */
@@ -2372,37 +684,33 @@ class Message {
2372
684
  static from(buffer) {
2373
685
  // Slice up wire data
2374
686
  let byteArray = [...buffer];
2375
- const numRequiredSignatures = byteArray.shift();
687
+ const numRequiredSignatures = guardedShift(byteArray);
2376
688
 
2377
689
  if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {
2378
690
  throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');
2379
691
  }
2380
692
 
2381
- const numReadonlySignedAccounts = byteArray.shift();
2382
- const numReadonlyUnsignedAccounts = byteArray.shift();
693
+ const numReadonlySignedAccounts = guardedShift(byteArray);
694
+ const numReadonlyUnsignedAccounts = guardedShift(byteArray);
2383
695
  const accountCount = decodeLength(byteArray);
2384
696
  let accountKeys = [];
2385
697
 
2386
698
  for (let i = 0; i < accountCount; i++) {
2387
- const account = byteArray.slice(0, PUBLIC_KEY_LENGTH);
2388
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
699
+ const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
2389
700
  accountKeys.push(bs58.encode(Buffer.from(account)));
2390
701
  }
2391
702
 
2392
- const recentBlockhash = byteArray.slice(0, PUBLIC_KEY_LENGTH);
2393
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
703
+ const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
2394
704
  const instructionCount = decodeLength(byteArray);
2395
705
  let instructions = [];
2396
706
 
2397
707
  for (let i = 0; i < instructionCount; i++) {
2398
- const programIdIndex = byteArray.shift();
708
+ const programIdIndex = guardedShift(byteArray);
2399
709
  const accountCount = decodeLength(byteArray);
2400
- const accounts = byteArray.slice(0, accountCount);
2401
- byteArray = byteArray.slice(accountCount);
710
+ const accounts = guardedSplice(byteArray, 0, accountCount);
2402
711
  const dataLength = decodeLength(byteArray);
2403
- const dataSlice = byteArray.slice(0, dataLength);
712
+ const dataSlice = guardedSplice(byteArray, 0, dataLength);
2404
713
  const data = bs58.encode(Buffer.from(dataSlice));
2405
- byteArray = byteArray.slice(dataLength);
2406
714
  instructions.push({
2407
715
  programIdIndex,
2408
716
  accounts,
@@ -2525,33 +833,33 @@ class MessageV0 {
2525
833
 
2526
834
  static deserialize(serializedMessage) {
2527
835
  let byteArray = [...serializedMessage];
2528
- const prefix = byteArray.shift();
836
+ const prefix = guardedShift(byteArray);
2529
837
  const maskedPrefix = prefix & VERSION_PREFIX_MASK;
2530
838
  assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
2531
839
  const version = maskedPrefix;
2532
840
  assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);
2533
841
  const header = {
2534
- numRequiredSignatures: byteArray.shift(),
2535
- numReadonlySignedAccounts: byteArray.shift(),
2536
- numReadonlyUnsignedAccounts: byteArray.shift()
842
+ numRequiredSignatures: guardedShift(byteArray),
843
+ numReadonlySignedAccounts: guardedShift(byteArray),
844
+ numReadonlyUnsignedAccounts: guardedShift(byteArray)
2537
845
  };
2538
846
  const staticAccountKeys = [];
2539
847
  const staticAccountKeysLength = decodeLength(byteArray);
2540
848
 
2541
849
  for (let i = 0; i < staticAccountKeysLength; i++) {
2542
- staticAccountKeys.push(new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH)));
850
+ staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));
2543
851
  }
2544
852
 
2545
- const recentBlockhash = bs58.encode(byteArray.splice(0, PUBLIC_KEY_LENGTH));
853
+ const recentBlockhash = bs58.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
2546
854
  const instructionCount = decodeLength(byteArray);
2547
855
  const compiledInstructions = [];
2548
856
 
2549
857
  for (let i = 0; i < instructionCount; i++) {
2550
- const programIdIndex = byteArray.shift();
858
+ const programIdIndex = guardedShift(byteArray);
2551
859
  const accountKeyIndexesLength = decodeLength(byteArray);
2552
- const accountKeyIndexes = byteArray.splice(0, accountKeyIndexesLength);
860
+ const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);
2553
861
  const dataLength = decodeLength(byteArray);
2554
- const data = new Uint8Array(byteArray.splice(0, dataLength));
862
+ const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));
2555
863
  compiledInstructions.push({
2556
864
  programIdIndex,
2557
865
  accountKeyIndexes,
@@ -2563,11 +871,11 @@ class MessageV0 {
2563
871
  const addressTableLookups = [];
2564
872
 
2565
873
  for (let i = 0; i < addressTableLookupsCount; i++) {
2566
- const accountKey = new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH));
874
+ const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
2567
875
  const writableIndexesLength = decodeLength(byteArray);
2568
- const writableIndexes = byteArray.splice(0, writableIndexesLength);
876
+ const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
2569
877
  const readonlyIndexesLength = decodeLength(byteArray);
2570
- const readonlyIndexes = byteArray.splice(0, readonlyIndexesLength);
878
+ const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);
2571
879
  addressTableLookups.push({
2572
880
  accountKey,
2573
881
  writableIndexes,
@@ -2607,6 +915,10 @@ const VersionedMessage = {
2607
915
  }
2608
916
  };
2609
917
 
918
+ /**
919
+ * Transaction signature as base-58 encoded string
920
+ */
921
+
2610
922
  let TransactionStatus;
2611
923
  /**
2612
924
  * Default (empty) signature
@@ -3132,7 +1444,7 @@ class Transaction {
3132
1444
  _partialSign(message, ...signers) {
3133
1445
  const signData = message.serialize();
3134
1446
  signers.forEach(signer => {
3135
- const signature = nacl.sign.detached(signData, signer.secretKey);
1447
+ const signature = sign(signData, signer.secretKey);
3136
1448
 
3137
1449
  this._addSignature(signer.publicKey, toBuffer(signature));
3138
1450
  });
@@ -3188,7 +1500,7 @@ class Transaction {
3188
1500
  return false;
3189
1501
  }
3190
1502
  } else {
3191
- if (!nacl.sign.detached.verify(signData, signature, publicKey.toBuffer())) {
1503
+ if (!verify(signature, signData, publicKey.toBuffer())) {
3192
1504
  return false;
3193
1505
  }
3194
1506
  }
@@ -3286,8 +1598,7 @@ class Transaction {
3286
1598
  let signatures = [];
3287
1599
 
3288
1600
  for (let i = 0; i < signatureCount; i++) {
3289
- const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES);
3290
- byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
1601
+ const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
3291
1602
  signatures.push(bs58.encode(Buffer.from(signature)));
3292
1603
  }
3293
1604
 
@@ -3379,7 +1690,7 @@ class VersionedTransaction {
3379
1690
  const signaturesLength = decodeLength(byteArray);
3380
1691
 
3381
1692
  for (let i = 0; i < signaturesLength; i++) {
3382
- signatures.push(new Uint8Array(byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES)));
1693
+ signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));
3383
1694
  }
3384
1695
 
3385
1696
  const message = VersionedMessage.deserialize(new Uint8Array(byteArray));
@@ -3393,7 +1704,7 @@ class VersionedTransaction {
3393
1704
  for (const signer of signers) {
3394
1705
  const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(signer.publicKey));
3395
1706
  assert(signerIndex >= 0, `Cannot sign with non signer key ${signer.publicKey.toBase58()}`);
3396
- this.signatures[signerIndex] = nacl.sign.detached(messageData, signer.secretKey);
1707
+ this.signatures[signerIndex] = sign(messageData, signer.secretKey);
3397
1708
  }
3398
1709
  }
3399
1710
 
@@ -5803,7 +4114,7 @@ const LogsNotificationResult = type({
5803
4114
 
5804
4115
  /** @internal */
5805
4116
  const COMMON_HTTP_HEADERS = {
5806
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
4117
+ 'solana-client': `js/${(_process$env$npm_pack = "1.54.2") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
5807
4118
  };
5808
4119
  /**
5809
4120
  * A connection to a fullnode JSON RPC endpoint
@@ -8599,12 +6910,7 @@ class Keypair {
8599
6910
  */
8600
6911
  constructor(keypair) {
8601
6912
  this._keypair = void 0;
8602
-
8603
- if (keypair) {
8604
- this._keypair = keypair;
8605
- } else {
8606
- this._keypair = nacl.sign.keyPair();
8607
- }
6913
+ this._keypair = keypair !== null && keypair !== void 0 ? keypair : generateKeypair();
8608
6914
  }
8609
6915
  /**
8610
6916
  * Generate a new random keypair
@@ -8612,7 +6918,7 @@ class Keypair {
8612
6918
 
8613
6919
 
8614
6920
  static generate() {
8615
- return new Keypair(nacl.sign.keyPair());
6921
+ return new Keypair(generateKeypair());
8616
6922
  }
8617
6923
  /**
8618
6924
  * Create a keypair from a raw secret key byte array.
@@ -8629,19 +6935,27 @@ class Keypair {
8629
6935
 
8630
6936
 
8631
6937
  static fromSecretKey(secretKey, options) {
8632
- const keypair = nacl.sign.keyPair.fromSecretKey(secretKey);
6938
+ if (secretKey.byteLength !== 64) {
6939
+ throw new Error('bad secret key size');
6940
+ }
6941
+
6942
+ const publicKey = secretKey.slice(32, 64);
8633
6943
 
8634
6944
  if (!options || !options.skipValidation) {
8635
- const encoder = new TextEncoder();
8636
- const signData = encoder.encode('@solana/web3.js-validation-v1');
8637
- const signature = nacl.sign.detached(signData, keypair.secretKey);
6945
+ const privateScalar = secretKey.slice(0, 32);
6946
+ const computedPublicKey = getPublicKey(privateScalar);
8638
6947
 
8639
- if (!nacl.sign.detached.verify(signData, signature, keypair.publicKey)) {
8640
- throw new Error('provided secretKey is invalid');
6948
+ for (let ii = 0; ii < 32; ii++) {
6949
+ if (publicKey[ii] !== computedPublicKey[ii]) {
6950
+ throw new Error('provided secretKey is invalid');
6951
+ }
8641
6952
  }
8642
6953
  }
8643
6954
 
8644
- return new Keypair(keypair);
6955
+ return new Keypair({
6956
+ publicKey,
6957
+ secretKey
6958
+ });
8645
6959
  }
8646
6960
  /**
8647
6961
  * Generate a keypair from a 32 byte seed.
@@ -8651,7 +6965,14 @@ class Keypair {
8651
6965
 
8652
6966
 
8653
6967
  static fromSeed(seed) {
8654
- return new Keypair(nacl.sign.keyPair.fromSeed(seed));
6968
+ const publicKey = getPublicKey(seed);
6969
+ const secretKey = new Uint8Array(64);
6970
+ secretKey.set(seed);
6971
+ secretKey.set(publicKey, 32);
6972
+ return new Keypair({
6973
+ publicKey,
6974
+ secretKey
6975
+ });
8655
6976
  }
8656
6977
  /**
8657
6978
  * The public key for this keypair
@@ -9203,7 +7524,7 @@ class Ed25519Program {
9203
7524
  try {
9204
7525
  const keypair = Keypair.fromSecretKey(privateKey);
9205
7526
  const publicKey = keypair.publicKey.toBytes();
9206
- const signature = nacl.sign.detached(message, keypair.secretKey);
7527
+ const signature = sign(message, keypair.secretKey);
9207
7528
  return this.createInstructionWithPublicKey({
9208
7529
  publicKey,
9209
7530
  message,
@@ -9218,10 +7539,21 @@ class Ed25519Program {
9218
7539
  }
9219
7540
  Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
9220
7541
 
9221
- const {
9222
- publicKeyCreate,
9223
- ecdsaSign
9224
- } = secp256k1;
7542
+ // library interoperable with the synchronous APIs in web3.js.
7543
+
7544
+ secp256k1.utils.hmacSha256Sync = (key, ...msgs) => {
7545
+ const h = hmac.create(sha256, key);
7546
+ msgs.forEach(msg => h.update(msg));
7547
+ return h.digest();
7548
+ };
7549
+
7550
+ const ecdsaSign = (msgHash, privKey) => secp256k1.signSync(msgHash, privKey, {
7551
+ der: false,
7552
+ recovered: true
7553
+ });
7554
+ secp256k1.utils.isValidPrivateKey;
7555
+ const publicKeyCreate = secp256k1.getPublicKey;
7556
+
9225
7557
  const PRIVATE_KEY_BYTES = 32;
9226
7558
  const ETHEREUM_ADDRESS_BYTES = 20;
9227
7559
  const PUBLIC_KEY_BYTES = 64;
@@ -9345,13 +7677,12 @@ class Secp256k1Program {
9345
7677
 
9346
7678
  try {
9347
7679
  const privateKey = toBuffer(pkey);
9348
- const publicKey = publicKeyCreate(privateKey, false).slice(1); // throw away leading byte
7680
+ const publicKey = publicKeyCreate(privateKey, false
7681
+ /* isCompressed */
7682
+ ).slice(1); // throw away leading byte
9349
7683
 
9350
7684
  const messageHash = Buffer.from(sha3.keccak_256.update(toBuffer(message)).digest());
9351
- const {
9352
- signature,
9353
- recid: recoveryId
9354
- } = ecdsaSign(messageHash, privateKey);
7685
+ const [signature, recoveryId] = ecdsaSign(messageHash, privateKey);
9355
7686
  return this.createInstructionWithPublicKey({
9356
7687
  publicKey,
9357
7688
  message,
@@ -10537,10 +8868,8 @@ class ValidatorInfo {
10537
8868
  const configKeys = [];
10538
8869
 
10539
8870
  for (let i = 0; i < 2; i++) {
10540
- const publicKey = new PublicKey(byteArray.slice(0, PUBLIC_KEY_LENGTH));
10541
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
10542
- const isSigner = byteArray.slice(0, 1)[0] === 1;
10543
- byteArray = byteArray.slice(1);
8871
+ const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
8872
+ const isSigner = guardedShift(byteArray) === 1;
10544
8873
  configKeys.push({
10545
8874
  publicKey,
10546
8875
  isSigner
@@ -10551,7 +8880,7 @@ class ValidatorInfo {
10551
8880
  if (configKeys[1].isSigner) {
10552
8881
  const rawInfo = rustString().decode(Buffer.from(byteArray));
10553
8882
  const info = JSON.parse(rawInfo);
10554
- assert$7(info, InfoString);
8883
+ assert$1(info, InfoString);
10555
8884
  return new ValidatorInfo(configKeys[1].publicKey, info);
10556
8885
  }
10557
8886
  }