@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.d.ts
CHANGED
|
@@ -2051,6 +2051,12 @@ declare module '@solana/web3.js' {
|
|
|
2051
2051
|
abortSignal?: AbortSignal;
|
|
2052
2052
|
signature: TransactionSignature;
|
|
2053
2053
|
}>;
|
|
2054
|
+
/**
|
|
2055
|
+
* This type represents all transaction confirmation strategies
|
|
2056
|
+
*/
|
|
2057
|
+
type TransactionConfirmationStrategy =
|
|
2058
|
+
| BlockheightBasedTransactionConfirmationStrategy
|
|
2059
|
+
| DurableNonceTransactionConfirmationStrategy;
|
|
2054
2060
|
/**
|
|
2055
2061
|
* The level of commitment desired when querying state
|
|
2056
2062
|
* <pre>
|
|
@@ -3496,12 +3502,10 @@ declare module '@solana/web3.js' {
|
|
|
3496
3502
|
}>
|
|
3497
3503
|
>;
|
|
3498
3504
|
confirmTransaction(
|
|
3499
|
-
strategy:
|
|
3500
|
-
| BlockheightBasedTransactionConfirmationStrategy
|
|
3501
|
-
| DurableNonceTransactionConfirmationStrategy,
|
|
3505
|
+
strategy: TransactionConfirmationStrategy,
|
|
3502
3506
|
commitment?: Commitment,
|
|
3503
3507
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
3504
|
-
/** @deprecated Instead, call `confirmTransaction`
|
|
3508
|
+
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
3505
3509
|
confirmTransaction(
|
|
3506
3510
|
strategy: TransactionSignature,
|
|
3507
3511
|
commitment?: Commitment,
|
|
@@ -4360,14 +4364,14 @@ declare module '@solana/web3.js' {
|
|
|
4360
4364
|
*
|
|
4361
4365
|
* @param {Connection} connection
|
|
4362
4366
|
* @param {Buffer} rawTransaction
|
|
4363
|
-
* @param {
|
|
4367
|
+
* @param {TransactionConfirmationStrategy} confirmationStrategy
|
|
4364
4368
|
* @param {ConfirmOptions} [options]
|
|
4365
4369
|
* @returns {Promise<TransactionSignature>}
|
|
4366
4370
|
*/
|
|
4367
4371
|
export function sendAndConfirmRawTransaction(
|
|
4368
4372
|
connection: Connection,
|
|
4369
4373
|
rawTransaction: Buffer,
|
|
4370
|
-
confirmationStrategy:
|
|
4374
|
+
confirmationStrategy: TransactionConfirmationStrategy,
|
|
4371
4375
|
options?: ConfirmOptions,
|
|
4372
4376
|
): Promise<TransactionSignature>;
|
|
4373
4377
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -8,13 +8,13 @@ import { serialize, deserialize, deserializeUnchecked } from 'borsh';
|
|
|
8
8
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
9
9
|
import { blob } from '@solana/buffer-layout';
|
|
10
10
|
import { toBigIntLE, toBufferLE } from 'bigint-buffer';
|
|
11
|
+
import require$$1 from 'tty';
|
|
11
12
|
import require$$0$1 from 'os';
|
|
12
|
-
import require$$0$2 from 'tty';
|
|
13
13
|
import require$$0 from 'util';
|
|
14
|
-
import require$$0$
|
|
15
|
-
import require$$1 from 'path';
|
|
16
|
-
import require$$0$
|
|
17
|
-
import require$$0$
|
|
14
|
+
import require$$0$2 from 'events';
|
|
15
|
+
import require$$1$1 from 'path';
|
|
16
|
+
import require$$0$3 from 'http';
|
|
17
|
+
import require$$0$4, { Agent as Agent$1 } from 'https';
|
|
18
18
|
import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$1 } from 'superstruct';
|
|
19
19
|
import { Client } from 'rpc-websockets';
|
|
20
20
|
import RpcClient from 'jayson/lib/client/browser';
|
|
@@ -202,7 +202,8 @@ class PublicKey extends Struct {
|
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
toBytes() {
|
|
205
|
-
|
|
205
|
+
const buf = this.toBuffer();
|
|
206
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
206
207
|
}
|
|
207
208
|
/**
|
|
208
209
|
* Return the Buffer representation of the public key in big endian
|
|
@@ -764,6 +765,36 @@ class CompiledKeys {
|
|
|
764
765
|
|
|
765
766
|
}
|
|
766
767
|
|
|
768
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
769
|
+
/**
|
|
770
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
771
|
+
*/
|
|
772
|
+
|
|
773
|
+
function guardedShift(byteArray) {
|
|
774
|
+
if (byteArray.length === 0) {
|
|
775
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return byteArray.shift();
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
782
|
+
* the array.
|
|
783
|
+
*/
|
|
784
|
+
|
|
785
|
+
function guardedSplice(byteArray, ...args) {
|
|
786
|
+
var _args$;
|
|
787
|
+
|
|
788
|
+
const [start] = args;
|
|
789
|
+
|
|
790
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
791
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
792
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
return byteArray.splice(...args);
|
|
796
|
+
}
|
|
797
|
+
|
|
767
798
|
/**
|
|
768
799
|
* An instruction to execute by a program
|
|
769
800
|
*
|
|
@@ -915,37 +946,33 @@ class Message {
|
|
|
915
946
|
static from(buffer) {
|
|
916
947
|
// Slice up wire data
|
|
917
948
|
let byteArray = [...buffer];
|
|
918
|
-
const numRequiredSignatures = byteArray
|
|
949
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
919
950
|
|
|
920
951
|
if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {
|
|
921
952
|
throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');
|
|
922
953
|
}
|
|
923
954
|
|
|
924
|
-
const numReadonlySignedAccounts = byteArray
|
|
925
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
955
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
956
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
926
957
|
const accountCount = decodeLength(byteArray);
|
|
927
958
|
let accountKeys = [];
|
|
928
959
|
|
|
929
960
|
for (let i = 0; i < accountCount; i++) {
|
|
930
|
-
const account = byteArray
|
|
931
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
961
|
+
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
932
962
|
accountKeys.push(new PublicKey(Buffer.from(account)));
|
|
933
963
|
}
|
|
934
964
|
|
|
935
|
-
const recentBlockhash = byteArray
|
|
936
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
965
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
937
966
|
const instructionCount = decodeLength(byteArray);
|
|
938
967
|
let instructions = [];
|
|
939
968
|
|
|
940
969
|
for (let i = 0; i < instructionCount; i++) {
|
|
941
|
-
const programIdIndex = byteArray
|
|
970
|
+
const programIdIndex = guardedShift(byteArray);
|
|
942
971
|
const accountCount = decodeLength(byteArray);
|
|
943
|
-
const accounts = byteArray
|
|
944
|
-
byteArray = byteArray.slice(accountCount);
|
|
972
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
945
973
|
const dataLength = decodeLength(byteArray);
|
|
946
|
-
const dataSlice = byteArray
|
|
974
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
947
975
|
const data = bs58.encode(Buffer.from(dataSlice));
|
|
948
|
-
byteArray = byteArray.slice(dataLength);
|
|
949
976
|
instructions.push({
|
|
950
977
|
programIdIndex,
|
|
951
978
|
accounts,
|
|
@@ -1181,33 +1208,33 @@ class MessageV0 {
|
|
|
1181
1208
|
|
|
1182
1209
|
static deserialize(serializedMessage) {
|
|
1183
1210
|
let byteArray = [...serializedMessage];
|
|
1184
|
-
const prefix = byteArray
|
|
1211
|
+
const prefix = guardedShift(byteArray);
|
|
1185
1212
|
const maskedPrefix = prefix & VERSION_PREFIX_MASK;
|
|
1186
1213
|
assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
|
|
1187
1214
|
const version = maskedPrefix;
|
|
1188
1215
|
assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);
|
|
1189
1216
|
const header = {
|
|
1190
|
-
numRequiredSignatures: byteArray
|
|
1191
|
-
numReadonlySignedAccounts: byteArray
|
|
1192
|
-
numReadonlyUnsignedAccounts: byteArray
|
|
1217
|
+
numRequiredSignatures: guardedShift(byteArray),
|
|
1218
|
+
numReadonlySignedAccounts: guardedShift(byteArray),
|
|
1219
|
+
numReadonlyUnsignedAccounts: guardedShift(byteArray)
|
|
1193
1220
|
};
|
|
1194
1221
|
const staticAccountKeys = [];
|
|
1195
1222
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
1196
1223
|
|
|
1197
1224
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
1198
|
-
staticAccountKeys.push(new PublicKey(byteArray
|
|
1225
|
+
staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));
|
|
1199
1226
|
}
|
|
1200
1227
|
|
|
1201
|
-
const recentBlockhash = bs58.encode(byteArray
|
|
1228
|
+
const recentBlockhash = bs58.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
1202
1229
|
const instructionCount = decodeLength(byteArray);
|
|
1203
1230
|
const compiledInstructions = [];
|
|
1204
1231
|
|
|
1205
1232
|
for (let i = 0; i < instructionCount; i++) {
|
|
1206
|
-
const programIdIndex = byteArray
|
|
1233
|
+
const programIdIndex = guardedShift(byteArray);
|
|
1207
1234
|
const accountKeyIndexesLength = decodeLength(byteArray);
|
|
1208
|
-
const accountKeyIndexes = byteArray
|
|
1235
|
+
const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);
|
|
1209
1236
|
const dataLength = decodeLength(byteArray);
|
|
1210
|
-
const data = new Uint8Array(byteArray
|
|
1237
|
+
const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));
|
|
1211
1238
|
compiledInstructions.push({
|
|
1212
1239
|
programIdIndex,
|
|
1213
1240
|
accountKeyIndexes,
|
|
@@ -1219,11 +1246,11 @@ class MessageV0 {
|
|
|
1219
1246
|
const addressTableLookups = [];
|
|
1220
1247
|
|
|
1221
1248
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
1222
|
-
const accountKey = new PublicKey(byteArray
|
|
1249
|
+
const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
1223
1250
|
const writableIndexesLength = decodeLength(byteArray);
|
|
1224
|
-
const writableIndexes = byteArray
|
|
1251
|
+
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
1225
1252
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
1226
|
-
const readonlyIndexes = byteArray
|
|
1253
|
+
const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);
|
|
1227
1254
|
addressTableLookups.push({
|
|
1228
1255
|
accountKey,
|
|
1229
1256
|
writableIndexes,
|
|
@@ -1963,8 +1990,7 @@ class Transaction {
|
|
|
1963
1990
|
let signatures = [];
|
|
1964
1991
|
|
|
1965
1992
|
for (let i = 0; i < signatureCount; i++) {
|
|
1966
|
-
const signature = byteArray
|
|
1967
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
1993
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
1968
1994
|
signatures.push(bs58.encode(Buffer.from(signature)));
|
|
1969
1995
|
}
|
|
1970
1996
|
|
|
@@ -2162,7 +2188,7 @@ class VersionedTransaction {
|
|
|
2162
2188
|
const signaturesLength = decodeLength(byteArray);
|
|
2163
2189
|
|
|
2164
2190
|
for (let i = 0; i < signaturesLength; i++) {
|
|
2165
|
-
signatures.push(new Uint8Array(byteArray
|
|
2191
|
+
signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));
|
|
2166
2192
|
}
|
|
2167
2193
|
|
|
2168
2194
|
const message = VersionedMessage.deserialize(new Uint8Array(byteArray));
|
|
@@ -3335,7 +3361,7 @@ var y = d * 365.25;
|
|
|
3335
3361
|
* @api public
|
|
3336
3362
|
*/
|
|
3337
3363
|
|
|
3338
|
-
var ms$
|
|
3364
|
+
var ms$3 = function (val, options) {
|
|
3339
3365
|
options = options || {};
|
|
3340
3366
|
var type = typeof val;
|
|
3341
3367
|
if (type === 'string' && val.length > 0) {
|
|
@@ -3484,11 +3510,11 @@ function plural(ms, msAbs, n, name) {
|
|
|
3484
3510
|
*/
|
|
3485
3511
|
|
|
3486
3512
|
var util = require$$0;
|
|
3487
|
-
var ms$
|
|
3513
|
+
var ms$2 = ms$3;
|
|
3488
3514
|
|
|
3489
3515
|
var humanizeMs = function (t) {
|
|
3490
3516
|
if (typeof t === 'number') return t;
|
|
3491
|
-
var r = ms$
|
|
3517
|
+
var r = ms$2(t);
|
|
3492
3518
|
if (r === undefined) {
|
|
3493
3519
|
var err = new Error(util.format('humanize-ms(%j) result undefined', t));
|
|
3494
3520
|
console.warn(err.stack);
|
|
@@ -3500,6 +3526,177 @@ var src = {exports: {}};
|
|
|
3500
3526
|
|
|
3501
3527
|
var browser = {exports: {}};
|
|
3502
3528
|
|
|
3529
|
+
/**
|
|
3530
|
+
* Helpers.
|
|
3531
|
+
*/
|
|
3532
|
+
|
|
3533
|
+
var ms$1;
|
|
3534
|
+
var hasRequiredMs;
|
|
3535
|
+
|
|
3536
|
+
function requireMs () {
|
|
3537
|
+
if (hasRequiredMs) return ms$1;
|
|
3538
|
+
hasRequiredMs = 1;
|
|
3539
|
+
var s = 1000;
|
|
3540
|
+
var m = s * 60;
|
|
3541
|
+
var h = m * 60;
|
|
3542
|
+
var d = h * 24;
|
|
3543
|
+
var w = d * 7;
|
|
3544
|
+
var y = d * 365.25;
|
|
3545
|
+
|
|
3546
|
+
/**
|
|
3547
|
+
* Parse or format the given `val`.
|
|
3548
|
+
*
|
|
3549
|
+
* Options:
|
|
3550
|
+
*
|
|
3551
|
+
* - `long` verbose formatting [false]
|
|
3552
|
+
*
|
|
3553
|
+
* @param {String|Number} val
|
|
3554
|
+
* @param {Object} [options]
|
|
3555
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
3556
|
+
* @return {String|Number}
|
|
3557
|
+
* @api public
|
|
3558
|
+
*/
|
|
3559
|
+
|
|
3560
|
+
ms$1 = function(val, options) {
|
|
3561
|
+
options = options || {};
|
|
3562
|
+
var type = typeof val;
|
|
3563
|
+
if (type === 'string' && val.length > 0) {
|
|
3564
|
+
return parse(val);
|
|
3565
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
3566
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
3567
|
+
}
|
|
3568
|
+
throw new Error(
|
|
3569
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
3570
|
+
JSON.stringify(val)
|
|
3571
|
+
);
|
|
3572
|
+
};
|
|
3573
|
+
|
|
3574
|
+
/**
|
|
3575
|
+
* Parse the given `str` and return milliseconds.
|
|
3576
|
+
*
|
|
3577
|
+
* @param {String} str
|
|
3578
|
+
* @return {Number}
|
|
3579
|
+
* @api private
|
|
3580
|
+
*/
|
|
3581
|
+
|
|
3582
|
+
function parse(str) {
|
|
3583
|
+
str = String(str);
|
|
3584
|
+
if (str.length > 100) {
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
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(
|
|
3588
|
+
str
|
|
3589
|
+
);
|
|
3590
|
+
if (!match) {
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3593
|
+
var n = parseFloat(match[1]);
|
|
3594
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
3595
|
+
switch (type) {
|
|
3596
|
+
case 'years':
|
|
3597
|
+
case 'year':
|
|
3598
|
+
case 'yrs':
|
|
3599
|
+
case 'yr':
|
|
3600
|
+
case 'y':
|
|
3601
|
+
return n * y;
|
|
3602
|
+
case 'weeks':
|
|
3603
|
+
case 'week':
|
|
3604
|
+
case 'w':
|
|
3605
|
+
return n * w;
|
|
3606
|
+
case 'days':
|
|
3607
|
+
case 'day':
|
|
3608
|
+
case 'd':
|
|
3609
|
+
return n * d;
|
|
3610
|
+
case 'hours':
|
|
3611
|
+
case 'hour':
|
|
3612
|
+
case 'hrs':
|
|
3613
|
+
case 'hr':
|
|
3614
|
+
case 'h':
|
|
3615
|
+
return n * h;
|
|
3616
|
+
case 'minutes':
|
|
3617
|
+
case 'minute':
|
|
3618
|
+
case 'mins':
|
|
3619
|
+
case 'min':
|
|
3620
|
+
case 'm':
|
|
3621
|
+
return n * m;
|
|
3622
|
+
case 'seconds':
|
|
3623
|
+
case 'second':
|
|
3624
|
+
case 'secs':
|
|
3625
|
+
case 'sec':
|
|
3626
|
+
case 's':
|
|
3627
|
+
return n * s;
|
|
3628
|
+
case 'milliseconds':
|
|
3629
|
+
case 'millisecond':
|
|
3630
|
+
case 'msecs':
|
|
3631
|
+
case 'msec':
|
|
3632
|
+
case 'ms':
|
|
3633
|
+
return n;
|
|
3634
|
+
default:
|
|
3635
|
+
return undefined;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
/**
|
|
3640
|
+
* Short format for `ms`.
|
|
3641
|
+
*
|
|
3642
|
+
* @param {Number} ms
|
|
3643
|
+
* @return {String}
|
|
3644
|
+
* @api private
|
|
3645
|
+
*/
|
|
3646
|
+
|
|
3647
|
+
function fmtShort(ms) {
|
|
3648
|
+
var msAbs = Math.abs(ms);
|
|
3649
|
+
if (msAbs >= d) {
|
|
3650
|
+
return Math.round(ms / d) + 'd';
|
|
3651
|
+
}
|
|
3652
|
+
if (msAbs >= h) {
|
|
3653
|
+
return Math.round(ms / h) + 'h';
|
|
3654
|
+
}
|
|
3655
|
+
if (msAbs >= m) {
|
|
3656
|
+
return Math.round(ms / m) + 'm';
|
|
3657
|
+
}
|
|
3658
|
+
if (msAbs >= s) {
|
|
3659
|
+
return Math.round(ms / s) + 's';
|
|
3660
|
+
}
|
|
3661
|
+
return ms + 'ms';
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
/**
|
|
3665
|
+
* Long format for `ms`.
|
|
3666
|
+
*
|
|
3667
|
+
* @param {Number} ms
|
|
3668
|
+
* @return {String}
|
|
3669
|
+
* @api private
|
|
3670
|
+
*/
|
|
3671
|
+
|
|
3672
|
+
function fmtLong(ms) {
|
|
3673
|
+
var msAbs = Math.abs(ms);
|
|
3674
|
+
if (msAbs >= d) {
|
|
3675
|
+
return plural(ms, msAbs, d, 'day');
|
|
3676
|
+
}
|
|
3677
|
+
if (msAbs >= h) {
|
|
3678
|
+
return plural(ms, msAbs, h, 'hour');
|
|
3679
|
+
}
|
|
3680
|
+
if (msAbs >= m) {
|
|
3681
|
+
return plural(ms, msAbs, m, 'minute');
|
|
3682
|
+
}
|
|
3683
|
+
if (msAbs >= s) {
|
|
3684
|
+
return plural(ms, msAbs, s, 'second');
|
|
3685
|
+
}
|
|
3686
|
+
return ms + ' ms';
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
/**
|
|
3690
|
+
* Pluralization helper.
|
|
3691
|
+
*/
|
|
3692
|
+
|
|
3693
|
+
function plural(ms, msAbs, n, name) {
|
|
3694
|
+
var isPlural = msAbs >= n * 1.5;
|
|
3695
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
3696
|
+
}
|
|
3697
|
+
return ms$1;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3503
3700
|
var common;
|
|
3504
3701
|
var hasRequiredCommon;
|
|
3505
3702
|
|
|
@@ -3518,7 +3715,7 @@ function requireCommon () {
|
|
|
3518
3715
|
createDebug.disable = disable;
|
|
3519
3716
|
createDebug.enable = enable;
|
|
3520
3717
|
createDebug.enabled = enabled;
|
|
3521
|
-
createDebug.humanize =
|
|
3718
|
+
createDebug.humanize = requireMs();
|
|
3522
3719
|
createDebug.destroy = destroy;
|
|
3523
3720
|
|
|
3524
3721
|
Object.keys(env).forEach(key => {
|
|
@@ -4069,12 +4266,12 @@ var hasRequiredHasFlag;
|
|
|
4069
4266
|
function requireHasFlag () {
|
|
4070
4267
|
if (hasRequiredHasFlag) return hasFlag;
|
|
4071
4268
|
hasRequiredHasFlag = 1;
|
|
4072
|
-
|
|
4073
|
-
|
|
4269
|
+
|
|
4270
|
+
hasFlag = (flag, argv = process.argv) => {
|
|
4074
4271
|
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
4075
|
-
const
|
|
4076
|
-
const
|
|
4077
|
-
return
|
|
4272
|
+
const position = argv.indexOf(prefix + flag);
|
|
4273
|
+
const terminatorPosition = argv.indexOf('--');
|
|
4274
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
4078
4275
|
};
|
|
4079
4276
|
return hasFlag;
|
|
4080
4277
|
}
|
|
@@ -4086,23 +4283,32 @@ function requireSupportsColor () {
|
|
|
4086
4283
|
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
4087
4284
|
hasRequiredSupportsColor = 1;
|
|
4088
4285
|
const os = require$$0$1;
|
|
4286
|
+
const tty = require$$1;
|
|
4089
4287
|
const hasFlag = requireHasFlag();
|
|
4090
4288
|
|
|
4091
|
-
const env = process
|
|
4289
|
+
const {env} = process;
|
|
4092
4290
|
|
|
4093
4291
|
let forceColor;
|
|
4094
4292
|
if (hasFlag('no-color') ||
|
|
4095
4293
|
hasFlag('no-colors') ||
|
|
4096
|
-
hasFlag('color=false')
|
|
4097
|
-
|
|
4294
|
+
hasFlag('color=false') ||
|
|
4295
|
+
hasFlag('color=never')) {
|
|
4296
|
+
forceColor = 0;
|
|
4098
4297
|
} else if (hasFlag('color') ||
|
|
4099
4298
|
hasFlag('colors') ||
|
|
4100
4299
|
hasFlag('color=true') ||
|
|
4101
4300
|
hasFlag('color=always')) {
|
|
4102
|
-
forceColor =
|
|
4301
|
+
forceColor = 1;
|
|
4103
4302
|
}
|
|
4303
|
+
|
|
4104
4304
|
if ('FORCE_COLOR' in env) {
|
|
4105
|
-
|
|
4305
|
+
if (env.FORCE_COLOR === 'true') {
|
|
4306
|
+
forceColor = 1;
|
|
4307
|
+
} else if (env.FORCE_COLOR === 'false') {
|
|
4308
|
+
forceColor = 0;
|
|
4309
|
+
} else {
|
|
4310
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
4311
|
+
}
|
|
4106
4312
|
}
|
|
4107
4313
|
|
|
4108
4314
|
function translateLevel(level) {
|
|
@@ -4118,8 +4324,8 @@ function requireSupportsColor () {
|
|
|
4118
4324
|
};
|
|
4119
4325
|
}
|
|
4120
4326
|
|
|
4121
|
-
function supportsColor(
|
|
4122
|
-
if (forceColor ===
|
|
4327
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
4328
|
+
if (forceColor === 0) {
|
|
4123
4329
|
return 0;
|
|
4124
4330
|
}
|
|
4125
4331
|
|
|
@@ -4133,22 +4339,21 @@ function requireSupportsColor () {
|
|
|
4133
4339
|
return 2;
|
|
4134
4340
|
}
|
|
4135
4341
|
|
|
4136
|
-
if (
|
|
4342
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
4137
4343
|
return 0;
|
|
4138
4344
|
}
|
|
4139
4345
|
|
|
4140
|
-
const min = forceColor
|
|
4346
|
+
const min = forceColor || 0;
|
|
4347
|
+
|
|
4348
|
+
if (env.TERM === 'dumb') {
|
|
4349
|
+
return min;
|
|
4350
|
+
}
|
|
4141
4351
|
|
|
4142
4352
|
if (process.platform === 'win32') {
|
|
4143
|
-
//
|
|
4144
|
-
//
|
|
4145
|
-
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
|
4146
|
-
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
|
|
4147
|
-
// release that supports 256 colors. Windows 10 build 14931 is the first release
|
|
4148
|
-
// that supports 16m/TrueColor.
|
|
4353
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
4354
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
4149
4355
|
const osRelease = os.release().split('.');
|
|
4150
4356
|
if (
|
|
4151
|
-
Number(process.versions.node.split('.')[0]) >= 8 &&
|
|
4152
4357
|
Number(osRelease[0]) >= 10 &&
|
|
4153
4358
|
Number(osRelease[2]) >= 10586
|
|
4154
4359
|
) {
|
|
@@ -4159,7 +4364,7 @@ function requireSupportsColor () {
|
|
|
4159
4364
|
}
|
|
4160
4365
|
|
|
4161
4366
|
if ('CI' in env) {
|
|
4162
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
4367
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
4163
4368
|
return 1;
|
|
4164
4369
|
}
|
|
4165
4370
|
|
|
@@ -4198,22 +4403,18 @@ function requireSupportsColor () {
|
|
|
4198
4403
|
return 1;
|
|
4199
4404
|
}
|
|
4200
4405
|
|
|
4201
|
-
if (env.TERM === 'dumb') {
|
|
4202
|
-
return min;
|
|
4203
|
-
}
|
|
4204
|
-
|
|
4205
4406
|
return min;
|
|
4206
4407
|
}
|
|
4207
4408
|
|
|
4208
4409
|
function getSupportLevel(stream) {
|
|
4209
|
-
const level = supportsColor(stream);
|
|
4410
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
4210
4411
|
return translateLevel(level);
|
|
4211
4412
|
}
|
|
4212
4413
|
|
|
4213
4414
|
supportsColor_1 = {
|
|
4214
4415
|
supportsColor: getSupportLevel,
|
|
4215
|
-
stdout:
|
|
4216
|
-
stderr:
|
|
4416
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
4417
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
4217
4418
|
};
|
|
4218
4419
|
return supportsColor_1;
|
|
4219
4420
|
}
|
|
@@ -4228,7 +4429,7 @@ function requireNode () {
|
|
|
4228
4429
|
if (hasRequiredNode) return node.exports;
|
|
4229
4430
|
hasRequiredNode = 1;
|
|
4230
4431
|
(function (module, exports) {
|
|
4231
|
-
const tty = require$$
|
|
4432
|
+
const tty = require$$1;
|
|
4232
4433
|
const util = require$$0;
|
|
4233
4434
|
|
|
4234
4435
|
/**
|
|
@@ -4660,7 +4861,7 @@ function requireEventListenerCount () {
|
|
|
4660
4861
|
* @private
|
|
4661
4862
|
*/
|
|
4662
4863
|
|
|
4663
|
-
var EventEmitter = require$$0$
|
|
4864
|
+
var EventEmitter = require$$0$2.EventEmitter;
|
|
4664
4865
|
|
|
4665
4866
|
/**
|
|
4666
4867
|
* Module exports.
|
|
@@ -4740,7 +4941,7 @@ function requireEventListenerCount () {
|
|
|
4740
4941
|
|
|
4741
4942
|
var callSiteToString = compat.exports.callSiteToString;
|
|
4742
4943
|
var eventListenerCount = compat.exports.eventListenerCount;
|
|
4743
|
-
var relative = require$$1.relative;
|
|
4944
|
+
var relative = require$$1$1.relative;
|
|
4744
4945
|
|
|
4745
4946
|
/**
|
|
4746
4947
|
* Module exports.
|
|
@@ -5263,7 +5464,7 @@ var constants = {
|
|
|
5263
5464
|
SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
|
|
5264
5465
|
};
|
|
5265
5466
|
|
|
5266
|
-
const OriginalAgent = require$$0$
|
|
5467
|
+
const OriginalAgent = require$$0$3.Agent;
|
|
5267
5468
|
const ms = humanizeMs;
|
|
5268
5469
|
const debug = src.exports('agentkeepalive');
|
|
5269
5470
|
const deprecate = depd_1('agentkeepalive');
|
|
@@ -5660,7 +5861,7 @@ function inspect(obj) {
|
|
|
5660
5861
|
return res;
|
|
5661
5862
|
}
|
|
5662
5863
|
|
|
5663
|
-
const OriginalHttpsAgent = require$$0$
|
|
5864
|
+
const OriginalHttpsAgent = require$$0$4.Agent;
|
|
5664
5865
|
const HttpAgent = agent;
|
|
5665
5866
|
const {
|
|
5666
5867
|
INIT_SOCKET,
|
|
@@ -7123,7 +7324,7 @@ const LogsNotificationResult = type({
|
|
|
7123
7324
|
|
|
7124
7325
|
/** @internal */
|
|
7125
7326
|
const COMMON_HTTP_HEADERS = {
|
|
7126
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
7327
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.70.4") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
7127
7328
|
};
|
|
7128
7329
|
/**
|
|
7129
7330
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -12541,10 +12742,8 @@ class ValidatorInfo {
|
|
|
12541
12742
|
const configKeys = [];
|
|
12542
12743
|
|
|
12543
12744
|
for (let i = 0; i < 2; i++) {
|
|
12544
|
-
const publicKey = new PublicKey(byteArray
|
|
12545
|
-
|
|
12546
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
12547
|
-
byteArray = byteArray.slice(1);
|
|
12745
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
12746
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
12548
12747
|
configKeys.push({
|
|
12549
12748
|
publicKey,
|
|
12550
12749
|
isSigner
|
|
@@ -12709,7 +12908,7 @@ function clusterApiUrl(cluster, tls) {
|
|
|
12709
12908
|
*
|
|
12710
12909
|
* @param {Connection} connection
|
|
12711
12910
|
* @param {Buffer} rawTransaction
|
|
12712
|
-
* @param {
|
|
12911
|
+
* @param {TransactionConfirmationStrategy} confirmationStrategy
|
|
12713
12912
|
* @param {ConfirmOptions} [options]
|
|
12714
12913
|
* @returns {Promise<TransactionSignature>}
|
|
12715
12914
|
*/
|