@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.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
  /**
@@ -7708,7 +7710,7 @@ class Connection {
7708
7710
  */
7709
7711
  async getConfirmedTransaction(signature, commitment) {
7710
7712
  const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7711
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
7713
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
7712
7714
  const res = superstruct.create(unsafeRes, GetTransactionRpcResult);
7713
7715
  if ('error' in res) {
7714
7716
  throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
@@ -7730,7 +7732,7 @@ class Connection {
7730
7732
  */
7731
7733
  async getParsedConfirmedTransaction(signature, commitment) {
7732
7734
  const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7733
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
7735
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
7734
7736
  const res = superstruct.create(unsafeRes, GetParsedTransactionRpcResult);
7735
7737
  if ('error' in res) {
7736
7738
  throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
@@ -7747,7 +7749,7 @@ class Connection {
7747
7749
  const batch = signatures.map(signature => {
7748
7750
  const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7749
7751
  return {
7750
- methodName: 'getConfirmedTransaction',
7752
+ methodName: 'getTransaction',
7751
7753
  args
7752
7754
  };
7753
7755
  });