@solana/web3.js 1.71.0 → 1.71.1

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.cjs.js CHANGED
@@ -11,13 +11,13 @@ var sha256 = require('@noble/hashes/sha256');
11
11
  var borsh = require('borsh');
12
12
  var BufferLayout = require('@solana/buffer-layout');
13
13
  var bigintBuffer = require('bigint-buffer');
14
+ var require$$1 = require('tty');
14
15
  var require$$0$1 = require('os');
15
- var require$$0$2 = require('tty');
16
16
  var require$$0 = require('util');
17
- var require$$0$3 = require('events');
18
- var require$$1 = require('path');
19
- var require$$0$4 = require('http');
20
- var require$$0$5 = require('https');
17
+ var require$$0$2 = require('events');
18
+ var require$$1$1 = require('path');
19
+ var require$$0$3 = require('http');
20
+ var require$$0$4 = require('https');
21
21
  var superstruct = require('superstruct');
22
22
  var rpcWebsockets = require('rpc-websockets');
23
23
  var RpcClient = require('jayson/lib/client/browser');
@@ -50,13 +50,13 @@ var ed25519__namespace = /*#__PURE__*/_interopNamespace(ed25519);
50
50
  var BN__default = /*#__PURE__*/_interopDefaultLegacy(BN);
51
51
  var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
52
52
  var BufferLayout__namespace = /*#__PURE__*/_interopNamespace(BufferLayout);
53
+ var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
53
54
  var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
54
- var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
55
55
  var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
56
+ var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
57
+ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
56
58
  var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
57
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
58
59
  var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
59
- var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
60
60
  var RpcClient__default = /*#__PURE__*/_interopDefaultLegacy(RpcClient);
61
61
  var nodeFetch__namespace = /*#__PURE__*/_interopNamespace(nodeFetch);
62
62
  var secp256k1__namespace = /*#__PURE__*/_interopNamespace(secp256k1);
@@ -803,6 +803,36 @@ class CompiledKeys {
803
803
 
804
804
  }
805
805
 
806
+ const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
807
+ /**
808
+ * Delegates to `Array#shift`, but throws if the array is zero-length.
809
+ */
810
+
811
+ function guardedShift(byteArray) {
812
+ if (byteArray.length === 0) {
813
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
814
+ }
815
+
816
+ return byteArray.shift();
817
+ }
818
+ /**
819
+ * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
820
+ * the array.
821
+ */
822
+
823
+ function guardedSplice(byteArray, ...args) {
824
+ var _args$;
825
+
826
+ const [start] = args;
827
+
828
+ if (args.length === 2 // Implies that `deleteCount` was supplied
829
+ ? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
830
+ throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
831
+ }
832
+
833
+ return byteArray.splice(...args);
834
+ }
835
+
806
836
  /**
807
837
  * An instruction to execute by a program
808
838
  *
@@ -954,37 +984,33 @@ class Message {
954
984
  static from(buffer$1) {
955
985
  // Slice up wire data
956
986
  let byteArray = [...buffer$1];
957
- const numRequiredSignatures = byteArray.shift();
987
+ const numRequiredSignatures = guardedShift(byteArray);
958
988
 
959
989
  if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {
960
990
  throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');
961
991
  }
962
992
 
963
- const numReadonlySignedAccounts = byteArray.shift();
964
- const numReadonlyUnsignedAccounts = byteArray.shift();
993
+ const numReadonlySignedAccounts = guardedShift(byteArray);
994
+ const numReadonlyUnsignedAccounts = guardedShift(byteArray);
965
995
  const accountCount = decodeLength(byteArray);
966
996
  let accountKeys = [];
967
997
 
968
998
  for (let i = 0; i < accountCount; i++) {
969
- const account = byteArray.slice(0, PUBLIC_KEY_LENGTH);
970
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
999
+ const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
971
1000
  accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
972
1001
  }
973
1002
 
974
- const recentBlockhash = byteArray.slice(0, PUBLIC_KEY_LENGTH);
975
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
1003
+ const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
976
1004
  const instructionCount = decodeLength(byteArray);
977
1005
  let instructions = [];
978
1006
 
979
1007
  for (let i = 0; i < instructionCount; i++) {
980
- const programIdIndex = byteArray.shift();
1008
+ const programIdIndex = guardedShift(byteArray);
981
1009
  const accountCount = decodeLength(byteArray);
982
- const accounts = byteArray.slice(0, accountCount);
983
- byteArray = byteArray.slice(accountCount);
1010
+ const accounts = guardedSplice(byteArray, 0, accountCount);
984
1011
  const dataLength = decodeLength(byteArray);
985
- const dataSlice = byteArray.slice(0, dataLength);
1012
+ const dataSlice = guardedSplice(byteArray, 0, dataLength);
986
1013
  const data = bs58__default["default"].encode(buffer.Buffer.from(dataSlice));
987
- byteArray = byteArray.slice(dataLength);
988
1014
  instructions.push({
989
1015
  programIdIndex,
990
1016
  accounts,
@@ -1220,33 +1246,33 @@ class MessageV0 {
1220
1246
 
1221
1247
  static deserialize(serializedMessage) {
1222
1248
  let byteArray = [...serializedMessage];
1223
- const prefix = byteArray.shift();
1249
+ const prefix = guardedShift(byteArray);
1224
1250
  const maskedPrefix = prefix & VERSION_PREFIX_MASK;
1225
1251
  assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
1226
1252
  const version = maskedPrefix;
1227
1253
  assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);
1228
1254
  const header = {
1229
- numRequiredSignatures: byteArray.shift(),
1230
- numReadonlySignedAccounts: byteArray.shift(),
1231
- numReadonlyUnsignedAccounts: byteArray.shift()
1255
+ numRequiredSignatures: guardedShift(byteArray),
1256
+ numReadonlySignedAccounts: guardedShift(byteArray),
1257
+ numReadonlyUnsignedAccounts: guardedShift(byteArray)
1232
1258
  };
1233
1259
  const staticAccountKeys = [];
1234
1260
  const staticAccountKeysLength = decodeLength(byteArray);
1235
1261
 
1236
1262
  for (let i = 0; i < staticAccountKeysLength; i++) {
1237
- staticAccountKeys.push(new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH)));
1263
+ staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));
1238
1264
  }
1239
1265
 
1240
- const recentBlockhash = bs58__default["default"].encode(byteArray.splice(0, PUBLIC_KEY_LENGTH));
1266
+ const recentBlockhash = bs58__default["default"].encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
1241
1267
  const instructionCount = decodeLength(byteArray);
1242
1268
  const compiledInstructions = [];
1243
1269
 
1244
1270
  for (let i = 0; i < instructionCount; i++) {
1245
- const programIdIndex = byteArray.shift();
1271
+ const programIdIndex = guardedShift(byteArray);
1246
1272
  const accountKeyIndexesLength = decodeLength(byteArray);
1247
- const accountKeyIndexes = byteArray.splice(0, accountKeyIndexesLength);
1273
+ const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);
1248
1274
  const dataLength = decodeLength(byteArray);
1249
- const data = new Uint8Array(byteArray.splice(0, dataLength));
1275
+ const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));
1250
1276
  compiledInstructions.push({
1251
1277
  programIdIndex,
1252
1278
  accountKeyIndexes,
@@ -1258,11 +1284,11 @@ class MessageV0 {
1258
1284
  const addressTableLookups = [];
1259
1285
 
1260
1286
  for (let i = 0; i < addressTableLookupsCount; i++) {
1261
- const accountKey = new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH));
1287
+ const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
1262
1288
  const writableIndexesLength = decodeLength(byteArray);
1263
- const writableIndexes = byteArray.splice(0, writableIndexesLength);
1289
+ const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
1264
1290
  const readonlyIndexesLength = decodeLength(byteArray);
1265
- const readonlyIndexes = byteArray.splice(0, readonlyIndexesLength);
1291
+ const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);
1266
1292
  addressTableLookups.push({
1267
1293
  accountKey,
1268
1294
  writableIndexes,
@@ -2004,8 +2030,7 @@ class Transaction {
2004
2030
  let signatures = [];
2005
2031
 
2006
2032
  for (let i = 0; i < signatureCount; i++) {
2007
- const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES);
2008
- byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
2033
+ const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
2009
2034
  signatures.push(bs58__default["default"].encode(buffer.Buffer.from(signature)));
2010
2035
  }
2011
2036
 
@@ -2203,7 +2228,7 @@ class VersionedTransaction {
2203
2228
  const signaturesLength = decodeLength(byteArray);
2204
2229
 
2205
2230
  for (let i = 0; i < signaturesLength; i++) {
2206
- signatures.push(new Uint8Array(byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES)));
2231
+ signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));
2207
2232
  }
2208
2233
 
2209
2234
  const message = VersionedMessage.deserialize(new Uint8Array(byteArray));
@@ -3376,7 +3401,7 @@ var y = d * 365.25;
3376
3401
  * @api public
3377
3402
  */
3378
3403
 
3379
- var ms$2 = function(val, options) {
3404
+ var ms$3 = function (val, options) {
3380
3405
  options = options || {};
3381
3406
  var type = typeof val;
3382
3407
  if (type === 'string' && val.length > 0) {
@@ -3525,11 +3550,11 @@ function plural(ms, msAbs, n, name) {
3525
3550
  */
3526
3551
 
3527
3552
  var util = require$$0__default["default"];
3528
- var ms$1 = ms$2;
3553
+ var ms$2 = ms$3;
3529
3554
 
3530
3555
  var humanizeMs = function (t) {
3531
3556
  if (typeof t === 'number') return t;
3532
- var r = ms$1(t);
3557
+ var r = ms$2(t);
3533
3558
  if (r === undefined) {
3534
3559
  var err = new Error(util.format('humanize-ms(%j) result undefined', t));
3535
3560
  console.warn(err.stack);
@@ -3541,6 +3566,177 @@ var src = {exports: {}};
3541
3566
 
3542
3567
  var browser = {exports: {}};
3543
3568
 
3569
+ /**
3570
+ * Helpers.
3571
+ */
3572
+
3573
+ var ms$1;
3574
+ var hasRequiredMs;
3575
+
3576
+ function requireMs () {
3577
+ if (hasRequiredMs) return ms$1;
3578
+ hasRequiredMs = 1;
3579
+ var s = 1000;
3580
+ var m = s * 60;
3581
+ var h = m * 60;
3582
+ var d = h * 24;
3583
+ var w = d * 7;
3584
+ var y = d * 365.25;
3585
+
3586
+ /**
3587
+ * Parse or format the given `val`.
3588
+ *
3589
+ * Options:
3590
+ *
3591
+ * - `long` verbose formatting [false]
3592
+ *
3593
+ * @param {String|Number} val
3594
+ * @param {Object} [options]
3595
+ * @throws {Error} throw an error if val is not a non-empty string or a number
3596
+ * @return {String|Number}
3597
+ * @api public
3598
+ */
3599
+
3600
+ ms$1 = function(val, options) {
3601
+ options = options || {};
3602
+ var type = typeof val;
3603
+ if (type === 'string' && val.length > 0) {
3604
+ return parse(val);
3605
+ } else if (type === 'number' && isFinite(val)) {
3606
+ return options.long ? fmtLong(val) : fmtShort(val);
3607
+ }
3608
+ throw new Error(
3609
+ 'val is not a non-empty string or a valid number. val=' +
3610
+ JSON.stringify(val)
3611
+ );
3612
+ };
3613
+
3614
+ /**
3615
+ * Parse the given `str` and return milliseconds.
3616
+ *
3617
+ * @param {String} str
3618
+ * @return {Number}
3619
+ * @api private
3620
+ */
3621
+
3622
+ function parse(str) {
3623
+ str = String(str);
3624
+ if (str.length > 100) {
3625
+ return;
3626
+ }
3627
+ 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(
3628
+ str
3629
+ );
3630
+ if (!match) {
3631
+ return;
3632
+ }
3633
+ var n = parseFloat(match[1]);
3634
+ var type = (match[2] || 'ms').toLowerCase();
3635
+ switch (type) {
3636
+ case 'years':
3637
+ case 'year':
3638
+ case 'yrs':
3639
+ case 'yr':
3640
+ case 'y':
3641
+ return n * y;
3642
+ case 'weeks':
3643
+ case 'week':
3644
+ case 'w':
3645
+ return n * w;
3646
+ case 'days':
3647
+ case 'day':
3648
+ case 'd':
3649
+ return n * d;
3650
+ case 'hours':
3651
+ case 'hour':
3652
+ case 'hrs':
3653
+ case 'hr':
3654
+ case 'h':
3655
+ return n * h;
3656
+ case 'minutes':
3657
+ case 'minute':
3658
+ case 'mins':
3659
+ case 'min':
3660
+ case 'm':
3661
+ return n * m;
3662
+ case 'seconds':
3663
+ case 'second':
3664
+ case 'secs':
3665
+ case 'sec':
3666
+ case 's':
3667
+ return n * s;
3668
+ case 'milliseconds':
3669
+ case 'millisecond':
3670
+ case 'msecs':
3671
+ case 'msec':
3672
+ case 'ms':
3673
+ return n;
3674
+ default:
3675
+ return undefined;
3676
+ }
3677
+ }
3678
+
3679
+ /**
3680
+ * Short format for `ms`.
3681
+ *
3682
+ * @param {Number} ms
3683
+ * @return {String}
3684
+ * @api private
3685
+ */
3686
+
3687
+ function fmtShort(ms) {
3688
+ var msAbs = Math.abs(ms);
3689
+ if (msAbs >= d) {
3690
+ return Math.round(ms / d) + 'd';
3691
+ }
3692
+ if (msAbs >= h) {
3693
+ return Math.round(ms / h) + 'h';
3694
+ }
3695
+ if (msAbs >= m) {
3696
+ return Math.round(ms / m) + 'm';
3697
+ }
3698
+ if (msAbs >= s) {
3699
+ return Math.round(ms / s) + 's';
3700
+ }
3701
+ return ms + 'ms';
3702
+ }
3703
+
3704
+ /**
3705
+ * Long format for `ms`.
3706
+ *
3707
+ * @param {Number} ms
3708
+ * @return {String}
3709
+ * @api private
3710
+ */
3711
+
3712
+ function fmtLong(ms) {
3713
+ var msAbs = Math.abs(ms);
3714
+ if (msAbs >= d) {
3715
+ return plural(ms, msAbs, d, 'day');
3716
+ }
3717
+ if (msAbs >= h) {
3718
+ return plural(ms, msAbs, h, 'hour');
3719
+ }
3720
+ if (msAbs >= m) {
3721
+ return plural(ms, msAbs, m, 'minute');
3722
+ }
3723
+ if (msAbs >= s) {
3724
+ return plural(ms, msAbs, s, 'second');
3725
+ }
3726
+ return ms + ' ms';
3727
+ }
3728
+
3729
+ /**
3730
+ * Pluralization helper.
3731
+ */
3732
+
3733
+ function plural(ms, msAbs, n, name) {
3734
+ var isPlural = msAbs >= n * 1.5;
3735
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
3736
+ }
3737
+ return ms$1;
3738
+ }
3739
+
3544
3740
  var common;
3545
3741
  var hasRequiredCommon;
3546
3742
 
@@ -3559,7 +3755,7 @@ function requireCommon () {
3559
3755
  createDebug.disable = disable;
3560
3756
  createDebug.enable = enable;
3561
3757
  createDebug.enabled = enabled;
3562
- createDebug.humanize = ms$2;
3758
+ createDebug.humanize = requireMs();
3563
3759
  createDebug.destroy = destroy;
3564
3760
 
3565
3761
  Object.keys(env).forEach(key => {
@@ -4110,12 +4306,12 @@ var hasRequiredHasFlag;
4110
4306
  function requireHasFlag () {
4111
4307
  if (hasRequiredHasFlag) return hasFlag;
4112
4308
  hasRequiredHasFlag = 1;
4113
- hasFlag = (flag, argv) => {
4114
- argv = argv || process.argv;
4309
+
4310
+ hasFlag = (flag, argv = process.argv) => {
4115
4311
  const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
4116
- const pos = argv.indexOf(prefix + flag);
4117
- const terminatorPos = argv.indexOf('--');
4118
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
4312
+ const position = argv.indexOf(prefix + flag);
4313
+ const terminatorPosition = argv.indexOf('--');
4314
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4119
4315
  };
4120
4316
  return hasFlag;
4121
4317
  }
@@ -4127,23 +4323,32 @@ function requireSupportsColor () {
4127
4323
  if (hasRequiredSupportsColor) return supportsColor_1;
4128
4324
  hasRequiredSupportsColor = 1;
4129
4325
  const os = require$$0__default$1["default"];
4326
+ const tty = require$$1__default["default"];
4130
4327
  const hasFlag = requireHasFlag();
4131
4328
 
4132
- const env = process.env;
4329
+ const {env} = process;
4133
4330
 
4134
4331
  let forceColor;
4135
4332
  if (hasFlag('no-color') ||
4136
4333
  hasFlag('no-colors') ||
4137
- hasFlag('color=false')) {
4138
- forceColor = false;
4334
+ hasFlag('color=false') ||
4335
+ hasFlag('color=never')) {
4336
+ forceColor = 0;
4139
4337
  } else if (hasFlag('color') ||
4140
4338
  hasFlag('colors') ||
4141
4339
  hasFlag('color=true') ||
4142
4340
  hasFlag('color=always')) {
4143
- forceColor = true;
4341
+ forceColor = 1;
4144
4342
  }
4343
+
4145
4344
  if ('FORCE_COLOR' in env) {
4146
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
4345
+ if (env.FORCE_COLOR === 'true') {
4346
+ forceColor = 1;
4347
+ } else if (env.FORCE_COLOR === 'false') {
4348
+ forceColor = 0;
4349
+ } else {
4350
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
4351
+ }
4147
4352
  }
4148
4353
 
4149
4354
  function translateLevel(level) {
@@ -4159,8 +4364,8 @@ function requireSupportsColor () {
4159
4364
  };
4160
4365
  }
4161
4366
 
4162
- function supportsColor(stream) {
4163
- if (forceColor === false) {
4367
+ function supportsColor(haveStream, streamIsTTY) {
4368
+ if (forceColor === 0) {
4164
4369
  return 0;
4165
4370
  }
4166
4371
 
@@ -4174,22 +4379,21 @@ function requireSupportsColor () {
4174
4379
  return 2;
4175
4380
  }
4176
4381
 
4177
- if (stream && !stream.isTTY && forceColor !== true) {
4382
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
4178
4383
  return 0;
4179
4384
  }
4180
4385
 
4181
- const min = forceColor ? 1 : 0;
4386
+ const min = forceColor || 0;
4387
+
4388
+ if (env.TERM === 'dumb') {
4389
+ return min;
4390
+ }
4182
4391
 
4183
4392
  if (process.platform === 'win32') {
4184
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
4185
- // libuv that enables 256 color output on Windows. Anything earlier and it
4186
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
4187
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
4188
- // release that supports 256 colors. Windows 10 build 14931 is the first release
4189
- // that supports 16m/TrueColor.
4393
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
4394
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
4190
4395
  const osRelease = os.release().split('.');
4191
4396
  if (
4192
- Number(process.versions.node.split('.')[0]) >= 8 &&
4193
4397
  Number(osRelease[0]) >= 10 &&
4194
4398
  Number(osRelease[2]) >= 10586
4195
4399
  ) {
@@ -4200,7 +4404,7 @@ function requireSupportsColor () {
4200
4404
  }
4201
4405
 
4202
4406
  if ('CI' in env) {
4203
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
4407
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
4204
4408
  return 1;
4205
4409
  }
4206
4410
 
@@ -4239,22 +4443,18 @@ function requireSupportsColor () {
4239
4443
  return 1;
4240
4444
  }
4241
4445
 
4242
- if (env.TERM === 'dumb') {
4243
- return min;
4244
- }
4245
-
4246
4446
  return min;
4247
4447
  }
4248
4448
 
4249
4449
  function getSupportLevel(stream) {
4250
- const level = supportsColor(stream);
4450
+ const level = supportsColor(stream, stream && stream.isTTY);
4251
4451
  return translateLevel(level);
4252
4452
  }
4253
4453
 
4254
4454
  supportsColor_1 = {
4255
4455
  supportsColor: getSupportLevel,
4256
- stdout: getSupportLevel(process.stdout),
4257
- stderr: getSupportLevel(process.stderr)
4456
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
4457
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
4258
4458
  };
4259
4459
  return supportsColor_1;
4260
4460
  }
@@ -4269,7 +4469,7 @@ function requireNode () {
4269
4469
  if (hasRequiredNode) return node.exports;
4270
4470
  hasRequiredNode = 1;
4271
4471
  (function (module, exports) {
4272
- const tty = require$$0__default$2["default"];
4472
+ const tty = require$$1__default["default"];
4273
4473
  const util = require$$0__default["default"];
4274
4474
 
4275
4475
  /**
@@ -4701,7 +4901,7 @@ function requireEventListenerCount () {
4701
4901
  * @private
4702
4902
  */
4703
4903
 
4704
- var EventEmitter = require$$0__default$3["default"].EventEmitter;
4904
+ var EventEmitter = require$$0__default$2["default"].EventEmitter;
4705
4905
 
4706
4906
  /**
4707
4907
  * Module exports.
@@ -4781,7 +4981,7 @@ function requireEventListenerCount () {
4781
4981
 
4782
4982
  var callSiteToString = compat.exports.callSiteToString;
4783
4983
  var eventListenerCount = compat.exports.eventListenerCount;
4784
- var relative = require$$1__default["default"].relative;
4984
+ var relative = require$$1__default$1["default"].relative;
4785
4985
 
4786
4986
  /**
4787
4987
  * Module exports.
@@ -5304,7 +5504,7 @@ var constants = {
5304
5504
  SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
5305
5505
  };
5306
5506
 
5307
- const OriginalAgent = require$$0__default$4["default"].Agent;
5507
+ const OriginalAgent = require$$0__default$3["default"].Agent;
5308
5508
  const ms = humanizeMs;
5309
5509
  const debug = src.exports('agentkeepalive');
5310
5510
  const deprecate = depd_1('agentkeepalive');
@@ -5701,7 +5901,7 @@ function inspect(obj) {
5701
5901
  return res;
5702
5902
  }
5703
5903
 
5704
- const OriginalHttpsAgent = require$$0__default$5["default"].Agent;
5904
+ const OriginalHttpsAgent = require$$0__default$4["default"].Agent;
5705
5905
  const HttpAgent = agent;
5706
5906
  const {
5707
5907
  INIT_SOCKET,
@@ -6359,9 +6559,9 @@ function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disable
6359
6559
  if (httpAgent !== false) {
6360
6560
  const isHttps = url.startsWith('https:');
6361
6561
 
6362
- if (isHttps && !(httpAgent instanceof require$$0$5.Agent)) {
6562
+ if (isHttps && !(httpAgent instanceof require$$0$4.Agent)) {
6363
6563
  throw new Error('The endpoint `' + url + '` can only be paired with an `https.Agent`. You have, instead, supplied an ' + '`http.Agent` through `httpAgent`.');
6364
- } else if (!isHttps && httpAgent instanceof require$$0$5.Agent) {
6564
+ } else if (!isHttps && httpAgent instanceof require$$0$4.Agent) {
6365
6565
  throw new Error('The endpoint `' + url + '` can only be paired with an `http.Agent`. You have, instead, supplied an ' + '`https.Agent` through `httpAgent`.');
6366
6566
  }
6367
6567
 
@@ -7164,7 +7364,7 @@ const LogsNotificationResult = superstruct.type({
7164
7364
 
7165
7365
  /** @internal */
7166
7366
  const COMMON_HTTP_HEADERS = {
7167
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
7367
+ 'solana-client': `js/${(_process$env$npm_pack = "1.71.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
7168
7368
  };
7169
7369
  /**
7170
7370
  * A connection to a fullnode JSON RPC endpoint
@@ -12582,10 +12782,8 @@ class ValidatorInfo {
12582
12782
  const configKeys = [];
12583
12783
 
12584
12784
  for (let i = 0; i < 2; i++) {
12585
- const publicKey = new PublicKey(byteArray.slice(0, PUBLIC_KEY_LENGTH));
12586
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
12587
- const isSigner = byteArray.slice(0, 1)[0] === 1;
12588
- byteArray = byteArray.slice(1);
12785
+ const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
12786
+ const isSigner = guardedShift(byteArray) === 1;
12589
12787
  configKeys.push({
12590
12788
  publicKey,
12591
12789
  isSigner