@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.iife.js CHANGED
@@ -12722,6 +12722,7 @@ var solanaWeb3 = (function (exports) {
12722
12722
 
12723
12723
  if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
12724
12724
  status = (await connection.confirmTransaction({
12725
+ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
12725
12726
  signature: signature,
12726
12727
  blockhash: transaction.recentBlockhash,
12727
12728
  lastValidBlockHeight: transaction.lastValidBlockHeight
@@ -12732,12 +12733,17 @@ var solanaWeb3 = (function (exports) {
12732
12733
  } = transaction.nonceInfo;
12733
12734
  const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
12734
12735
  status = (await connection.confirmTransaction({
12736
+ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
12735
12737
  minContextSlot: transaction.minNonceContextSlot,
12736
12738
  nonceAccountPubkey,
12737
12739
  nonceValue: transaction.nonceInfo.nonce,
12738
12740
  signature
12739
12741
  }, options && options.commitment)).value;
12740
12742
  } else {
12743
+ if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
12744
+ 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.');
12745
+ }
12746
+
12741
12747
  status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
12742
12748
  }
12743
12749
 
@@ -17066,7 +17072,7 @@ var solanaWeb3 = (function (exports) {
17066
17072
  /**
17067
17073
  * Epoch schedule
17068
17074
  * (see https://docs.solana.com/terminology#epoch)
17069
- * Can be retrieved with the {@link connection.getEpochSchedule} method
17075
+ * Can be retrieved with the {@link Connection.getEpochSchedule} method
17070
17076
  */
17071
17077
 
17072
17078
 
@@ -17338,13 +17344,10 @@ var solanaWeb3 = (function (exports) {
17338
17344
  };
17339
17345
  }
17340
17346
  /**
17341
- * A strategy for confirming durable nonce transactions.
17347
+ * @internal
17342
17348
  */
17343
17349
 
17344
17350
 
17345
- /**
17346
- * @internal
17347
- */
17348
17351
  function createRpcResult(result) {
17349
17352
  return union([type({
17350
17353
  jsonrpc: literal('2.0'),
@@ -18335,7 +18338,7 @@ var solanaWeb3 = (function (exports) {
18335
18338
 
18336
18339
  /** @internal */
18337
18340
  const COMMON_HTTP_HEADERS = {
18338
- 'solana-client': `js/${(_process$env$npm_pack = "1.68.2") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
18341
+ 'solana-client': `js/${(_process$env$npm_pack = "1.69.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
18339
18342
  };
18340
18343
  /**
18341
18344
  * A connection to a fullnode JSON RPC endpoint
@@ -18951,7 +18954,14 @@ var solanaWeb3 = (function (exports) {
18951
18954
  if (typeof strategy == 'string') {
18952
18955
  rawSignature = strategy;
18953
18956
  } else {
18957
+ var _config$abortSignal;
18958
+
18954
18959
  const config = strategy;
18960
+
18961
+ if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
18962
+ return Promise.reject(config.abortSignal.reason);
18963
+ }
18964
+
18955
18965
  rawSignature = config.signature;
18956
18966
  }
18957
18967
 
@@ -18983,6 +18993,22 @@ var solanaWeb3 = (function (exports) {
18983
18993
  }
18984
18994
  }
18985
18995
 
18996
+ getCancellationPromise(signal) {
18997
+ return new Promise((_, reject) => {
18998
+ if (signal == null) {
18999
+ return;
19000
+ }
19001
+
19002
+ if (signal.aborted) {
19003
+ reject(signal.reason);
19004
+ } else {
19005
+ signal.addEventListener('abort', () => {
19006
+ reject(signal.reason);
19007
+ });
19008
+ }
19009
+ });
19010
+ }
19011
+
18986
19012
  getTransactionConfirmationPromise({
18987
19013
  commitment,
18988
19014
  signature
@@ -19101,6 +19127,7 @@ var solanaWeb3 = (function (exports) {
19101
19127
  async confirmTransactionUsingBlockHeightExceedanceStrategy({
19102
19128
  commitment,
19103
19129
  strategy: {
19130
+ abortSignal,
19104
19131
  lastValidBlockHeight,
19105
19132
  signature
19106
19133
  }
@@ -19139,10 +19166,11 @@ var solanaWeb3 = (function (exports) {
19139
19166
  commitment,
19140
19167
  signature
19141
19168
  });
19169
+ const cancellationPromise = this.getCancellationPromise(abortSignal);
19142
19170
  let result;
19143
19171
 
19144
19172
  try {
19145
- const outcome = await Promise.race([confirmationPromise, expiryPromise]);
19173
+ const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
19146
19174
 
19147
19175
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
19148
19176
  result = outcome.response;
@@ -19160,6 +19188,7 @@ var solanaWeb3 = (function (exports) {
19160
19188
  async confirmTransactionUsingDurableNonceStrategy({
19161
19189
  commitment,
19162
19190
  strategy: {
19191
+ abortSignal,
19163
19192
  minContextSlot,
19164
19193
  nonceAccountPubkey,
19165
19194
  nonceValue,
@@ -19217,10 +19246,11 @@ var solanaWeb3 = (function (exports) {
19217
19246
  commitment,
19218
19247
  signature
19219
19248
  });
19249
+ const cancellationPromise = this.getCancellationPromise(abortSignal);
19220
19250
  let result;
19221
19251
 
19222
19252
  try {
19223
- const outcome = await Promise.race([confirmationPromise, expiryPromise]);
19253
+ const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
19224
19254
 
19225
19255
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
19226
19256
  result = outcome.response;