@solana/web3.js 1.70.2 → 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.browser.cjs.js +58 -34
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +58 -34
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +281 -82
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +10 -6
- package/lib/index.esm.js +276 -77
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +58 -34
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +58 -34
- package/lib/index.native.js.map +1 -1
- package/package.json +22 -22
- package/src/connection.ts +12 -11
- package/src/message/legacy.ts +9 -12
- package/src/message/v0.ts +29 -12
- package/src/publickey.ts +2 -1
- package/src/transaction/legacy.ts +2 -2
- package/src/transaction/versioned.ts +2 -1
- package/src/utils/guarded-array-utils.ts +34 -0
- package/src/utils/send-and-confirm-raw-transaction.ts +5 -8
- package/src/validator-info.ts +5 -4
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$
|
|
18
|
-
var require$$1 = require('path');
|
|
19
|
-
var require$$0$
|
|
20
|
-
var require$$0$
|
|
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);
|
|
@@ -240,7 +240,8 @@ class PublicKey extends Struct {
|
|
|
240
240
|
|
|
241
241
|
|
|
242
242
|
toBytes() {
|
|
243
|
-
|
|
243
|
+
const buf = this.toBuffer();
|
|
244
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
244
245
|
}
|
|
245
246
|
/**
|
|
246
247
|
* Return the Buffer representation of the public key in big endian
|
|
@@ -802,6 +803,36 @@ class CompiledKeys {
|
|
|
802
803
|
|
|
803
804
|
}
|
|
804
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
|
+
|
|
805
836
|
/**
|
|
806
837
|
* An instruction to execute by a program
|
|
807
838
|
*
|
|
@@ -953,37 +984,33 @@ class Message {
|
|
|
953
984
|
static from(buffer$1) {
|
|
954
985
|
// Slice up wire data
|
|
955
986
|
let byteArray = [...buffer$1];
|
|
956
|
-
const numRequiredSignatures = byteArray
|
|
987
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
957
988
|
|
|
958
989
|
if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {
|
|
959
990
|
throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');
|
|
960
991
|
}
|
|
961
992
|
|
|
962
|
-
const numReadonlySignedAccounts = byteArray
|
|
963
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
993
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
994
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
964
995
|
const accountCount = decodeLength(byteArray);
|
|
965
996
|
let accountKeys = [];
|
|
966
997
|
|
|
967
998
|
for (let i = 0; i < accountCount; i++) {
|
|
968
|
-
const account = byteArray
|
|
969
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
999
|
+
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
970
1000
|
accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
|
|
971
1001
|
}
|
|
972
1002
|
|
|
973
|
-
const recentBlockhash = byteArray
|
|
974
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
1003
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
975
1004
|
const instructionCount = decodeLength(byteArray);
|
|
976
1005
|
let instructions = [];
|
|
977
1006
|
|
|
978
1007
|
for (let i = 0; i < instructionCount; i++) {
|
|
979
|
-
const programIdIndex = byteArray
|
|
1008
|
+
const programIdIndex = guardedShift(byteArray);
|
|
980
1009
|
const accountCount = decodeLength(byteArray);
|
|
981
|
-
const accounts = byteArray
|
|
982
|
-
byteArray = byteArray.slice(accountCount);
|
|
1010
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
983
1011
|
const dataLength = decodeLength(byteArray);
|
|
984
|
-
const dataSlice = byteArray
|
|
1012
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
985
1013
|
const data = bs58__default["default"].encode(buffer.Buffer.from(dataSlice));
|
|
986
|
-
byteArray = byteArray.slice(dataLength);
|
|
987
1014
|
instructions.push({
|
|
988
1015
|
programIdIndex,
|
|
989
1016
|
accounts,
|
|
@@ -1219,33 +1246,33 @@ class MessageV0 {
|
|
|
1219
1246
|
|
|
1220
1247
|
static deserialize(serializedMessage) {
|
|
1221
1248
|
let byteArray = [...serializedMessage];
|
|
1222
|
-
const prefix = byteArray
|
|
1249
|
+
const prefix = guardedShift(byteArray);
|
|
1223
1250
|
const maskedPrefix = prefix & VERSION_PREFIX_MASK;
|
|
1224
1251
|
assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
|
|
1225
1252
|
const version = maskedPrefix;
|
|
1226
1253
|
assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);
|
|
1227
1254
|
const header = {
|
|
1228
|
-
numRequiredSignatures: byteArray
|
|
1229
|
-
numReadonlySignedAccounts: byteArray
|
|
1230
|
-
numReadonlyUnsignedAccounts: byteArray
|
|
1255
|
+
numRequiredSignatures: guardedShift(byteArray),
|
|
1256
|
+
numReadonlySignedAccounts: guardedShift(byteArray),
|
|
1257
|
+
numReadonlyUnsignedAccounts: guardedShift(byteArray)
|
|
1231
1258
|
};
|
|
1232
1259
|
const staticAccountKeys = [];
|
|
1233
1260
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
1234
1261
|
|
|
1235
1262
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
1236
|
-
staticAccountKeys.push(new PublicKey(byteArray
|
|
1263
|
+
staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));
|
|
1237
1264
|
}
|
|
1238
1265
|
|
|
1239
|
-
const recentBlockhash = bs58__default["default"].encode(byteArray
|
|
1266
|
+
const recentBlockhash = bs58__default["default"].encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
1240
1267
|
const instructionCount = decodeLength(byteArray);
|
|
1241
1268
|
const compiledInstructions = [];
|
|
1242
1269
|
|
|
1243
1270
|
for (let i = 0; i < instructionCount; i++) {
|
|
1244
|
-
const programIdIndex = byteArray
|
|
1271
|
+
const programIdIndex = guardedShift(byteArray);
|
|
1245
1272
|
const accountKeyIndexesLength = decodeLength(byteArray);
|
|
1246
|
-
const accountKeyIndexes = byteArray
|
|
1273
|
+
const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);
|
|
1247
1274
|
const dataLength = decodeLength(byteArray);
|
|
1248
|
-
const data = new Uint8Array(byteArray
|
|
1275
|
+
const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));
|
|
1249
1276
|
compiledInstructions.push({
|
|
1250
1277
|
programIdIndex,
|
|
1251
1278
|
accountKeyIndexes,
|
|
@@ -1257,11 +1284,11 @@ class MessageV0 {
|
|
|
1257
1284
|
const addressTableLookups = [];
|
|
1258
1285
|
|
|
1259
1286
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
1260
|
-
const accountKey = new PublicKey(byteArray
|
|
1287
|
+
const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
1261
1288
|
const writableIndexesLength = decodeLength(byteArray);
|
|
1262
|
-
const writableIndexes = byteArray
|
|
1289
|
+
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
1263
1290
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
1264
|
-
const readonlyIndexes = byteArray
|
|
1291
|
+
const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);
|
|
1265
1292
|
addressTableLookups.push({
|
|
1266
1293
|
accountKey,
|
|
1267
1294
|
writableIndexes,
|
|
@@ -2001,8 +2028,7 @@ class Transaction {
|
|
|
2001
2028
|
let signatures = [];
|
|
2002
2029
|
|
|
2003
2030
|
for (let i = 0; i < signatureCount; i++) {
|
|
2004
|
-
const signature = byteArray
|
|
2005
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
2031
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
2006
2032
|
signatures.push(bs58__default["default"].encode(buffer.Buffer.from(signature)));
|
|
2007
2033
|
}
|
|
2008
2034
|
|
|
@@ -2200,7 +2226,7 @@ class VersionedTransaction {
|
|
|
2200
2226
|
const signaturesLength = decodeLength(byteArray);
|
|
2201
2227
|
|
|
2202
2228
|
for (let i = 0; i < signaturesLength; i++) {
|
|
2203
|
-
signatures.push(new Uint8Array(byteArray
|
|
2229
|
+
signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));
|
|
2204
2230
|
}
|
|
2205
2231
|
|
|
2206
2232
|
const message = VersionedMessage.deserialize(new Uint8Array(byteArray));
|
|
@@ -3373,7 +3399,7 @@ var y = d * 365.25;
|
|
|
3373
3399
|
* @api public
|
|
3374
3400
|
*/
|
|
3375
3401
|
|
|
3376
|
-
var ms$
|
|
3402
|
+
var ms$3 = function (val, options) {
|
|
3377
3403
|
options = options || {};
|
|
3378
3404
|
var type = typeof val;
|
|
3379
3405
|
if (type === 'string' && val.length > 0) {
|
|
@@ -3522,11 +3548,11 @@ function plural(ms, msAbs, n, name) {
|
|
|
3522
3548
|
*/
|
|
3523
3549
|
|
|
3524
3550
|
var util = require$$0__default["default"];
|
|
3525
|
-
var ms$
|
|
3551
|
+
var ms$2 = ms$3;
|
|
3526
3552
|
|
|
3527
3553
|
var humanizeMs = function (t) {
|
|
3528
3554
|
if (typeof t === 'number') return t;
|
|
3529
|
-
var r = ms$
|
|
3555
|
+
var r = ms$2(t);
|
|
3530
3556
|
if (r === undefined) {
|
|
3531
3557
|
var err = new Error(util.format('humanize-ms(%j) result undefined', t));
|
|
3532
3558
|
console.warn(err.stack);
|
|
@@ -3538,6 +3564,177 @@ var src = {exports: {}};
|
|
|
3538
3564
|
|
|
3539
3565
|
var browser = {exports: {}};
|
|
3540
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
|
+
|
|
3541
3738
|
var common;
|
|
3542
3739
|
var hasRequiredCommon;
|
|
3543
3740
|
|
|
@@ -3556,7 +3753,7 @@ function requireCommon () {
|
|
|
3556
3753
|
createDebug.disable = disable;
|
|
3557
3754
|
createDebug.enable = enable;
|
|
3558
3755
|
createDebug.enabled = enabled;
|
|
3559
|
-
createDebug.humanize =
|
|
3756
|
+
createDebug.humanize = requireMs();
|
|
3560
3757
|
createDebug.destroy = destroy;
|
|
3561
3758
|
|
|
3562
3759
|
Object.keys(env).forEach(key => {
|
|
@@ -4107,12 +4304,12 @@ var hasRequiredHasFlag;
|
|
|
4107
4304
|
function requireHasFlag () {
|
|
4108
4305
|
if (hasRequiredHasFlag) return hasFlag;
|
|
4109
4306
|
hasRequiredHasFlag = 1;
|
|
4110
|
-
|
|
4111
|
-
|
|
4307
|
+
|
|
4308
|
+
hasFlag = (flag, argv = process.argv) => {
|
|
4112
4309
|
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
4113
|
-
const
|
|
4114
|
-
const
|
|
4115
|
-
return
|
|
4310
|
+
const position = argv.indexOf(prefix + flag);
|
|
4311
|
+
const terminatorPosition = argv.indexOf('--');
|
|
4312
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
4116
4313
|
};
|
|
4117
4314
|
return hasFlag;
|
|
4118
4315
|
}
|
|
@@ -4124,23 +4321,32 @@ function requireSupportsColor () {
|
|
|
4124
4321
|
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
4125
4322
|
hasRequiredSupportsColor = 1;
|
|
4126
4323
|
const os = require$$0__default$1["default"];
|
|
4324
|
+
const tty = require$$1__default["default"];
|
|
4127
4325
|
const hasFlag = requireHasFlag();
|
|
4128
4326
|
|
|
4129
|
-
const env = process
|
|
4327
|
+
const {env} = process;
|
|
4130
4328
|
|
|
4131
4329
|
let forceColor;
|
|
4132
4330
|
if (hasFlag('no-color') ||
|
|
4133
4331
|
hasFlag('no-colors') ||
|
|
4134
|
-
hasFlag('color=false')
|
|
4135
|
-
|
|
4332
|
+
hasFlag('color=false') ||
|
|
4333
|
+
hasFlag('color=never')) {
|
|
4334
|
+
forceColor = 0;
|
|
4136
4335
|
} else if (hasFlag('color') ||
|
|
4137
4336
|
hasFlag('colors') ||
|
|
4138
4337
|
hasFlag('color=true') ||
|
|
4139
4338
|
hasFlag('color=always')) {
|
|
4140
|
-
forceColor =
|
|
4339
|
+
forceColor = 1;
|
|
4141
4340
|
}
|
|
4341
|
+
|
|
4142
4342
|
if ('FORCE_COLOR' in env) {
|
|
4143
|
-
|
|
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
|
+
}
|
|
4144
4350
|
}
|
|
4145
4351
|
|
|
4146
4352
|
function translateLevel(level) {
|
|
@@ -4156,8 +4362,8 @@ function requireSupportsColor () {
|
|
|
4156
4362
|
};
|
|
4157
4363
|
}
|
|
4158
4364
|
|
|
4159
|
-
function supportsColor(
|
|
4160
|
-
if (forceColor ===
|
|
4365
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
4366
|
+
if (forceColor === 0) {
|
|
4161
4367
|
return 0;
|
|
4162
4368
|
}
|
|
4163
4369
|
|
|
@@ -4171,22 +4377,21 @@ function requireSupportsColor () {
|
|
|
4171
4377
|
return 2;
|
|
4172
4378
|
}
|
|
4173
4379
|
|
|
4174
|
-
if (
|
|
4380
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
4175
4381
|
return 0;
|
|
4176
4382
|
}
|
|
4177
4383
|
|
|
4178
|
-
const min = forceColor
|
|
4384
|
+
const min = forceColor || 0;
|
|
4385
|
+
|
|
4386
|
+
if (env.TERM === 'dumb') {
|
|
4387
|
+
return min;
|
|
4388
|
+
}
|
|
4179
4389
|
|
|
4180
4390
|
if (process.platform === 'win32') {
|
|
4181
|
-
//
|
|
4182
|
-
//
|
|
4183
|
-
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
|
4184
|
-
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
|
|
4185
|
-
// release that supports 256 colors. Windows 10 build 14931 is the first release
|
|
4186
|
-
// 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.
|
|
4187
4393
|
const osRelease = os.release().split('.');
|
|
4188
4394
|
if (
|
|
4189
|
-
Number(process.versions.node.split('.')[0]) >= 8 &&
|
|
4190
4395
|
Number(osRelease[0]) >= 10 &&
|
|
4191
4396
|
Number(osRelease[2]) >= 10586
|
|
4192
4397
|
) {
|
|
@@ -4197,7 +4402,7 @@ function requireSupportsColor () {
|
|
|
4197
4402
|
}
|
|
4198
4403
|
|
|
4199
4404
|
if ('CI' in env) {
|
|
4200
|
-
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') {
|
|
4201
4406
|
return 1;
|
|
4202
4407
|
}
|
|
4203
4408
|
|
|
@@ -4236,22 +4441,18 @@ function requireSupportsColor () {
|
|
|
4236
4441
|
return 1;
|
|
4237
4442
|
}
|
|
4238
4443
|
|
|
4239
|
-
if (env.TERM === 'dumb') {
|
|
4240
|
-
return min;
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
4444
|
return min;
|
|
4244
4445
|
}
|
|
4245
4446
|
|
|
4246
4447
|
function getSupportLevel(stream) {
|
|
4247
|
-
const level = supportsColor(stream);
|
|
4448
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
4248
4449
|
return translateLevel(level);
|
|
4249
4450
|
}
|
|
4250
4451
|
|
|
4251
4452
|
supportsColor_1 = {
|
|
4252
4453
|
supportsColor: getSupportLevel,
|
|
4253
|
-
stdout:
|
|
4254
|
-
stderr:
|
|
4454
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
4455
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
4255
4456
|
};
|
|
4256
4457
|
return supportsColor_1;
|
|
4257
4458
|
}
|
|
@@ -4266,7 +4467,7 @@ function requireNode () {
|
|
|
4266
4467
|
if (hasRequiredNode) return node.exports;
|
|
4267
4468
|
hasRequiredNode = 1;
|
|
4268
4469
|
(function (module, exports) {
|
|
4269
|
-
const tty = require$$
|
|
4470
|
+
const tty = require$$1__default["default"];
|
|
4270
4471
|
const util = require$$0__default["default"];
|
|
4271
4472
|
|
|
4272
4473
|
/**
|
|
@@ -4698,7 +4899,7 @@ function requireEventListenerCount () {
|
|
|
4698
4899
|
* @private
|
|
4699
4900
|
*/
|
|
4700
4901
|
|
|
4701
|
-
var EventEmitter = require$$0__default$
|
|
4902
|
+
var EventEmitter = require$$0__default$2["default"].EventEmitter;
|
|
4702
4903
|
|
|
4703
4904
|
/**
|
|
4704
4905
|
* Module exports.
|
|
@@ -4778,7 +4979,7 @@ function requireEventListenerCount () {
|
|
|
4778
4979
|
|
|
4779
4980
|
var callSiteToString = compat.exports.callSiteToString;
|
|
4780
4981
|
var eventListenerCount = compat.exports.eventListenerCount;
|
|
4781
|
-
var relative = require$$1__default["default"].relative;
|
|
4982
|
+
var relative = require$$1__default$1["default"].relative;
|
|
4782
4983
|
|
|
4783
4984
|
/**
|
|
4784
4985
|
* Module exports.
|
|
@@ -5301,7 +5502,7 @@ var constants = {
|
|
|
5301
5502
|
SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
|
|
5302
5503
|
};
|
|
5303
5504
|
|
|
5304
|
-
const OriginalAgent = require$$0__default$
|
|
5505
|
+
const OriginalAgent = require$$0__default$3["default"].Agent;
|
|
5305
5506
|
const ms = humanizeMs;
|
|
5306
5507
|
const debug = src.exports('agentkeepalive');
|
|
5307
5508
|
const deprecate = depd_1('agentkeepalive');
|
|
@@ -5698,7 +5899,7 @@ function inspect(obj) {
|
|
|
5698
5899
|
return res;
|
|
5699
5900
|
}
|
|
5700
5901
|
|
|
5701
|
-
const OriginalHttpsAgent = require$$0__default$
|
|
5902
|
+
const OriginalHttpsAgent = require$$0__default$4["default"].Agent;
|
|
5702
5903
|
const HttpAgent = agent;
|
|
5703
5904
|
const {
|
|
5704
5905
|
INIT_SOCKET,
|
|
@@ -6356,9 +6557,9 @@ function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disable
|
|
|
6356
6557
|
if (httpAgent !== false) {
|
|
6357
6558
|
const isHttps = url.startsWith('https:');
|
|
6358
6559
|
|
|
6359
|
-
if (isHttps && !(httpAgent instanceof require$$0$
|
|
6560
|
+
if (isHttps && !(httpAgent instanceof require$$0$4.Agent)) {
|
|
6360
6561
|
throw new Error('The endpoint `' + url + '` can only be paired with an `https.Agent`. You have, instead, supplied an ' + '`http.Agent` through `httpAgent`.');
|
|
6361
|
-
} else if (!isHttps && httpAgent instanceof require$$0$
|
|
6562
|
+
} else if (!isHttps && httpAgent instanceof require$$0$4.Agent) {
|
|
6362
6563
|
throw new Error('The endpoint `' + url + '` can only be paired with an `http.Agent`. You have, instead, supplied an ' + '`https.Agent` through `httpAgent`.');
|
|
6363
6564
|
}
|
|
6364
6565
|
|
|
@@ -7161,7 +7362,7 @@ const LogsNotificationResult = superstruct.type({
|
|
|
7161
7362
|
|
|
7162
7363
|
/** @internal */
|
|
7163
7364
|
const COMMON_HTTP_HEADERS = {
|
|
7164
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
7365
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.70.4") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
7165
7366
|
};
|
|
7166
7367
|
/**
|
|
7167
7368
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -12579,10 +12780,8 @@ class ValidatorInfo {
|
|
|
12579
12780
|
const configKeys = [];
|
|
12580
12781
|
|
|
12581
12782
|
for (let i = 0; i < 2; i++) {
|
|
12582
|
-
const publicKey = new PublicKey(byteArray
|
|
12583
|
-
|
|
12584
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
12585
|
-
byteArray = byteArray.slice(1);
|
|
12783
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
12784
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
12586
12785
|
configKeys.push({
|
|
12587
12786
|
publicKey,
|
|
12588
12787
|
isSigner
|
|
@@ -12747,7 +12946,7 @@ function clusterApiUrl(cluster, tls) {
|
|
|
12747
12946
|
*
|
|
12748
12947
|
* @param {Connection} connection
|
|
12749
12948
|
* @param {Buffer} rawTransaction
|
|
12750
|
-
* @param {
|
|
12949
|
+
* @param {TransactionConfirmationStrategy} confirmationStrategy
|
|
12751
12950
|
* @param {ConfirmOptions} [options]
|
|
12752
12951
|
* @returns {Promise<TransactionSignature>}
|
|
12753
12952
|
*/
|