@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.esm.js
CHANGED
|
@@ -2237,6 +2237,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2237
2237
|
|
|
2238
2238
|
if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
|
|
2239
2239
|
status = (await connection.confirmTransaction({
|
|
2240
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2240
2241
|
signature: signature,
|
|
2241
2242
|
blockhash: transaction.recentBlockhash,
|
|
2242
2243
|
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
@@ -2247,12 +2248,17 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2247
2248
|
} = transaction.nonceInfo;
|
|
2248
2249
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
2249
2250
|
status = (await connection.confirmTransaction({
|
|
2251
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2250
2252
|
minContextSlot: transaction.minNonceContextSlot,
|
|
2251
2253
|
nonceAccountPubkey,
|
|
2252
2254
|
nonceValue: transaction.nonceInfo.nonce,
|
|
2253
2255
|
signature
|
|
2254
2256
|
}, options && options.commitment)).value;
|
|
2255
2257
|
} else {
|
|
2258
|
+
if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
|
|
2259
|
+
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.');
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2256
2262
|
status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
2257
2263
|
}
|
|
2258
2264
|
|
|
@@ -3465,7 +3471,7 @@ function nextPowerOfTwo(n) {
|
|
|
3465
3471
|
/**
|
|
3466
3472
|
* Epoch schedule
|
|
3467
3473
|
* (see https://docs.solana.com/terminology#epoch)
|
|
3468
|
-
* Can be retrieved with the {@link
|
|
3474
|
+
* Can be retrieved with the {@link Connection.getEpochSchedule} method
|
|
3469
3475
|
*/
|
|
3470
3476
|
|
|
3471
3477
|
|
|
@@ -3740,13 +3746,10 @@ function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
|
3740
3746
|
};
|
|
3741
3747
|
}
|
|
3742
3748
|
/**
|
|
3743
|
-
*
|
|
3749
|
+
* @internal
|
|
3744
3750
|
*/
|
|
3745
3751
|
|
|
3746
3752
|
|
|
3747
|
-
/**
|
|
3748
|
-
* @internal
|
|
3749
|
-
*/
|
|
3750
3753
|
function createRpcResult(result) {
|
|
3751
3754
|
return union([type({
|
|
3752
3755
|
jsonrpc: literal('2.0'),
|
|
@@ -4745,7 +4748,7 @@ const LogsNotificationResult = type({
|
|
|
4745
4748
|
|
|
4746
4749
|
/** @internal */
|
|
4747
4750
|
const COMMON_HTTP_HEADERS = {
|
|
4748
|
-
'solana-client': `js/${(_process$env$npm_pack = "1.
|
|
4751
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.69.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4749
4752
|
};
|
|
4750
4753
|
/**
|
|
4751
4754
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -5361,7 +5364,14 @@ class Connection {
|
|
|
5361
5364
|
if (typeof strategy == 'string') {
|
|
5362
5365
|
rawSignature = strategy;
|
|
5363
5366
|
} else {
|
|
5367
|
+
var _config$abortSignal;
|
|
5368
|
+
|
|
5364
5369
|
const config = strategy;
|
|
5370
|
+
|
|
5371
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
5372
|
+
return Promise.reject(config.abortSignal.reason);
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5365
5375
|
rawSignature = config.signature;
|
|
5366
5376
|
}
|
|
5367
5377
|
|
|
@@ -5393,6 +5403,22 @@ class Connection {
|
|
|
5393
5403
|
}
|
|
5394
5404
|
}
|
|
5395
5405
|
|
|
5406
|
+
getCancellationPromise(signal) {
|
|
5407
|
+
return new Promise((_, reject) => {
|
|
5408
|
+
if (signal == null) {
|
|
5409
|
+
return;
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
if (signal.aborted) {
|
|
5413
|
+
reject(signal.reason);
|
|
5414
|
+
} else {
|
|
5415
|
+
signal.addEventListener('abort', () => {
|
|
5416
|
+
reject(signal.reason);
|
|
5417
|
+
});
|
|
5418
|
+
}
|
|
5419
|
+
});
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5396
5422
|
getTransactionConfirmationPromise({
|
|
5397
5423
|
commitment,
|
|
5398
5424
|
signature
|
|
@@ -5511,6 +5537,7 @@ class Connection {
|
|
|
5511
5537
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
5512
5538
|
commitment,
|
|
5513
5539
|
strategy: {
|
|
5540
|
+
abortSignal,
|
|
5514
5541
|
lastValidBlockHeight,
|
|
5515
5542
|
signature
|
|
5516
5543
|
}
|
|
@@ -5549,10 +5576,11 @@ class Connection {
|
|
|
5549
5576
|
commitment,
|
|
5550
5577
|
signature
|
|
5551
5578
|
});
|
|
5579
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5552
5580
|
let result;
|
|
5553
5581
|
|
|
5554
5582
|
try {
|
|
5555
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5583
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5556
5584
|
|
|
5557
5585
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5558
5586
|
result = outcome.response;
|
|
@@ -5570,6 +5598,7 @@ class Connection {
|
|
|
5570
5598
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
5571
5599
|
commitment,
|
|
5572
5600
|
strategy: {
|
|
5601
|
+
abortSignal,
|
|
5573
5602
|
minContextSlot,
|
|
5574
5603
|
nonceAccountPubkey,
|
|
5575
5604
|
nonceValue,
|
|
@@ -5627,10 +5656,11 @@ class Connection {
|
|
|
5627
5656
|
commitment,
|
|
5628
5657
|
signature
|
|
5629
5658
|
});
|
|
5659
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5630
5660
|
let result;
|
|
5631
5661
|
|
|
5632
5662
|
try {
|
|
5633
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5663
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5634
5664
|
|
|
5635
5665
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5636
5666
|
result = outcome.response;
|