@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.iife.js CHANGED
@@ -12697,6 +12697,7 @@ var solanaWeb3 = (function (exports) {
12697
12697
 
12698
12698
  if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
12699
12699
  status = (await connection.confirmTransaction({
12700
+ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
12700
12701
  signature: signature,
12701
12702
  blockhash: transaction.recentBlockhash,
12702
12703
  lastValidBlockHeight: transaction.lastValidBlockHeight
@@ -12707,12 +12708,17 @@ var solanaWeb3 = (function (exports) {
12707
12708
  } = transaction.nonceInfo;
12708
12709
  const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
12709
12710
  status = (await connection.confirmTransaction({
12711
+ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
12710
12712
  minContextSlot: transaction.minNonceContextSlot,
12711
12713
  nonceAccountPubkey,
12712
12714
  nonceValue: transaction.nonceInfo.nonce,
12713
12715
  signature
12714
12716
  }, options && options.commitment)).value;
12715
12717
  } else {
12718
+ if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
12719
+ 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.');
12720
+ }
12721
+
12716
12722
  status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
12717
12723
  }
12718
12724
 
@@ -17041,7 +17047,7 @@ var solanaWeb3 = (function (exports) {
17041
17047
  /**
17042
17048
  * Epoch schedule
17043
17049
  * (see https://docs.solana.com/terminology#epoch)
17044
- * Can be retrieved with the {@link connection.getEpochSchedule} method
17050
+ * Can be retrieved with the {@link Connection.getEpochSchedule} method
17045
17051
  */
17046
17052
 
17047
17053
 
@@ -17313,13 +17319,10 @@ var solanaWeb3 = (function (exports) {
17313
17319
  };
17314
17320
  }
17315
17321
  /**
17316
- * A strategy for confirming durable nonce transactions.
17322
+ * @internal
17317
17323
  */
17318
17324
 
17319
17325
 
17320
- /**
17321
- * @internal
17322
- */
17323
17326
  function createRpcResult(result) {
17324
17327
  return union([type({
17325
17328
  jsonrpc: literal('2.0'),
@@ -18926,7 +18929,14 @@ var solanaWeb3 = (function (exports) {
18926
18929
  if (typeof strategy == 'string') {
18927
18930
  rawSignature = strategy;
18928
18931
  } else {
18932
+ var _config$abortSignal;
18933
+
18929
18934
  const config = strategy;
18935
+
18936
+ if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
18937
+ return Promise.reject(config.abortSignal.reason);
18938
+ }
18939
+
18930
18940
  rawSignature = config.signature;
18931
18941
  }
18932
18942
 
@@ -18958,6 +18968,22 @@ var solanaWeb3 = (function (exports) {
18958
18968
  }
18959
18969
  }
18960
18970
 
18971
+ getCancellationPromise(signal) {
18972
+ return new Promise((_, reject) => {
18973
+ if (signal == null) {
18974
+ return;
18975
+ }
18976
+
18977
+ if (signal.aborted) {
18978
+ reject(signal.reason);
18979
+ } else {
18980
+ signal.addEventListener('abort', () => {
18981
+ reject(signal.reason);
18982
+ });
18983
+ }
18984
+ });
18985
+ }
18986
+
18961
18987
  getTransactionConfirmationPromise({
18962
18988
  commitment,
18963
18989
  signature
@@ -19076,6 +19102,7 @@ var solanaWeb3 = (function (exports) {
19076
19102
  async confirmTransactionUsingBlockHeightExceedanceStrategy({
19077
19103
  commitment,
19078
19104
  strategy: {
19105
+ abortSignal,
19079
19106
  lastValidBlockHeight,
19080
19107
  signature
19081
19108
  }
@@ -19114,10 +19141,11 @@ var solanaWeb3 = (function (exports) {
19114
19141
  commitment,
19115
19142
  signature
19116
19143
  });
19144
+ const cancellationPromise = this.getCancellationPromise(abortSignal);
19117
19145
  let result;
19118
19146
 
19119
19147
  try {
19120
- const outcome = await Promise.race([confirmationPromise, expiryPromise]);
19148
+ const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
19121
19149
 
19122
19150
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
19123
19151
  result = outcome.response;
@@ -19135,6 +19163,7 @@ var solanaWeb3 = (function (exports) {
19135
19163
  async confirmTransactionUsingDurableNonceStrategy({
19136
19164
  commitment,
19137
19165
  strategy: {
19166
+ abortSignal,
19138
19167
  minContextSlot,
19139
19168
  nonceAccountPubkey,
19140
19169
  nonceValue,
@@ -19192,10 +19221,11 @@ var solanaWeb3 = (function (exports) {
19192
19221
  commitment,
19193
19222
  signature
19194
19223
  });
19224
+ const cancellationPromise = this.getCancellationPromise(abortSignal);
19195
19225
  let result;
19196
19226
 
19197
19227
  try {
19198
- const outcome = await Promise.race([confirmationPromise, expiryPromise]);
19228
+ const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
19199
19229
 
19200
19230
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
19201
19231
  result = outcome.response;