@solana/web3.js 1.66.4 → 1.66.5

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.
@@ -5213,7 +5213,7 @@ class Connection {
5213
5213
  }
5214
5214
 
5215
5215
  assert(decodedSignature.length === 64, 'signature has invalid length');
5216
- const subscriptionCommitment = commitment || this.commitment;
5216
+ const confirmationCommitment = commitment || this.commitment;
5217
5217
  let timeoutId;
5218
5218
  let signatureSubscriptionId;
5219
5219
  let disposeSignatureSubscriptionStateChangeObserver;
@@ -5231,7 +5231,7 @@ class Connection {
5231
5231
  __type: exports.TransactionStatus.PROCESSED,
5232
5232
  response
5233
5233
  });
5234
- }, subscriptionCommitment);
5234
+ }, confirmationCommitment);
5235
5235
  const subscriptionSetupPromise = new Promise(resolveSubscriptionSetup => {
5236
5236
  if (signatureSubscriptionId == null) {
5237
5237
  resolveSubscriptionSetup();
@@ -5259,11 +5259,41 @@ class Connection {
5259
5259
  value
5260
5260
  } = response;
5261
5261
 
5262
+ if (value == null) {
5263
+ return;
5264
+ }
5265
+
5262
5266
  if (value !== null && value !== void 0 && value.err) {
5263
5267
  reject(value.err);
5264
- }
5268
+ } else {
5269
+ switch (confirmationCommitment) {
5270
+ case 'confirmed':
5271
+ case 'single':
5272
+ case 'singleGossip':
5273
+ {
5274
+ if (value.confirmationStatus === 'processed') {
5275
+ return;
5276
+ }
5277
+
5278
+ break;
5279
+ }
5280
+
5281
+ case 'finalized':
5282
+ case 'max':
5283
+ case 'root':
5284
+ {
5285
+ if (value.confirmationStatus === 'processed' || value.confirmationStatus === 'confirmed') {
5286
+ return;
5287
+ }
5288
+
5289
+ break;
5290
+ }
5291
+ // exhaust enums to ensure full coverage
5292
+
5293
+ case 'processed':
5294
+ case 'recent':
5295
+ }
5265
5296
 
5266
- if (value) {
5267
5297
  done = true;
5268
5298
  resolve({
5269
5299
  __type: exports.TransactionStatus.PROCESSED,
@@ -5282,7 +5312,7 @@ class Connection {
5282
5312
  if (typeof strategy === 'string') {
5283
5313
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
5284
5314
 
5285
- switch (subscriptionCommitment) {
5315
+ switch (confirmationCommitment) {
5286
5316
  case 'processed':
5287
5317
  case 'recent':
5288
5318
  case 'single':