@solana/web3.js 1.70.3 → 1.70.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.
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,
@@ -2002,8 +2028,7 @@ class Transaction {
2002
2028
  let signatures = [];
2003
2029
 
2004
2030
  for (let i = 0; i < signatureCount; i++) {
2005
- const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES);
2006
- byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
2031
+ const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
2007
2032
  signatures.push(bs58__default["default"].encode(buffer.Buffer.from(signature)));
2008
2033
  }
2009
2034
 
@@ -2201,7 +2226,7 @@ class VersionedTransaction {
2201
2226
  const signaturesLength = decodeLength(byteArray);
2202
2227
 
2203
2228
  for (let i = 0; i < signaturesLength; i++) {
2204
- signatures.push(new Uint8Array(byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES)));
2229
+ signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));
2205
2230
  }
2206
2231
 
2207
2232
  const message = VersionedMessage.deserialize(new Uint8Array(byteArray));
@@ -3374,7 +3399,7 @@ var y = d * 365.25;
3374
3399
  * @api public
3375
3400
  */
3376
3401
 
3377
- var ms$2 = function(val, options) {
3402
+ var ms$3 = function (val, options) {
3378
3403
  options = options || {};
3379
3404
  var type = typeof val;
3380
3405
  if (type === 'string' && val.length > 0) {
@@ -3523,11 +3548,11 @@ function plural(ms, msAbs, n, name) {
3523
3548
  */
3524
3549
 
3525
3550
  var util = require$$0__default["default"];
3526
- var ms$1 = ms$2;
3551
+ var ms$2 = ms$3;
3527
3552
 
3528
3553
  var humanizeMs = function (t) {
3529
3554
  if (typeof t === 'number') return t;
3530
- var r = ms$1(t);
3555
+ var r = ms$2(t);
3531
3556
  if (r === undefined) {
3532
3557
  var err = new Error(util.format('humanize-ms(%j) result undefined', t));
3533
3558
  console.warn(err.stack);
@@ -3539,6 +3564,177 @@ var src = {exports: {}};
3539
3564
 
3540
3565
  var browser = {exports: {}};
3541
3566
 
3567
+ /**
3568
+ * Helpers.
3569
+ */
3570
+
3571
+ var ms$1;
3572
+ var hasRequiredMs;
3573
+
3574
+ function requireMs () {
3575
+ if (hasRequiredMs) return ms$1;
3576
+ hasRequiredMs = 1;
3577
+ var s = 1000;
3578
+ var m = s * 60;
3579
+ var h = m * 60;
3580
+ var d = h * 24;
3581
+ var w = d * 7;
3582
+ var y = d * 365.25;
3583
+
3584
+ /**
3585
+ * Parse or format the given `val`.
3586
+ *
3587
+ * Options:
3588
+ *
3589
+ * - `long` verbose formatting [false]
3590
+ *
3591
+ * @param {String|Number} val
3592
+ * @param {Object} [options]
3593
+ * @throws {Error} throw an error if val is not a non-empty string or a number
3594
+ * @return {String|Number}
3595
+ * @api public
3596
+ */
3597
+
3598
+ ms$1 = function(val, options) {
3599
+ options = options || {};
3600
+ var type = typeof val;
3601
+ if (type === 'string' && val.length > 0) {
3602
+ return parse(val);
3603
+ } else if (type === 'number' && isFinite(val)) {
3604
+ return options.long ? fmtLong(val) : fmtShort(val);
3605
+ }
3606
+ throw new Error(
3607
+ 'val is not a non-empty string or a valid number. val=' +
3608
+ JSON.stringify(val)
3609
+ );
3610
+ };
3611
+
3612
+ /**
3613
+ * Parse the given `str` and return milliseconds.
3614
+ *
3615
+ * @param {String} str
3616
+ * @return {Number}
3617
+ * @api private
3618
+ */
3619
+
3620
+ function parse(str) {
3621
+ str = String(str);
3622
+ if (str.length > 100) {
3623
+ return;
3624
+ }
3625
+ 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(
3626
+ str
3627
+ );
3628
+ if (!match) {
3629
+ return;
3630
+ }
3631
+ var n = parseFloat(match[1]);
3632
+ var type = (match[2] || 'ms').toLowerCase();
3633
+ switch (type) {
3634
+ case 'years':
3635
+ case 'year':
3636
+ case 'yrs':
3637
+ case 'yr':
3638
+ case 'y':
3639
+ return n * y;
3640
+ case 'weeks':
3641
+ case 'week':
3642
+ case 'w':
3643
+ return n * w;
3644
+ case 'days':
3645
+ case 'day':
3646
+ case 'd':
3647
+ return n * d;
3648
+ case 'hours':
3649
+ case 'hour':
3650
+ case 'hrs':
3651
+ case 'hr':
3652
+ case 'h':
3653
+ return n * h;
3654
+ case 'minutes':
3655
+ case 'minute':
3656
+ case 'mins':
3657
+ case 'min':
3658
+ case 'm':
3659
+ return n * m;
3660
+ case 'seconds':
3661
+ case 'second':
3662
+ case 'secs':
3663
+ case 'sec':
3664
+ case 's':
3665
+ return n * s;
3666
+ case 'milliseconds':
3667
+ case 'millisecond':
3668
+ case 'msecs':
3669
+ case 'msec':
3670
+ case 'ms':
3671
+ return n;
3672
+ default:
3673
+ return undefined;
3674
+ }
3675
+ }
3676
+
3677
+ /**
3678
+ * Short format for `ms`.
3679
+ *
3680
+ * @param {Number} ms
3681
+ * @return {String}
3682
+ * @api private
3683
+ */
3684
+
3685
+ function fmtShort(ms) {
3686
+ var msAbs = Math.abs(ms);
3687
+ if (msAbs >= d) {
3688
+ return Math.round(ms / d) + 'd';
3689
+ }
3690
+ if (msAbs >= h) {
3691
+ return Math.round(ms / h) + 'h';
3692
+ }
3693
+ if (msAbs >= m) {
3694
+ return Math.round(ms / m) + 'm';
3695
+ }
3696
+ if (msAbs >= s) {
3697
+ return Math.round(ms / s) + 's';
3698
+ }
3699
+ return ms + 'ms';
3700
+ }
3701
+
3702
+ /**
3703
+ * Long format for `ms`.
3704
+ *
3705
+ * @param {Number} ms
3706
+ * @return {String}
3707
+ * @api private
3708
+ */
3709
+
3710
+ function fmtLong(ms) {
3711
+ var msAbs = Math.abs(ms);
3712
+ if (msAbs >= d) {
3713
+ return plural(ms, msAbs, d, 'day');
3714
+ }
3715
+ if (msAbs >= h) {
3716
+ return plural(ms, msAbs, h, 'hour');
3717
+ }
3718
+ if (msAbs >= m) {
3719
+ return plural(ms, msAbs, m, 'minute');
3720
+ }
3721
+ if (msAbs >= s) {
3722
+ return plural(ms, msAbs, s, 'second');
3723
+ }
3724
+ return ms + ' ms';
3725
+ }
3726
+
3727
+ /**
3728
+ * Pluralization helper.
3729
+ */
3730
+
3731
+ function plural(ms, msAbs, n, name) {
3732
+ var isPlural = msAbs >= n * 1.5;
3733
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
3734
+ }
3735
+ return ms$1;
3736
+ }
3737
+
3542
3738
  var common;
3543
3739
  var hasRequiredCommon;
3544
3740
 
@@ -3557,7 +3753,7 @@ function requireCommon () {
3557
3753
  createDebug.disable = disable;
3558
3754
  createDebug.enable = enable;
3559
3755
  createDebug.enabled = enabled;
3560
- createDebug.humanize = ms$2;
3756
+ createDebug.humanize = requireMs();
3561
3757
  createDebug.destroy = destroy;
3562
3758
 
3563
3759
  Object.keys(env).forEach(key => {
@@ -4108,12 +4304,12 @@ var hasRequiredHasFlag;
4108
4304
  function requireHasFlag () {
4109
4305
  if (hasRequiredHasFlag) return hasFlag;
4110
4306
  hasRequiredHasFlag = 1;
4111
- hasFlag = (flag, argv) => {
4112
- argv = argv || process.argv;
4307
+
4308
+ hasFlag = (flag, argv = process.argv) => {
4113
4309
  const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
4114
- const pos = argv.indexOf(prefix + flag);
4115
- const terminatorPos = argv.indexOf('--');
4116
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
4310
+ const position = argv.indexOf(prefix + flag);
4311
+ const terminatorPosition = argv.indexOf('--');
4312
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4117
4313
  };
4118
4314
  return hasFlag;
4119
4315
  }
@@ -4125,23 +4321,32 @@ function requireSupportsColor () {
4125
4321
  if (hasRequiredSupportsColor) return supportsColor_1;
4126
4322
  hasRequiredSupportsColor = 1;
4127
4323
  const os = require$$0__default$1["default"];
4324
+ const tty = require$$1__default["default"];
4128
4325
  const hasFlag = requireHasFlag();
4129
4326
 
4130
- const env = process.env;
4327
+ const {env} = process;
4131
4328
 
4132
4329
  let forceColor;
4133
4330
  if (hasFlag('no-color') ||
4134
4331
  hasFlag('no-colors') ||
4135
- hasFlag('color=false')) {
4136
- forceColor = false;
4332
+ hasFlag('color=false') ||
4333
+ hasFlag('color=never')) {
4334
+ forceColor = 0;
4137
4335
  } else if (hasFlag('color') ||
4138
4336
  hasFlag('colors') ||
4139
4337
  hasFlag('color=true') ||
4140
4338
  hasFlag('color=always')) {
4141
- forceColor = true;
4339
+ forceColor = 1;
4142
4340
  }
4341
+
4143
4342
  if ('FORCE_COLOR' in env) {
4144
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
4343
+ if (env.FORCE_COLOR === 'true') {
4344
+ forceColor = 1;
4345
+ } else if (env.FORCE_COLOR === 'false') {
4346
+ forceColor = 0;
4347
+ } else {
4348
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
4349
+ }
4145
4350
  }
4146
4351
 
4147
4352
  function translateLevel(level) {
@@ -4157,8 +4362,8 @@ function requireSupportsColor () {
4157
4362
  };
4158
4363
  }
4159
4364
 
4160
- function supportsColor(stream) {
4161
- if (forceColor === false) {
4365
+ function supportsColor(haveStream, streamIsTTY) {
4366
+ if (forceColor === 0) {
4162
4367
  return 0;
4163
4368
  }
4164
4369
 
@@ -4172,22 +4377,21 @@ function requireSupportsColor () {
4172
4377
  return 2;
4173
4378
  }
4174
4379
 
4175
- if (stream && !stream.isTTY && forceColor !== true) {
4380
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
4176
4381
  return 0;
4177
4382
  }
4178
4383
 
4179
- const min = forceColor ? 1 : 0;
4384
+ const min = forceColor || 0;
4385
+
4386
+ if (env.TERM === 'dumb') {
4387
+ return min;
4388
+ }
4180
4389
 
4181
4390
  if (process.platform === 'win32') {
4182
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
4183
- // libuv that enables 256 color output on Windows. Anything earlier and it
4184
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
4185
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
4186
- // release that supports 256 colors. Windows 10 build 14931 is the first release
4187
- // that supports 16m/TrueColor.
4391
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
4392
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
4188
4393
  const osRelease = os.release().split('.');
4189
4394
  if (
4190
- Number(process.versions.node.split('.')[0]) >= 8 &&
4191
4395
  Number(osRelease[0]) >= 10 &&
4192
4396
  Number(osRelease[2]) >= 10586
4193
4397
  ) {
@@ -4198,7 +4402,7 @@ function requireSupportsColor () {
4198
4402
  }
4199
4403
 
4200
4404
  if ('CI' in env) {
4201
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
4405
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
4202
4406
  return 1;
4203
4407
  }
4204
4408
 
@@ -4237,22 +4441,18 @@ function requireSupportsColor () {
4237
4441
  return 1;
4238
4442
  }
4239
4443
 
4240
- if (env.TERM === 'dumb') {
4241
- return min;
4242
- }
4243
-
4244
4444
  return min;
4245
4445
  }
4246
4446
 
4247
4447
  function getSupportLevel(stream) {
4248
- const level = supportsColor(stream);
4448
+ const level = supportsColor(stream, stream && stream.isTTY);
4249
4449
  return translateLevel(level);
4250
4450
  }
4251
4451
 
4252
4452
  supportsColor_1 = {
4253
4453
  supportsColor: getSupportLevel,
4254
- stdout: getSupportLevel(process.stdout),
4255
- stderr: getSupportLevel(process.stderr)
4454
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
4455
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
4256
4456
  };
4257
4457
  return supportsColor_1;
4258
4458
  }
@@ -4267,7 +4467,7 @@ function requireNode () {
4267
4467
  if (hasRequiredNode) return node.exports;
4268
4468
  hasRequiredNode = 1;
4269
4469
  (function (module, exports) {
4270
- const tty = require$$0__default$2["default"];
4470
+ const tty = require$$1__default["default"];
4271
4471
  const util = require$$0__default["default"];
4272
4472
 
4273
4473
  /**
@@ -4699,7 +4899,7 @@ function requireEventListenerCount () {
4699
4899
  * @private
4700
4900
  */
4701
4901
 
4702
- var EventEmitter = require$$0__default$3["default"].EventEmitter;
4902
+ var EventEmitter = require$$0__default$2["default"].EventEmitter;
4703
4903
 
4704
4904
  /**
4705
4905
  * Module exports.
@@ -4779,7 +4979,7 @@ function requireEventListenerCount () {
4779
4979
 
4780
4980
  var callSiteToString = compat.exports.callSiteToString;
4781
4981
  var eventListenerCount = compat.exports.eventListenerCount;
4782
- var relative = require$$1__default["default"].relative;
4982
+ var relative = require$$1__default$1["default"].relative;
4783
4983
 
4784
4984
  /**
4785
4985
  * Module exports.
@@ -5302,7 +5502,7 @@ var constants = {
5302
5502
  SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
5303
5503
  };
5304
5504
 
5305
- const OriginalAgent = require$$0__default$4["default"].Agent;
5505
+ const OriginalAgent = require$$0__default$3["default"].Agent;
5306
5506
  const ms = humanizeMs;
5307
5507
  const debug = src.exports('agentkeepalive');
5308
5508
  const deprecate = depd_1('agentkeepalive');
@@ -5699,7 +5899,7 @@ function inspect(obj) {
5699
5899
  return res;
5700
5900
  }
5701
5901
 
5702
- const OriginalHttpsAgent = require$$0__default$5["default"].Agent;
5902
+ const OriginalHttpsAgent = require$$0__default$4["default"].Agent;
5703
5903
  const HttpAgent = agent;
5704
5904
  const {
5705
5905
  INIT_SOCKET,
@@ -6357,9 +6557,9 @@ function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disable
6357
6557
  if (httpAgent !== false) {
6358
6558
  const isHttps = url.startsWith('https:');
6359
6559
 
6360
- if (isHttps && !(httpAgent instanceof require$$0$5.Agent)) {
6560
+ if (isHttps && !(httpAgent instanceof require$$0$4.Agent)) {
6361
6561
  throw new Error('The endpoint `' + url + '` can only be paired with an `https.Agent`. You have, instead, supplied an ' + '`http.Agent` through `httpAgent`.');
6362
- } else if (!isHttps && httpAgent instanceof require$$0$5.Agent) {
6562
+ } else if (!isHttps && httpAgent instanceof require$$0$4.Agent) {
6363
6563
  throw new Error('The endpoint `' + url + '` can only be paired with an `http.Agent`. You have, instead, supplied an ' + '`https.Agent` through `httpAgent`.');
6364
6564
  }
6365
6565
 
@@ -7162,7 +7362,7 @@ const LogsNotificationResult = superstruct.type({
7162
7362
 
7163
7363
  /** @internal */
7164
7364
  const COMMON_HTTP_HEADERS = {
7165
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
7365
+ 'solana-client': `js/${(_process$env$npm_pack = "1.70.4") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
7166
7366
  };
7167
7367
  /**
7168
7368
  * A connection to a fullnode JSON RPC endpoint
@@ -12580,10 +12780,8 @@ class ValidatorInfo {
12580
12780
  const configKeys = [];
12581
12781
 
12582
12782
  for (let i = 0; i < 2; i++) {
12583
- const publicKey = new PublicKey(byteArray.slice(0, PUBLIC_KEY_LENGTH));
12584
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
12585
- const isSigner = byteArray.slice(0, 1)[0] === 1;
12586
- byteArray = byteArray.slice(1);
12783
+ const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
12784
+ const isSigner = guardedShift(byteArray) === 1;
12587
12785
  configKeys.push({
12588
12786
  publicKey,
12589
12787
  isSigner