@solana/web3.js 1.68.2 → 1.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.browser.cjs.js +38 -8
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +38 -8
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +38 -8
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +239 -234
- package/lib/index.esm.js +38 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +38 -8
- 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/lib/index.native.js +38 -8
- package/lib/index.native.js.map +1 -1
- package/package.json +5 -4
- package/src/connection.ts +70 -28
- package/src/epoch-schedule.ts +1 -1
- package/src/utils/send-and-confirm-transaction.ts +14 -1
package/lib/index.native.js
CHANGED
|
@@ -2264,6 +2264,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2264
2264
|
|
|
2265
2265
|
if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
|
|
2266
2266
|
status = (await connection.confirmTransaction({
|
|
2267
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2267
2268
|
signature: signature,
|
|
2268
2269
|
blockhash: transaction.recentBlockhash,
|
|
2269
2270
|
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
@@ -2274,12 +2275,17 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2274
2275
|
} = transaction.nonceInfo;
|
|
2275
2276
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
2276
2277
|
status = (await connection.confirmTransaction({
|
|
2278
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2277
2279
|
minContextSlot: transaction.minNonceContextSlot,
|
|
2278
2280
|
nonceAccountPubkey,
|
|
2279
2281
|
nonceValue: transaction.nonceInfo.nonce,
|
|
2280
2282
|
signature
|
|
2281
2283
|
}, options && options.commitment)).value;
|
|
2282
2284
|
} else {
|
|
2285
|
+
if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
|
|
2286
|
+
console.warn('sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was ' + 'supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` ' + 'or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.');
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2283
2289
|
status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
2284
2290
|
}
|
|
2285
2291
|
|
|
@@ -3443,7 +3449,7 @@ function nextPowerOfTwo(n) {
|
|
|
3443
3449
|
/**
|
|
3444
3450
|
* Epoch schedule
|
|
3445
3451
|
* (see https://docs.solana.com/terminology#epoch)
|
|
3446
|
-
* Can be retrieved with the {@link
|
|
3452
|
+
* Can be retrieved with the {@link Connection.getEpochSchedule} method
|
|
3447
3453
|
*/
|
|
3448
3454
|
|
|
3449
3455
|
|
|
@@ -3715,13 +3721,10 @@ function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
|
3715
3721
|
};
|
|
3716
3722
|
}
|
|
3717
3723
|
/**
|
|
3718
|
-
*
|
|
3724
|
+
* @internal
|
|
3719
3725
|
*/
|
|
3720
3726
|
|
|
3721
3727
|
|
|
3722
|
-
/**
|
|
3723
|
-
* @internal
|
|
3724
|
-
*/
|
|
3725
3728
|
function createRpcResult(result) {
|
|
3726
3729
|
return superstruct.union([superstruct.type({
|
|
3727
3730
|
jsonrpc: superstruct.literal('2.0'),
|
|
@@ -4712,7 +4715,7 @@ const LogsNotificationResult = superstruct.type({
|
|
|
4712
4715
|
|
|
4713
4716
|
/** @internal */
|
|
4714
4717
|
const COMMON_HTTP_HEADERS = {
|
|
4715
|
-
'solana-client': `js/${(_process$env$npm_pack = "1.
|
|
4718
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.69.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4716
4719
|
};
|
|
4717
4720
|
/**
|
|
4718
4721
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -5328,7 +5331,14 @@ class Connection {
|
|
|
5328
5331
|
if (typeof strategy == 'string') {
|
|
5329
5332
|
rawSignature = strategy;
|
|
5330
5333
|
} else {
|
|
5334
|
+
var _config$abortSignal;
|
|
5335
|
+
|
|
5331
5336
|
const config = strategy;
|
|
5337
|
+
|
|
5338
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
5339
|
+
return Promise.reject(config.abortSignal.reason);
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5332
5342
|
rawSignature = config.signature;
|
|
5333
5343
|
}
|
|
5334
5344
|
|
|
@@ -5360,6 +5370,22 @@ class Connection {
|
|
|
5360
5370
|
}
|
|
5361
5371
|
}
|
|
5362
5372
|
|
|
5373
|
+
getCancellationPromise(signal) {
|
|
5374
|
+
return new Promise((_, reject) => {
|
|
5375
|
+
if (signal == null) {
|
|
5376
|
+
return;
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5379
|
+
if (signal.aborted) {
|
|
5380
|
+
reject(signal.reason);
|
|
5381
|
+
} else {
|
|
5382
|
+
signal.addEventListener('abort', () => {
|
|
5383
|
+
reject(signal.reason);
|
|
5384
|
+
});
|
|
5385
|
+
}
|
|
5386
|
+
});
|
|
5387
|
+
}
|
|
5388
|
+
|
|
5363
5389
|
getTransactionConfirmationPromise({
|
|
5364
5390
|
commitment,
|
|
5365
5391
|
signature
|
|
@@ -5478,6 +5504,7 @@ class Connection {
|
|
|
5478
5504
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
5479
5505
|
commitment,
|
|
5480
5506
|
strategy: {
|
|
5507
|
+
abortSignal,
|
|
5481
5508
|
lastValidBlockHeight,
|
|
5482
5509
|
signature
|
|
5483
5510
|
}
|
|
@@ -5516,10 +5543,11 @@ class Connection {
|
|
|
5516
5543
|
commitment,
|
|
5517
5544
|
signature
|
|
5518
5545
|
});
|
|
5546
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5519
5547
|
let result;
|
|
5520
5548
|
|
|
5521
5549
|
try {
|
|
5522
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5550
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5523
5551
|
|
|
5524
5552
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
5525
5553
|
result = outcome.response;
|
|
@@ -5537,6 +5565,7 @@ class Connection {
|
|
|
5537
5565
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
5538
5566
|
commitment,
|
|
5539
5567
|
strategy: {
|
|
5568
|
+
abortSignal,
|
|
5540
5569
|
minContextSlot,
|
|
5541
5570
|
nonceAccountPubkey,
|
|
5542
5571
|
nonceValue,
|
|
@@ -5594,10 +5623,11 @@ class Connection {
|
|
|
5594
5623
|
commitment,
|
|
5595
5624
|
signature
|
|
5596
5625
|
});
|
|
5626
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5597
5627
|
let result;
|
|
5598
5628
|
|
|
5599
5629
|
try {
|
|
5600
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5630
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5601
5631
|
|
|
5602
5632
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
5603
5633
|
result = outcome.response;
|