@solana/web3.js 1.96.0 → 1.98.0

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.esm.js CHANGED
@@ -5724,18 +5724,6 @@ const GetParsedTransactionRpcResult = jsonRpcResult(nullable(type({
5724
5724
  version: optional(TransactionVersionStruct)
5725
5725
  })));
5726
5726
 
5727
- /**
5728
- * Expected JSON RPC response for the "getRecentBlockhash" message
5729
- *
5730
- * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
5731
- */
5732
- const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(type({
5733
- blockhash: string(),
5734
- feeCalculator: type({
5735
- lamportsPerSignature: number()
5736
- })
5737
- }));
5738
-
5739
5727
  /**
5740
5728
  * Expected JSON RPC response for the "getLatestBlockhash" message
5741
5729
  */
@@ -7113,13 +7101,27 @@ class Connection {
7113
7101
  * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.
7114
7102
  */
7115
7103
  async getRecentBlockhashAndContext(commitment) {
7116
- const args = this._buildArgs([], commitment);
7117
- const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);
7118
- const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
7119
- if ('error' in res) {
7120
- throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
7121
- }
7122
- return res.result;
7104
+ const {
7105
+ context,
7106
+ value: {
7107
+ blockhash
7108
+ }
7109
+ } = await this.getLatestBlockhashAndContext(commitment);
7110
+ const feeCalculator = {
7111
+ get lamportsPerSignature() {
7112
+ throw new Error('The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is ' + 'no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee ' + 'for a given message.');
7113
+ },
7114
+ toJSON() {
7115
+ return {};
7116
+ }
7117
+ };
7118
+ return {
7119
+ context,
7120
+ value: {
7121
+ blockhash,
7122
+ feeCalculator
7123
+ }
7124
+ };
7123
7125
  }
7124
7126
 
7125
7127
  /**
@@ -7678,7 +7680,7 @@ class Connection {
7678
7680
  */
7679
7681
  async getConfirmedTransaction(signature, commitment) {
7680
7682
  const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7681
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
7683
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
7682
7684
  const res = create(unsafeRes, GetTransactionRpcResult);
7683
7685
  if ('error' in res) {
7684
7686
  throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
@@ -7700,7 +7702,7 @@ class Connection {
7700
7702
  */
7701
7703
  async getParsedConfirmedTransaction(signature, commitment) {
7702
7704
  const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7703
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
7705
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
7704
7706
  const res = create(unsafeRes, GetParsedTransactionRpcResult);
7705
7707
  if ('error' in res) {
7706
7708
  throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
@@ -7717,7 +7719,7 @@ class Connection {
7717
7719
  const batch = signatures.map(signature => {
7718
7720
  const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7719
7721
  return {
7720
- methodName: 'getConfirmedTransaction',
7722
+ methodName: 'getTransaction',
7721
7723
  args
7722
7724
  };
7723
7725
  });