@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.
@@ -4427,6 +4427,28 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
4427
4427
  blockTime: superstruct.nullable(superstruct.number()),
4428
4428
  blockHeight: superstruct.nullable(superstruct.number())
4429
4429
  })));
4430
+ /**
4431
+ * Expected parsed JSON RPC response for the "getBlock" message
4432
+ */
4433
+
4434
+ const GetParsedBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
4435
+ blockhash: superstruct.string(),
4436
+ previousBlockhash: superstruct.string(),
4437
+ parentSlot: superstruct.number(),
4438
+ transactions: superstruct.array(superstruct.type({
4439
+ transaction: ParsedConfirmedTransactionResult,
4440
+ meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
4441
+ version: superstruct.optional(TransactionVersionStruct)
4442
+ })),
4443
+ rewards: superstruct.optional(superstruct.array(superstruct.type({
4444
+ pubkey: superstruct.string(),
4445
+ lamports: superstruct.number(),
4446
+ postBalance: superstruct.nullable(superstruct.number()),
4447
+ rewardType: superstruct.nullable(superstruct.string())
4448
+ }))),
4449
+ blockTime: superstruct.nullable(superstruct.number()),
4450
+ blockHeight: superstruct.nullable(superstruct.number())
4451
+ })));
4430
4452
  /**
4431
4453
  * Expected JSON RPC response for the "getConfirmedBlock" message
4432
4454
  *
@@ -5766,6 +5788,28 @@ class Connection {
5766
5788
  }))
5767
5789
  };
5768
5790
  }
5791
+ /**
5792
+ * Fetch parsed transaction details for a confirmed or finalized block
5793
+ */
5794
+
5795
+
5796
+ async getParsedBlock(slot, rawConfig) {
5797
+ const {
5798
+ commitment,
5799
+ config
5800
+ } = extractCommitmentFromConfig(rawConfig);
5801
+
5802
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);
5803
+
5804
+ const unsafeRes = await this._rpcRequest('getBlock', args);
5805
+ const res = superstruct.create(unsafeRes, GetParsedBlockRpcResult);
5806
+
5807
+ if ('error' in res) {
5808
+ throw new SolanaJSONRPCError(res.error, 'failed to get block');
5809
+ }
5810
+
5811
+ return res.result;
5812
+ }
5769
5813
  /*
5770
5814
  * Returns the current block height of the node
5771
5815
  */