@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.
package/lib/index.d.ts CHANGED
@@ -1830,7 +1830,7 @@ declare module '@solana/web3.js' {
1830
1830
  /**
1831
1831
  * Get the estimated fee associated with a transaction
1832
1832
  */
1833
- getEstimatedFee(connection: Connection): Promise<number>;
1833
+ getEstimatedFee(connection: Connection): Promise<number | null>;
1834
1834
  /**
1835
1835
  * Specify the public keys which will be used to sign the Transaction.
1836
1836
  * The first signer will be used as the transaction fee payer account.
@@ -3658,7 +3658,7 @@ declare module '@solana/web3.js' {
3658
3658
  getFeeForMessage(
3659
3659
  message: VersionedMessage,
3660
3660
  commitment?: Commitment,
3661
- ): Promise<RpcResponseAndContext<number>>;
3661
+ ): Promise<RpcResponseAndContext<number | null>>;
3662
3662
  /**
3663
3663
  * Fetch a recent blockhash from the cluster
3664
3664
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
package/lib/index.esm.js CHANGED
@@ -2226,7 +2226,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2226
2226
 
2227
2227
  if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
2228
2228
  status = (await connection.confirmTransaction({
2229
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2229
+ abortSignal: options?.abortSignal,
2230
2230
  signature: signature,
2231
2231
  blockhash: transaction.recentBlockhash,
2232
2232
  lastValidBlockHeight: transaction.lastValidBlockHeight
@@ -2237,14 +2237,14 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2237
2237
  } = transaction.nonceInfo;
2238
2238
  const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
2239
2239
  status = (await connection.confirmTransaction({
2240
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
2240
+ abortSignal: options?.abortSignal,
2241
2241
  minContextSlot: transaction.minNonceContextSlot,
2242
2242
  nonceAccountPubkey,
2243
2243
  nonceValue: transaction.nonceInfo.nonce,
2244
2244
  signature
2245
2245
  }, options && options.commitment)).value;
2246
2246
  } else {
2247
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
2247
+ if (options?.abortSignal != null) {
2248
2248
  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.');
2249
2249
  }
2250
2250
 
@@ -6052,7 +6052,6 @@ function makeWebsocketUrl(endpoint) {
6052
6052
  return `${protocol}//${hostish}${websocketPort}${rest}`;
6053
6053
  }
6054
6054
 
6055
- var _process$env$npm_pack;
6056
6055
  const PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));
6057
6056
  const RawAccountDataResult = tuple([string(), literal('base64')]);
6058
6057
  const BufferFromRawAccountData = coerce(instance(Buffer), RawAccountDataResult, value => Buffer.from(value[0], 'base64'));
@@ -7143,7 +7142,7 @@ const LogsNotificationResult = type({
7143
7142
 
7144
7143
  /** @internal */
7145
7144
  const COMMON_HTTP_HEADERS = {
7146
- 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
7145
+ 'solana-client': `js/${"0.0.0-development" }`
7147
7146
  };
7148
7147
  /**
7149
7148
  * A connection to a fullnode JSON RPC endpoint
@@ -7689,7 +7688,7 @@ class Connection {
7689
7688
  const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
7690
7689
  /* encoding */
7691
7690
  , { ...config,
7692
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
7691
+ epoch: epoch != null ? epoch : config?.epoch
7693
7692
  });
7694
7693
 
7695
7694
  const unsafeRes = await this._rpcRequest('getStakeActivation', args);
@@ -7761,11 +7760,9 @@ class Connection {
7761
7760
  if (typeof strategy == 'string') {
7762
7761
  rawSignature = strategy;
7763
7762
  } else {
7764
- var _config$abortSignal;
7765
-
7766
7763
  const config = strategy;
7767
7764
 
7768
- if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
7765
+ if (config.abortSignal?.aborted) {
7769
7766
  return Promise.reject(config.abortSignal.reason);
7770
7767
  }
7771
7768
 
@@ -7867,7 +7864,7 @@ class Connection {
7867
7864
  return;
7868
7865
  }
7869
7866
 
7870
- if (value !== null && value !== void 0 && value.err) {
7867
+ if (value?.err) {
7871
7868
  reject(value.err);
7872
7869
  } else {
7873
7870
  switch (commitment) {
@@ -8017,7 +8014,7 @@ class Connection {
8017
8014
  minContextSlot
8018
8015
  });
8019
8016
  lastCheckedSlot = context.slot;
8020
- return nonceAccount === null || nonceAccount === void 0 ? void 0 : nonceAccount.nonce;
8017
+ return nonceAccount?.nonce;
8021
8018
  } catch (e) {
8022
8019
  // If for whatever reason we can't reach/read the nonce
8023
8020
  // account, just keep using the last-known value.
@@ -8062,22 +8059,18 @@ class Connection {
8062
8059
  if (outcome.__type === TransactionStatus.PROCESSED) {
8063
8060
  result = outcome.response;
8064
8061
  } else {
8065
- var _signatureStatus;
8066
-
8067
8062
  // Double check that the transaction is indeed unconfirmed.
8068
8063
  let signatureStatus;
8069
8064
 
8070
8065
  while (true // eslint-disable-line no-constant-condition
8071
8066
  ) {
8072
- var _outcome$slotInWhichN;
8073
-
8074
8067
  const status = await this.getSignatureStatus(signature);
8075
8068
 
8076
8069
  if (status == null) {
8077
8070
  break;
8078
8071
  }
8079
8072
 
8080
- if (status.context.slot < ((_outcome$slotInWhichN = outcome.slotInWhichNonceDidAdvance) !== null && _outcome$slotInWhichN !== void 0 ? _outcome$slotInWhichN : minContextSlot)) {
8073
+ if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {
8081
8074
  await sleep(400);
8082
8075
  continue;
8083
8076
  }
@@ -8086,7 +8079,7 @@ class Connection {
8086
8079
  break;
8087
8080
  }
8088
8081
 
8089
- if ((_signatureStatus = signatureStatus) !== null && _signatureStatus !== void 0 && _signatureStatus.value) {
8082
+ if (signatureStatus?.value) {
8090
8083
  const commitmentForStatus = commitment || 'finalized';
8091
8084
  const {
8092
8085
  confirmationStatus
@@ -8399,7 +8392,7 @@ class Connection {
8399
8392
  const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
8400
8393
  /* encoding */
8401
8394
  , { ...config,
8402
- epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
8395
+ epoch: epoch != null ? epoch : config?.epoch
8403
8396
  });
8404
8397
 
8405
8398
  const unsafeRes = await this._rpcRequest('getInflationReward', args);
@@ -8696,7 +8689,7 @@ class Connection {
8696
8689
  const unsafeRes = await this._rpcRequest('getBlock', args);
8697
8690
 
8698
8691
  try {
8699
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
8692
+ switch (config?.transactionDetails) {
8700
8693
  case 'accounts':
8701
8694
  {
8702
8695
  const res = create(unsafeRes, GetAccountsModeBlockRpcResult);
@@ -8766,7 +8759,7 @@ class Connection {
8766
8759
  const unsafeRes = await this._rpcRequest('getBlock', args);
8767
8760
 
8768
8761
  try {
8769
- switch (config === null || config === void 0 ? void 0 : config.transactionDetails) {
8762
+ switch (config?.transactionDetails) {
8770
8763
  case 'accounts':
8771
8764
  {
8772
8765
  const res = create(unsafeRes, GetParsedAccountsModeBlockRpcResult);
@@ -9781,9 +9774,7 @@ class Connection {
9781
9774
 
9782
9775
 
9783
9776
  _setSubscription(hash, nextSubscription) {
9784
- var _this$_subscriptionsB;
9785
-
9786
- const prevState = (_this$_subscriptionsB = this._subscriptionsByHash[hash]) === null || _this$_subscriptionsB === void 0 ? void 0 : _this$_subscriptionsB.state;
9777
+ const prevState = this._subscriptionsByHash[hash]?.state;
9787
9778
  this._subscriptionsByHash[hash] = nextSubscription;
9788
9779
 
9789
9780
  if (prevState !== nextSubscription.state) {
@@ -10541,7 +10532,7 @@ class Keypair {
10541
10532
  */
10542
10533
  constructor(keypair) {
10543
10534
  this._keypair = void 0;
10544
- this._keypair = keypair !== null && keypair !== void 0 ? keypair : generateKeypair();
10535
+ this._keypair = keypair ?? generateKeypair();
10545
10536
  }
10546
10537
  /**
10547
10538
  * Generate a new random keypair