@solana/web3.js 1.73.0 → 1.73.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.
@@ -2248,7 +2248,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2248
2248
 
2249
2249
  if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
2250
2250
  status = (await connection.confirmTransaction({
2251
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2251
+ abortSignal: options?.abortSignal,
2252
2252
  signature: signature,
2253
2253
  blockhash: transaction.recentBlockhash,
2254
2254
  lastValidBlockHeight: transaction.lastValidBlockHeight
@@ -2259,14 +2259,14 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2259
2259
  } = transaction.nonceInfo;
2260
2260
  const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
2261
2261
  status = (await connection.confirmTransaction({
2262
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2262
+ abortSignal: options?.abortSignal,
2263
2263
  minContextSlot: transaction.minNonceContextSlot,
2264
2264
  nonceAccountPubkey,
2265
2265
  nonceValue: transaction.nonceInfo.nonce,
2266
2266
  signature
2267
2267
  }, options && options.commitment)).value;
2268
2268
  } else {
2269
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
2269
+ if (options?.abortSignal != null) {
2270
2270
  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.');
2271
2271
  }
2272
2272
 
@@ -3656,7 +3656,6 @@ function makeWebsocketUrl(endpoint) {
3656
3656
  return `${protocol}//${hostish}${websocketPort}${rest}`;
3657
3657
  }
3658
3658
 
3659
- var _process$env$npm_pack;
3660
3659
  const PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey), superstruct.string(), value => new PublicKey(value));
3661
3660
  const RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal('base64')]);
3662
3661
  const BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
@@ -4721,7 +4720,7 @@ const LogsNotificationResult = superstruct.type({
4721
4720
 
4722
4721
  /** @internal */
4723
4722
  const COMMON_HTTP_HEADERS = {
4724
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
4723
+ 'solana-client': `js/${"0.0.0-development" }`
4725
4724
  };
4726
4725
  /**
4727
4726
  * A connection to a fullnode JSON RPC endpoint
@@ -5267,7 +5266,7 @@ class Connection {
5267
5266
  const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
5268
5267
  /* encoding */
5269
5268
  , { ...config,
5270
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
5269
+ epoch: epoch != null ? epoch : config?.epoch
5271
5270
  });
5272
5271
 
5273
5272
  const unsafeRes = await this._rpcRequest('getStakeActivation', args);
@@ -5339,11 +5338,9 @@ class Connection {
5339
5338
  if (typeof strategy == 'string') {
5340
5339
  rawSignature = strategy;
5341
5340
  } else {
5342
- var _config$abortSignal;
5343
-
5344
5341
  const config = strategy;
5345
5342
 
5346
- if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
5343
+ if (config.abortSignal?.aborted) {
5347
5344
  return Promise.reject(config.abortSignal.reason);
5348
5345
  }
5349
5346
 
@@ -5445,7 +5442,7 @@ class Connection {
5445
5442
  return;
5446
5443
  }
5447
5444
 
5448
- if (value !== null && value !== void 0 && value.err) {
5445
+ if (value?.err) {
5449
5446
  reject(value.err);
5450
5447
  } else {
5451
5448
  switch (commitment) {
@@ -5595,7 +5592,7 @@ class Connection {
5595
5592
  minContextSlot
5596
5593
  });
5597
5594
  lastCheckedSlot = context.slot;
5598
- return nonceAccount === null || nonceAccount === void 0 ? void 0 : nonceAccount.nonce;
5595
+ return nonceAccount?.nonce;
5599
5596
  } catch (e) {
5600
5597
  // If for whatever reason we can't reach/read the nonce
5601
5598
  // account, just keep using the last-known value.
@@ -5640,22 +5637,18 @@ class Connection {
5640
5637
  if (outcome.__type === exports.TransactionStatus.PROCESSED) {
5641
5638
  result = outcome.response;
5642
5639
  } else {
5643
- var _signatureStatus;
5644
-
5645
5640
  // Double check that the transaction is indeed unconfirmed.
5646
5641
  let signatureStatus;
5647
5642
 
5648
5643
  while (true // eslint-disable-line no-constant-condition
5649
5644
  ) {
5650
- var _outcome$slotInWhichN;
5651
-
5652
5645
  const status = await this.getSignatureStatus(signature);
5653
5646
 
5654
5647
  if (status == null) {
5655
5648
  break;
5656
5649
  }
5657
5650
 
5658
- if (status.context.slot < ((_outcome$slotInWhichN = outcome.slotInWhichNonceDidAdvance) !== null && _outcome$slotInWhichN !== void 0 ? _outcome$slotInWhichN : minContextSlot)) {
5651
+ if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {
5659
5652
  await sleep(400);
5660
5653
  continue;
5661
5654
  }
@@ -5664,7 +5657,7 @@ class Connection {
5664
5657
  break;
5665
5658
  }
5666
5659
 
5667
- if ((_signatureStatus = signatureStatus) !== null && _signatureStatus !== void 0 && _signatureStatus.value) {
5660
+ if (signatureStatus?.value) {
5668
5661
  const commitmentForStatus = commitment || 'finalized';
5669
5662
  const {
5670
5663
  confirmationStatus
@@ -5977,7 +5970,7 @@ class Connection {
5977
5970
  const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
5978
5971
  /* encoding */
5979
5972
  , { ...config,
5980
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
5973
+ epoch: epoch != null ? epoch : config?.epoch
5981
5974
  });
5982
5975
 
5983
5976
  const unsafeRes = await this._rpcRequest('getInflationReward', args);
@@ -6274,7 +6267,7 @@ class Connection {
6274
6267
  const unsafeRes = await this._rpcRequest('getBlock', args);
6275
6268
 
6276
6269
  try {
6277
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
6270
+ switch (config?.transactionDetails) {
6278
6271
  case 'accounts':
6279
6272
  {
6280
6273
  const res = superstruct.create(unsafeRes, GetAccountsModeBlockRpcResult);
@@ -6344,7 +6337,7 @@ class Connection {
6344
6337
  const unsafeRes = await this._rpcRequest('getBlock', args);
6345
6338
 
6346
6339
  try {
6347
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
6340
+ switch (config?.transactionDetails) {
6348
6341
  case 'accounts':
6349
6342
  {
6350
6343
  const res = superstruct.create(unsafeRes, GetParsedAccountsModeBlockRpcResult);
@@ -7359,9 +7352,7 @@ class Connection {
7359
7352
 
7360
7353
 
7361
7354
  _setSubscription(hash, nextSubscription) {
7362
- var _this$_subscriptionsB;
7363
-
7364
- const prevState = (_this$_subscriptionsB = this._subscriptionsByHash[hash]) === null || _this$_subscriptionsB === void 0 ? void 0 : _this$_subscriptionsB.state;
7355
+ const prevState = this._subscriptionsByHash[hash]?.state;
7365
7356
  this._subscriptionsByHash[hash] = nextSubscription;
7366
7357
 
7367
7358
  if (prevState !== nextSubscription.state) {
@@ -8119,7 +8110,7 @@ class Keypair {
8119
8110
  */
8120
8111
  constructor(keypair) {
8121
8112
  this._keypair = void 0;
8122
- this._keypair = keypair !== null && keypair !== void 0 ? keypair : generateKeypair();
8113
+ this._keypair = keypair ?? generateKeypair();
8123
8114
  }
8124
8115
  /**
8125
8116
  * Generate a new random keypair