@solana/web3.js 1.29.2 → 1.29.4

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.
@@ -4,10 +4,9 @@ import nacl__default from 'tweetnacl';
4
4
  import { Buffer } from 'buffer';
5
5
  import BN from 'bn.js';
6
6
  import bs58 from 'bs58';
7
- import { sha256 } from 'crypto-hash';
8
7
  import { serialize, deserialize, deserializeUnchecked } from 'borsh';
9
8
  import * as BufferLayout from '@solana/buffer-layout';
10
- import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$1 } from 'superstruct';
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
10
  import { Client } from 'rpc-websockets';
12
11
  import RpcClient from 'jayson/lib/client/browser';
13
12
  import secp256k1 from 'secp256k1';
@@ -23,6 +22,1679 @@ const toBuffer = arr => {
23
22
  }
24
23
  };
25
24
 
25
+ const version$2 = "logger/5.5.0";
26
+
27
+ let _permanentCensorErrors = false;
28
+ let _censorErrors = false;
29
+ const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
30
+ let _logLevel = LogLevels["default"];
31
+ let _globalLogger = null;
32
+ function _checkNormalize() {
33
+ try {
34
+ const missing = [];
35
+ // Make sure all forms of normalization are supported
36
+ ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
37
+ try {
38
+ if ("test".normalize(form) !== "test") {
39
+ throw new Error("bad normalize");
40
+ }
41
+ ;
42
+ }
43
+ catch (error) {
44
+ missing.push(form);
45
+ }
46
+ });
47
+ if (missing.length) {
48
+ throw new Error("missing " + missing.join(", "));
49
+ }
50
+ if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) {
51
+ throw new Error("broken implementation");
52
+ }
53
+ }
54
+ catch (error) {
55
+ return error.message;
56
+ }
57
+ return null;
58
+ }
59
+ const _normalizeError = _checkNormalize();
60
+ var LogLevel;
61
+ (function (LogLevel) {
62
+ LogLevel["DEBUG"] = "DEBUG";
63
+ LogLevel["INFO"] = "INFO";
64
+ LogLevel["WARNING"] = "WARNING";
65
+ LogLevel["ERROR"] = "ERROR";
66
+ LogLevel["OFF"] = "OFF";
67
+ })(LogLevel || (LogLevel = {}));
68
+ var ErrorCode;
69
+ (function (ErrorCode) {
70
+ ///////////////////
71
+ // Generic Errors
72
+ // Unknown Error
73
+ ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
74
+ // Not Implemented
75
+ ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
76
+ // Unsupported Operation
77
+ // - operation
78
+ ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
79
+ // Network Error (i.e. Ethereum Network, such as an invalid chain ID)
80
+ // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown)
81
+ ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
82
+ // Some sort of bad response from the server
83
+ ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
84
+ // Timeout
85
+ ErrorCode["TIMEOUT"] = "TIMEOUT";
86
+ ///////////////////
87
+ // Operational Errors
88
+ // Buffer Overrun
89
+ ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
90
+ // Numeric Fault
91
+ // - operation: the operation being executed
92
+ // - fault: the reason this faulted
93
+ ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
94
+ ///////////////////
95
+ // Argument Errors
96
+ // Missing new operator to an object
97
+ // - name: The name of the class
98
+ ErrorCode["MISSING_NEW"] = "MISSING_NEW";
99
+ // Invalid argument (e.g. value is incompatible with type) to a function:
100
+ // - argument: The argument name that was invalid
101
+ // - value: The value of the argument
102
+ ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
103
+ // Missing argument to a function:
104
+ // - count: The number of arguments received
105
+ // - expectedCount: The number of arguments expected
106
+ ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
107
+ // Too many arguments
108
+ // - count: The number of arguments received
109
+ // - expectedCount: The number of arguments expected
110
+ ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
111
+ ///////////////////
112
+ // Blockchain Errors
113
+ // Call exception
114
+ // - transaction: the transaction
115
+ // - address?: the contract address
116
+ // - args?: The arguments passed into the function
117
+ // - method?: The Solidity method signature
118
+ // - errorSignature?: The EIP848 error signature
119
+ // - errorArgs?: The EIP848 error parameters
120
+ // - reason: The reason (only for EIP848 "Error(string)")
121
+ ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
122
+ // Insufficient funds (< value + gasLimit * gasPrice)
123
+ // - transaction: the transaction attempted
124
+ ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
125
+ // Nonce has already been used
126
+ // - transaction: the transaction attempted
127
+ ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
128
+ // The replacement fee for the transaction is too low
129
+ // - transaction: the transaction attempted
130
+ ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
131
+ // The gas limit could not be estimated
132
+ // - transaction: the transaction passed to estimateGas
133
+ ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
134
+ // The transaction was replaced by one with a higher gas price
135
+ // - reason: "cancelled", "replaced" or "repriced"
136
+ // - cancelled: true if reason == "cancelled" or reason == "replaced")
137
+ // - hash: original transaction hash
138
+ // - replacement: the full TransactionsResponse for the replacement
139
+ // - receipt: the receipt of the replacement
140
+ ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
141
+ })(ErrorCode || (ErrorCode = {}));
142
+ const HEX = "0123456789abcdef";
143
+ class Logger {
144
+ constructor(version) {
145
+ Object.defineProperty(this, "version", {
146
+ enumerable: true,
147
+ value: version,
148
+ writable: false
149
+ });
150
+ }
151
+ _log(logLevel, args) {
152
+ const level = logLevel.toLowerCase();
153
+ if (LogLevels[level] == null) {
154
+ this.throwArgumentError("invalid log level name", "logLevel", logLevel);
155
+ }
156
+ if (_logLevel > LogLevels[level]) {
157
+ return;
158
+ }
159
+ console.log.apply(console, args);
160
+ }
161
+ debug(...args) {
162
+ this._log(Logger.levels.DEBUG, args);
163
+ }
164
+ info(...args) {
165
+ this._log(Logger.levels.INFO, args);
166
+ }
167
+ warn(...args) {
168
+ this._log(Logger.levels.WARNING, args);
169
+ }
170
+ makeError(message, code, params) {
171
+ // Errors are being censored
172
+ if (_censorErrors) {
173
+ return this.makeError("censored error", code, {});
174
+ }
175
+ if (!code) {
176
+ code = Logger.errors.UNKNOWN_ERROR;
177
+ }
178
+ if (!params) {
179
+ params = {};
180
+ }
181
+ const messageDetails = [];
182
+ Object.keys(params).forEach((key) => {
183
+ const value = params[key];
184
+ try {
185
+ if (value instanceof Uint8Array) {
186
+ let hex = "";
187
+ for (let i = 0; i < value.length; i++) {
188
+ hex += HEX[value[i] >> 4];
189
+ hex += HEX[value[i] & 0x0f];
190
+ }
191
+ messageDetails.push(key + "=Uint8Array(0x" + hex + ")");
192
+ }
193
+ else {
194
+ messageDetails.push(key + "=" + JSON.stringify(value));
195
+ }
196
+ }
197
+ catch (error) {
198
+ messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
199
+ }
200
+ });
201
+ messageDetails.push(`code=${code}`);
202
+ messageDetails.push(`version=${this.version}`);
203
+ const reason = message;
204
+ if (messageDetails.length) {
205
+ message += " (" + messageDetails.join(", ") + ")";
206
+ }
207
+ // @TODO: Any??
208
+ const error = new Error(message);
209
+ error.reason = reason;
210
+ error.code = code;
211
+ Object.keys(params).forEach(function (key) {
212
+ error[key] = params[key];
213
+ });
214
+ return error;
215
+ }
216
+ throwError(message, code, params) {
217
+ throw this.makeError(message, code, params);
218
+ }
219
+ throwArgumentError(message, name, value) {
220
+ return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
221
+ argument: name,
222
+ value: value
223
+ });
224
+ }
225
+ assert(condition, message, code, params) {
226
+ if (!!condition) {
227
+ return;
228
+ }
229
+ this.throwError(message, code, params);
230
+ }
231
+ assertArgument(condition, message, name, value) {
232
+ if (!!condition) {
233
+ return;
234
+ }
235
+ this.throwArgumentError(message, name, value);
236
+ }
237
+ checkNormalize(message) {
238
+ if (_normalizeError) {
239
+ this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
240
+ operation: "String.prototype.normalize", form: _normalizeError
241
+ });
242
+ }
243
+ }
244
+ checkSafeUint53(value, message) {
245
+ if (typeof (value) !== "number") {
246
+ return;
247
+ }
248
+ if (message == null) {
249
+ message = "value not safe";
250
+ }
251
+ if (value < 0 || value >= 0x1fffffffffffff) {
252
+ this.throwError(message, Logger.errors.NUMERIC_FAULT, {
253
+ operation: "checkSafeInteger",
254
+ fault: "out-of-safe-range",
255
+ value: value
256
+ });
257
+ }
258
+ if (value % 1) {
259
+ this.throwError(message, Logger.errors.NUMERIC_FAULT, {
260
+ operation: "checkSafeInteger",
261
+ fault: "non-integer",
262
+ value: value
263
+ });
264
+ }
265
+ }
266
+ checkArgumentCount(count, expectedCount, message) {
267
+ if (message) {
268
+ message = ": " + message;
269
+ }
270
+ else {
271
+ message = "";
272
+ }
273
+ if (count < expectedCount) {
274
+ this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
275
+ count: count,
276
+ expectedCount: expectedCount
277
+ });
278
+ }
279
+ if (count > expectedCount) {
280
+ this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
281
+ count: count,
282
+ expectedCount: expectedCount
283
+ });
284
+ }
285
+ }
286
+ checkNew(target, kind) {
287
+ if (target === Object || target == null) {
288
+ this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
289
+ }
290
+ }
291
+ checkAbstract(target, kind) {
292
+ if (target === kind) {
293
+ this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
294
+ }
295
+ else if (target === Object || target == null) {
296
+ this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
297
+ }
298
+ }
299
+ static globalLogger() {
300
+ if (!_globalLogger) {
301
+ _globalLogger = new Logger(version$2);
302
+ }
303
+ return _globalLogger;
304
+ }
305
+ static setCensorship(censorship, permanent) {
306
+ if (!censorship && permanent) {
307
+ this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, {
308
+ operation: "setCensorship"
309
+ });
310
+ }
311
+ if (_permanentCensorErrors) {
312
+ if (!censorship) {
313
+ return;
314
+ }
315
+ this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
316
+ operation: "setCensorship"
317
+ });
318
+ }
319
+ _censorErrors = !!censorship;
320
+ _permanentCensorErrors = !!permanent;
321
+ }
322
+ static setLogLevel(logLevel) {
323
+ const level = LogLevels[logLevel.toLowerCase()];
324
+ if (level == null) {
325
+ Logger.globalLogger().warn("invalid log level - " + logLevel);
326
+ return;
327
+ }
328
+ _logLevel = level;
329
+ }
330
+ static from(version) {
331
+ return new Logger(version);
332
+ }
333
+ }
334
+ Logger.errors = ErrorCode;
335
+ Logger.levels = LogLevel;
336
+
337
+ const version$1 = "bytes/5.5.0";
338
+
339
+ const logger = new Logger(version$1);
340
+ ///////////////////////////////
341
+ function isHexable(value) {
342
+ return !!(value.toHexString);
343
+ }
344
+ function addSlice(array) {
345
+ if (array.slice) {
346
+ return array;
347
+ }
348
+ array.slice = function () {
349
+ const args = Array.prototype.slice.call(arguments);
350
+ return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
351
+ };
352
+ return array;
353
+ }
354
+ function isInteger(value) {
355
+ return (typeof (value) === "number" && value == value && (value % 1) === 0);
356
+ }
357
+ function isBytes(value) {
358
+ if (value == null) {
359
+ return false;
360
+ }
361
+ if (value.constructor === Uint8Array) {
362
+ return true;
363
+ }
364
+ if (typeof (value) === "string") {
365
+ return false;
366
+ }
367
+ if (!isInteger(value.length) || value.length < 0) {
368
+ return false;
369
+ }
370
+ for (let i = 0; i < value.length; i++) {
371
+ const v = value[i];
372
+ if (!isInteger(v) || v < 0 || v >= 256) {
373
+ return false;
374
+ }
375
+ }
376
+ return true;
377
+ }
378
+ function arrayify(value, options) {
379
+ if (!options) {
380
+ options = {};
381
+ }
382
+ if (typeof (value) === "number") {
383
+ logger.checkSafeUint53(value, "invalid arrayify value");
384
+ const result = [];
385
+ while (value) {
386
+ result.unshift(value & 0xff);
387
+ value = parseInt(String(value / 256));
388
+ }
389
+ if (result.length === 0) {
390
+ result.push(0);
391
+ }
392
+ return addSlice(new Uint8Array(result));
393
+ }
394
+ if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
395
+ value = "0x" + value;
396
+ }
397
+ if (isHexable(value)) {
398
+ value = value.toHexString();
399
+ }
400
+ if (isHexString(value)) {
401
+ let hex = value.substring(2);
402
+ if (hex.length % 2) {
403
+ if (options.hexPad === "left") {
404
+ hex = "0x0" + hex.substring(2);
405
+ }
406
+ else if (options.hexPad === "right") {
407
+ hex += "0";
408
+ }
409
+ else {
410
+ logger.throwArgumentError("hex data is odd-length", "value", value);
411
+ }
412
+ }
413
+ const result = [];
414
+ for (let i = 0; i < hex.length; i += 2) {
415
+ result.push(parseInt(hex.substring(i, i + 2), 16));
416
+ }
417
+ return addSlice(new Uint8Array(result));
418
+ }
419
+ if (isBytes(value)) {
420
+ return addSlice(new Uint8Array(value));
421
+ }
422
+ return logger.throwArgumentError("invalid arrayify value", "value", value);
423
+ }
424
+ function isHexString(value, length) {
425
+ if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
426
+ return false;
427
+ }
428
+ if (length && value.length !== 2 + 2 * length) {
429
+ return false;
430
+ }
431
+ return true;
432
+ }
433
+
434
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
435
+
436
+ function getDefaultExportFromCjs (x) {
437
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
438
+ }
439
+
440
+ var hash$1 = {};
441
+
442
+ var utils$9 = {};
443
+
444
+ var minimalisticAssert = assert$6;
445
+
446
+ function assert$6(val, msg) {
447
+ if (!val)
448
+ throw new Error(msg || 'Assertion failed');
449
+ }
450
+
451
+ assert$6.equal = function assertEqual(l, r, msg) {
452
+ if (l != r)
453
+ throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
454
+ };
455
+
456
+ var inherits_browser = {exports: {}};
457
+
458
+ if (typeof Object.create === 'function') {
459
+ // implementation from standard node.js 'util' module
460
+ inherits_browser.exports = function inherits(ctor, superCtor) {
461
+ ctor.super_ = superCtor;
462
+ ctor.prototype = Object.create(superCtor.prototype, {
463
+ constructor: {
464
+ value: ctor,
465
+ enumerable: false,
466
+ writable: true,
467
+ configurable: true
468
+ }
469
+ });
470
+ };
471
+ } else {
472
+ // old school shim for old browsers
473
+ inherits_browser.exports = function inherits(ctor, superCtor) {
474
+ ctor.super_ = superCtor;
475
+ var TempCtor = function () {};
476
+ TempCtor.prototype = superCtor.prototype;
477
+ ctor.prototype = new TempCtor();
478
+ ctor.prototype.constructor = ctor;
479
+ };
480
+ }
481
+
482
+ var assert$5 = minimalisticAssert;
483
+ var inherits = inherits_browser.exports;
484
+
485
+ utils$9.inherits = inherits;
486
+
487
+ function isSurrogatePair(msg, i) {
488
+ if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
489
+ return false;
490
+ }
491
+ if (i < 0 || i + 1 >= msg.length) {
492
+ return false;
493
+ }
494
+ return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
495
+ }
496
+
497
+ function toArray(msg, enc) {
498
+ if (Array.isArray(msg))
499
+ return msg.slice();
500
+ if (!msg)
501
+ return [];
502
+ var res = [];
503
+ if (typeof msg === 'string') {
504
+ if (!enc) {
505
+ // Inspired by stringToUtf8ByteArray() in closure-library by Google
506
+ // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
507
+ // Apache License 2.0
508
+ // https://github.com/google/closure-library/blob/master/LICENSE
509
+ var p = 0;
510
+ for (var i = 0; i < msg.length; i++) {
511
+ var c = msg.charCodeAt(i);
512
+ if (c < 128) {
513
+ res[p++] = c;
514
+ } else if (c < 2048) {
515
+ res[p++] = (c >> 6) | 192;
516
+ res[p++] = (c & 63) | 128;
517
+ } else if (isSurrogatePair(msg, i)) {
518
+ c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
519
+ res[p++] = (c >> 18) | 240;
520
+ res[p++] = ((c >> 12) & 63) | 128;
521
+ res[p++] = ((c >> 6) & 63) | 128;
522
+ res[p++] = (c & 63) | 128;
523
+ } else {
524
+ res[p++] = (c >> 12) | 224;
525
+ res[p++] = ((c >> 6) & 63) | 128;
526
+ res[p++] = (c & 63) | 128;
527
+ }
528
+ }
529
+ } else if (enc === 'hex') {
530
+ msg = msg.replace(/[^a-z0-9]+/ig, '');
531
+ if (msg.length % 2 !== 0)
532
+ msg = '0' + msg;
533
+ for (i = 0; i < msg.length; i += 2)
534
+ res.push(parseInt(msg[i] + msg[i + 1], 16));
535
+ }
536
+ } else {
537
+ for (i = 0; i < msg.length; i++)
538
+ res[i] = msg[i] | 0;
539
+ }
540
+ return res;
541
+ }
542
+ utils$9.toArray = toArray;
543
+
544
+ function toHex(msg) {
545
+ var res = '';
546
+ for (var i = 0; i < msg.length; i++)
547
+ res += zero2(msg[i].toString(16));
548
+ return res;
549
+ }
550
+ utils$9.toHex = toHex;
551
+
552
+ function htonl(w) {
553
+ var res = (w >>> 24) |
554
+ ((w >>> 8) & 0xff00) |
555
+ ((w << 8) & 0xff0000) |
556
+ ((w & 0xff) << 24);
557
+ return res >>> 0;
558
+ }
559
+ utils$9.htonl = htonl;
560
+
561
+ function toHex32(msg, endian) {
562
+ var res = '';
563
+ for (var i = 0; i < msg.length; i++) {
564
+ var w = msg[i];
565
+ if (endian === 'little')
566
+ w = htonl(w);
567
+ res += zero8(w.toString(16));
568
+ }
569
+ return res;
570
+ }
571
+ utils$9.toHex32 = toHex32;
572
+
573
+ function zero2(word) {
574
+ if (word.length === 1)
575
+ return '0' + word;
576
+ else
577
+ return word;
578
+ }
579
+ utils$9.zero2 = zero2;
580
+
581
+ function zero8(word) {
582
+ if (word.length === 7)
583
+ return '0' + word;
584
+ else if (word.length === 6)
585
+ return '00' + word;
586
+ else if (word.length === 5)
587
+ return '000' + word;
588
+ else if (word.length === 4)
589
+ return '0000' + word;
590
+ else if (word.length === 3)
591
+ return '00000' + word;
592
+ else if (word.length === 2)
593
+ return '000000' + word;
594
+ else if (word.length === 1)
595
+ return '0000000' + word;
596
+ else
597
+ return word;
598
+ }
599
+ utils$9.zero8 = zero8;
600
+
601
+ function join32(msg, start, end, endian) {
602
+ var len = end - start;
603
+ assert$5(len % 4 === 0);
604
+ var res = new Array(len / 4);
605
+ for (var i = 0, k = start; i < res.length; i++, k += 4) {
606
+ var w;
607
+ if (endian === 'big')
608
+ w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
609
+ else
610
+ w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
611
+ res[i] = w >>> 0;
612
+ }
613
+ return res;
614
+ }
615
+ utils$9.join32 = join32;
616
+
617
+ function split32(msg, endian) {
618
+ var res = new Array(msg.length * 4);
619
+ for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
620
+ var m = msg[i];
621
+ if (endian === 'big') {
622
+ res[k] = m >>> 24;
623
+ res[k + 1] = (m >>> 16) & 0xff;
624
+ res[k + 2] = (m >>> 8) & 0xff;
625
+ res[k + 3] = m & 0xff;
626
+ } else {
627
+ res[k + 3] = m >>> 24;
628
+ res[k + 2] = (m >>> 16) & 0xff;
629
+ res[k + 1] = (m >>> 8) & 0xff;
630
+ res[k] = m & 0xff;
631
+ }
632
+ }
633
+ return res;
634
+ }
635
+ utils$9.split32 = split32;
636
+
637
+ function rotr32$1(w, b) {
638
+ return (w >>> b) | (w << (32 - b));
639
+ }
640
+ utils$9.rotr32 = rotr32$1;
641
+
642
+ function rotl32$2(w, b) {
643
+ return (w << b) | (w >>> (32 - b));
644
+ }
645
+ utils$9.rotl32 = rotl32$2;
646
+
647
+ function sum32$3(a, b) {
648
+ return (a + b) >>> 0;
649
+ }
650
+ utils$9.sum32 = sum32$3;
651
+
652
+ function sum32_3$1(a, b, c) {
653
+ return (a + b + c) >>> 0;
654
+ }
655
+ utils$9.sum32_3 = sum32_3$1;
656
+
657
+ function sum32_4$2(a, b, c, d) {
658
+ return (a + b + c + d) >>> 0;
659
+ }
660
+ utils$9.sum32_4 = sum32_4$2;
661
+
662
+ function sum32_5$2(a, b, c, d, e) {
663
+ return (a + b + c + d + e) >>> 0;
664
+ }
665
+ utils$9.sum32_5 = sum32_5$2;
666
+
667
+ function sum64$1(buf, pos, ah, al) {
668
+ var bh = buf[pos];
669
+ var bl = buf[pos + 1];
670
+
671
+ var lo = (al + bl) >>> 0;
672
+ var hi = (lo < al ? 1 : 0) + ah + bh;
673
+ buf[pos] = hi >>> 0;
674
+ buf[pos + 1] = lo;
675
+ }
676
+ utils$9.sum64 = sum64$1;
677
+
678
+ function sum64_hi$1(ah, al, bh, bl) {
679
+ var lo = (al + bl) >>> 0;
680
+ var hi = (lo < al ? 1 : 0) + ah + bh;
681
+ return hi >>> 0;
682
+ }
683
+ utils$9.sum64_hi = sum64_hi$1;
684
+
685
+ function sum64_lo$1(ah, al, bh, bl) {
686
+ var lo = al + bl;
687
+ return lo >>> 0;
688
+ }
689
+ utils$9.sum64_lo = sum64_lo$1;
690
+
691
+ function sum64_4_hi$1(ah, al, bh, bl, ch, cl, dh, dl) {
692
+ var carry = 0;
693
+ var lo = al;
694
+ lo = (lo + bl) >>> 0;
695
+ carry += lo < al ? 1 : 0;
696
+ lo = (lo + cl) >>> 0;
697
+ carry += lo < cl ? 1 : 0;
698
+ lo = (lo + dl) >>> 0;
699
+ carry += lo < dl ? 1 : 0;
700
+
701
+ var hi = ah + bh + ch + dh + carry;
702
+ return hi >>> 0;
703
+ }
704
+ utils$9.sum64_4_hi = sum64_4_hi$1;
705
+
706
+ function sum64_4_lo$1(ah, al, bh, bl, ch, cl, dh, dl) {
707
+ var lo = al + bl + cl + dl;
708
+ return lo >>> 0;
709
+ }
710
+ utils$9.sum64_4_lo = sum64_4_lo$1;
711
+
712
+ function sum64_5_hi$1(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
713
+ var carry = 0;
714
+ var lo = al;
715
+ lo = (lo + bl) >>> 0;
716
+ carry += lo < al ? 1 : 0;
717
+ lo = (lo + cl) >>> 0;
718
+ carry += lo < cl ? 1 : 0;
719
+ lo = (lo + dl) >>> 0;
720
+ carry += lo < dl ? 1 : 0;
721
+ lo = (lo + el) >>> 0;
722
+ carry += lo < el ? 1 : 0;
723
+
724
+ var hi = ah + bh + ch + dh + eh + carry;
725
+ return hi >>> 0;
726
+ }
727
+ utils$9.sum64_5_hi = sum64_5_hi$1;
728
+
729
+ function sum64_5_lo$1(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
730
+ var lo = al + bl + cl + dl + el;
731
+
732
+ return lo >>> 0;
733
+ }
734
+ utils$9.sum64_5_lo = sum64_5_lo$1;
735
+
736
+ function rotr64_hi$1(ah, al, num) {
737
+ var r = (al << (32 - num)) | (ah >>> num);
738
+ return r >>> 0;
739
+ }
740
+ utils$9.rotr64_hi = rotr64_hi$1;
741
+
742
+ function rotr64_lo$1(ah, al, num) {
743
+ var r = (ah << (32 - num)) | (al >>> num);
744
+ return r >>> 0;
745
+ }
746
+ utils$9.rotr64_lo = rotr64_lo$1;
747
+
748
+ function shr64_hi$1(ah, al, num) {
749
+ return ah >>> num;
750
+ }
751
+ utils$9.shr64_hi = shr64_hi$1;
752
+
753
+ function shr64_lo$1(ah, al, num) {
754
+ var r = (ah << (32 - num)) | (al >>> num);
755
+ return r >>> 0;
756
+ }
757
+ utils$9.shr64_lo = shr64_lo$1;
758
+
759
+ var common$5 = {};
760
+
761
+ var utils$8 = utils$9;
762
+ var assert$4 = minimalisticAssert;
763
+
764
+ function BlockHash$4() {
765
+ this.pending = null;
766
+ this.pendingTotal = 0;
767
+ this.blockSize = this.constructor.blockSize;
768
+ this.outSize = this.constructor.outSize;
769
+ this.hmacStrength = this.constructor.hmacStrength;
770
+ this.padLength = this.constructor.padLength / 8;
771
+ this.endian = 'big';
772
+
773
+ this._delta8 = this.blockSize / 8;
774
+ this._delta32 = this.blockSize / 32;
775
+ }
776
+ common$5.BlockHash = BlockHash$4;
777
+
778
+ BlockHash$4.prototype.update = function update(msg, enc) {
779
+ // Convert message to array, pad it, and join into 32bit blocks
780
+ msg = utils$8.toArray(msg, enc);
781
+ if (!this.pending)
782
+ this.pending = msg;
783
+ else
784
+ this.pending = this.pending.concat(msg);
785
+ this.pendingTotal += msg.length;
786
+
787
+ // Enough data, try updating
788
+ if (this.pending.length >= this._delta8) {
789
+ msg = this.pending;
790
+
791
+ // Process pending data in blocks
792
+ var r = msg.length % this._delta8;
793
+ this.pending = msg.slice(msg.length - r, msg.length);
794
+ if (this.pending.length === 0)
795
+ this.pending = null;
796
+
797
+ msg = utils$8.join32(msg, 0, msg.length - r, this.endian);
798
+ for (var i = 0; i < msg.length; i += this._delta32)
799
+ this._update(msg, i, i + this._delta32);
800
+ }
801
+
802
+ return this;
803
+ };
804
+
805
+ BlockHash$4.prototype.digest = function digest(enc) {
806
+ this.update(this._pad());
807
+ assert$4(this.pending === null);
808
+
809
+ return this._digest(enc);
810
+ };
811
+
812
+ BlockHash$4.prototype._pad = function pad() {
813
+ var len = this.pendingTotal;
814
+ var bytes = this._delta8;
815
+ var k = bytes - ((len + this.padLength) % bytes);
816
+ var res = new Array(k + this.padLength);
817
+ res[0] = 0x80;
818
+ for (var i = 1; i < k; i++)
819
+ res[i] = 0;
820
+
821
+ // Append length
822
+ len <<= 3;
823
+ if (this.endian === 'big') {
824
+ for (var t = 8; t < this.padLength; t++)
825
+ res[i++] = 0;
826
+
827
+ res[i++] = 0;
828
+ res[i++] = 0;
829
+ res[i++] = 0;
830
+ res[i++] = 0;
831
+ res[i++] = (len >>> 24) & 0xff;
832
+ res[i++] = (len >>> 16) & 0xff;
833
+ res[i++] = (len >>> 8) & 0xff;
834
+ res[i++] = len & 0xff;
835
+ } else {
836
+ res[i++] = len & 0xff;
837
+ res[i++] = (len >>> 8) & 0xff;
838
+ res[i++] = (len >>> 16) & 0xff;
839
+ res[i++] = (len >>> 24) & 0xff;
840
+ res[i++] = 0;
841
+ res[i++] = 0;
842
+ res[i++] = 0;
843
+ res[i++] = 0;
844
+
845
+ for (t = 8; t < this.padLength; t++)
846
+ res[i++] = 0;
847
+ }
848
+
849
+ return res;
850
+ };
851
+
852
+ var sha = {};
853
+
854
+ var common$4 = {};
855
+
856
+ var utils$7 = utils$9;
857
+ var rotr32 = utils$7.rotr32;
858
+
859
+ function ft_1$1(s, x, y, z) {
860
+ if (s === 0)
861
+ return ch32$1(x, y, z);
862
+ if (s === 1 || s === 3)
863
+ return p32(x, y, z);
864
+ if (s === 2)
865
+ return maj32$1(x, y, z);
866
+ }
867
+ common$4.ft_1 = ft_1$1;
868
+
869
+ function ch32$1(x, y, z) {
870
+ return (x & y) ^ ((~x) & z);
871
+ }
872
+ common$4.ch32 = ch32$1;
873
+
874
+ function maj32$1(x, y, z) {
875
+ return (x & y) ^ (x & z) ^ (y & z);
876
+ }
877
+ common$4.maj32 = maj32$1;
878
+
879
+ function p32(x, y, z) {
880
+ return x ^ y ^ z;
881
+ }
882
+ common$4.p32 = p32;
883
+
884
+ function s0_256$1(x) {
885
+ return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
886
+ }
887
+ common$4.s0_256 = s0_256$1;
888
+
889
+ function s1_256$1(x) {
890
+ return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
891
+ }
892
+ common$4.s1_256 = s1_256$1;
893
+
894
+ function g0_256$1(x) {
895
+ return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
896
+ }
897
+ common$4.g0_256 = g0_256$1;
898
+
899
+ function g1_256$1(x) {
900
+ return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
901
+ }
902
+ common$4.g1_256 = g1_256$1;
903
+
904
+ var utils$6 = utils$9;
905
+ var common$3 = common$5;
906
+ var shaCommon$1 = common$4;
907
+
908
+ var rotl32$1 = utils$6.rotl32;
909
+ var sum32$2 = utils$6.sum32;
910
+ var sum32_5$1 = utils$6.sum32_5;
911
+ var ft_1 = shaCommon$1.ft_1;
912
+ var BlockHash$3 = common$3.BlockHash;
913
+
914
+ var sha1_K = [
915
+ 0x5A827999, 0x6ED9EBA1,
916
+ 0x8F1BBCDC, 0xCA62C1D6
917
+ ];
918
+
919
+ function SHA1() {
920
+ if (!(this instanceof SHA1))
921
+ return new SHA1();
922
+
923
+ BlockHash$3.call(this);
924
+ this.h = [
925
+ 0x67452301, 0xefcdab89, 0x98badcfe,
926
+ 0x10325476, 0xc3d2e1f0 ];
927
+ this.W = new Array(80);
928
+ }
929
+
930
+ utils$6.inherits(SHA1, BlockHash$3);
931
+ var _1 = SHA1;
932
+
933
+ SHA1.blockSize = 512;
934
+ SHA1.outSize = 160;
935
+ SHA1.hmacStrength = 80;
936
+ SHA1.padLength = 64;
937
+
938
+ SHA1.prototype._update = function _update(msg, start) {
939
+ var W = this.W;
940
+
941
+ for (var i = 0; i < 16; i++)
942
+ W[i] = msg[start + i];
943
+
944
+ for(; i < W.length; i++)
945
+ W[i] = rotl32$1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
946
+
947
+ var a = this.h[0];
948
+ var b = this.h[1];
949
+ var c = this.h[2];
950
+ var d = this.h[3];
951
+ var e = this.h[4];
952
+
953
+ for (i = 0; i < W.length; i++) {
954
+ var s = ~~(i / 20);
955
+ var t = sum32_5$1(rotl32$1(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
956
+ e = d;
957
+ d = c;
958
+ c = rotl32$1(b, 30);
959
+ b = a;
960
+ a = t;
961
+ }
962
+
963
+ this.h[0] = sum32$2(this.h[0], a);
964
+ this.h[1] = sum32$2(this.h[1], b);
965
+ this.h[2] = sum32$2(this.h[2], c);
966
+ this.h[3] = sum32$2(this.h[3], d);
967
+ this.h[4] = sum32$2(this.h[4], e);
968
+ };
969
+
970
+ SHA1.prototype._digest = function digest(enc) {
971
+ if (enc === 'hex')
972
+ return utils$6.toHex32(this.h, 'big');
973
+ else
974
+ return utils$6.split32(this.h, 'big');
975
+ };
976
+
977
+ var utils$5 = utils$9;
978
+ var common$2 = common$5;
979
+ var shaCommon = common$4;
980
+ var assert$3 = minimalisticAssert;
981
+
982
+ var sum32$1 = utils$5.sum32;
983
+ var sum32_4$1 = utils$5.sum32_4;
984
+ var sum32_5 = utils$5.sum32_5;
985
+ var ch32 = shaCommon.ch32;
986
+ var maj32 = shaCommon.maj32;
987
+ var s0_256 = shaCommon.s0_256;
988
+ var s1_256 = shaCommon.s1_256;
989
+ var g0_256 = shaCommon.g0_256;
990
+ var g1_256 = shaCommon.g1_256;
991
+
992
+ var BlockHash$2 = common$2.BlockHash;
993
+
994
+ var sha256_K = [
995
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
996
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
997
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
998
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
999
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
1000
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
1001
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
1002
+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
1003
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
1004
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
1005
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
1006
+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
1007
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
1008
+ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
1009
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
1010
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
1011
+ ];
1012
+
1013
+ function SHA256$1() {
1014
+ if (!(this instanceof SHA256$1))
1015
+ return new SHA256$1();
1016
+
1017
+ BlockHash$2.call(this);
1018
+ this.h = [
1019
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
1020
+ 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
1021
+ ];
1022
+ this.k = sha256_K;
1023
+ this.W = new Array(64);
1024
+ }
1025
+ utils$5.inherits(SHA256$1, BlockHash$2);
1026
+ var _256 = SHA256$1;
1027
+
1028
+ SHA256$1.blockSize = 512;
1029
+ SHA256$1.outSize = 256;
1030
+ SHA256$1.hmacStrength = 192;
1031
+ SHA256$1.padLength = 64;
1032
+
1033
+ SHA256$1.prototype._update = function _update(msg, start) {
1034
+ var W = this.W;
1035
+
1036
+ for (var i = 0; i < 16; i++)
1037
+ W[i] = msg[start + i];
1038
+ for (; i < W.length; i++)
1039
+ W[i] = sum32_4$1(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
1040
+
1041
+ var a = this.h[0];
1042
+ var b = this.h[1];
1043
+ var c = this.h[2];
1044
+ var d = this.h[3];
1045
+ var e = this.h[4];
1046
+ var f = this.h[5];
1047
+ var g = this.h[6];
1048
+ var h = this.h[7];
1049
+
1050
+ assert$3(this.k.length === W.length);
1051
+ for (i = 0; i < W.length; i++) {
1052
+ var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
1053
+ var T2 = sum32$1(s0_256(a), maj32(a, b, c));
1054
+ h = g;
1055
+ g = f;
1056
+ f = e;
1057
+ e = sum32$1(d, T1);
1058
+ d = c;
1059
+ c = b;
1060
+ b = a;
1061
+ a = sum32$1(T1, T2);
1062
+ }
1063
+
1064
+ this.h[0] = sum32$1(this.h[0], a);
1065
+ this.h[1] = sum32$1(this.h[1], b);
1066
+ this.h[2] = sum32$1(this.h[2], c);
1067
+ this.h[3] = sum32$1(this.h[3], d);
1068
+ this.h[4] = sum32$1(this.h[4], e);
1069
+ this.h[5] = sum32$1(this.h[5], f);
1070
+ this.h[6] = sum32$1(this.h[6], g);
1071
+ this.h[7] = sum32$1(this.h[7], h);
1072
+ };
1073
+
1074
+ SHA256$1.prototype._digest = function digest(enc) {
1075
+ if (enc === 'hex')
1076
+ return utils$5.toHex32(this.h, 'big');
1077
+ else
1078
+ return utils$5.split32(this.h, 'big');
1079
+ };
1080
+
1081
+ var utils$4 = utils$9;
1082
+ var SHA256 = _256;
1083
+
1084
+ function SHA224() {
1085
+ if (!(this instanceof SHA224))
1086
+ return new SHA224();
1087
+
1088
+ SHA256.call(this);
1089
+ this.h = [
1090
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
1091
+ 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
1092
+ }
1093
+ utils$4.inherits(SHA224, SHA256);
1094
+ var _224 = SHA224;
1095
+
1096
+ SHA224.blockSize = 512;
1097
+ SHA224.outSize = 224;
1098
+ SHA224.hmacStrength = 192;
1099
+ SHA224.padLength = 64;
1100
+
1101
+ SHA224.prototype._digest = function digest(enc) {
1102
+ // Just truncate output
1103
+ if (enc === 'hex')
1104
+ return utils$4.toHex32(this.h.slice(0, 7), 'big');
1105
+ else
1106
+ return utils$4.split32(this.h.slice(0, 7), 'big');
1107
+ };
1108
+
1109
+ var utils$3 = utils$9;
1110
+ var common$1 = common$5;
1111
+ var assert$2 = minimalisticAssert;
1112
+
1113
+ var rotr64_hi = utils$3.rotr64_hi;
1114
+ var rotr64_lo = utils$3.rotr64_lo;
1115
+ var shr64_hi = utils$3.shr64_hi;
1116
+ var shr64_lo = utils$3.shr64_lo;
1117
+ var sum64 = utils$3.sum64;
1118
+ var sum64_hi = utils$3.sum64_hi;
1119
+ var sum64_lo = utils$3.sum64_lo;
1120
+ var sum64_4_hi = utils$3.sum64_4_hi;
1121
+ var sum64_4_lo = utils$3.sum64_4_lo;
1122
+ var sum64_5_hi = utils$3.sum64_5_hi;
1123
+ var sum64_5_lo = utils$3.sum64_5_lo;
1124
+
1125
+ var BlockHash$1 = common$1.BlockHash;
1126
+
1127
+ var sha512_K = [
1128
+ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
1129
+ 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
1130
+ 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
1131
+ 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
1132
+ 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
1133
+ 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
1134
+ 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
1135
+ 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
1136
+ 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
1137
+ 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
1138
+ 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
1139
+ 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
1140
+ 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
1141
+ 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
1142
+ 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
1143
+ 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
1144
+ 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
1145
+ 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
1146
+ 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
1147
+ 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
1148
+ 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
1149
+ 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
1150
+ 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
1151
+ 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
1152
+ 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
1153
+ 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
1154
+ 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
1155
+ 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
1156
+ 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
1157
+ 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
1158
+ 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
1159
+ 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
1160
+ 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
1161
+ 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
1162
+ 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
1163
+ 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
1164
+ 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
1165
+ 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
1166
+ 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
1167
+ 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
1168
+ ];
1169
+
1170
+ function SHA512$1() {
1171
+ if (!(this instanceof SHA512$1))
1172
+ return new SHA512$1();
1173
+
1174
+ BlockHash$1.call(this);
1175
+ this.h = [
1176
+ 0x6a09e667, 0xf3bcc908,
1177
+ 0xbb67ae85, 0x84caa73b,
1178
+ 0x3c6ef372, 0xfe94f82b,
1179
+ 0xa54ff53a, 0x5f1d36f1,
1180
+ 0x510e527f, 0xade682d1,
1181
+ 0x9b05688c, 0x2b3e6c1f,
1182
+ 0x1f83d9ab, 0xfb41bd6b,
1183
+ 0x5be0cd19, 0x137e2179 ];
1184
+ this.k = sha512_K;
1185
+ this.W = new Array(160);
1186
+ }
1187
+ utils$3.inherits(SHA512$1, BlockHash$1);
1188
+ var _512 = SHA512$1;
1189
+
1190
+ SHA512$1.blockSize = 1024;
1191
+ SHA512$1.outSize = 512;
1192
+ SHA512$1.hmacStrength = 192;
1193
+ SHA512$1.padLength = 128;
1194
+
1195
+ SHA512$1.prototype._prepareBlock = function _prepareBlock(msg, start) {
1196
+ var W = this.W;
1197
+
1198
+ // 32 x 32bit words
1199
+ for (var i = 0; i < 32; i++)
1200
+ W[i] = msg[start + i];
1201
+ for (; i < W.length; i += 2) {
1202
+ var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
1203
+ var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
1204
+ var c1_hi = W[i - 14]; // i - 7
1205
+ var c1_lo = W[i - 13];
1206
+ var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
1207
+ var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
1208
+ var c3_hi = W[i - 32]; // i - 16
1209
+ var c3_lo = W[i - 31];
1210
+
1211
+ W[i] = sum64_4_hi(
1212
+ c0_hi, c0_lo,
1213
+ c1_hi, c1_lo,
1214
+ c2_hi, c2_lo,
1215
+ c3_hi, c3_lo);
1216
+ W[i + 1] = sum64_4_lo(
1217
+ c0_hi, c0_lo,
1218
+ c1_hi, c1_lo,
1219
+ c2_hi, c2_lo,
1220
+ c3_hi, c3_lo);
1221
+ }
1222
+ };
1223
+
1224
+ SHA512$1.prototype._update = function _update(msg, start) {
1225
+ this._prepareBlock(msg, start);
1226
+
1227
+ var W = this.W;
1228
+
1229
+ var ah = this.h[0];
1230
+ var al = this.h[1];
1231
+ var bh = this.h[2];
1232
+ var bl = this.h[3];
1233
+ var ch = this.h[4];
1234
+ var cl = this.h[5];
1235
+ var dh = this.h[6];
1236
+ var dl = this.h[7];
1237
+ var eh = this.h[8];
1238
+ var el = this.h[9];
1239
+ var fh = this.h[10];
1240
+ var fl = this.h[11];
1241
+ var gh = this.h[12];
1242
+ var gl = this.h[13];
1243
+ var hh = this.h[14];
1244
+ var hl = this.h[15];
1245
+
1246
+ assert$2(this.k.length === W.length);
1247
+ for (var i = 0; i < W.length; i += 2) {
1248
+ var c0_hi = hh;
1249
+ var c0_lo = hl;
1250
+ var c1_hi = s1_512_hi(eh, el);
1251
+ var c1_lo = s1_512_lo(eh, el);
1252
+ var c2_hi = ch64_hi(eh, el, fh, fl, gh);
1253
+ var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
1254
+ var c3_hi = this.k[i];
1255
+ var c3_lo = this.k[i + 1];
1256
+ var c4_hi = W[i];
1257
+ var c4_lo = W[i + 1];
1258
+
1259
+ var T1_hi = sum64_5_hi(
1260
+ c0_hi, c0_lo,
1261
+ c1_hi, c1_lo,
1262
+ c2_hi, c2_lo,
1263
+ c3_hi, c3_lo,
1264
+ c4_hi, c4_lo);
1265
+ var T1_lo = sum64_5_lo(
1266
+ c0_hi, c0_lo,
1267
+ c1_hi, c1_lo,
1268
+ c2_hi, c2_lo,
1269
+ c3_hi, c3_lo,
1270
+ c4_hi, c4_lo);
1271
+
1272
+ c0_hi = s0_512_hi(ah, al);
1273
+ c0_lo = s0_512_lo(ah, al);
1274
+ c1_hi = maj64_hi(ah, al, bh, bl, ch);
1275
+ c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
1276
+
1277
+ var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
1278
+ var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
1279
+
1280
+ hh = gh;
1281
+ hl = gl;
1282
+
1283
+ gh = fh;
1284
+ gl = fl;
1285
+
1286
+ fh = eh;
1287
+ fl = el;
1288
+
1289
+ eh = sum64_hi(dh, dl, T1_hi, T1_lo);
1290
+ el = sum64_lo(dl, dl, T1_hi, T1_lo);
1291
+
1292
+ dh = ch;
1293
+ dl = cl;
1294
+
1295
+ ch = bh;
1296
+ cl = bl;
1297
+
1298
+ bh = ah;
1299
+ bl = al;
1300
+
1301
+ ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
1302
+ al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
1303
+ }
1304
+
1305
+ sum64(this.h, 0, ah, al);
1306
+ sum64(this.h, 2, bh, bl);
1307
+ sum64(this.h, 4, ch, cl);
1308
+ sum64(this.h, 6, dh, dl);
1309
+ sum64(this.h, 8, eh, el);
1310
+ sum64(this.h, 10, fh, fl);
1311
+ sum64(this.h, 12, gh, gl);
1312
+ sum64(this.h, 14, hh, hl);
1313
+ };
1314
+
1315
+ SHA512$1.prototype._digest = function digest(enc) {
1316
+ if (enc === 'hex')
1317
+ return utils$3.toHex32(this.h, 'big');
1318
+ else
1319
+ return utils$3.split32(this.h, 'big');
1320
+ };
1321
+
1322
+ function ch64_hi(xh, xl, yh, yl, zh) {
1323
+ var r = (xh & yh) ^ ((~xh) & zh);
1324
+ if (r < 0)
1325
+ r += 0x100000000;
1326
+ return r;
1327
+ }
1328
+
1329
+ function ch64_lo(xh, xl, yh, yl, zh, zl) {
1330
+ var r = (xl & yl) ^ ((~xl) & zl);
1331
+ if (r < 0)
1332
+ r += 0x100000000;
1333
+ return r;
1334
+ }
1335
+
1336
+ function maj64_hi(xh, xl, yh, yl, zh) {
1337
+ var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
1338
+ if (r < 0)
1339
+ r += 0x100000000;
1340
+ return r;
1341
+ }
1342
+
1343
+ function maj64_lo(xh, xl, yh, yl, zh, zl) {
1344
+ var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
1345
+ if (r < 0)
1346
+ r += 0x100000000;
1347
+ return r;
1348
+ }
1349
+
1350
+ function s0_512_hi(xh, xl) {
1351
+ var c0_hi = rotr64_hi(xh, xl, 28);
1352
+ var c1_hi = rotr64_hi(xl, xh, 2); // 34
1353
+ var c2_hi = rotr64_hi(xl, xh, 7); // 39
1354
+
1355
+ var r = c0_hi ^ c1_hi ^ c2_hi;
1356
+ if (r < 0)
1357
+ r += 0x100000000;
1358
+ return r;
1359
+ }
1360
+
1361
+ function s0_512_lo(xh, xl) {
1362
+ var c0_lo = rotr64_lo(xh, xl, 28);
1363
+ var c1_lo = rotr64_lo(xl, xh, 2); // 34
1364
+ var c2_lo = rotr64_lo(xl, xh, 7); // 39
1365
+
1366
+ var r = c0_lo ^ c1_lo ^ c2_lo;
1367
+ if (r < 0)
1368
+ r += 0x100000000;
1369
+ return r;
1370
+ }
1371
+
1372
+ function s1_512_hi(xh, xl) {
1373
+ var c0_hi = rotr64_hi(xh, xl, 14);
1374
+ var c1_hi = rotr64_hi(xh, xl, 18);
1375
+ var c2_hi = rotr64_hi(xl, xh, 9); // 41
1376
+
1377
+ var r = c0_hi ^ c1_hi ^ c2_hi;
1378
+ if (r < 0)
1379
+ r += 0x100000000;
1380
+ return r;
1381
+ }
1382
+
1383
+ function s1_512_lo(xh, xl) {
1384
+ var c0_lo = rotr64_lo(xh, xl, 14);
1385
+ var c1_lo = rotr64_lo(xh, xl, 18);
1386
+ var c2_lo = rotr64_lo(xl, xh, 9); // 41
1387
+
1388
+ var r = c0_lo ^ c1_lo ^ c2_lo;
1389
+ if (r < 0)
1390
+ r += 0x100000000;
1391
+ return r;
1392
+ }
1393
+
1394
+ function g0_512_hi(xh, xl) {
1395
+ var c0_hi = rotr64_hi(xh, xl, 1);
1396
+ var c1_hi = rotr64_hi(xh, xl, 8);
1397
+ var c2_hi = shr64_hi(xh, xl, 7);
1398
+
1399
+ var r = c0_hi ^ c1_hi ^ c2_hi;
1400
+ if (r < 0)
1401
+ r += 0x100000000;
1402
+ return r;
1403
+ }
1404
+
1405
+ function g0_512_lo(xh, xl) {
1406
+ var c0_lo = rotr64_lo(xh, xl, 1);
1407
+ var c1_lo = rotr64_lo(xh, xl, 8);
1408
+ var c2_lo = shr64_lo(xh, xl, 7);
1409
+
1410
+ var r = c0_lo ^ c1_lo ^ c2_lo;
1411
+ if (r < 0)
1412
+ r += 0x100000000;
1413
+ return r;
1414
+ }
1415
+
1416
+ function g1_512_hi(xh, xl) {
1417
+ var c0_hi = rotr64_hi(xh, xl, 19);
1418
+ var c1_hi = rotr64_hi(xl, xh, 29); // 61
1419
+ var c2_hi = shr64_hi(xh, xl, 6);
1420
+
1421
+ var r = c0_hi ^ c1_hi ^ c2_hi;
1422
+ if (r < 0)
1423
+ r += 0x100000000;
1424
+ return r;
1425
+ }
1426
+
1427
+ function g1_512_lo(xh, xl) {
1428
+ var c0_lo = rotr64_lo(xh, xl, 19);
1429
+ var c1_lo = rotr64_lo(xl, xh, 29); // 61
1430
+ var c2_lo = shr64_lo(xh, xl, 6);
1431
+
1432
+ var r = c0_lo ^ c1_lo ^ c2_lo;
1433
+ if (r < 0)
1434
+ r += 0x100000000;
1435
+ return r;
1436
+ }
1437
+
1438
+ var utils$2 = utils$9;
1439
+
1440
+ var SHA512 = _512;
1441
+
1442
+ function SHA384() {
1443
+ if (!(this instanceof SHA384))
1444
+ return new SHA384();
1445
+
1446
+ SHA512.call(this);
1447
+ this.h = [
1448
+ 0xcbbb9d5d, 0xc1059ed8,
1449
+ 0x629a292a, 0x367cd507,
1450
+ 0x9159015a, 0x3070dd17,
1451
+ 0x152fecd8, 0xf70e5939,
1452
+ 0x67332667, 0xffc00b31,
1453
+ 0x8eb44a87, 0x68581511,
1454
+ 0xdb0c2e0d, 0x64f98fa7,
1455
+ 0x47b5481d, 0xbefa4fa4 ];
1456
+ }
1457
+ utils$2.inherits(SHA384, SHA512);
1458
+ var _384 = SHA384;
1459
+
1460
+ SHA384.blockSize = 1024;
1461
+ SHA384.outSize = 384;
1462
+ SHA384.hmacStrength = 192;
1463
+ SHA384.padLength = 128;
1464
+
1465
+ SHA384.prototype._digest = function digest(enc) {
1466
+ if (enc === 'hex')
1467
+ return utils$2.toHex32(this.h.slice(0, 12), 'big');
1468
+ else
1469
+ return utils$2.split32(this.h.slice(0, 12), 'big');
1470
+ };
1471
+
1472
+ sha.sha1 = _1;
1473
+ sha.sha224 = _224;
1474
+ sha.sha256 = _256;
1475
+ sha.sha384 = _384;
1476
+ sha.sha512 = _512;
1477
+
1478
+ var ripemd = {};
1479
+
1480
+ var utils$1 = utils$9;
1481
+ var common = common$5;
1482
+
1483
+ var rotl32 = utils$1.rotl32;
1484
+ var sum32 = utils$1.sum32;
1485
+ var sum32_3 = utils$1.sum32_3;
1486
+ var sum32_4 = utils$1.sum32_4;
1487
+ var BlockHash = common.BlockHash;
1488
+
1489
+ function RIPEMD160() {
1490
+ if (!(this instanceof RIPEMD160))
1491
+ return new RIPEMD160();
1492
+
1493
+ BlockHash.call(this);
1494
+
1495
+ this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
1496
+ this.endian = 'little';
1497
+ }
1498
+ utils$1.inherits(RIPEMD160, BlockHash);
1499
+ ripemd.ripemd160 = RIPEMD160;
1500
+
1501
+ RIPEMD160.blockSize = 512;
1502
+ RIPEMD160.outSize = 160;
1503
+ RIPEMD160.hmacStrength = 192;
1504
+ RIPEMD160.padLength = 64;
1505
+
1506
+ RIPEMD160.prototype._update = function update(msg, start) {
1507
+ var A = this.h[0];
1508
+ var B = this.h[1];
1509
+ var C = this.h[2];
1510
+ var D = this.h[3];
1511
+ var E = this.h[4];
1512
+ var Ah = A;
1513
+ var Bh = B;
1514
+ var Ch = C;
1515
+ var Dh = D;
1516
+ var Eh = E;
1517
+ for (var j = 0; j < 80; j++) {
1518
+ var T = sum32(
1519
+ rotl32(
1520
+ sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
1521
+ s[j]),
1522
+ E);
1523
+ A = E;
1524
+ E = D;
1525
+ D = rotl32(C, 10);
1526
+ C = B;
1527
+ B = T;
1528
+ T = sum32(
1529
+ rotl32(
1530
+ sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
1531
+ sh[j]),
1532
+ Eh);
1533
+ Ah = Eh;
1534
+ Eh = Dh;
1535
+ Dh = rotl32(Ch, 10);
1536
+ Ch = Bh;
1537
+ Bh = T;
1538
+ }
1539
+ T = sum32_3(this.h[1], C, Dh);
1540
+ this.h[1] = sum32_3(this.h[2], D, Eh);
1541
+ this.h[2] = sum32_3(this.h[3], E, Ah);
1542
+ this.h[3] = sum32_3(this.h[4], A, Bh);
1543
+ this.h[4] = sum32_3(this.h[0], B, Ch);
1544
+ this.h[0] = T;
1545
+ };
1546
+
1547
+ RIPEMD160.prototype._digest = function digest(enc) {
1548
+ if (enc === 'hex')
1549
+ return utils$1.toHex32(this.h, 'little');
1550
+ else
1551
+ return utils$1.split32(this.h, 'little');
1552
+ };
1553
+
1554
+ function f(j, x, y, z) {
1555
+ if (j <= 15)
1556
+ return x ^ y ^ z;
1557
+ else if (j <= 31)
1558
+ return (x & y) | ((~x) & z);
1559
+ else if (j <= 47)
1560
+ return (x | (~y)) ^ z;
1561
+ else if (j <= 63)
1562
+ return (x & z) | (y & (~z));
1563
+ else
1564
+ return x ^ (y | (~z));
1565
+ }
1566
+
1567
+ function K(j) {
1568
+ if (j <= 15)
1569
+ return 0x00000000;
1570
+ else if (j <= 31)
1571
+ return 0x5a827999;
1572
+ else if (j <= 47)
1573
+ return 0x6ed9eba1;
1574
+ else if (j <= 63)
1575
+ return 0x8f1bbcdc;
1576
+ else
1577
+ return 0xa953fd4e;
1578
+ }
1579
+
1580
+ function Kh(j) {
1581
+ if (j <= 15)
1582
+ return 0x50a28be6;
1583
+ else if (j <= 31)
1584
+ return 0x5c4dd124;
1585
+ else if (j <= 47)
1586
+ return 0x6d703ef3;
1587
+ else if (j <= 63)
1588
+ return 0x7a6d76e9;
1589
+ else
1590
+ return 0x00000000;
1591
+ }
1592
+
1593
+ var r = [
1594
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1595
+ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
1596
+ 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
1597
+ 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
1598
+ 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
1599
+ ];
1600
+
1601
+ var rh = [
1602
+ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
1603
+ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
1604
+ 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
1605
+ 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
1606
+ 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
1607
+ ];
1608
+
1609
+ var s = [
1610
+ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
1611
+ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
1612
+ 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
1613
+ 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
1614
+ 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
1615
+ ];
1616
+
1617
+ var sh = [
1618
+ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
1619
+ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
1620
+ 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
1621
+ 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
1622
+ 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
1623
+ ];
1624
+
1625
+ var utils = utils$9;
1626
+ var assert$1 = minimalisticAssert;
1627
+
1628
+ function Hmac(hash, key, enc) {
1629
+ if (!(this instanceof Hmac))
1630
+ return new Hmac(hash, key, enc);
1631
+ this.Hash = hash;
1632
+ this.blockSize = hash.blockSize / 8;
1633
+ this.outSize = hash.outSize / 8;
1634
+ this.inner = null;
1635
+ this.outer = null;
1636
+
1637
+ this._init(utils.toArray(key, enc));
1638
+ }
1639
+ var hmac = Hmac;
1640
+
1641
+ Hmac.prototype._init = function init(key) {
1642
+ // Shorten key, if needed
1643
+ if (key.length > this.blockSize)
1644
+ key = new this.Hash().update(key).digest();
1645
+ assert$1(key.length <= this.blockSize);
1646
+
1647
+ // Add padding to key
1648
+ for (var i = key.length; i < this.blockSize; i++)
1649
+ key.push(0);
1650
+
1651
+ for (i = 0; i < key.length; i++)
1652
+ key[i] ^= 0x36;
1653
+ this.inner = new this.Hash().update(key);
1654
+
1655
+ // 0x36 ^ 0x5c = 0x6a
1656
+ for (i = 0; i < key.length; i++)
1657
+ key[i] ^= 0x6a;
1658
+ this.outer = new this.Hash().update(key);
1659
+ };
1660
+
1661
+ Hmac.prototype.update = function update(msg, enc) {
1662
+ this.inner.update(msg, enc);
1663
+ return this;
1664
+ };
1665
+
1666
+ Hmac.prototype.digest = function digest(enc) {
1667
+ this.outer.update(this.inner.digest());
1668
+ return this.outer.digest(enc);
1669
+ };
1670
+
1671
+ (function (exports) {
1672
+ var hash = exports;
1673
+
1674
+ hash.utils = utils$9;
1675
+ hash.common = common$5;
1676
+ hash.sha = sha;
1677
+ hash.ripemd = ripemd;
1678
+ hash.hmac = hmac;
1679
+
1680
+ // Proxy hash functions to the main object
1681
+ hash.sha1 = hash.sha.sha1;
1682
+ hash.sha256 = hash.sha.sha256;
1683
+ hash.sha224 = hash.sha.sha224;
1684
+ hash.sha384 = hash.sha.sha384;
1685
+ hash.sha512 = hash.sha.sha512;
1686
+ hash.ripemd160 = hash.ripemd.ripemd160;
1687
+ }(hash$1));
1688
+
1689
+ var hash = hash$1;
1690
+
1691
+ const version = "sha2/5.5.0";
1692
+
1693
+ new Logger(version);
1694
+ function sha256(data) {
1695
+ return "0x" + (hash.sha256().update(arrayify(data)).digest("hex"));
1696
+ }
1697
+
26
1698
  class Struct {
27
1699
  constructor(properties) {
28
1700
  Object.assign(this, properties);
@@ -98,7 +1770,7 @@ class PublicKey extends Struct {
98
1770
  const decoded = bs58.decode(value);
99
1771
 
100
1772
  if (decoded.length != 32) {
101
- throw new Error(`Invalid public key input`);
1773
+ throw new Error("Invalid public key input");
102
1774
  }
103
1775
 
104
1776
  this._bn = new BN(decoded);
@@ -107,7 +1779,7 @@ class PublicKey extends Struct {
107
1779
  }
108
1780
 
109
1781
  if (this._bn.byteLength() > 32) {
110
- throw new Error(`Invalid public key input`);
1782
+ throw new Error("Invalid public key input");
111
1783
  }
112
1784
  }
113
1785
  }
@@ -168,32 +1840,36 @@ class PublicKey extends Struct {
168
1840
  * it permission to write data to the account.
169
1841
  */
170
1842
 
1843
+ /* eslint-disable require-await */
1844
+
171
1845
 
172
1846
  static async createWithSeed(fromPublicKey, seed, programId) {
173
1847
  const buffer = Buffer.concat([fromPublicKey.toBuffer(), Buffer.from(seed), programId.toBuffer()]);
174
- const hash = await sha256(new Uint8Array(buffer));
1848
+ const hash = sha256(new Uint8Array(buffer)).slice(2);
175
1849
  return new PublicKey(Buffer.from(hash, 'hex'));
176
1850
  }
177
1851
  /**
178
1852
  * Derive a program address from seeds and a program ID.
179
1853
  */
180
1854
 
1855
+ /* eslint-disable require-await */
1856
+
181
1857
 
182
1858
  static async createProgramAddress(seeds, programId) {
183
1859
  let buffer = Buffer.alloc(0);
184
1860
  seeds.forEach(function (seed) {
185
1861
  if (seed.length > MAX_SEED_LENGTH) {
186
- throw new TypeError(`Max seed length exceeded`);
1862
+ throw new TypeError("Max seed length exceeded");
187
1863
  }
188
1864
 
189
1865
  buffer = Buffer.concat([buffer, toBuffer(seed)]);
190
1866
  });
191
1867
  buffer = Buffer.concat([buffer, programId.toBuffer(), Buffer.from('ProgramDerivedAddress')]);
192
- let hash = await sha256(new Uint8Array(buffer));
1868
+ let hash = sha256(new Uint8Array(buffer)).slice(2);
193
1869
  let publicKeyBytes = new BN(hash, 16).toArray(undefined, 32);
194
1870
 
195
1871
  if (is_on_curve(publicKeyBytes)) {
196
- throw new Error(`Invalid seeds, address must fall off the curve`);
1872
+ throw new Error("Invalid seeds, address must fall off the curve");
197
1873
  }
198
1874
 
199
1875
  return new PublicKey(publicKeyBytes);
@@ -227,7 +1903,7 @@ class PublicKey extends Struct {
227
1903
  return [address, nonce];
228
1904
  }
229
1905
 
230
- throw new Error(`Unable to find a viable program address nonce`);
1906
+ throw new Error("Unable to find a viable program address nonce");
231
1907
  }
232
1908
  /**
233
1909
  * Check that a pubkey is on the ed25519 curve.
@@ -439,6 +2115,36 @@ function encodeLength(bytes, len) {
439
2115
  }
440
2116
  }
441
2117
 
2118
+ const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
2119
+ /**
2120
+ * Delegates to `Array#shift`, but throws if the array is zero-length.
2121
+ */
2122
+
2123
+ function guardedShift(byteArray) {
2124
+ if (byteArray.length === 0) {
2125
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
2126
+ }
2127
+
2128
+ return byteArray.shift();
2129
+ }
2130
+ /**
2131
+ * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
2132
+ * the array.
2133
+ */
2134
+
2135
+ function guardedSplice(byteArray, ...args) {
2136
+ var _args$;
2137
+
2138
+ const [start] = args;
2139
+
2140
+ if (args.length === 2 // Implies that `deleteCount` was supplied
2141
+ ? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
2142
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
2143
+ }
2144
+
2145
+ return byteArray.splice(...args);
2146
+ }
2147
+
442
2148
  /**
443
2149
  * The message header, identifying signed and read-only account
444
2150
  */
@@ -542,32 +2248,28 @@ class Message {
542
2248
  static from(buffer) {
543
2249
  // Slice up wire data
544
2250
  let byteArray = [...buffer];
545
- const numRequiredSignatures = byteArray.shift();
546
- const numReadonlySignedAccounts = byteArray.shift();
547
- const numReadonlyUnsignedAccounts = byteArray.shift();
2251
+ const numRequiredSignatures = guardedShift(byteArray);
2252
+ const numReadonlySignedAccounts = guardedShift(byteArray);
2253
+ const numReadonlyUnsignedAccounts = guardedShift(byteArray);
548
2254
  const accountCount = decodeLength(byteArray);
549
2255
  let accountKeys = [];
550
2256
 
551
2257
  for (let i = 0; i < accountCount; i++) {
552
- const account = byteArray.slice(0, PUBKEY_LENGTH);
553
- byteArray = byteArray.slice(PUBKEY_LENGTH);
2258
+ const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
554
2259
  accountKeys.push(bs58.encode(Buffer.from(account)));
555
2260
  }
556
2261
 
557
- const recentBlockhash = byteArray.slice(0, PUBKEY_LENGTH);
558
- byteArray = byteArray.slice(PUBKEY_LENGTH);
2262
+ const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
559
2263
  const instructionCount = decodeLength(byteArray);
560
2264
  let instructions = [];
561
2265
 
562
2266
  for (let i = 0; i < instructionCount; i++) {
563
- const programIdIndex = byteArray.shift();
2267
+ const programIdIndex = guardedShift(byteArray);
564
2268
  const accountCount = decodeLength(byteArray);
565
- const accounts = byteArray.slice(0, accountCount);
566
- byteArray = byteArray.slice(accountCount);
2269
+ const accounts = guardedSplice(byteArray, 0, accountCount);
567
2270
  const dataLength = decodeLength(byteArray);
568
- const dataSlice = byteArray.slice(0, dataLength);
2271
+ const dataSlice = guardedSplice(byteArray, 0, dataLength);
569
2272
  const data = bs58.encode(Buffer.from(dataSlice));
570
- byteArray = byteArray.slice(dataLength);
571
2273
  instructions.push({
572
2274
  programIdIndex,
573
2275
  accounts,
@@ -596,6 +2298,10 @@ function assert (condition, message) {
596
2298
  }
597
2299
  }
598
2300
 
2301
+ /**
2302
+ * Transaction signature as base-58 encoded string
2303
+ */
2304
+
599
2305
  /**
600
2306
  * Default (empty) signature
601
2307
  *
@@ -753,7 +2459,7 @@ class Transaction {
753
2459
 
754
2460
  for (let i = 0; i < this.instructions.length; i++) {
755
2461
  if (this.instructions[i].programId === undefined) {
756
- throw new Error(`Transaction instruction index ${i} has undefined program id`);
2462
+ throw new Error("Transaction instruction index ".concat(i, " has undefined program id"));
757
2463
  }
758
2464
  }
759
2465
 
@@ -828,7 +2534,7 @@ class Transaction {
828
2534
  console.warn('Transaction references a signature that is unnecessary, ' + 'only the fee payer and instruction signer accounts should sign a transaction. ' + 'This behavior is deprecated and will throw an error in the next major version release.');
829
2535
  }
830
2536
  } else {
831
- throw new Error(`unknown signer: ${signature.publicKey.toString()}`);
2537
+ throw new Error("unknown signer: ".concat(signature.publicKey.toString()));
832
2538
  }
833
2539
  }
834
2540
 
@@ -1063,7 +2769,7 @@ class Transaction {
1063
2769
  const index = this.signatures.findIndex(sigpair => pubkey.equals(sigpair.publicKey));
1064
2770
 
1065
2771
  if (index < 0) {
1066
- throw new Error(`unknown signer: ${pubkey.toString()}`);
2772
+ throw new Error("unknown signer: ".concat(pubkey.toString()));
1067
2773
  }
1068
2774
 
1069
2775
  this.signatures[index].signature = Buffer.from(signature);
@@ -1139,12 +2845,12 @@ class Transaction {
1139
2845
  signature
1140
2846
  }, index) => {
1141
2847
  if (signature !== null) {
1142
- assert(signature.length === 64, `signature has invalid length`);
2848
+ assert(signature.length === 64, "signature has invalid length");
1143
2849
  Buffer.from(signature).copy(wireTransaction, signatureCount.length + index * 64);
1144
2850
  }
1145
2851
  });
1146
2852
  signData.copy(wireTransaction, signatureCount.length + signatures.length * 64);
1147
- assert(wireTransaction.length <= PACKET_DATA_SIZE, `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`);
2853
+ assert(wireTransaction.length <= PACKET_DATA_SIZE, "Transaction too large: ".concat(wireTransaction.length, " > ").concat(PACKET_DATA_SIZE));
1148
2854
  return wireTransaction;
1149
2855
  }
1150
2856
  /**
@@ -1189,8 +2895,7 @@ class Transaction {
1189
2895
  let signatures = [];
1190
2896
 
1191
2897
  for (let i = 0; i < signatureCount; i++) {
1192
- const signature = byteArray.slice(0, SIGNATURE_LENGTH);
1193
- byteArray = byteArray.slice(SIGNATURE_LENGTH);
2898
+ const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
1194
2899
  signatures.push(bs58.encode(Buffer.from(signature)));
1195
2900
  }
1196
2901
 
@@ -1263,7 +2968,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
1263
2968
  const status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
1264
2969
 
1265
2970
  if (status.err) {
1266
- throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
2971
+ throw new Error("Transaction ".concat(signature, " failed (").concat(JSON.stringify(status), ")"));
1267
2972
  }
1268
2973
 
1269
2974
  return signature;
@@ -1306,7 +3011,7 @@ function decodeData(type, buffer) {
1306
3011
  }
1307
3012
 
1308
3013
  if (data.instruction !== type.index) {
1309
- throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);
3014
+ throw new Error("invalid instruction; instruction index mismatch ".concat(data.instruction, " != ").concat(type.index));
1310
3015
  }
1311
3016
 
1312
3017
  return data;
@@ -1646,7 +3351,7 @@ class SystemInstruction {
1646
3351
 
1647
3352
  static checkKeyLength(keys, expectedLength) {
1648
3353
  if (keys.length < expectedLength) {
1649
- throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);
3354
+ throw new Error("invalid instruction; found ".concat(keys.length, " keys, expected at least ").concat(expectedLength));
1650
3355
  }
1651
3356
  }
1652
3357
 
@@ -2108,7 +3813,8 @@ class Loader {
2108
3813
  * Can be used to calculate transaction fees
2109
3814
  */
2110
3815
  static getMinNumSignatures(dataLength) {
2111
- return 2 * (Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
3816
+ return 2 * ( // Every transaction requires two signatures (payer + program)
3817
+ Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
2112
3818
  1) // Add one for Finalize transaction
2113
3819
  ;
2114
3820
  }
@@ -2283,12 +3989,6 @@ class BpfLoader {
2283
3989
 
2284
3990
  }
2285
3991
 
2286
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2287
-
2288
- function getDefaultExportFromCjs (x) {
2289
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
2290
- }
2291
-
2292
3992
  var browserPonyfill = {exports: {}};
2293
3993
 
2294
3994
  (function (module, exports) {
@@ -3235,7 +4935,7 @@ function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRet
3235
4935
  break;
3236
4936
  }
3237
4937
 
3238
- console.log(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`);
4938
+ console.log("Server responded with ".concat(res.status, " ").concat(res.statusText, ". Retrying after ").concat(waitTime, "ms delay..."));
3239
4939
  await sleep(waitTime);
3240
4940
  waitTime *= 2;
3241
4941
  }
@@ -3245,7 +4945,7 @@ function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRet
3245
4945
  if (res.ok) {
3246
4946
  callback(null, text);
3247
4947
  } else {
3248
- callback(new Error(`${res.status} ${res.statusText}: ${text}`));
4948
+ callback(new Error("".concat(res.status, " ").concat(res.statusText, ": ").concat(text)));
3249
4949
  }
3250
4950
  } catch (err) {
3251
4951
  if (err instanceof Error) callback(err);
@@ -4330,7 +6030,7 @@ class Connection {
4330
6030
  const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
4331
6031
 
4332
6032
  if ('error' in res) {
4333
- throw new Error(`failed to get Stake Activation ${publicKey.toBase58()}: ${res.error.message}`);
6033
+ throw new Error("failed to get Stake Activation ".concat(publicKey.toBase58(), ": ").concat(res.error.message));
4334
6034
  }
4335
6035
 
4336
6036
  return res.result;
@@ -4466,7 +6166,7 @@ class Connection {
4466
6166
 
4467
6167
  if (response === null) {
4468
6168
  const duration = (Date.now() - start) / 1000;
4469
- throw new Error(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`);
6169
+ throw new Error("Transaction was not confirmed in ".concat(duration.toFixed(2), " seconds. It is unknown if it succeeded or failed. Check signature ").concat(signature, " using the Solana Explorer or CLI tools."));
4470
6170
  }
4471
6171
 
4472
6172
  return response;
@@ -5245,7 +6945,7 @@ class Connection {
5245
6945
  await sleep(MS_PER_SLOT / 2);
5246
6946
  }
5247
6947
 
5248
- throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`);
6948
+ throw new Error("Unable to obtain a new blockhash after ".concat(Date.now() - startTime, "ms"));
5249
6949
  } finally {
5250
6950
  this._pollingBlockhash = false;
5251
6951
  }
@@ -5502,7 +7202,7 @@ class Connection {
5502
7202
  }
5503
7203
 
5504
7204
  if (err instanceof Error) {
5505
- console.error(`${rpcMethod} error for argument`, rpcArgs, err.message);
7205
+ console.error("".concat(rpcMethod, " error for argument"), rpcArgs, err.message);
5506
7206
  }
5507
7207
  }
5508
7208
  }
@@ -5522,7 +7222,7 @@ class Connection {
5522
7222
  await this._rpcWebSocket.call(rpcMethod, [unsubscribeId]);
5523
7223
  } catch (err) {
5524
7224
  if (err instanceof Error) {
5525
- console.error(`${rpcMethod} error:`, err.message);
7225
+ console.error("".concat(rpcMethod, " error:"), err.message);
5526
7226
  }
5527
7227
  }
5528
7228
  }
@@ -5687,7 +7387,7 @@ class Connection {
5687
7387
 
5688
7388
  this._updateSubscriptions();
5689
7389
  } else {
5690
- throw new Error(`Unknown account change id: ${id}`);
7390
+ throw new Error("Unknown account change id: ".concat(id));
5691
7391
  }
5692
7392
  }
5693
7393
  /**
@@ -5753,7 +7453,7 @@ class Connection {
5753
7453
 
5754
7454
  this._updateSubscriptions();
5755
7455
  } else {
5756
- throw new Error(`Unknown program account change id: ${id}`);
7456
+ throw new Error("Unknown program account change id: ".concat(id));
5757
7457
  }
5758
7458
  }
5759
7459
  /**
@@ -5783,7 +7483,7 @@ class Connection {
5783
7483
 
5784
7484
  async removeOnLogsListener(id) {
5785
7485
  if (!this._logsSubscriptions[id]) {
5786
- throw new Error(`Unknown logs id: ${id}`);
7486
+ throw new Error("Unknown logs id: ".concat(id));
5787
7487
  }
5788
7488
 
5789
7489
  const subInfo = this._logsSubscriptions[id];
@@ -5859,7 +7559,7 @@ class Connection {
5859
7559
 
5860
7560
  this._updateSubscriptions();
5861
7561
  } else {
5862
- throw new Error(`Unknown slot change id: ${id}`);
7562
+ throw new Error("Unknown slot change id: ".concat(id));
5863
7563
  }
5864
7564
  }
5865
7565
  /**
@@ -5912,7 +7612,7 @@ class Connection {
5912
7612
 
5913
7613
  this._updateSubscriptions();
5914
7614
  } else {
5915
- throw new Error(`Unknown slot update id: ${id}`);
7615
+ throw new Error("Unknown slot update id: ".concat(id));
5916
7616
  }
5917
7617
  }
5918
7618
 
@@ -6053,7 +7753,7 @@ class Connection {
6053
7753
 
6054
7754
  this._updateSubscriptions();
6055
7755
  } else {
6056
- throw new Error(`Unknown signature result id: ${id}`);
7756
+ throw new Error("Unknown signature result id: ".concat(id));
6057
7757
  }
6058
7758
  }
6059
7759
  /**
@@ -6105,7 +7805,7 @@ class Connection {
6105
7805
 
6106
7806
  this._updateSubscriptions();
6107
7807
  } else {
6108
- throw new Error(`Unknown root change id: ${id}`);
7808
+ throw new Error("Unknown root change id: ".concat(id));
6109
7809
  }
6110
7810
  }
6111
7811
 
@@ -6230,8 +7930,8 @@ class Ed25519Program {
6230
7930
  signature,
6231
7931
  instructionIndex
6232
7932
  } = params;
6233
- assert(publicKey.length === PUBLIC_KEY_BYTES$1, `Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${publicKey.length} bytes`);
6234
- assert(signature.length === SIGNATURE_BYTES, `Signature must be ${SIGNATURE_BYTES} bytes but received ${signature.length} bytes`);
7933
+ assert(publicKey.length === PUBLIC_KEY_BYTES$1, "Public Key must be ".concat(PUBLIC_KEY_BYTES$1, " bytes but received ").concat(publicKey.length, " bytes"));
7934
+ assert(signature.length === SIGNATURE_BYTES, "Signature must be ".concat(SIGNATURE_BYTES, " bytes but received ").concat(signature.length, " bytes"));
6235
7935
  const publicKeyOffset = ED25519_INSTRUCTION_LAYOUT.span;
6236
7936
  const signatureOffset = publicKeyOffset + publicKey.length;
6237
7937
  const messageDataOffset = signatureOffset + signature.length;
@@ -6269,7 +7969,7 @@ class Ed25519Program {
6269
7969
  message,
6270
7970
  instructionIndex
6271
7971
  } = params;
6272
- assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`);
7972
+ assert(privateKey.length === PRIVATE_KEY_BYTES$1, "Private key must be ".concat(PRIVATE_KEY_BYTES$1, " bytes but received ").concat(privateKey.length, " bytes"));
6273
7973
 
6274
7974
  try {
6275
7975
  const keypair = Keypair.fromSecretKey(privateKey);
@@ -6282,7 +7982,7 @@ class Ed25519Program {
6282
7982
  instructionIndex
6283
7983
  });
6284
7984
  } catch (error) {
6285
- throw new Error(`Error creating instruction; ${error}`);
7985
+ throw new Error("Error creating instruction; ".concat(error));
6286
7986
  }
6287
7987
  }
6288
7988
 
@@ -6568,7 +8268,7 @@ class StakeInstruction {
6568
8268
 
6569
8269
  static checkKeyLength(keys, expectedLength) {
6570
8270
  if (keys.length < expectedLength) {
6571
- throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);
8271
+ throw new Error("invalid instruction; found ".concat(keys.length, " keys, expected at least ").concat(expectedLength));
6572
8272
  }
6573
8273
  }
6574
8274
 
@@ -7076,12 +8776,12 @@ class Secp256k1Program {
7076
8776
  * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
7077
8777
  */
7078
8778
  static publicKeyToEthAddress(publicKey) {
7079
- assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);
8779
+ assert(publicKey.length === PUBLIC_KEY_BYTES, "Public key must be ".concat(PUBLIC_KEY_BYTES, " bytes but received ").concat(publicKey.length, " bytes"));
7080
8780
 
7081
8781
  try {
7082
8782
  return Buffer.from(keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
7083
8783
  } catch (error) {
7084
- throw new Error(`Error constructing Ethereum address: ${error}`);
8784
+ throw new Error("Error constructing Ethereum address: ".concat(error));
7085
8785
  }
7086
8786
  }
7087
8787
  /**
@@ -7132,7 +8832,7 @@ class Secp256k1Program {
7132
8832
  ethAddress = rawAddress;
7133
8833
  }
7134
8834
 
7135
- assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, `Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`);
8835
+ assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, "Address must be ".concat(ETHEREUM_ADDRESS_BYTES, " bytes but received ").concat(ethAddress.length, " bytes"));
7136
8836
  const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;
7137
8837
  const ethAddressOffset = dataStart;
7138
8838
  const signatureOffset = dataStart + ethAddress.length;
@@ -7171,7 +8871,7 @@ class Secp256k1Program {
7171
8871
  message,
7172
8872
  instructionIndex
7173
8873
  } = params;
7174
- assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);
8874
+ assert(pkey.length === PRIVATE_KEY_BYTES, "Private key must be ".concat(PRIVATE_KEY_BYTES, " bytes but received ").concat(pkey.length, " bytes"));
7175
8875
 
7176
8876
  try {
7177
8877
  const privateKey = toBuffer(pkey);
@@ -7190,7 +8890,7 @@ class Secp256k1Program {
7190
8890
  instructionIndex
7191
8891
  });
7192
8892
  } catch (error) {
7193
- throw new Error(`Error creating instruction; ${error}`);
8893
+ throw new Error("Error creating instruction; ".concat(error));
7194
8894
  }
7195
8895
  }
7196
8896
 
@@ -7253,10 +8953,8 @@ class ValidatorInfo {
7253
8953
  const configKeys = [];
7254
8954
 
7255
8955
  for (let i = 0; i < 2; i++) {
7256
- const publicKey = new PublicKey(byteArray.slice(0, PUBKEY_LENGTH));
7257
- byteArray = byteArray.slice(PUBKEY_LENGTH);
7258
- const isSigner = byteArray.slice(0, 1)[0] === 1;
7259
- byteArray = byteArray.slice(1);
8956
+ const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
8957
+ const isSigner = guardedShift(byteArray) === 1;
7260
8958
  configKeys.push({
7261
8959
  publicKey,
7262
8960
  isSigner
@@ -7267,7 +8965,7 @@ class ValidatorInfo {
7267
8965
  if (configKeys[1].isSigner) {
7268
8966
  const rawInfo = rustString().decode(Buffer.from(byteArray));
7269
8967
  const info = JSON.parse(rawInfo);
7270
- assert$1(info, InfoString);
8968
+ assert$7(info, InfoString);
7271
8969
  return new ValidatorInfo(configKeys[1].publicKey, info);
7272
8970
  }
7273
8971
  }
@@ -7378,7 +9076,7 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, options)
7378
9076
  const status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
7379
9077
 
7380
9078
  if (status.err) {
7381
- throw new Error(`Raw transaction ${signature} failed (${JSON.stringify(status)})`);
9079
+ throw new Error("Raw transaction ".concat(signature, " failed (").concat(JSON.stringify(status), ")"));
7382
9080
  }
7383
9081
 
7384
9082
  return signature;
@@ -7410,7 +9108,7 @@ function clusterApiUrl(cluster, tls) {
7410
9108
  const url = endpoint[key][cluster];
7411
9109
 
7412
9110
  if (!url) {
7413
- throw new Error(`Unknown ${key} cluster: ${cluster}`);
9111
+ throw new Error("Unknown ".concat(key, " cluster: ").concat(cluster));
7414
9112
  }
7415
9113
 
7416
9114
  return url;