@solana/web3.js 1.68.1 → 1.69.0
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 +37 -7
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +37 -7
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +37 -7
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +239 -234
- package/lib/index.esm.js +37 -7
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +37 -7
- 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 +37 -7
- 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.browser.esm.js
CHANGED
|
@@ -2209,6 +2209,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2209
2209
|
|
|
2210
2210
|
if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
|
|
2211
2211
|
status = (await connection.confirmTransaction({
|
|
2212
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2212
2213
|
signature: signature,
|
|
2213
2214
|
blockhash: transaction.recentBlockhash,
|
|
2214
2215
|
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
@@ -2219,12 +2220,17 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2219
2220
|
} = transaction.nonceInfo;
|
|
2220
2221
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
2221
2222
|
status = (await connection.confirmTransaction({
|
|
2223
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2222
2224
|
minContextSlot: transaction.minNonceContextSlot,
|
|
2223
2225
|
nonceAccountPubkey,
|
|
2224
2226
|
nonceValue: transaction.nonceInfo.nonce,
|
|
2225
2227
|
signature
|
|
2226
2228
|
}, options && options.commitment)).value;
|
|
2227
2229
|
} else {
|
|
2230
|
+
if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
|
|
2231
|
+
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.');
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2228
2234
|
status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
2229
2235
|
}
|
|
2230
2236
|
|
|
@@ -3388,7 +3394,7 @@ function nextPowerOfTwo(n) {
|
|
|
3388
3394
|
/**
|
|
3389
3395
|
* Epoch schedule
|
|
3390
3396
|
* (see https://docs.solana.com/terminology#epoch)
|
|
3391
|
-
* Can be retrieved with the {@link
|
|
3397
|
+
* Can be retrieved with the {@link Connection.getEpochSchedule} method
|
|
3392
3398
|
*/
|
|
3393
3399
|
|
|
3394
3400
|
|
|
@@ -3660,13 +3666,10 @@ function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
|
3660
3666
|
};
|
|
3661
3667
|
}
|
|
3662
3668
|
/**
|
|
3663
|
-
*
|
|
3669
|
+
* @internal
|
|
3664
3670
|
*/
|
|
3665
3671
|
|
|
3666
3672
|
|
|
3667
|
-
/**
|
|
3668
|
-
* @internal
|
|
3669
|
-
*/
|
|
3670
3673
|
function createRpcResult(result) {
|
|
3671
3674
|
return union([type({
|
|
3672
3675
|
jsonrpc: literal('2.0'),
|
|
@@ -5273,7 +5276,14 @@ class Connection {
|
|
|
5273
5276
|
if (typeof strategy == 'string') {
|
|
5274
5277
|
rawSignature = strategy;
|
|
5275
5278
|
} else {
|
|
5279
|
+
var _config$abortSignal;
|
|
5280
|
+
|
|
5276
5281
|
const config = strategy;
|
|
5282
|
+
|
|
5283
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
5284
|
+
return Promise.reject(config.abortSignal.reason);
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5277
5287
|
rawSignature = config.signature;
|
|
5278
5288
|
}
|
|
5279
5289
|
|
|
@@ -5305,6 +5315,22 @@ class Connection {
|
|
|
5305
5315
|
}
|
|
5306
5316
|
}
|
|
5307
5317
|
|
|
5318
|
+
getCancellationPromise(signal) {
|
|
5319
|
+
return new Promise((_, reject) => {
|
|
5320
|
+
if (signal == null) {
|
|
5321
|
+
return;
|
|
5322
|
+
}
|
|
5323
|
+
|
|
5324
|
+
if (signal.aborted) {
|
|
5325
|
+
reject(signal.reason);
|
|
5326
|
+
} else {
|
|
5327
|
+
signal.addEventListener('abort', () => {
|
|
5328
|
+
reject(signal.reason);
|
|
5329
|
+
});
|
|
5330
|
+
}
|
|
5331
|
+
});
|
|
5332
|
+
}
|
|
5333
|
+
|
|
5308
5334
|
getTransactionConfirmationPromise({
|
|
5309
5335
|
commitment,
|
|
5310
5336
|
signature
|
|
@@ -5423,6 +5449,7 @@ class Connection {
|
|
|
5423
5449
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
5424
5450
|
commitment,
|
|
5425
5451
|
strategy: {
|
|
5452
|
+
abortSignal,
|
|
5426
5453
|
lastValidBlockHeight,
|
|
5427
5454
|
signature
|
|
5428
5455
|
}
|
|
@@ -5461,10 +5488,11 @@ class Connection {
|
|
|
5461
5488
|
commitment,
|
|
5462
5489
|
signature
|
|
5463
5490
|
});
|
|
5491
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5464
5492
|
let result;
|
|
5465
5493
|
|
|
5466
5494
|
try {
|
|
5467
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5495
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5468
5496
|
|
|
5469
5497
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5470
5498
|
result = outcome.response;
|
|
@@ -5482,6 +5510,7 @@ class Connection {
|
|
|
5482
5510
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
5483
5511
|
commitment,
|
|
5484
5512
|
strategy: {
|
|
5513
|
+
abortSignal,
|
|
5485
5514
|
minContextSlot,
|
|
5486
5515
|
nonceAccountPubkey,
|
|
5487
5516
|
nonceValue,
|
|
@@ -5539,10 +5568,11 @@ class Connection {
|
|
|
5539
5568
|
commitment,
|
|
5540
5569
|
signature
|
|
5541
5570
|
});
|
|
5571
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5542
5572
|
let result;
|
|
5543
5573
|
|
|
5544
5574
|
try {
|
|
5545
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5575
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5546
5576
|
|
|
5547
5577
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5548
5578
|
result = outcome.response;
|