@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -2599,20 +2599,6 @@ const GetParsedTransactionRpcResult = jsonRpcResult(
2599
2599
  ),
2600
2600
  );
2601
2601
 
2602
- /**
2603
- * Expected JSON RPC response for the "getRecentBlockhash" message
2604
- *
2605
- * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
2606
- */
2607
- const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(
2608
- pick({
2609
- blockhash: string(),
2610
- feeCalculator: pick({
2611
- lamportsPerSignature: number(),
2612
- }),
2613
- }),
2614
- );
2615
-
2616
2602
  /**
2617
2603
  * Expected JSON RPC response for the "getLatestBlockhash" message
2618
2604
  */
@@ -4567,13 +4553,29 @@ export class Connection {
4567
4553
  feeCalculator: FeeCalculator;
4568
4554
  }>
4569
4555
  > {
4570
- const args = this._buildArgs([], commitment);
4571
- const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);
4572
- const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
4573
- if ('error' in res) {
4574
- throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
4575
- }
4576
- return res.result;
4556
+ const {
4557
+ context,
4558
+ value: {blockhash},
4559
+ } = await this.getLatestBlockhashAndContext(commitment);
4560
+ const feeCalculator = {
4561
+ get lamportsPerSignature(): number {
4562
+ throw new Error(
4563
+ 'The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is ' +
4564
+ 'no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee ' +
4565
+ 'for a given message.',
4566
+ );
4567
+ },
4568
+ toJSON() {
4569
+ return {};
4570
+ },
4571
+ };
4572
+ return {
4573
+ context,
4574
+ value: {
4575
+ blockhash,
4576
+ feeCalculator,
4577
+ },
4578
+ };
4577
4579
  }
4578
4580
 
4579
4581
  /**
@@ -5353,7 +5355,7 @@ export class Connection {
5353
5355
  commitment?: Finality,
5354
5356
  ): Promise<ConfirmedTransaction | null> {
5355
5357
  const args = this._buildArgsAtLeastConfirmed([signature], commitment);
5356
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
5358
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
5357
5359
  const res = create(unsafeRes, GetTransactionRpcResult);
5358
5360
  if ('error' in res) {
5359
5361
  throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
@@ -5384,7 +5386,7 @@ export class Connection {
5384
5386
  commitment,
5385
5387
  'jsonParsed',
5386
5388
  );
5387
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
5389
+ const unsafeRes = await this._rpcRequest('getTransaction', args);
5388
5390
  const res = create(unsafeRes, GetParsedTransactionRpcResult);
5389
5391
  if ('error' in res) {
5390
5392
  throw new SolanaJSONRPCError(
@@ -5411,7 +5413,7 @@ export class Connection {
5411
5413
  'jsonParsed',
5412
5414
  );
5413
5415
  return {
5414
- methodName: 'getConfirmedTransaction',
5416
+ methodName: 'getTransaction',
5415
5417
  args,
5416
5418
  };
5417
5419
  });