@solana/web3.js 1.63.1 → 1.64.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
@@ -4493,6 +4493,28 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
4493
4493
  blockTime: superstruct.nullable(superstruct.number()),
4494
4494
  blockHeight: superstruct.nullable(superstruct.number())
4495
4495
  })));
4496
+ /**
4497
+ * Expected parsed JSON RPC response for the "getBlock" message
4498
+ */
4499
+
4500
+ const GetParsedBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
4501
+ blockhash: superstruct.string(),
4502
+ previousBlockhash: superstruct.string(),
4503
+ parentSlot: superstruct.number(),
4504
+ transactions: superstruct.array(superstruct.type({
4505
+ transaction: ParsedConfirmedTransactionResult,
4506
+ meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
4507
+ version: superstruct.optional(TransactionVersionStruct)
4508
+ })),
4509
+ rewards: superstruct.optional(superstruct.array(superstruct.type({
4510
+ pubkey: superstruct.string(),
4511
+ lamports: superstruct.number(),
4512
+ postBalance: superstruct.nullable(superstruct.number()),
4513
+ rewardType: superstruct.nullable(superstruct.string())
4514
+ }))),
4515
+ blockTime: superstruct.nullable(superstruct.number()),
4516
+ blockHeight: superstruct.nullable(superstruct.number())
4517
+ })));
4496
4518
  /**
4497
4519
  * Expected JSON RPC response for the "getConfirmedBlock" message
4498
4520
  *
@@ -5832,6 +5854,28 @@ class Connection {
5832
5854
  }))
5833
5855
  };
5834
5856
  }
5857
+ /**
5858
+ * Fetch parsed transaction details for a confirmed or finalized block
5859
+ */
5860
+
5861
+
5862
+ async getParsedBlock(slot, rawConfig) {
5863
+ const {
5864
+ commitment,
5865
+ config
5866
+ } = extractCommitmentFromConfig(rawConfig);
5867
+
5868
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);
5869
+
5870
+ const unsafeRes = await this._rpcRequest('getBlock', args);
5871
+ const res = superstruct.create(unsafeRes, GetParsedBlockRpcResult);
5872
+
5873
+ if ('error' in res) {
5874
+ throw new SolanaJSONRPCError(res.error, 'failed to get block');
5875
+ }
5876
+
5877
+ return res.result;
5878
+ }
5835
5879
  /*
5836
5880
  * Returns the current block height of the node
5837
5881
  */