@solana/web3.js 1.73.1-pr-29195.6 → 1.73.2

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.
@@ -2251,7 +2251,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2251
2251
 
2252
2252
  if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
2253
2253
  status = (await connection.confirmTransaction({
2254
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2254
+ abortSignal: options?.abortSignal,
2255
2255
  signature: signature,
2256
2256
  blockhash: transaction.recentBlockhash,
2257
2257
  lastValidBlockHeight: transaction.lastValidBlockHeight
@@ -2262,14 +2262,14 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2262
2262
  } = transaction.nonceInfo;
2263
2263
  const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
2264
2264
  status = (await connection.confirmTransaction({
2265
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2265
+ abortSignal: options?.abortSignal,
2266
2266
  minContextSlot: transaction.minNonceContextSlot,
2267
2267
  nonceAccountPubkey,
2268
2268
  nonceValue: transaction.nonceInfo.nonce,
2269
2269
  signature
2270
2270
  }, options && options.commitment)).value;
2271
2271
  } else {
2272
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
2272
+ if (options?.abortSignal != null) {
2273
2273
  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.');
2274
2274
  }
2275
2275
 
@@ -3575,9 +3575,7 @@ class RpcWebSocketClient extends RpcWebSocketCommonClient__default["default"] {
3575
3575
  }
3576
3576
 
3577
3577
  call(...args) {
3578
- var _this$underlyingSocke;
3579
-
3580
- const readyState = (_this$underlyingSocke = this.underlyingSocket) === null || _this$underlyingSocke === void 0 ? void 0 : _this$underlyingSocke.readyState;
3578
+ const readyState = this.underlyingSocket?.readyState;
3581
3579
 
3582
3580
  if (readyState === 1
3583
3581
  /* WebSocket.OPEN */
@@ -3589,9 +3587,7 @@ class RpcWebSocketClient extends RpcWebSocketCommonClient__default["default"] {
3589
3587
  }
3590
3588
 
3591
3589
  notify(...args) {
3592
- var _this$underlyingSocke2;
3593
-
3594
- const readyState = (_this$underlyingSocke2 = this.underlyingSocket) === null || _this$underlyingSocke2 === void 0 ? void 0 : _this$underlyingSocke2.readyState;
3590
+ const readyState = this.underlyingSocket?.readyState;
3595
3591
 
3596
3592
  if (readyState === 1
3597
3593
  /* WebSocket.OPEN */
@@ -3713,7 +3709,6 @@ function makeWebsocketUrl(endpoint) {
3713
3709
  return `${protocol}//${hostish}${websocketPort}${rest}`;
3714
3710
  }
3715
3711
 
3716
- var _process$env$npm_pack;
3717
3712
  const PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey), superstruct.string(), value => new PublicKey(value));
3718
3713
  const RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal('base64')]);
3719
3714
  const BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
@@ -4778,7 +4773,7 @@ const LogsNotificationResult = superstruct.type({
4778
4773
 
4779
4774
  /** @internal */
4780
4775
  const COMMON_HTTP_HEADERS = {
4781
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
4776
+ 'solana-client': `js/${"0.0.0-development" }`
4782
4777
  };
4783
4778
  /**
4784
4779
  * A connection to a fullnode JSON RPC endpoint
@@ -5324,7 +5319,7 @@ class Connection {
5324
5319
  const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
5325
5320
  /* encoding */
5326
5321
  , { ...config,
5327
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
5322
+ epoch: epoch != null ? epoch : config?.epoch
5328
5323
  });
5329
5324
 
5330
5325
  const unsafeRes = await this._rpcRequest('getStakeActivation', args);
@@ -5396,11 +5391,9 @@ class Connection {
5396
5391
  if (typeof strategy == 'string') {
5397
5392
  rawSignature = strategy;
5398
5393
  } else {
5399
- var _config$abortSignal;
5400
-
5401
5394
  const config = strategy;
5402
5395
 
5403
- if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
5396
+ if (config.abortSignal?.aborted) {
5404
5397
  return Promise.reject(config.abortSignal.reason);
5405
5398
  }
5406
5399
 
@@ -5502,7 +5495,7 @@ class Connection {
5502
5495
  return;
5503
5496
  }
5504
5497
 
5505
- if (value !== null && value !== void 0 && value.err) {
5498
+ if (value?.err) {
5506
5499
  reject(value.err);
5507
5500
  } else {
5508
5501
  switch (commitment) {
@@ -5652,7 +5645,7 @@ class Connection {
5652
5645
  minContextSlot
5653
5646
  });
5654
5647
  lastCheckedSlot = context.slot;
5655
- return nonceAccount === null || nonceAccount === void 0 ? void 0 : nonceAccount.nonce;
5648
+ return nonceAccount?.nonce;
5656
5649
  } catch (e) {
5657
5650
  // If for whatever reason we can't reach/read the nonce
5658
5651
  // account, just keep using the last-known value.
@@ -5697,22 +5690,18 @@ class Connection {
5697
5690
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
5698
5691
  result = outcome.response;
5699
5692
  } else {
5700
- var _signatureStatus;
5701
-
5702
5693
  // Double check that the transaction is indeed unconfirmed.
5703
5694
  let signatureStatus;
5704
5695
 
5705
5696
  while (true // eslint-disable-line no-constant-condition
5706
5697
  ) {
5707
- var _outcome$slotInWhichN;
5708
-
5709
5698
  const status = await this.getSignatureStatus(signature);
5710
5699
 
5711
5700
  if (status == null) {
5712
5701
  break;
5713
5702
  }
5714
5703
 
5715
- if (status.context.slot < ((_outcome$slotInWhichN = outcome.slotInWhichNonceDidAdvance) !== null && _outcome$slotInWhichN !== void 0 ? _outcome$slotInWhichN : minContextSlot)) {
5704
+ if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {
5716
5705
  await sleep(400);
5717
5706
  continue;
5718
5707
  }
@@ -5721,7 +5710,7 @@ class Connection {
5721
5710
  break;
5722
5711
  }
5723
5712
 
5724
- if ((_signatureStatus = signatureStatus) !== null && _signatureStatus !== void 0 && _signatureStatus.value) {
5713
+ if (signatureStatus?.value) {
5725
5714
  const commitmentForStatus = commitment || 'finalized';
5726
5715
  const {
5727
5716
  confirmationStatus
@@ -6034,7 +6023,7 @@ class Connection {
6034
6023
  const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
6035
6024
  /* encoding */
6036
6025
  , { ...config,
6037
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
6026
+ epoch: epoch != null ? epoch : config?.epoch
6038
6027
  });
6039
6028
 
6040
6029
  const unsafeRes = await this._rpcRequest('getInflationReward', args);
@@ -6331,7 +6320,7 @@ class Connection {
6331
6320
  const unsafeRes = await this._rpcRequest('getBlock', args);
6332
6321
 
6333
6322
  try {
6334
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
6323
+ switch (config?.transactionDetails) {
6335
6324
  case 'accounts':
6336
6325
  {
6337
6326
  const res = superstruct.create(unsafeRes, GetAccountsModeBlockRpcResult);
@@ -6401,7 +6390,7 @@ class Connection {
6401
6390
  const unsafeRes = await this._rpcRequest('getBlock', args);
6402
6391
 
6403
6392
  try {
6404
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
6393
+ switch (config?.transactionDetails) {
6405
6394
  case 'accounts':
6406
6395
  {
6407
6396
  const res = superstruct.create(unsafeRes, GetParsedAccountsModeBlockRpcResult);
@@ -7420,9 +7409,7 @@ class Connection {
7420
7409
 
7421
7410
 
7422
7411
  _setSubscription(hash, nextSubscription) {
7423
- var _this$_subscriptionsB;
7424
-
7425
- const prevState = (_this$_subscriptionsB = this._subscriptionsByHash[hash]) === null || _this$_subscriptionsB === void 0 ? void 0 : _this$_subscriptionsB.state;
7412
+ const prevState = this._subscriptionsByHash[hash]?.state;
7426
7413
  this._subscriptionsByHash[hash] = nextSubscription;
7427
7414
 
7428
7415
  if (prevState !== nextSubscription.state) {
@@ -7716,9 +7703,7 @@ class Connection {
7716
7703
  */
7717
7704
  args) {
7718
7705
  const clientSubscriptionId = this._nextClientSubscriptionId++;
7719
- const hash = fastStableStringify$1([subscriptionConfig.method, args], true
7720
- /* isArrayProp */
7721
- );
7706
+ const hash = fastStableStringify$1([subscriptionConfig.method, args]);
7722
7707
  const existingSubscription = this._subscriptionsByHash[hash];
7723
7708
 
7724
7709
  if (existingSubscription === undefined) {
@@ -8180,7 +8165,7 @@ class Keypair {
8180
8165
  */
8181
8166
  constructor(keypair) {
8182
8167
  this._keypair = void 0;
8183
- this._keypair = keypair !== null && keypair !== void 0 ? keypair : generateKeypair();
8168
+ this._keypair = keypair ?? generateKeypair();
8184
8169
  }
8185
8170
  /**
8186
8171
  * Generate a new random keypair