@solana/web3.js 1.87.6 → 1.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.esm.js CHANGED
@@ -7,11 +7,9 @@ import { serialize, deserialize, deserializeUnchecked } from 'borsh';
7
7
  import * as BufferLayout from '@solana/buffer-layout';
8
8
  import { blob } from '@solana/buffer-layout';
9
9
  import { toBigIntLE, toBufferLE } from 'bigint-buffer';
10
- import require$$0$1 from 'tty';
11
10
  import require$$0 from 'util';
12
- import require$$0$2 from 'path';
13
- import require$$0$3 from 'http';
14
- import require$$0$4, { Agent as Agent$1 } from 'https';
11
+ import require$$0$1 from 'http';
12
+ import require$$0$2, { Agent as Agent$1 } from 'https';
15
13
  import { coerce, instance, string, tuple, literal, unknown, type, number, array, nullable, optional, boolean, record, union, create, any, assert as assert$1 } from 'superstruct';
16
14
  import RpcClient from 'jayson/lib/client/browser';
17
15
  import * as nodeFetch from 'node-fetch';
@@ -1130,6 +1128,8 @@ const VersionedMessage = {
1130
1128
  }
1131
1129
  };
1132
1130
 
1131
+ /** @internal */
1132
+
1133
1133
  /**
1134
1134
  * Transaction signature as base-58 encoded string
1135
1135
  */
@@ -1219,20 +1219,25 @@ class TransactionInstruction {
1219
1219
  // For backward compatibility; an unfortunate consequence of being
1220
1220
  // forced to over-export types by the documentation generator.
1221
1221
  // See https://github.com/solana-labs/solana/pull/25820
1222
+
1222
1223
  /**
1223
1224
  * Blockhash-based transactions have a lifetime that are defined by
1224
1225
  * the blockhash they include. Any transaction whose blockhash is
1225
1226
  * too old will be rejected.
1226
1227
  */
1228
+
1227
1229
  /**
1228
1230
  * Use these options to construct a durable nonce transaction.
1229
1231
  */
1232
+
1230
1233
  /**
1231
1234
  * Nonce information to be used to build an offline Transaction.
1232
1235
  */
1236
+
1233
1237
  /**
1234
1238
  * @internal
1235
1239
  */
1240
+
1236
1241
  /**
1237
1242
  * Transaction class
1238
1243
  */
@@ -1745,29 +1750,31 @@ class Transaction {
1745
1750
  *
1746
1751
  * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
1747
1752
  */
1748
- verifySignatures(requireAllSignatures) {
1749
- return this._verifySignatures(this.serializeMessage(), requireAllSignatures === undefined ? true : requireAllSignatures);
1753
+ verifySignatures(requireAllSignatures = true) {
1754
+ const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
1755
+ return !signatureErrors;
1750
1756
  }
1751
1757
 
1752
1758
  /**
1753
1759
  * @internal
1754
1760
  */
1755
- _verifySignatures(signData, requireAllSignatures) {
1761
+ _getMessageSignednessErrors(message, requireAllSignatures) {
1762
+ const errors = {};
1756
1763
  for (const {
1757
1764
  signature,
1758
1765
  publicKey
1759
1766
  } of this.signatures) {
1760
1767
  if (signature === null) {
1761
1768
  if (requireAllSignatures) {
1762
- return false;
1769
+ (errors.missing ||= []).push(publicKey);
1763
1770
  }
1764
1771
  } else {
1765
- if (!verify(signature, signData, publicKey.toBytes())) {
1766
- return false;
1772
+ if (!verify(signature, message, publicKey.toBytes())) {
1773
+ (errors.invalid ||= []).push(publicKey);
1767
1774
  }
1768
1775
  }
1769
1776
  }
1770
- return true;
1777
+ return errors.invalid || errors.missing ? errors : undefined;
1771
1778
  }
1772
1779
 
1773
1780
  /**
@@ -1786,8 +1793,18 @@ class Transaction {
1786
1793
  verifySignatures: true
1787
1794
  }, config);
1788
1795
  const signData = this.serializeMessage();
1789
- if (verifySignatures && !this._verifySignatures(signData, requireAllSignatures)) {
1790
- throw new Error('Signature verification failed');
1796
+ if (verifySignatures) {
1797
+ const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
1798
+ if (sigErrors) {
1799
+ let errorMessage = 'Signature verification failed.';
1800
+ if (sigErrors.invalid) {
1801
+ errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
1802
+ }
1803
+ if (sigErrors.missing) {
1804
+ errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
1805
+ }
1806
+ throw new Error(errorMessage);
1807
+ }
1791
1808
  }
1792
1809
  return this._serialize(signData);
1793
1810
  }
@@ -3255,7 +3272,7 @@ var y = d * 365.25;
3255
3272
  * @api public
3256
3273
  */
3257
3274
 
3258
- var ms$3 = function (val, options) {
3275
+ var ms$2 = function (val, options) {
3259
3276
  options = options || {};
3260
3277
  var type = typeof val;
3261
3278
  if (type === 'string' && val.length > 0) {
@@ -3404,11 +3421,11 @@ function plural(ms, msAbs, n, name) {
3404
3421
  */
3405
3422
 
3406
3423
  var util = require$$0;
3407
- var ms$2 = ms$3;
3424
+ var ms$1 = ms$2;
3408
3425
 
3409
3426
  var humanizeMs = function (t) {
3410
3427
  if (typeof t === 'number') return t;
3411
- var r = ms$2(t);
3428
+ var r = ms$1(t);
3412
3429
  if (r === undefined) {
3413
3430
  var err = new Error(util.format('humanize-ms(%j) result undefined', t));
3414
3431
  console.warn(err.stack);
@@ -3416,1602 +3433,6 @@ var humanizeMs = function (t) {
3416
3433
  return r;
3417
3434
  };
3418
3435
 
3419
- var src = {exports: {}};
3420
-
3421
- var browser$1 = {exports: {}};
3422
-
3423
- /**
3424
- * Helpers.
3425
- */
3426
-
3427
- var ms$1;
3428
- var hasRequiredMs;
3429
-
3430
- function requireMs () {
3431
- if (hasRequiredMs) return ms$1;
3432
- hasRequiredMs = 1;
3433
- var s = 1000;
3434
- var m = s * 60;
3435
- var h = m * 60;
3436
- var d = h * 24;
3437
- var w = d * 7;
3438
- var y = d * 365.25;
3439
-
3440
- /**
3441
- * Parse or format the given `val`.
3442
- *
3443
- * Options:
3444
- *
3445
- * - `long` verbose formatting [false]
3446
- *
3447
- * @param {String|Number} val
3448
- * @param {Object} [options]
3449
- * @throws {Error} throw an error if val is not a non-empty string or a number
3450
- * @return {String|Number}
3451
- * @api public
3452
- */
3453
-
3454
- ms$1 = function(val, options) {
3455
- options = options || {};
3456
- var type = typeof val;
3457
- if (type === 'string' && val.length > 0) {
3458
- return parse(val);
3459
- } else if (type === 'number' && isFinite(val)) {
3460
- return options.long ? fmtLong(val) : fmtShort(val);
3461
- }
3462
- throw new Error(
3463
- 'val is not a non-empty string or a valid number. val=' +
3464
- JSON.stringify(val)
3465
- );
3466
- };
3467
-
3468
- /**
3469
- * Parse the given `str` and return milliseconds.
3470
- *
3471
- * @param {String} str
3472
- * @return {Number}
3473
- * @api private
3474
- */
3475
-
3476
- function parse(str) {
3477
- str = String(str);
3478
- if (str.length > 100) {
3479
- return;
3480
- }
3481
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
3482
- str
3483
- );
3484
- if (!match) {
3485
- return;
3486
- }
3487
- var n = parseFloat(match[1]);
3488
- var type = (match[2] || 'ms').toLowerCase();
3489
- switch (type) {
3490
- case 'years':
3491
- case 'year':
3492
- case 'yrs':
3493
- case 'yr':
3494
- case 'y':
3495
- return n * y;
3496
- case 'weeks':
3497
- case 'week':
3498
- case 'w':
3499
- return n * w;
3500
- case 'days':
3501
- case 'day':
3502
- case 'd':
3503
- return n * d;
3504
- case 'hours':
3505
- case 'hour':
3506
- case 'hrs':
3507
- case 'hr':
3508
- case 'h':
3509
- return n * h;
3510
- case 'minutes':
3511
- case 'minute':
3512
- case 'mins':
3513
- case 'min':
3514
- case 'm':
3515
- return n * m;
3516
- case 'seconds':
3517
- case 'second':
3518
- case 'secs':
3519
- case 'sec':
3520
- case 's':
3521
- return n * s;
3522
- case 'milliseconds':
3523
- case 'millisecond':
3524
- case 'msecs':
3525
- case 'msec':
3526
- case 'ms':
3527
- return n;
3528
- default:
3529
- return undefined;
3530
- }
3531
- }
3532
-
3533
- /**
3534
- * Short format for `ms`.
3535
- *
3536
- * @param {Number} ms
3537
- * @return {String}
3538
- * @api private
3539
- */
3540
-
3541
- function fmtShort(ms) {
3542
- var msAbs = Math.abs(ms);
3543
- if (msAbs >= d) {
3544
- return Math.round(ms / d) + 'd';
3545
- }
3546
- if (msAbs >= h) {
3547
- return Math.round(ms / h) + 'h';
3548
- }
3549
- if (msAbs >= m) {
3550
- return Math.round(ms / m) + 'm';
3551
- }
3552
- if (msAbs >= s) {
3553
- return Math.round(ms / s) + 's';
3554
- }
3555
- return ms + 'ms';
3556
- }
3557
-
3558
- /**
3559
- * Long format for `ms`.
3560
- *
3561
- * @param {Number} ms
3562
- * @return {String}
3563
- * @api private
3564
- */
3565
-
3566
- function fmtLong(ms) {
3567
- var msAbs = Math.abs(ms);
3568
- if (msAbs >= d) {
3569
- return plural(ms, msAbs, d, 'day');
3570
- }
3571
- if (msAbs >= h) {
3572
- return plural(ms, msAbs, h, 'hour');
3573
- }
3574
- if (msAbs >= m) {
3575
- return plural(ms, msAbs, m, 'minute');
3576
- }
3577
- if (msAbs >= s) {
3578
- return plural(ms, msAbs, s, 'second');
3579
- }
3580
- return ms + ' ms';
3581
- }
3582
-
3583
- /**
3584
- * Pluralization helper.
3585
- */
3586
-
3587
- function plural(ms, msAbs, n, name) {
3588
- var isPlural = msAbs >= n * 1.5;
3589
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
3590
- }
3591
- return ms$1;
3592
- }
3593
-
3594
- var common;
3595
- var hasRequiredCommon;
3596
-
3597
- function requireCommon () {
3598
- if (hasRequiredCommon) return common;
3599
- hasRequiredCommon = 1;
3600
- /**
3601
- * This is the common logic for both the Node.js and web browser
3602
- * implementations of `debug()`.
3603
- */
3604
-
3605
- function setup(env) {
3606
- createDebug.debug = createDebug;
3607
- createDebug.default = createDebug;
3608
- createDebug.coerce = coerce;
3609
- createDebug.disable = disable;
3610
- createDebug.enable = enable;
3611
- createDebug.enabled = enabled;
3612
- createDebug.humanize = requireMs();
3613
- createDebug.destroy = destroy;
3614
-
3615
- Object.keys(env).forEach(key => {
3616
- createDebug[key] = env[key];
3617
- });
3618
-
3619
- /**
3620
- * The currently active debug mode names, and names to skip.
3621
- */
3622
-
3623
- createDebug.names = [];
3624
- createDebug.skips = [];
3625
-
3626
- /**
3627
- * Map of special "%n" handling functions, for the debug "format" argument.
3628
- *
3629
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
3630
- */
3631
- createDebug.formatters = {};
3632
-
3633
- /**
3634
- * Selects a color for a debug namespace
3635
- * @param {String} namespace The namespace string for the debug instance to be colored
3636
- * @return {Number|String} An ANSI color code for the given namespace
3637
- * @api private
3638
- */
3639
- function selectColor(namespace) {
3640
- let hash = 0;
3641
-
3642
- for (let i = 0; i < namespace.length; i++) {
3643
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
3644
- hash |= 0; // Convert to 32bit integer
3645
- }
3646
-
3647
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
3648
- }
3649
- createDebug.selectColor = selectColor;
3650
-
3651
- /**
3652
- * Create a debugger with the given `namespace`.
3653
- *
3654
- * @param {String} namespace
3655
- * @return {Function}
3656
- * @api public
3657
- */
3658
- function createDebug(namespace) {
3659
- let prevTime;
3660
- let enableOverride = null;
3661
- let namespacesCache;
3662
- let enabledCache;
3663
-
3664
- function debug(...args) {
3665
- // Disabled?
3666
- if (!debug.enabled) {
3667
- return;
3668
- }
3669
-
3670
- const self = debug;
3671
-
3672
- // Set `diff` timestamp
3673
- const curr = Number(new Date());
3674
- const ms = curr - (prevTime || curr);
3675
- self.diff = ms;
3676
- self.prev = prevTime;
3677
- self.curr = curr;
3678
- prevTime = curr;
3679
-
3680
- args[0] = createDebug.coerce(args[0]);
3681
-
3682
- if (typeof args[0] !== 'string') {
3683
- // Anything else let's inspect with %O
3684
- args.unshift('%O');
3685
- }
3686
-
3687
- // Apply any `formatters` transformations
3688
- let index = 0;
3689
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
3690
- // If we encounter an escaped % then don't increase the array index
3691
- if (match === '%%') {
3692
- return '%';
3693
- }
3694
- index++;
3695
- const formatter = createDebug.formatters[format];
3696
- if (typeof formatter === 'function') {
3697
- const val = args[index];
3698
- match = formatter.call(self, val);
3699
-
3700
- // Now we need to remove `args[index]` since it's inlined in the `format`
3701
- args.splice(index, 1);
3702
- index--;
3703
- }
3704
- return match;
3705
- });
3706
-
3707
- // Apply env-specific formatting (colors, etc.)
3708
- createDebug.formatArgs.call(self, args);
3709
-
3710
- const logFn = self.log || createDebug.log;
3711
- logFn.apply(self, args);
3712
- }
3713
-
3714
- debug.namespace = namespace;
3715
- debug.useColors = createDebug.useColors();
3716
- debug.color = createDebug.selectColor(namespace);
3717
- debug.extend = extend;
3718
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
3719
-
3720
- Object.defineProperty(debug, 'enabled', {
3721
- enumerable: true,
3722
- configurable: false,
3723
- get: () => {
3724
- if (enableOverride !== null) {
3725
- return enableOverride;
3726
- }
3727
- if (namespacesCache !== createDebug.namespaces) {
3728
- namespacesCache = createDebug.namespaces;
3729
- enabledCache = createDebug.enabled(namespace);
3730
- }
3731
-
3732
- return enabledCache;
3733
- },
3734
- set: v => {
3735
- enableOverride = v;
3736
- }
3737
- });
3738
-
3739
- // Env-specific initialization logic for debug instances
3740
- if (typeof createDebug.init === 'function') {
3741
- createDebug.init(debug);
3742
- }
3743
-
3744
- return debug;
3745
- }
3746
-
3747
- function extend(namespace, delimiter) {
3748
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
3749
- newDebug.log = this.log;
3750
- return newDebug;
3751
- }
3752
-
3753
- /**
3754
- * Enables a debug mode by namespaces. This can include modes
3755
- * separated by a colon and wildcards.
3756
- *
3757
- * @param {String} namespaces
3758
- * @api public
3759
- */
3760
- function enable(namespaces) {
3761
- createDebug.save(namespaces);
3762
- createDebug.namespaces = namespaces;
3763
-
3764
- createDebug.names = [];
3765
- createDebug.skips = [];
3766
-
3767
- let i;
3768
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
3769
- const len = split.length;
3770
-
3771
- for (i = 0; i < len; i++) {
3772
- if (!split[i]) {
3773
- // ignore empty strings
3774
- continue;
3775
- }
3776
-
3777
- namespaces = split[i].replace(/\*/g, '.*?');
3778
-
3779
- if (namespaces[0] === '-') {
3780
- createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
3781
- } else {
3782
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
3783
- }
3784
- }
3785
- }
3786
-
3787
- /**
3788
- * Disable debug output.
3789
- *
3790
- * @return {String} namespaces
3791
- * @api public
3792
- */
3793
- function disable() {
3794
- const namespaces = [
3795
- ...createDebug.names.map(toNamespace),
3796
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
3797
- ].join(',');
3798
- createDebug.enable('');
3799
- return namespaces;
3800
- }
3801
-
3802
- /**
3803
- * Returns true if the given mode name is enabled, false otherwise.
3804
- *
3805
- * @param {String} name
3806
- * @return {Boolean}
3807
- * @api public
3808
- */
3809
- function enabled(name) {
3810
- if (name[name.length - 1] === '*') {
3811
- return true;
3812
- }
3813
-
3814
- let i;
3815
- let len;
3816
-
3817
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
3818
- if (createDebug.skips[i].test(name)) {
3819
- return false;
3820
- }
3821
- }
3822
-
3823
- for (i = 0, len = createDebug.names.length; i < len; i++) {
3824
- if (createDebug.names[i].test(name)) {
3825
- return true;
3826
- }
3827
- }
3828
-
3829
- return false;
3830
- }
3831
-
3832
- /**
3833
- * Convert regexp to namespace
3834
- *
3835
- * @param {RegExp} regxep
3836
- * @return {String} namespace
3837
- * @api private
3838
- */
3839
- function toNamespace(regexp) {
3840
- return regexp.toString()
3841
- .substring(2, regexp.toString().length - 2)
3842
- .replace(/\.\*\?$/, '*');
3843
- }
3844
-
3845
- /**
3846
- * Coerce `val`.
3847
- *
3848
- * @param {Mixed} val
3849
- * @return {Mixed}
3850
- * @api private
3851
- */
3852
- function coerce(val) {
3853
- if (val instanceof Error) {
3854
- return val.stack || val.message;
3855
- }
3856
- return val;
3857
- }
3858
-
3859
- /**
3860
- * XXX DO NOT USE. This is a temporary stub function.
3861
- * XXX It WILL be removed in the next major release.
3862
- */
3863
- function destroy() {
3864
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
3865
- }
3866
-
3867
- createDebug.enable(createDebug.load());
3868
-
3869
- return createDebug;
3870
- }
3871
-
3872
- common = setup;
3873
- return common;
3874
- }
3875
-
3876
- /* eslint-env browser */
3877
-
3878
- var hasRequiredBrowser$1;
3879
-
3880
- function requireBrowser$1 () {
3881
- if (hasRequiredBrowser$1) return browser$1.exports;
3882
- hasRequiredBrowser$1 = 1;
3883
- (function (module, exports) {
3884
- /**
3885
- * This is the web browser implementation of `debug()`.
3886
- */
3887
-
3888
- exports.formatArgs = formatArgs;
3889
- exports.save = save;
3890
- exports.load = load;
3891
- exports.useColors = useColors;
3892
- exports.storage = localstorage();
3893
- exports.destroy = (() => {
3894
- let warned = false;
3895
-
3896
- return () => {
3897
- if (!warned) {
3898
- warned = true;
3899
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
3900
- }
3901
- };
3902
- })();
3903
-
3904
- /**
3905
- * Colors.
3906
- */
3907
-
3908
- exports.colors = [
3909
- '#0000CC',
3910
- '#0000FF',
3911
- '#0033CC',
3912
- '#0033FF',
3913
- '#0066CC',
3914
- '#0066FF',
3915
- '#0099CC',
3916
- '#0099FF',
3917
- '#00CC00',
3918
- '#00CC33',
3919
- '#00CC66',
3920
- '#00CC99',
3921
- '#00CCCC',
3922
- '#00CCFF',
3923
- '#3300CC',
3924
- '#3300FF',
3925
- '#3333CC',
3926
- '#3333FF',
3927
- '#3366CC',
3928
- '#3366FF',
3929
- '#3399CC',
3930
- '#3399FF',
3931
- '#33CC00',
3932
- '#33CC33',
3933
- '#33CC66',
3934
- '#33CC99',
3935
- '#33CCCC',
3936
- '#33CCFF',
3937
- '#6600CC',
3938
- '#6600FF',
3939
- '#6633CC',
3940
- '#6633FF',
3941
- '#66CC00',
3942
- '#66CC33',
3943
- '#9900CC',
3944
- '#9900FF',
3945
- '#9933CC',
3946
- '#9933FF',
3947
- '#99CC00',
3948
- '#99CC33',
3949
- '#CC0000',
3950
- '#CC0033',
3951
- '#CC0066',
3952
- '#CC0099',
3953
- '#CC00CC',
3954
- '#CC00FF',
3955
- '#CC3300',
3956
- '#CC3333',
3957
- '#CC3366',
3958
- '#CC3399',
3959
- '#CC33CC',
3960
- '#CC33FF',
3961
- '#CC6600',
3962
- '#CC6633',
3963
- '#CC9900',
3964
- '#CC9933',
3965
- '#CCCC00',
3966
- '#CCCC33',
3967
- '#FF0000',
3968
- '#FF0033',
3969
- '#FF0066',
3970
- '#FF0099',
3971
- '#FF00CC',
3972
- '#FF00FF',
3973
- '#FF3300',
3974
- '#FF3333',
3975
- '#FF3366',
3976
- '#FF3399',
3977
- '#FF33CC',
3978
- '#FF33FF',
3979
- '#FF6600',
3980
- '#FF6633',
3981
- '#FF9900',
3982
- '#FF9933',
3983
- '#FFCC00',
3984
- '#FFCC33'
3985
- ];
3986
-
3987
- /**
3988
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
3989
- * and the Firebug extension (any Firefox version) are known
3990
- * to support "%c" CSS customizations.
3991
- *
3992
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
3993
- */
3994
-
3995
- // eslint-disable-next-line complexity
3996
- function useColors() {
3997
- // NB: In an Electron preload script, document will be defined but not fully
3998
- // initialized. Since we know we're in Chrome, we'll just detect this case
3999
- // explicitly
4000
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
4001
- return true;
4002
- }
4003
-
4004
- // Internet Explorer and Edge do not support colors.
4005
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
4006
- return false;
4007
- }
4008
-
4009
- // Is webkit? http://stackoverflow.com/a/16459606/376773
4010
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
4011
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
4012
- // Is firebug? http://stackoverflow.com/a/398120/376773
4013
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
4014
- // Is firefox >= v31?
4015
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
4016
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
4017
- // Double check webkit in userAgent just in case we are in a worker
4018
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
4019
- }
4020
-
4021
- /**
4022
- * Colorize log arguments if enabled.
4023
- *
4024
- * @api public
4025
- */
4026
-
4027
- function formatArgs(args) {
4028
- args[0] = (this.useColors ? '%c' : '') +
4029
- this.namespace +
4030
- (this.useColors ? ' %c' : ' ') +
4031
- args[0] +
4032
- (this.useColors ? '%c ' : ' ') +
4033
- '+' + module.exports.humanize(this.diff);
4034
-
4035
- if (!this.useColors) {
4036
- return;
4037
- }
4038
-
4039
- const c = 'color: ' + this.color;
4040
- args.splice(1, 0, c, 'color: inherit');
4041
-
4042
- // The final "%c" is somewhat tricky, because there could be other
4043
- // arguments passed either before or after the %c, so we need to
4044
- // figure out the correct index to insert the CSS into
4045
- let index = 0;
4046
- let lastC = 0;
4047
- args[0].replace(/%[a-zA-Z%]/g, match => {
4048
- if (match === '%%') {
4049
- return;
4050
- }
4051
- index++;
4052
- if (match === '%c') {
4053
- // We only are interested in the *last* %c
4054
- // (the user may have provided their own)
4055
- lastC = index;
4056
- }
4057
- });
4058
-
4059
- args.splice(lastC, 0, c);
4060
- }
4061
-
4062
- /**
4063
- * Invokes `console.debug()` when available.
4064
- * No-op when `console.debug` is not a "function".
4065
- * If `console.debug` is not available, falls back
4066
- * to `console.log`.
4067
- *
4068
- * @api public
4069
- */
4070
- exports.log = console.debug || console.log || (() => {});
4071
-
4072
- /**
4073
- * Save `namespaces`.
4074
- *
4075
- * @param {String} namespaces
4076
- * @api private
4077
- */
4078
- function save(namespaces) {
4079
- try {
4080
- if (namespaces) {
4081
- exports.storage.setItem('debug', namespaces);
4082
- } else {
4083
- exports.storage.removeItem('debug');
4084
- }
4085
- } catch (error) {
4086
- // Swallow
4087
- // XXX (@Qix-) should we be logging these?
4088
- }
4089
- }
4090
-
4091
- /**
4092
- * Load `namespaces`.
4093
- *
4094
- * @return {String} returns the previously persisted debug modes
4095
- * @api private
4096
- */
4097
- function load() {
4098
- let r;
4099
- try {
4100
- r = exports.storage.getItem('debug');
4101
- } catch (error) {
4102
- // Swallow
4103
- // XXX (@Qix-) should we be logging these?
4104
- }
4105
-
4106
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
4107
- if (!r && typeof process !== 'undefined' && 'env' in process) {
4108
- r = process.env.DEBUG;
4109
- }
4110
-
4111
- return r;
4112
- }
4113
-
4114
- /**
4115
- * Localstorage attempts to return the localstorage.
4116
- *
4117
- * This is necessary because safari throws
4118
- * when a user disables cookies/localstorage
4119
- * and you attempt to access it.
4120
- *
4121
- * @return {LocalStorage}
4122
- * @api private
4123
- */
4124
-
4125
- function localstorage() {
4126
- try {
4127
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
4128
- // The Browser also has localStorage in the global context.
4129
- return localStorage;
4130
- } catch (error) {
4131
- // Swallow
4132
- // XXX (@Qix-) should we be logging these?
4133
- }
4134
- }
4135
-
4136
- module.exports = requireCommon()(exports);
4137
-
4138
- const {formatters} = module.exports;
4139
-
4140
- /**
4141
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
4142
- */
4143
-
4144
- formatters.j = function (v) {
4145
- try {
4146
- return JSON.stringify(v);
4147
- } catch (error) {
4148
- return '[UnexpectedJSONParseError]: ' + error.message;
4149
- }
4150
- };
4151
- } (browser$1, browser$1.exports));
4152
- return browser$1.exports;
4153
- }
4154
-
4155
- var node = {exports: {}};
4156
-
4157
- /* eslint-env browser */
4158
-
4159
- var browser;
4160
- var hasRequiredBrowser;
4161
-
4162
- function requireBrowser () {
4163
- if (hasRequiredBrowser) return browser;
4164
- hasRequiredBrowser = 1;
4165
-
4166
- function getChromeVersion() {
4167
- const matches = /(Chrome|Chromium)\/(?<chromeVersion>\d+)\./.exec(navigator.userAgent);
4168
-
4169
- if (!matches) {
4170
- return;
4171
- }
4172
-
4173
- return Number.parseInt(matches.groups.chromeVersion, 10);
4174
- }
4175
-
4176
- const colorSupport = getChromeVersion() >= 69 ? {
4177
- level: 1,
4178
- hasBasic: true,
4179
- has256: false,
4180
- has16m: false
4181
- } : false;
4182
-
4183
- browser = {
4184
- stdout: colorSupport,
4185
- stderr: colorSupport
4186
- };
4187
- return browser;
4188
- }
4189
-
4190
- /**
4191
- * Module dependencies.
4192
- */
4193
-
4194
- var hasRequiredNode;
4195
-
4196
- function requireNode () {
4197
- if (hasRequiredNode) return node.exports;
4198
- hasRequiredNode = 1;
4199
- (function (module, exports) {
4200
- const tty = require$$0$1;
4201
- const util = require$$0;
4202
-
4203
- /**
4204
- * This is the Node.js implementation of `debug()`.
4205
- */
4206
-
4207
- exports.init = init;
4208
- exports.log = log;
4209
- exports.formatArgs = formatArgs;
4210
- exports.save = save;
4211
- exports.load = load;
4212
- exports.useColors = useColors;
4213
- exports.destroy = util.deprecate(
4214
- () => {},
4215
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
4216
- );
4217
-
4218
- /**
4219
- * Colors.
4220
- */
4221
-
4222
- exports.colors = [6, 2, 3, 4, 5, 1];
4223
-
4224
- try {
4225
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
4226
- // eslint-disable-next-line import/no-extraneous-dependencies
4227
- const supportsColor = requireBrowser();
4228
-
4229
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
4230
- exports.colors = [
4231
- 20,
4232
- 21,
4233
- 26,
4234
- 27,
4235
- 32,
4236
- 33,
4237
- 38,
4238
- 39,
4239
- 40,
4240
- 41,
4241
- 42,
4242
- 43,
4243
- 44,
4244
- 45,
4245
- 56,
4246
- 57,
4247
- 62,
4248
- 63,
4249
- 68,
4250
- 69,
4251
- 74,
4252
- 75,
4253
- 76,
4254
- 77,
4255
- 78,
4256
- 79,
4257
- 80,
4258
- 81,
4259
- 92,
4260
- 93,
4261
- 98,
4262
- 99,
4263
- 112,
4264
- 113,
4265
- 128,
4266
- 129,
4267
- 134,
4268
- 135,
4269
- 148,
4270
- 149,
4271
- 160,
4272
- 161,
4273
- 162,
4274
- 163,
4275
- 164,
4276
- 165,
4277
- 166,
4278
- 167,
4279
- 168,
4280
- 169,
4281
- 170,
4282
- 171,
4283
- 172,
4284
- 173,
4285
- 178,
4286
- 179,
4287
- 184,
4288
- 185,
4289
- 196,
4290
- 197,
4291
- 198,
4292
- 199,
4293
- 200,
4294
- 201,
4295
- 202,
4296
- 203,
4297
- 204,
4298
- 205,
4299
- 206,
4300
- 207,
4301
- 208,
4302
- 209,
4303
- 214,
4304
- 215,
4305
- 220,
4306
- 221
4307
- ];
4308
- }
4309
- } catch (error) {
4310
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
4311
- }
4312
-
4313
- /**
4314
- * Build up the default `inspectOpts` object from the environment variables.
4315
- *
4316
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
4317
- */
4318
-
4319
- exports.inspectOpts = Object.keys(process.env).filter(key => {
4320
- return /^debug_/i.test(key);
4321
- }).reduce((obj, key) => {
4322
- // Camel-case
4323
- const prop = key
4324
- .substring(6)
4325
- .toLowerCase()
4326
- .replace(/_([a-z])/g, (_, k) => {
4327
- return k.toUpperCase();
4328
- });
4329
-
4330
- // Coerce string value into JS value
4331
- let val = process.env[key];
4332
- if (/^(yes|on|true|enabled)$/i.test(val)) {
4333
- val = true;
4334
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
4335
- val = false;
4336
- } else if (val === 'null') {
4337
- val = null;
4338
- } else {
4339
- val = Number(val);
4340
- }
4341
-
4342
- obj[prop] = val;
4343
- return obj;
4344
- }, {});
4345
-
4346
- /**
4347
- * Is stdout a TTY? Colored output is enabled when `true`.
4348
- */
4349
-
4350
- function useColors() {
4351
- return 'colors' in exports.inspectOpts ?
4352
- Boolean(exports.inspectOpts.colors) :
4353
- tty.isatty(process.stderr.fd);
4354
- }
4355
-
4356
- /**
4357
- * Adds ANSI color escape codes if enabled.
4358
- *
4359
- * @api public
4360
- */
4361
-
4362
- function formatArgs(args) {
4363
- const {namespace: name, useColors} = this;
4364
-
4365
- if (useColors) {
4366
- const c = this.color;
4367
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
4368
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
4369
-
4370
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
4371
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
4372
- } else {
4373
- args[0] = getDate() + name + ' ' + args[0];
4374
- }
4375
- }
4376
-
4377
- function getDate() {
4378
- if (exports.inspectOpts.hideDate) {
4379
- return '';
4380
- }
4381
- return new Date().toISOString() + ' ';
4382
- }
4383
-
4384
- /**
4385
- * Invokes `util.format()` with the specified arguments and writes to stderr.
4386
- */
4387
-
4388
- function log(...args) {
4389
- return process.stderr.write(util.format(...args) + '\n');
4390
- }
4391
-
4392
- /**
4393
- * Save `namespaces`.
4394
- *
4395
- * @param {String} namespaces
4396
- * @api private
4397
- */
4398
- function save(namespaces) {
4399
- if (namespaces) {
4400
- process.env.DEBUG = namespaces;
4401
- } else {
4402
- // If you set a process.env field to null or undefined, it gets cast to the
4403
- // string 'null' or 'undefined'. Just delete instead.
4404
- delete process.env.DEBUG;
4405
- }
4406
- }
4407
-
4408
- /**
4409
- * Load `namespaces`.
4410
- *
4411
- * @return {String} returns the previously persisted debug modes
4412
- * @api private
4413
- */
4414
-
4415
- function load() {
4416
- return process.env.DEBUG;
4417
- }
4418
-
4419
- /**
4420
- * Init logic for `debug` instances.
4421
- *
4422
- * Create a new `inspectOpts` object in case `useColors` is set
4423
- * differently for a particular `debug` instance.
4424
- */
4425
-
4426
- function init(debug) {
4427
- debug.inspectOpts = {};
4428
-
4429
- const keys = Object.keys(exports.inspectOpts);
4430
- for (let i = 0; i < keys.length; i++) {
4431
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
4432
- }
4433
- }
4434
-
4435
- module.exports = requireCommon()(exports);
4436
-
4437
- const {formatters} = module.exports;
4438
-
4439
- /**
4440
- * Map %o to `util.inspect()`, all on a single line.
4441
- */
4442
-
4443
- formatters.o = function (v) {
4444
- this.inspectOpts.colors = this.useColors;
4445
- return util.inspect(v, this.inspectOpts)
4446
- .split('\n')
4447
- .map(str => str.trim())
4448
- .join(' ');
4449
- };
4450
-
4451
- /**
4452
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
4453
- */
4454
-
4455
- formatters.O = function (v) {
4456
- this.inspectOpts.colors = this.useColors;
4457
- return util.inspect(v, this.inspectOpts);
4458
- };
4459
- } (node, node.exports));
4460
- return node.exports;
4461
- }
4462
-
4463
- /**
4464
- * Detect Electron renderer / nwjs process, which is node, but we should
4465
- * treat as a browser.
4466
- */
4467
-
4468
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
4469
- src.exports = requireBrowser$1();
4470
- } else {
4471
- src.exports = requireNode();
4472
- }
4473
-
4474
- var srcExports = src.exports;
4475
-
4476
- /*!
4477
- * depd
4478
- * Copyright(c) 2014-2018 Douglas Christopher Wilson
4479
- * MIT Licensed
4480
- */
4481
-
4482
- /**
4483
- * Module dependencies.
4484
- */
4485
-
4486
- var relative = require$$0$2.relative;
4487
-
4488
- /**
4489
- * Module exports.
4490
- */
4491
-
4492
- var depd_1 = depd;
4493
-
4494
- /**
4495
- * Get the path to base files on.
4496
- */
4497
-
4498
- var basePath = process.cwd();
4499
-
4500
- /**
4501
- * Determine if namespace is contained in the string.
4502
- */
4503
-
4504
- function containsNamespace (str, namespace) {
4505
- var vals = str.split(/[ ,]+/);
4506
- var ns = String(namespace).toLowerCase();
4507
-
4508
- for (var i = 0; i < vals.length; i++) {
4509
- var val = vals[i];
4510
-
4511
- // namespace contained
4512
- if (val && (val === '*' || val.toLowerCase() === ns)) {
4513
- return true
4514
- }
4515
- }
4516
-
4517
- return false
4518
- }
4519
-
4520
- /**
4521
- * Convert a data descriptor to accessor descriptor.
4522
- */
4523
-
4524
- function convertDataDescriptorToAccessor (obj, prop, message) {
4525
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
4526
- var value = descriptor.value;
4527
-
4528
- descriptor.get = function getter () { return value };
4529
-
4530
- if (descriptor.writable) {
4531
- descriptor.set = function setter (val) { return (value = val) };
4532
- }
4533
-
4534
- delete descriptor.value;
4535
- delete descriptor.writable;
4536
-
4537
- Object.defineProperty(obj, prop, descriptor);
4538
-
4539
- return descriptor
4540
- }
4541
-
4542
- /**
4543
- * Create arguments string to keep arity.
4544
- */
4545
-
4546
- function createArgumentsString (arity) {
4547
- var str = '';
4548
-
4549
- for (var i = 0; i < arity; i++) {
4550
- str += ', arg' + i;
4551
- }
4552
-
4553
- return str.substr(2)
4554
- }
4555
-
4556
- /**
4557
- * Create stack string from stack.
4558
- */
4559
-
4560
- function createStackString (stack) {
4561
- var str = this.name + ': ' + this.namespace;
4562
-
4563
- if (this.message) {
4564
- str += ' deprecated ' + this.message;
4565
- }
4566
-
4567
- for (var i = 0; i < stack.length; i++) {
4568
- str += '\n at ' + stack[i].toString();
4569
- }
4570
-
4571
- return str
4572
- }
4573
-
4574
- /**
4575
- * Create deprecate for namespace in caller.
4576
- */
4577
-
4578
- function depd (namespace) {
4579
- if (!namespace) {
4580
- throw new TypeError('argument namespace is required')
4581
- }
4582
-
4583
- var stack = getStack();
4584
- var site = callSiteLocation(stack[1]);
4585
- var file = site[0];
4586
-
4587
- function deprecate (message) {
4588
- // call to self as log
4589
- log.call(deprecate, message);
4590
- }
4591
-
4592
- deprecate._file = file;
4593
- deprecate._ignored = isignored(namespace);
4594
- deprecate._namespace = namespace;
4595
- deprecate._traced = istraced(namespace);
4596
- deprecate._warned = Object.create(null);
4597
-
4598
- deprecate.function = wrapfunction;
4599
- deprecate.property = wrapproperty;
4600
-
4601
- return deprecate
4602
- }
4603
-
4604
- /**
4605
- * Determine if event emitter has listeners of a given type.
4606
- *
4607
- * The way to do this check is done three different ways in Node.js >= 0.8
4608
- * so this consolidates them into a minimal set using instance methods.
4609
- *
4610
- * @param {EventEmitter} emitter
4611
- * @param {string} type
4612
- * @returns {boolean}
4613
- * @private
4614
- */
4615
-
4616
- function eehaslisteners (emitter, type) {
4617
- var count = typeof emitter.listenerCount !== 'function'
4618
- ? emitter.listeners(type).length
4619
- : emitter.listenerCount(type);
4620
-
4621
- return count > 0
4622
- }
4623
-
4624
- /**
4625
- * Determine if namespace is ignored.
4626
- */
4627
-
4628
- function isignored (namespace) {
4629
- if (process.noDeprecation) {
4630
- // --no-deprecation support
4631
- return true
4632
- }
4633
-
4634
- var str = process.env.NO_DEPRECATION || '';
4635
-
4636
- // namespace ignored
4637
- return containsNamespace(str, namespace)
4638
- }
4639
-
4640
- /**
4641
- * Determine if namespace is traced.
4642
- */
4643
-
4644
- function istraced (namespace) {
4645
- if (process.traceDeprecation) {
4646
- // --trace-deprecation support
4647
- return true
4648
- }
4649
-
4650
- var str = process.env.TRACE_DEPRECATION || '';
4651
-
4652
- // namespace traced
4653
- return containsNamespace(str, namespace)
4654
- }
4655
-
4656
- /**
4657
- * Display deprecation message.
4658
- */
4659
-
4660
- function log (message, site) {
4661
- var haslisteners = eehaslisteners(process, 'deprecation');
4662
-
4663
- // abort early if no destination
4664
- if (!haslisteners && this._ignored) {
4665
- return
4666
- }
4667
-
4668
- var caller;
4669
- var callFile;
4670
- var callSite;
4671
- var depSite;
4672
- var i = 0;
4673
- var seen = false;
4674
- var stack = getStack();
4675
- var file = this._file;
4676
-
4677
- if (site) {
4678
- // provided site
4679
- depSite = site;
4680
- callSite = callSiteLocation(stack[1]);
4681
- callSite.name = depSite.name;
4682
- file = callSite[0];
4683
- } else {
4684
- // get call site
4685
- i = 2;
4686
- depSite = callSiteLocation(stack[i]);
4687
- callSite = depSite;
4688
- }
4689
-
4690
- // get caller of deprecated thing in relation to file
4691
- for (; i < stack.length; i++) {
4692
- caller = callSiteLocation(stack[i]);
4693
- callFile = caller[0];
4694
-
4695
- if (callFile === file) {
4696
- seen = true;
4697
- } else if (callFile === this._file) {
4698
- file = this._file;
4699
- } else if (seen) {
4700
- break
4701
- }
4702
- }
4703
-
4704
- var key = caller
4705
- ? depSite.join(':') + '__' + caller.join(':')
4706
- : undefined;
4707
-
4708
- if (key !== undefined && key in this._warned) {
4709
- // already warned
4710
- return
4711
- }
4712
-
4713
- this._warned[key] = true;
4714
-
4715
- // generate automatic message from call site
4716
- var msg = message;
4717
- if (!msg) {
4718
- msg = callSite === depSite || !callSite.name
4719
- ? defaultMessage(depSite)
4720
- : defaultMessage(callSite);
4721
- }
4722
-
4723
- // emit deprecation if listeners exist
4724
- if (haslisteners) {
4725
- var err = DeprecationError(this._namespace, msg, stack.slice(i));
4726
- process.emit('deprecation', err);
4727
- return
4728
- }
4729
-
4730
- // format and write message
4731
- var format = process.stderr.isTTY
4732
- ? formatColor
4733
- : formatPlain;
4734
- var output = format.call(this, msg, caller, stack.slice(i));
4735
- process.stderr.write(output + '\n', 'utf8');
4736
- }
4737
-
4738
- /**
4739
- * Get call site location as array.
4740
- */
4741
-
4742
- function callSiteLocation (callSite) {
4743
- var file = callSite.getFileName() || '<anonymous>';
4744
- var line = callSite.getLineNumber();
4745
- var colm = callSite.getColumnNumber();
4746
-
4747
- if (callSite.isEval()) {
4748
- file = callSite.getEvalOrigin() + ', ' + file;
4749
- }
4750
-
4751
- var site = [file, line, colm];
4752
-
4753
- site.callSite = callSite;
4754
- site.name = callSite.getFunctionName();
4755
-
4756
- return site
4757
- }
4758
-
4759
- /**
4760
- * Generate a default message from the site.
4761
- */
4762
-
4763
- function defaultMessage (site) {
4764
- var callSite = site.callSite;
4765
- var funcName = site.name;
4766
-
4767
- // make useful anonymous name
4768
- if (!funcName) {
4769
- funcName = '<anonymous@' + formatLocation(site) + '>';
4770
- }
4771
-
4772
- var context = callSite.getThis();
4773
- var typeName = context && callSite.getTypeName();
4774
-
4775
- // ignore useless type name
4776
- if (typeName === 'Object') {
4777
- typeName = undefined;
4778
- }
4779
-
4780
- // make useful type name
4781
- if (typeName === 'Function') {
4782
- typeName = context.name || typeName;
4783
- }
4784
-
4785
- return typeName && callSite.getMethodName()
4786
- ? typeName + '.' + funcName
4787
- : funcName
4788
- }
4789
-
4790
- /**
4791
- * Format deprecation message without color.
4792
- */
4793
-
4794
- function formatPlain (msg, caller, stack) {
4795
- var timestamp = new Date().toUTCString();
4796
-
4797
- var formatted = timestamp +
4798
- ' ' + this._namespace +
4799
- ' deprecated ' + msg;
4800
-
4801
- // add stack trace
4802
- if (this._traced) {
4803
- for (var i = 0; i < stack.length; i++) {
4804
- formatted += '\n at ' + stack[i].toString();
4805
- }
4806
-
4807
- return formatted
4808
- }
4809
-
4810
- if (caller) {
4811
- formatted += ' at ' + formatLocation(caller);
4812
- }
4813
-
4814
- return formatted
4815
- }
4816
-
4817
- /**
4818
- * Format deprecation message with color.
4819
- */
4820
-
4821
- function formatColor (msg, caller, stack) {
4822
- var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
4823
- ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
4824
- ' \x1b[0m' + msg + '\x1b[39m'; // reset
4825
-
4826
- // add stack trace
4827
- if (this._traced) {
4828
- for (var i = 0; i < stack.length; i++) {
4829
- formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m'; // cyan
4830
- }
4831
-
4832
- return formatted
4833
- }
4834
-
4835
- if (caller) {
4836
- formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m'; // cyan
4837
- }
4838
-
4839
- return formatted
4840
- }
4841
-
4842
- /**
4843
- * Format call site location.
4844
- */
4845
-
4846
- function formatLocation (callSite) {
4847
- return relative(basePath, callSite[0]) +
4848
- ':' + callSite[1] +
4849
- ':' + callSite[2]
4850
- }
4851
-
4852
- /**
4853
- * Get the stack as array of call sites.
4854
- */
4855
-
4856
- function getStack () {
4857
- var limit = Error.stackTraceLimit;
4858
- var obj = {};
4859
- var prep = Error.prepareStackTrace;
4860
-
4861
- Error.prepareStackTrace = prepareObjectStackTrace;
4862
- Error.stackTraceLimit = Math.max(10, limit);
4863
-
4864
- // capture the stack
4865
- Error.captureStackTrace(obj);
4866
-
4867
- // slice this function off the top
4868
- var stack = obj.stack.slice(1);
4869
-
4870
- Error.prepareStackTrace = prep;
4871
- Error.stackTraceLimit = limit;
4872
-
4873
- return stack
4874
- }
4875
-
4876
- /**
4877
- * Capture call site stack from v8.
4878
- */
4879
-
4880
- function prepareObjectStackTrace (obj, stack) {
4881
- return stack
4882
- }
4883
-
4884
- /**
4885
- * Return a wrapped function in a deprecation message.
4886
- */
4887
-
4888
- function wrapfunction (fn, message) {
4889
- if (typeof fn !== 'function') {
4890
- throw new TypeError('argument fn must be a function')
4891
- }
4892
-
4893
- var args = createArgumentsString(fn.length);
4894
- var stack = getStack();
4895
- var site = callSiteLocation(stack[1]);
4896
-
4897
- site.name = fn.name;
4898
-
4899
- // eslint-disable-next-line no-new-func
4900
- var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
4901
- '"use strict"\n' +
4902
- 'return function (' + args + ') {' +
4903
- 'log.call(deprecate, message, site)\n' +
4904
- 'return fn.apply(this, arguments)\n' +
4905
- '}')(fn, log, this, message, site);
4906
-
4907
- return deprecatedfn
4908
- }
4909
-
4910
- /**
4911
- * Wrap property in a deprecation message.
4912
- */
4913
-
4914
- function wrapproperty (obj, prop, message) {
4915
- if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
4916
- throw new TypeError('argument obj must be object')
4917
- }
4918
-
4919
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
4920
-
4921
- if (!descriptor) {
4922
- throw new TypeError('must call property on owner object')
4923
- }
4924
-
4925
- if (!descriptor.configurable) {
4926
- throw new TypeError('property must be configurable')
4927
- }
4928
-
4929
- var deprecate = this;
4930
- var stack = getStack();
4931
- var site = callSiteLocation(stack[1]);
4932
-
4933
- // set site name
4934
- site.name = prop;
4935
-
4936
- // convert data descriptor
4937
- if ('value' in descriptor) {
4938
- descriptor = convertDataDescriptorToAccessor(obj, prop);
4939
- }
4940
-
4941
- var get = descriptor.get;
4942
- var set = descriptor.set;
4943
-
4944
- // wrap getter
4945
- if (typeof get === 'function') {
4946
- descriptor.get = function getter () {
4947
- log.call(deprecate, message, site);
4948
- return get.apply(this, arguments)
4949
- };
4950
- }
4951
-
4952
- // wrap setter
4953
- if (typeof set === 'function') {
4954
- descriptor.set = function setter () {
4955
- log.call(deprecate, message, site);
4956
- return set.apply(this, arguments)
4957
- };
4958
- }
4959
-
4960
- Object.defineProperty(obj, prop, descriptor);
4961
- }
4962
-
4963
- /**
4964
- * Create DeprecationError for deprecation
4965
- */
4966
-
4967
- function DeprecationError (namespace, message, stack) {
4968
- var error = new Error();
4969
- var stackString;
4970
-
4971
- Object.defineProperty(error, 'constructor', {
4972
- value: DeprecationError
4973
- });
4974
-
4975
- Object.defineProperty(error, 'message', {
4976
- configurable: true,
4977
- enumerable: false,
4978
- value: message,
4979
- writable: true
4980
- });
4981
-
4982
- Object.defineProperty(error, 'name', {
4983
- enumerable: false,
4984
- configurable: true,
4985
- value: 'DeprecationError',
4986
- writable: true
4987
- });
4988
-
4989
- Object.defineProperty(error, 'namespace', {
4990
- configurable: true,
4991
- enumerable: false,
4992
- value: namespace,
4993
- writable: true
4994
- });
4995
-
4996
- Object.defineProperty(error, 'stack', {
4997
- configurable: true,
4998
- enumerable: false,
4999
- get: function () {
5000
- if (stackString !== undefined) {
5001
- return stackString
5002
- }
5003
-
5004
- // prepare stack trace
5005
- return (stackString = createStackString.call(this, stack))
5006
- },
5007
- set: function setter (val) {
5008
- stackString = val;
5009
- }
5010
- });
5011
-
5012
- return error
5013
- }
5014
-
5015
3436
  var constants = {
5016
3437
  // agent
5017
3438
  CURRENT_ID: Symbol('agentkeepalive#currentId'),
@@ -5025,10 +3446,9 @@ var constants = {
5025
3446
  SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
5026
3447
  };
5027
3448
 
5028
- const OriginalAgent = require$$0$3.Agent;
3449
+ const OriginalAgent = require$$0$1.Agent;
5029
3450
  const ms = humanizeMs;
5030
- const debug = srcExports('agentkeepalive');
5031
- const deprecate = depd_1('agentkeepalive');
3451
+ const debug = require$$0.debuglog('agentkeepalive');
5032
3452
  const {
5033
3453
  INIT_SOCKET: INIT_SOCKET$1,
5034
3454
  CURRENT_ID,
@@ -5052,6 +3472,10 @@ if (majorVersion >= 11 && majorVersion <= 12) {
5052
3472
  defaultTimeoutListenerCount = 3;
5053
3473
  }
5054
3474
 
3475
+ function deprecate(message) {
3476
+ console.log('[agentkeepalive:deprecated] %s', message);
3477
+ }
3478
+
5055
3479
  class Agent extends OriginalAgent {
5056
3480
  constructor(options) {
5057
3481
  options = options || {};
@@ -5255,6 +3679,7 @@ class Agent extends OriginalAgent {
5255
3679
 
5256
3680
  const newSocket = super.createConnection(options, onNewCreate);
5257
3681
  if (newSocket) onNewCreate(null, newSocket);
3682
+ return newSocket;
5258
3683
  }
5259
3684
 
5260
3685
  get statusChanged() {
@@ -5422,7 +3847,7 @@ function inspect(obj) {
5422
3847
  return res;
5423
3848
  }
5424
3849
 
5425
- const OriginalHttpsAgent = require$$0$4.Agent;
3850
+ const OriginalHttpsAgent = require$$0$2.Agent;
5426
3851
  const HttpAgent = agent;
5427
3852
  const {
5428
3853
  INIT_SOCKET,
@@ -5447,8 +3872,8 @@ let HttpsAgent$1 = class HttpsAgent extends HttpAgent {
5447
3872
  };
5448
3873
  }
5449
3874
 
5450
- createConnection(options) {
5451
- const socket = this[CREATE_HTTPS_CONNECTION](options);
3875
+ createConnection(options, oncreate) {
3876
+ const socket = this[CREATE_HTTPS_CONNECTION](options, oncreate);
5452
3877
  this[INIT_SOCKET](socket, options);
5453
3878
  return socket;
5454
3879
  }
@@ -6030,6 +4455,7 @@ function versionedMessageFromResponse(version, response) {
6030
4455
  */
6031
4456
 
6032
4457
  // Deprecated as of v1.5.5
4458
+
6033
4459
  /**
6034
4460
  * A subset of Commitment levels, which are at least optimistically confirmed
6035
4461
  * <pre>
@@ -6037,6 +4463,7 @@ function versionedMessageFromResponse(version, response) {
6037
4463
  * 'finalized': Query the most recent block which has been finalized by the cluster
6038
4464
  * </pre>
6039
4465
  */
4466
+
6040
4467
  /**
6041
4468
  * Filter for largest accounts query
6042
4469
  * <pre>
@@ -6044,70 +4471,92 @@ function versionedMessageFromResponse(version, response) {
6044
4471
  * 'nonCirculating': Return the largest accounts that are not part of the circulating supply
6045
4472
  * </pre>
6046
4473
  */
4474
+
6047
4475
  /**
6048
4476
  * Configuration object for changing `getAccountInfo` query behavior
6049
4477
  */
4478
+
6050
4479
  /**
6051
4480
  * Configuration object for changing `getBalance` query behavior
6052
4481
  */
4482
+
6053
4483
  /**
6054
4484
  * Configuration object for changing `getBlock` query behavior
6055
4485
  */
4486
+
6056
4487
  /**
6057
4488
  * Configuration object for changing `getBlock` query behavior
6058
4489
  */
4490
+
6059
4491
  /**
6060
4492
  * Configuration object for changing `getStakeMinimumDelegation` query behavior
6061
4493
  */
4494
+
6062
4495
  /**
6063
4496
  * Configuration object for changing `getBlockHeight` query behavior
6064
4497
  */
4498
+
6065
4499
  /**
6066
4500
  * Configuration object for changing `getEpochInfo` query behavior
6067
4501
  */
4502
+
6068
4503
  /**
6069
4504
  * Configuration object for changing `getInflationReward` query behavior
6070
4505
  */
4506
+
6071
4507
  /**
6072
4508
  * Configuration object for changing `getLatestBlockhash` query behavior
6073
4509
  */
4510
+
6074
4511
  /**
6075
4512
  * Configuration object for changing `isBlockhashValid` query behavior
6076
4513
  */
4514
+
6077
4515
  /**
6078
4516
  * Configuration object for changing `getSlot` query behavior
6079
4517
  */
4518
+
6080
4519
  /**
6081
4520
  * Configuration object for changing `getSlotLeader` query behavior
6082
4521
  */
4522
+
6083
4523
  /**
6084
4524
  * Configuration object for changing `getTransaction` query behavior
6085
4525
  */
4526
+
6086
4527
  /**
6087
4528
  * Configuration object for changing `getTransaction` query behavior
6088
4529
  */
4530
+
6089
4531
  /**
6090
4532
  * Configuration object for changing `getLargestAccounts` query behavior
6091
4533
  */
4534
+
6092
4535
  /**
6093
4536
  * Configuration object for changing `getSupply` request behavior
6094
4537
  */
4538
+
6095
4539
  /**
6096
4540
  * Configuration object for changing query behavior
6097
4541
  */
4542
+
6098
4543
  /**
6099
4544
  * Information describing a cluster node
6100
4545
  */
4546
+
6101
4547
  /**
6102
4548
  * Information describing a vote account
6103
4549
  */
4550
+
6104
4551
  /**
6105
4552
  * A collection of cluster vote accounts
6106
4553
  */
4554
+
6107
4555
  /**
6108
4556
  * Network Inflation
6109
4557
  * (see https://docs.solana.com/implemented-proposals/ed_overview)
6110
4558
  */
4559
+
6111
4560
  const GetInflationGovernorResult = type({
6112
4561
  foundation: number(),
6113
4562
  foundationTerm: number(),
@@ -7858,7 +6307,9 @@ class Connection {
7858
6307
  return res.result;
7859
6308
  }
7860
6309
 
7861
- /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */ // eslint-disable-next-line no-dupe-class-members
6310
+ /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
6311
+ // eslint-disable-next-line no-dupe-class-members
6312
+
7862
6313
  // eslint-disable-next-line no-dupe-class-members
7863
6314
  async confirmTransaction(strategy, commitment) {
7864
6315
  let rawSignature;
@@ -8653,21 +7104,28 @@ class Connection {
8653
7104
  /**
8654
7105
  * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
8655
7106
  * setting the `maxSupportedTransactionVersion` property.
8656
- */ // eslint-disable-next-line no-dupe-class-members
7107
+ */
7108
+ // eslint-disable-next-line no-dupe-class-members
7109
+
8657
7110
  /**
8658
7111
  * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
8659
7112
  * setting the `maxSupportedTransactionVersion` property.
8660
7113
  */
8661
7114
  // eslint-disable-next-line no-dupe-class-members
7115
+
8662
7116
  /**
8663
7117
  * Fetch a processed block from the cluster.
8664
7118
  */
8665
7119
  // eslint-disable-next-line no-dupe-class-members
7120
+
8666
7121
  // eslint-disable-next-line no-dupe-class-members
7122
+
8667
7123
  // eslint-disable-next-line no-dupe-class-members
7124
+
8668
7125
  /**
8669
7126
  * Fetch a processed block from the cluster.
8670
- */ // eslint-disable-next-line no-dupe-class-members
7127
+ */
7128
+ // eslint-disable-next-line no-dupe-class-members
8671
7129
  async getBlock(slot, rawConfig) {
8672
7130
  const {
8673
7131
  commitment,
@@ -8806,10 +7264,13 @@ class Connection {
8806
7264
 
8807
7265
  /**
8808
7266
  * Fetch a confirmed or finalized transaction from the cluster.
8809
- */ // eslint-disable-next-line no-dupe-class-members
7267
+ */
7268
+ // eslint-disable-next-line no-dupe-class-members
7269
+
8810
7270
  /**
8811
7271
  * Fetch a confirmed or finalized transaction from the cluster.
8812
- */ // eslint-disable-next-line no-dupe-class-members
7272
+ */
7273
+ // eslint-disable-next-line no-dupe-class-members
8813
7274
  async getTransaction(signature, rawConfig) {
8814
7275
  const {
8815
7276
  commitment,
@@ -8888,12 +7349,15 @@ class Connection {
8888
7349
  * Fetch transaction details for a batch of confirmed transactions.
8889
7350
  * Similar to {@link getParsedTransactions} but returns a {@link
8890
7351
  * VersionedTransactionResponse}.
8891
- */ // eslint-disable-next-line no-dupe-class-members
7352
+ */
7353
+ // eslint-disable-next-line no-dupe-class-members
7354
+
8892
7355
  /**
8893
7356
  * Fetch transaction details for a batch of confirmed transactions.
8894
7357
  * Similar to {@link getParsedTransactions} but returns a {@link
8895
7358
  * VersionedTransactionResponse}.
8896
- */ // eslint-disable-next-line no-dupe-class-members
7359
+ */
7360
+ // eslint-disable-next-line no-dupe-class-members
8897
7361
  async getTransactions(signatures, commitmentOrConfig) {
8898
7362
  const {
8899
7363
  commitment,
@@ -9319,10 +7783,13 @@ class Connection {
9319
7783
 
9320
7784
  /**
9321
7785
  * Simulate a transaction
9322
- */ // eslint-disable-next-line no-dupe-class-members
7786
+ */
7787
+ // eslint-disable-next-line no-dupe-class-members
7788
+
9323
7789
  /**
9324
7790
  * Simulate a transaction
9325
- */ // eslint-disable-next-line no-dupe-class-members
7791
+ */
7792
+ // eslint-disable-next-line no-dupe-class-members
9326
7793
  async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
9327
7794
  if ('message' in transactionOrMessage) {
9328
7795
  const versionedTx = transactionOrMessage;
@@ -9374,7 +7841,6 @@ class Connection {
9374
7841
  if (!transaction.signature) {
9375
7842
  throw new Error('!signature'); // should never happen
9376
7843
  }
9377
-
9378
7844
  const signature = transaction.signature.toString('base64');
9379
7845
  if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {
9380
7846
  // The signature of this transaction has not been seen before with the
@@ -9435,10 +7901,13 @@ class Connection {
9435
7901
 
9436
7902
  /**
9437
7903
  * Send a signed transaction
9438
- */ // eslint-disable-next-line no-dupe-class-members
7904
+ */
7905
+ // eslint-disable-next-line no-dupe-class-members
7906
+
9439
7907
  /**
9440
7908
  * Sign and send a transaction
9441
- */ // eslint-disable-next-line no-dupe-class-members
7909
+ */
7910
+ // eslint-disable-next-line no-dupe-class-members
9442
7911
  async sendTransaction(transaction, signersOrOptions, options) {
9443
7912
  if ('version' in transaction) {
9444
7913
  if (signersOrOptions && Array.isArray(signersOrOptions)) {
@@ -9463,7 +7932,6 @@ class Connection {
9463
7932
  if (!transaction.signature) {
9464
7933
  throw new Error('!signature'); // should never happen
9465
7934
  }
9466
-
9467
7935
  const signature = transaction.signature.toString('base64');
9468
7936
  if (!this._blockhashInfo.transactionSignatures.includes(signature)) {
9469
7937
  // The signature of this transaction has not been seen before with the
@@ -9847,7 +8315,6 @@ class Connection {
9847
8315
  args) {
9848
8316
  const clientSubscriptionId = this._nextClientSubscriptionId++;
9849
8317
  const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
9850
-
9851
8318
  const existingSubscription = this._subscriptionsByHash[hash];
9852
8319
  if (existingSubscription === undefined) {
9853
8320
  this._subscriptionsByHash[hash] = {
@@ -9930,7 +8397,6 @@ class Connection {
9930
8397
  'base64' /* encoding */, filters ? {
9931
8398
  filters: filters
9932
8399
  } : undefined /* extra */);
9933
-
9934
8400
  return this._makeSubscription({
9935
8401
  callback,
9936
8402
  method: 'programSubscribe',
@@ -9955,7 +8421,6 @@ class Connection {
9955
8421
  mentions: [filter.toString()]
9956
8422
  } : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.
9957
8423
  );
9958
-
9959
8424
  return this._makeSubscription({
9960
8425
  callback,
9961
8426
  method: 'logsSubscribe',
@@ -10136,7 +8601,6 @@ class Connection {
10136
8601
  onSignature(signature, callback, commitment) {
10137
8602
  const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.
10138
8603
  );
10139
-
10140
8604
  const clientSubscriptionId = this._makeSubscription({
10141
8605
  callback: (notification, context) => {
10142
8606
  if (notification.type === 'status') {
@@ -10175,7 +8639,6 @@ class Connection {
10175
8639
  ...options,
10176
8640
  commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.
10177
8641
  };
10178
-
10179
8642
  const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);
10180
8643
  const clientSubscriptionId = this._makeSubscription({
10181
8644
  callback: (notification, context) => {
@@ -11538,7 +10001,7 @@ class StakeProgram {
11538
10001
  if (custodianPubkey) {
11539
10002
  keys.push({
11540
10003
  pubkey: custodianPubkey,
11541
- isSigner: false,
10004
+ isSigner: true,
11542
10005
  isWritable: false
11543
10006
  });
11544
10007
  }
@@ -11586,7 +10049,7 @@ class StakeProgram {
11586
10049
  if (custodianPubkey) {
11587
10050
  keys.push({
11588
10051
  pubkey: custodianPubkey,
11589
- isSigner: false,
10052
+ isSigner: true,
11590
10053
  isWritable: false
11591
10054
  });
11592
10055
  }
@@ -11751,7 +10214,7 @@ class StakeProgram {
11751
10214
  if (custodianPubkey) {
11752
10215
  keys.push({
11753
10216
  pubkey: custodianPubkey,
11754
- isSigner: false,
10217
+ isSigner: true,
11755
10218
  isWritable: false
11756
10219
  });
11757
10220
  }
@@ -12442,7 +10905,9 @@ function clusterApiUrl(cluster, tls) {
12442
10905
  /**
12443
10906
  * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
12444
10907
  * is no longer supported and will be removed in a future version.
12445
- */ // eslint-disable-next-line no-redeclare
10908
+ */
10909
+ // eslint-disable-next-line no-redeclare
10910
+
12446
10911
  // eslint-disable-next-line no-redeclare
12447
10912
  async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {
12448
10913
  let confirmationStrategy;