@solana/web3.js 1.41.9 → 1.41.11
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 +181 -60
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +182 -61
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +181 -60
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +44 -10
- package/lib/index.esm.js +182 -61
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +181 -60
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +22 -22
- package/src/connection.ts +118 -41
- package/src/message.ts +9 -12
- package/src/transaction.ts +56 -8
- package/src/util/guarded-array-utils.ts +34 -0
- package/src/util/send-and-confirm-transaction.ts +19 -6
- package/src/util/tx-expiry-custom-errors.ts +35 -0
- package/src/validator-info.ts +5 -4
package/lib/index.d.ts
CHANGED
|
@@ -338,6 +338,11 @@ declare module '@solana/web3.js' {
|
|
|
338
338
|
* Transaction signature as base-58 encoded string
|
|
339
339
|
*/
|
|
340
340
|
export type TransactionSignature = string;
|
|
341
|
+
export const enum TransactionStatus {
|
|
342
|
+
BLOCKHEIGHT_EXCEEDED = 0,
|
|
343
|
+
PROCESSED = 1,
|
|
344
|
+
TIMED_OUT = 2,
|
|
345
|
+
}
|
|
341
346
|
/**
|
|
342
347
|
* Account metadata used to define instructions
|
|
343
348
|
*/
|
|
@@ -394,17 +399,29 @@ declare module '@solana/web3.js' {
|
|
|
394
399
|
};
|
|
395
400
|
/**
|
|
396
401
|
* List of Transaction object fields that may be initialized at construction
|
|
397
|
-
*
|
|
398
402
|
*/
|
|
399
|
-
export type
|
|
400
|
-
/** A recent blockhash */
|
|
401
|
-
recentBlockhash?: Blockhash | null;
|
|
403
|
+
export type TransactionCtorFields_DEPRECATED = {
|
|
402
404
|
/** Optional nonce information used for offline nonce'd transactions */
|
|
403
405
|
nonceInfo?: NonceInformation | null;
|
|
404
406
|
/** The transaction fee payer */
|
|
405
407
|
feePayer?: PublicKey | null;
|
|
406
408
|
/** One or more signatures */
|
|
407
409
|
signatures?: Array<SignaturePubkeyPair>;
|
|
410
|
+
/** A recent blockhash */
|
|
411
|
+
recentBlockhash?: Blockhash;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* List of Transaction object fields that may be initialized at construction
|
|
415
|
+
*/
|
|
416
|
+
export type TransactionBlockhashCtor = {
|
|
417
|
+
/** The transaction fee payer */
|
|
418
|
+
feePayer?: PublicKey | null;
|
|
419
|
+
/** One or more signatures */
|
|
420
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
421
|
+
/** A recent blockhash */
|
|
422
|
+
blockhash: Blockhash;
|
|
423
|
+
/** the last block chain can advance to before tx is exportd expired */
|
|
424
|
+
lastValidBlockHeight: number;
|
|
408
425
|
};
|
|
409
426
|
/**
|
|
410
427
|
* Nonce information to be used to build an offline Transaction.
|
|
@@ -440,15 +457,21 @@ declare module '@solana/web3.js' {
|
|
|
440
457
|
* A recent transaction id. Must be populated by the caller
|
|
441
458
|
*/
|
|
442
459
|
recentBlockhash?: Blockhash;
|
|
460
|
+
/**
|
|
461
|
+
* the last block chain can advance to before tx is exportd expired
|
|
462
|
+
* */
|
|
463
|
+
lastValidBlockHeight?: number;
|
|
443
464
|
/**
|
|
444
465
|
* Optional Nonce information. If populated, transaction will use a durable
|
|
445
466
|
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
446
467
|
*/
|
|
447
468
|
nonceInfo?: NonceInformation;
|
|
469
|
+
constructor(opts?: TransactionBlockhashCtor);
|
|
448
470
|
/**
|
|
449
|
-
*
|
|
471
|
+
* @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
|
|
472
|
+
* Please supply a `TransactionBlockhashCtor` instead.
|
|
450
473
|
*/
|
|
451
|
-
constructor(opts?:
|
|
474
|
+
constructor(opts?: TransactionCtorFields_DEPRECATED);
|
|
452
475
|
/**
|
|
453
476
|
* Add one or more instructions to this Transaction
|
|
454
477
|
*/
|
|
@@ -602,6 +625,15 @@ declare module '@solana/web3.js' {
|
|
|
602
625
|
/** response value */
|
|
603
626
|
value: T;
|
|
604
627
|
};
|
|
628
|
+
/**
|
|
629
|
+
* A strategy for confirming transactions that uses the last valid
|
|
630
|
+
* block height for a given blockhash to check for transaction expiration.
|
|
631
|
+
*/
|
|
632
|
+
export type BlockheightBasedTransactionConfimationStrategy = {
|
|
633
|
+
signature: TransactionSignature;
|
|
634
|
+
blockhash: Blockhash;
|
|
635
|
+
lastValidBlockHeight: number;
|
|
636
|
+
};
|
|
605
637
|
/**
|
|
606
638
|
* The level of commitment desired when querying state
|
|
607
639
|
* <pre>
|
|
@@ -1624,11 +1656,13 @@ declare module '@solana/web3.js' {
|
|
|
1624
1656
|
account: AccountInfo<Buffer | ParsedAccountData>;
|
|
1625
1657
|
}>
|
|
1626
1658
|
>;
|
|
1627
|
-
/**
|
|
1628
|
-
* Confirm the transaction identified by the specified signature.
|
|
1629
|
-
*/
|
|
1630
1659
|
confirmTransaction(
|
|
1631
|
-
|
|
1660
|
+
strategy: BlockheightBasedTransactionConfimationStrategy,
|
|
1661
|
+
commitment?: Commitment,
|
|
1662
|
+
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
1663
|
+
/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */
|
|
1664
|
+
confirmTransaction(
|
|
1665
|
+
strategy: TransactionSignature,
|
|
1632
1666
|
commitment?: Commitment,
|
|
1633
1667
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
1634
1668
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -2201,6 +2201,36 @@ function encodeLength(bytes, len) {
|
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
2203
|
|
|
2204
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
2205
|
+
/**
|
|
2206
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
2207
|
+
*/
|
|
2208
|
+
|
|
2209
|
+
function guardedShift(byteArray) {
|
|
2210
|
+
if (byteArray.length === 0) {
|
|
2211
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
return byteArray.shift();
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
2218
|
+
* the array.
|
|
2219
|
+
*/
|
|
2220
|
+
|
|
2221
|
+
function guardedSplice(byteArray, ...args) {
|
|
2222
|
+
var _args$;
|
|
2223
|
+
|
|
2224
|
+
const [start] = args;
|
|
2225
|
+
|
|
2226
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
2227
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
2228
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
return byteArray.splice(...args);
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2204
2234
|
/**
|
|
2205
2235
|
* The message header, identifying signed and read-only account
|
|
2206
2236
|
*/
|
|
@@ -2299,32 +2329,28 @@ class Message {
|
|
|
2299
2329
|
static from(buffer) {
|
|
2300
2330
|
// Slice up wire data
|
|
2301
2331
|
let byteArray = [...buffer];
|
|
2302
|
-
const numRequiredSignatures = byteArray
|
|
2303
|
-
const numReadonlySignedAccounts = byteArray
|
|
2304
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
2332
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
2333
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
2334
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
2305
2335
|
const accountCount = decodeLength(byteArray);
|
|
2306
2336
|
let accountKeys = [];
|
|
2307
2337
|
|
|
2308
2338
|
for (let i = 0; i < accountCount; i++) {
|
|
2309
|
-
const account = byteArray
|
|
2310
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
2339
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
2311
2340
|
accountKeys.push(bs58.encode(Buffer.from(account)));
|
|
2312
2341
|
}
|
|
2313
2342
|
|
|
2314
|
-
const recentBlockhash = byteArray
|
|
2315
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
2343
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
2316
2344
|
const instructionCount = decodeLength(byteArray);
|
|
2317
2345
|
let instructions = [];
|
|
2318
2346
|
|
|
2319
2347
|
for (let i = 0; i < instructionCount; i++) {
|
|
2320
|
-
const programIdIndex = byteArray
|
|
2348
|
+
const programIdIndex = guardedShift(byteArray);
|
|
2321
2349
|
const accountCount = decodeLength(byteArray);
|
|
2322
|
-
const accounts = byteArray
|
|
2323
|
-
byteArray = byteArray.slice(accountCount);
|
|
2350
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
2324
2351
|
const dataLength = decodeLength(byteArray);
|
|
2325
|
-
const dataSlice = byteArray
|
|
2352
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
2326
2353
|
const data = bs58.encode(Buffer.from(dataSlice));
|
|
2327
|
-
byteArray = byteArray.slice(dataLength);
|
|
2328
2354
|
instructions.push({
|
|
2329
2355
|
programIdIndex,
|
|
2330
2356
|
accounts,
|
|
@@ -2353,9 +2379,21 @@ function assert (condition, message) {
|
|
|
2353
2379
|
}
|
|
2354
2380
|
}
|
|
2355
2381
|
|
|
2382
|
+
/**
|
|
2383
|
+
* Transaction signature as base-58 encoded string
|
|
2384
|
+
*/
|
|
2385
|
+
|
|
2386
|
+
let TransactionStatus;
|
|
2356
2387
|
/**
|
|
2357
2388
|
* Default (empty) signature
|
|
2358
2389
|
*/
|
|
2390
|
+
|
|
2391
|
+
(function (TransactionStatus) {
|
|
2392
|
+
TransactionStatus[TransactionStatus["BLOCKHEIGHT_EXCEEDED"] = 0] = "BLOCKHEIGHT_EXCEEDED";
|
|
2393
|
+
TransactionStatus[TransactionStatus["PROCESSED"] = 1] = "PROCESSED";
|
|
2394
|
+
TransactionStatus[TransactionStatus["TIMED_OUT"] = 2] = "TIMED_OUT";
|
|
2395
|
+
})(TransactionStatus || (TransactionStatus = {}));
|
|
2396
|
+
|
|
2359
2397
|
const DEFAULT_SIGNATURE = Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
|
|
2360
2398
|
/**
|
|
2361
2399
|
* Account metadata used to define instructions
|
|
@@ -2446,10 +2484,23 @@ class Transaction {
|
|
|
2446
2484
|
this.feePayer = void 0;
|
|
2447
2485
|
this.instructions = [];
|
|
2448
2486
|
this.recentBlockhash = void 0;
|
|
2487
|
+
this.lastValidBlockHeight = void 0;
|
|
2449
2488
|
this.nonceInfo = void 0;
|
|
2450
2489
|
this._message = void 0;
|
|
2451
2490
|
this._json = void 0;
|
|
2452
|
-
|
|
2491
|
+
|
|
2492
|
+
if (!opts) {
|
|
2493
|
+
return;
|
|
2494
|
+
} else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
|
|
2495
|
+
const newOpts = opts;
|
|
2496
|
+
Object.assign(this, newOpts);
|
|
2497
|
+
this.recentBlockhash = newOpts.blockhash;
|
|
2498
|
+
this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
|
|
2499
|
+
} else {
|
|
2500
|
+
const oldOpts = opts;
|
|
2501
|
+
Object.assign(this, oldOpts);
|
|
2502
|
+
this.recentBlockhash = oldOpts.recentBlockhash;
|
|
2503
|
+
}
|
|
2453
2504
|
}
|
|
2454
2505
|
/**
|
|
2455
2506
|
* @internal
|
|
@@ -2982,8 +3033,7 @@ class Transaction {
|
|
|
2982
3033
|
let signatures = [];
|
|
2983
3034
|
|
|
2984
3035
|
for (let i = 0; i < signatureCount; i++) {
|
|
2985
|
-
const signature = byteArray
|
|
2986
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
3036
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
2987
3037
|
signatures.push(bs58.encode(Buffer.from(signature)));
|
|
2988
3038
|
}
|
|
2989
3039
|
|
|
@@ -3059,7 +3109,11 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
3059
3109
|
maxRetries: options.maxRetries
|
|
3060
3110
|
};
|
|
3061
3111
|
const signature = await connection.sendTransaction(transaction, signers, sendOptions);
|
|
3062
|
-
const status = (await connection.confirmTransaction(
|
|
3112
|
+
const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
|
|
3113
|
+
signature: signature,
|
|
3114
|
+
blockhash: transaction.recentBlockhash,
|
|
3115
|
+
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
3116
|
+
}, options && options.commitment)).value : (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
3063
3117
|
|
|
3064
3118
|
if (status.err) {
|
|
3065
3119
|
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
@@ -4459,16 +4513,28 @@ const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
|
4459
4513
|
|
|
4460
4514
|
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
|
|
4461
4515
|
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
return result;
|
|
4470
|
-
});
|
|
4516
|
+
class TransactionExpiredBlockheightExceededError extends Error {
|
|
4517
|
+
constructor(signature) {
|
|
4518
|
+
super(`Signature ${signature} has expired: block height exceeded.`);
|
|
4519
|
+
this.signature = void 0;
|
|
4520
|
+
this.signature = signature;
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4471
4523
|
}
|
|
4524
|
+
Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype, 'name', {
|
|
4525
|
+
value: 'TransactionExpiredBlockheightExceededError'
|
|
4526
|
+
});
|
|
4527
|
+
class TransactionExpiredTimeoutError extends Error {
|
|
4528
|
+
constructor(signature, timeoutSeconds) {
|
|
4529
|
+
super(`Transaction was not confirmed in ${timeoutSeconds.toFixed(2)} seconds. It is ` + 'unknown if it succeeded or failed. Check signature ' + `${signature} using the Solana Explorer or CLI tools.`);
|
|
4530
|
+
this.signature = void 0;
|
|
4531
|
+
this.signature = signature;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
}
|
|
4535
|
+
Object.defineProperty(TransactionExpiredTimeoutError.prototype, 'name', {
|
|
4536
|
+
value: 'TransactionExpiredTimeoutError'
|
|
4537
|
+
});
|
|
4472
4538
|
|
|
4473
4539
|
function makeWebsocketUrl(endpoint) {
|
|
4474
4540
|
let url = new URL(endpoint);
|
|
@@ -5944,67 +6010,124 @@ class Connection {
|
|
|
5944
6010
|
|
|
5945
6011
|
return res.result;
|
|
5946
6012
|
}
|
|
5947
|
-
/**
|
|
5948
|
-
* Confirm the transaction identified by the specified signature.
|
|
5949
|
-
*/
|
|
5950
6013
|
|
|
6014
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6015
|
+
async confirmTransaction(strategy, commitment) {
|
|
6016
|
+
let rawSignature;
|
|
6017
|
+
|
|
6018
|
+
if (typeof strategy == 'string') {
|
|
6019
|
+
rawSignature = strategy;
|
|
6020
|
+
} else {
|
|
6021
|
+
const config = strategy;
|
|
6022
|
+
rawSignature = config.signature;
|
|
6023
|
+
}
|
|
5951
6024
|
|
|
5952
|
-
async confirmTransaction(signature, commitment) {
|
|
5953
6025
|
let decodedSignature;
|
|
5954
6026
|
|
|
5955
6027
|
try {
|
|
5956
|
-
decodedSignature = bs58.decode(
|
|
6028
|
+
decodedSignature = bs58.decode(rawSignature);
|
|
5957
6029
|
} catch (err) {
|
|
5958
|
-
throw new Error('signature must be base58 encoded: ' +
|
|
6030
|
+
throw new Error('signature must be base58 encoded: ' + rawSignature);
|
|
5959
6031
|
}
|
|
5960
6032
|
|
|
5961
6033
|
assert(decodedSignature.length === 64, 'signature has invalid length');
|
|
5962
|
-
const start = Date.now();
|
|
5963
6034
|
const subscriptionCommitment = commitment || this.commitment;
|
|
6035
|
+
let timeoutId;
|
|
5964
6036
|
let subscriptionId;
|
|
5965
|
-
let
|
|
5966
|
-
const
|
|
6037
|
+
let done = false;
|
|
6038
|
+
const confirmationPromise = new Promise((resolve, reject) => {
|
|
5967
6039
|
try {
|
|
5968
|
-
subscriptionId = this.onSignature(
|
|
6040
|
+
subscriptionId = this.onSignature(rawSignature, (result, context) => {
|
|
5969
6041
|
subscriptionId = undefined;
|
|
5970
|
-
response = {
|
|
6042
|
+
const response = {
|
|
5971
6043
|
context,
|
|
5972
6044
|
value: result
|
|
5973
6045
|
};
|
|
5974
|
-
|
|
6046
|
+
done = true;
|
|
6047
|
+
resolve({
|
|
6048
|
+
__type: TransactionStatus.PROCESSED,
|
|
6049
|
+
response
|
|
6050
|
+
});
|
|
5975
6051
|
}, subscriptionCommitment);
|
|
5976
6052
|
} catch (err) {
|
|
5977
6053
|
reject(err);
|
|
5978
6054
|
}
|
|
5979
6055
|
});
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6056
|
+
|
|
6057
|
+
const checkBlockHeight = async () => {
|
|
6058
|
+
try {
|
|
6059
|
+
const blockHeight = await this.getBlockHeight(commitment);
|
|
6060
|
+
return blockHeight;
|
|
6061
|
+
} catch (_e) {
|
|
6062
|
+
return -1;
|
|
6063
|
+
}
|
|
6064
|
+
};
|
|
6065
|
+
|
|
6066
|
+
const expiryPromise = new Promise(resolve => {
|
|
6067
|
+
if (typeof strategy === 'string') {
|
|
6068
|
+
let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
|
|
6069
|
+
|
|
6070
|
+
switch (subscriptionCommitment) {
|
|
6071
|
+
case 'processed':
|
|
6072
|
+
case 'recent':
|
|
6073
|
+
case 'single':
|
|
6074
|
+
case 'confirmed':
|
|
6075
|
+
case 'singleGossip':
|
|
6076
|
+
{
|
|
6077
|
+
timeoutMs = this._confirmTransactionInitialTimeout || 30 * 1000;
|
|
6078
|
+
break;
|
|
6079
|
+
}
|
|
5991
6080
|
}
|
|
5992
|
-
|
|
6081
|
+
|
|
6082
|
+
timeoutId = setTimeout(() => resolve({
|
|
6083
|
+
__type: TransactionStatus.TIMED_OUT,
|
|
6084
|
+
timeoutMs
|
|
6085
|
+
}), timeoutMs);
|
|
6086
|
+
} else {
|
|
6087
|
+
let config = strategy;
|
|
6088
|
+
|
|
6089
|
+
(async () => {
|
|
6090
|
+
let currentBlockHeight = await checkBlockHeight();
|
|
6091
|
+
if (done) return;
|
|
6092
|
+
|
|
6093
|
+
while (currentBlockHeight <= config.lastValidBlockHeight) {
|
|
6094
|
+
await sleep(1000);
|
|
6095
|
+
if (done) return;
|
|
6096
|
+
currentBlockHeight = await checkBlockHeight();
|
|
6097
|
+
if (done) return;
|
|
6098
|
+
}
|
|
6099
|
+
|
|
6100
|
+
resolve({
|
|
6101
|
+
__type: TransactionStatus.BLOCKHEIGHT_EXCEEDED
|
|
6102
|
+
});
|
|
6103
|
+
})();
|
|
6104
|
+
}
|
|
6105
|
+
});
|
|
6106
|
+
let result;
|
|
5993
6107
|
|
|
5994
6108
|
try {
|
|
5995
|
-
await
|
|
6109
|
+
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
6110
|
+
|
|
6111
|
+
switch (outcome.__type) {
|
|
6112
|
+
case TransactionStatus.BLOCKHEIGHT_EXCEEDED:
|
|
6113
|
+
throw new TransactionExpiredBlockheightExceededError(rawSignature);
|
|
6114
|
+
|
|
6115
|
+
case TransactionStatus.PROCESSED:
|
|
6116
|
+
result = outcome.response;
|
|
6117
|
+
break;
|
|
6118
|
+
|
|
6119
|
+
case TransactionStatus.TIMED_OUT:
|
|
6120
|
+
throw new TransactionExpiredTimeoutError(rawSignature, outcome.timeoutMs / 1000);
|
|
6121
|
+
}
|
|
5996
6122
|
} finally {
|
|
6123
|
+
clearTimeout(timeoutId);
|
|
6124
|
+
|
|
5997
6125
|
if (subscriptionId) {
|
|
5998
6126
|
this.removeSignatureListener(subscriptionId);
|
|
5999
6127
|
}
|
|
6000
6128
|
}
|
|
6001
6129
|
|
|
6002
|
-
|
|
6003
|
-
const duration = (Date.now() - start) / 1000;
|
|
6004
|
-
throw new Error(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`);
|
|
6005
|
-
}
|
|
6006
|
-
|
|
6007
|
-
return response;
|
|
6130
|
+
return result;
|
|
6008
6131
|
}
|
|
6009
6132
|
/**
|
|
6010
6133
|
* Return the list of nodes that are currently participating in the cluster
|
|
@@ -9121,10 +9244,8 @@ class ValidatorInfo {
|
|
|
9121
9244
|
const configKeys = [];
|
|
9122
9245
|
|
|
9123
9246
|
for (let i = 0; i < 2; i++) {
|
|
9124
|
-
const publicKey = new PublicKey(byteArray
|
|
9125
|
-
|
|
9126
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
9127
|
-
byteArray = byteArray.slice(1);
|
|
9247
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
9248
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
9128
9249
|
configKeys.push({
|
|
9129
9250
|
publicKey,
|
|
9130
9251
|
isSigner
|
|
@@ -9629,5 +9750,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9629
9750
|
|
|
9630
9751
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9631
9752
|
|
|
9632
|
-
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionInstruction, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9753
|
+
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionInstruction, TransactionStatus, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9633
9754
|
//# sourceMappingURL=index.esm.js.map
|