@solana/web3.js 1.97.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
  /**