@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.browser.esm.js
CHANGED
|
@@ -2234,6 +2234,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2234
2234
|
|
|
2235
2235
|
if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
|
|
2236
2236
|
status = (await connection.confirmTransaction({
|
|
2237
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2237
2238
|
signature: signature,
|
|
2238
2239
|
blockhash: transaction.recentBlockhash,
|
|
2239
2240
|
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
@@ -2244,12 +2245,17 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
2244
2245
|
} = transaction.nonceInfo;
|
|
2245
2246
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
2246
2247
|
status = (await connection.confirmTransaction({
|
|
2248
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
2247
2249
|
minContextSlot: transaction.minNonceContextSlot,
|
|
2248
2250
|
nonceAccountPubkey,
|
|
2249
2251
|
nonceValue: transaction.nonceInfo.nonce,
|
|
2250
2252
|
signature
|
|
2251
2253
|
}, options && options.commitment)).value;
|
|
2252
2254
|
} else {
|
|
2255
|
+
if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
|
|
2256
|
+
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.');
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2253
2259
|
status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
2254
2260
|
}
|
|
2255
2261
|
|
|
@@ -3413,7 +3419,7 @@ function nextPowerOfTwo(n) {
|
|
|
3413
3419
|
/**
|
|
3414
3420
|
* Epoch schedule
|
|
3415
3421
|
* (see https://docs.solana.com/terminology#epoch)
|
|
3416
|
-
* Can be retrieved with the {@link
|
|
3422
|
+
* Can be retrieved with the {@link Connection.getEpochSchedule} method
|
|
3417
3423
|
*/
|
|
3418
3424
|
|
|
3419
3425
|
|
|
@@ -3685,13 +3691,10 @@ function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
|
3685
3691
|
};
|
|
3686
3692
|
}
|
|
3687
3693
|
/**
|
|
3688
|
-
*
|
|
3694
|
+
* @internal
|
|
3689
3695
|
*/
|
|
3690
3696
|
|
|
3691
3697
|
|
|
3692
|
-
/**
|
|
3693
|
-
* @internal
|
|
3694
|
-
*/
|
|
3695
3698
|
function createRpcResult(result) {
|
|
3696
3699
|
return union([type({
|
|
3697
3700
|
jsonrpc: literal('2.0'),
|
|
@@ -4682,7 +4685,7 @@ const LogsNotificationResult = type({
|
|
|
4682
4685
|
|
|
4683
4686
|
/** @internal */
|
|
4684
4687
|
const COMMON_HTTP_HEADERS = {
|
|
4685
|
-
'solana-client': `js/${(_process$env$npm_pack = "1.
|
|
4688
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.69.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4686
4689
|
};
|
|
4687
4690
|
/**
|
|
4688
4691
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -5298,7 +5301,14 @@ class Connection {
|
|
|
5298
5301
|
if (typeof strategy == 'string') {
|
|
5299
5302
|
rawSignature = strategy;
|
|
5300
5303
|
} else {
|
|
5304
|
+
var _config$abortSignal;
|
|
5305
|
+
|
|
5301
5306
|
const config = strategy;
|
|
5307
|
+
|
|
5308
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
5309
|
+
return Promise.reject(config.abortSignal.reason);
|
|
5310
|
+
}
|
|
5311
|
+
|
|
5302
5312
|
rawSignature = config.signature;
|
|
5303
5313
|
}
|
|
5304
5314
|
|
|
@@ -5330,6 +5340,22 @@ class Connection {
|
|
|
5330
5340
|
}
|
|
5331
5341
|
}
|
|
5332
5342
|
|
|
5343
|
+
getCancellationPromise(signal) {
|
|
5344
|
+
return new Promise((_, reject) => {
|
|
5345
|
+
if (signal == null) {
|
|
5346
|
+
return;
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
if (signal.aborted) {
|
|
5350
|
+
reject(signal.reason);
|
|
5351
|
+
} else {
|
|
5352
|
+
signal.addEventListener('abort', () => {
|
|
5353
|
+
reject(signal.reason);
|
|
5354
|
+
});
|
|
5355
|
+
}
|
|
5356
|
+
});
|
|
5357
|
+
}
|
|
5358
|
+
|
|
5333
5359
|
getTransactionConfirmationPromise({
|
|
5334
5360
|
commitment,
|
|
5335
5361
|
signature
|
|
@@ -5448,6 +5474,7 @@ class Connection {
|
|
|
5448
5474
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
5449
5475
|
commitment,
|
|
5450
5476
|
strategy: {
|
|
5477
|
+
abortSignal,
|
|
5451
5478
|
lastValidBlockHeight,
|
|
5452
5479
|
signature
|
|
5453
5480
|
}
|
|
@@ -5486,10 +5513,11 @@ class Connection {
|
|
|
5486
5513
|
commitment,
|
|
5487
5514
|
signature
|
|
5488
5515
|
});
|
|
5516
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5489
5517
|
let result;
|
|
5490
5518
|
|
|
5491
5519
|
try {
|
|
5492
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5520
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5493
5521
|
|
|
5494
5522
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5495
5523
|
result = outcome.response;
|
|
@@ -5507,6 +5535,7 @@ class Connection {
|
|
|
5507
5535
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
5508
5536
|
commitment,
|
|
5509
5537
|
strategy: {
|
|
5538
|
+
abortSignal,
|
|
5510
5539
|
minContextSlot,
|
|
5511
5540
|
nonceAccountPubkey,
|
|
5512
5541
|
nonceValue,
|
|
@@ -5564,10 +5593,11 @@ class Connection {
|
|
|
5564
5593
|
commitment,
|
|
5565
5594
|
signature
|
|
5566
5595
|
});
|
|
5596
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
5567
5597
|
let result;
|
|
5568
5598
|
|
|
5569
5599
|
try {
|
|
5570
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
5600
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
5571
5601
|
|
|
5572
5602
|
if (outcome.__type === TransactionStatus.PROCESSED) {
|
|
5573
5603
|
result = outcome.response;
|