@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.66.4",
3
+ "version": "1.66.5",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -3386,7 +3386,7 @@ export class Connection {
3386
3386
 
3387
3387
  assert(decodedSignature.length === 64, 'signature has invalid length');
3388
3388
 
3389
- const subscriptionCommitment = commitment || this.commitment;
3389
+ const confirmationCommitment = commitment || this.commitment;
3390
3390
  let timeoutId;
3391
3391
  let signatureSubscriptionId: number | undefined;
3392
3392
  let disposeSignatureSubscriptionStateChangeObserver:
@@ -3410,7 +3410,7 @@ export class Connection {
3410
3410
  done = true;
3411
3411
  resolve({__type: TransactionStatus.PROCESSED, response});
3412
3412
  },
3413
- subscriptionCommitment,
3413
+ confirmationCommitment,
3414
3414
  );
3415
3415
  const subscriptionSetupPromise = new Promise<void>(
3416
3416
  resolveSubscriptionSetup => {
@@ -3438,10 +3438,36 @@ export class Connection {
3438
3438
  return;
3439
3439
  }
3440
3440
  const {context, value} = response;
3441
+ if (value == null) {
3442
+ return;
3443
+ }
3441
3444
  if (value?.err) {
3442
3445
  reject(value.err);
3443
- }
3444
- if (value) {
3446
+ } else {
3447
+ switch (confirmationCommitment) {
3448
+ case 'confirmed':
3449
+ case 'single':
3450
+ case 'singleGossip': {
3451
+ if (value.confirmationStatus === 'processed') {
3452
+ return;
3453
+ }
3454
+ break;
3455
+ }
3456
+ case 'finalized':
3457
+ case 'max':
3458
+ case 'root': {
3459
+ if (
3460
+ value.confirmationStatus === 'processed' ||
3461
+ value.confirmationStatus === 'confirmed'
3462
+ ) {
3463
+ return;
3464
+ }
3465
+ break;
3466
+ }
3467
+ // exhaust enums to ensure full coverage
3468
+ case 'processed':
3469
+ case 'recent':
3470
+ }
3445
3471
  done = true;
3446
3472
  resolve({
3447
3473
  __type: TransactionStatus.PROCESSED,
@@ -3463,7 +3489,7 @@ export class Connection {
3463
3489
  >(resolve => {
3464
3490
  if (typeof strategy === 'string') {
3465
3491
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
3466
- switch (subscriptionCommitment) {
3492
+ switch (confirmationCommitment) {
3467
3493
  case 'processed':
3468
3494
  case 'recent':
3469
3495
  case 'single':