@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.cjs.js CHANGED
@@ -5754,18 +5754,6 @@ const GetParsedTransactionRpcResult = jsonRpcResult(superstruct.nullable(superst
5754
5754
  version: superstruct.optional(TransactionVersionStruct)
5755
5755
  })));
5756
5756
 
5757
- /**
5758
- * Expected JSON RPC response for the "getRecentBlockhash" message
5759
- *
5760
- * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
5761
- */
5762
- const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(superstruct.type({
5763
- blockhash: superstruct.string(),
5764
- feeCalculator: superstruct.type({
5765
- lamportsPerSignature: superstruct.number()
5766
- })
5767
- }));
5768
-
5769
5757
  /**
5770
5758
  * Expected JSON RPC response for the "getLatestBlockhash" message
5771
5759
  */
@@ -7143,13 +7131,27 @@ class Connection {
7143
7131
  * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.
7144
7132
  */
7145
7133
  async getRecentBlockhashAndContext(commitment) {
7146
- const args = this._buildArgs([], commitment);
7147
- const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);
7148
- const res = superstruct.create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
7149
- if ('error' in res) {
7150
- throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
7151
- }
7152
- return res.result;
7134
+ const {
7135
+ context,
7136
+ value: {
7137
+ blockhash
7138
+ }
7139
+ } = await this.getLatestBlockhashAndContext(commitment);
7140
+ const feeCalculator = {
7141
+ get lamportsPerSignature() {
7142
+ 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.');
7143
+ },
7144
+ toJSON() {
7145
+ return {};
7146
+ }
7147
+ };
7148
+ return {
7149
+ context,
7150
+ value: {
7151
+ blockhash,
7152
+ feeCalculator
7153
+ }
7154
+ };
7153
7155
  }
7154
7156
 
7155
7157
  /**