@solana/web3.js 1.63.0 → 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.
@@ -1003,13 +1003,13 @@ class MessageV0 {
1003
1003
  getAccountKeys(args) {
1004
1004
  let accountKeysFromLookups;
1005
1005
 
1006
- if (args && 'accountKeysFromLookups' in args) {
1006
+ if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {
1007
1007
  if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
1008
1008
  throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
1009
1009
  }
1010
1010
 
1011
1011
  accountKeysFromLookups = args.accountKeysFromLookups;
1012
- } else if (args && 'addressLookupTableAccounts' in args) {
1012
+ } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {
1013
1013
  accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
1014
1014
  } else if (this.addressTableLookups.length > 0) {
1015
1015
  throw new Error('Failed to get account keys because address table lookups were not resolved');
@@ -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
  */