AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.

Start building today!     

Contents

getParsedBlock RPC Method

The getParsedBlock method is only supported with the @solana/web3.js SDK. To use cURL or solana.py, check out the getBlock method examples where the encoding is set to jsonParsed.

Parameters:

slot_number - slot, as u64 (64-bit unsigned integer) integer. Object - (optional) Configuration object containing the following optional fields:

encoding - "jsonParsed" (n/a if using JS getParsedBlock)

transactionDetails - (optional) level of transaction detail to return, either "full", "signatures", or "none". If parameter not provided, the default detail level is "full".

rewards - (optional) Boolean value, whether to populate the rewards array. If parameter not provided, the default includes rewards.

Commitment - (optional) "processed" is not supported. If parameter not provided, the default is "finalized".

Finalized - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.

Confirmed - the node will query the most recent block that has been voted on by supermajority of the cluster.

Processed - not supported in this method.

maxSupportedTransactionVersion (optional) set the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt an error.

legacy - older transaction format with no additional benefit (default value).

0 - added support for Address Lookup Tables.

Returns:

Result - The result field will be an object with the following fields:

null - if specified block is not confirmed.

Object - if block is confirmed, an object with the following fields:

blockhash - the blockhash of this block, as base-58 encoded string.

previousBlockhash - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111".

parentSlot - the slot index of this block's parent.

transactions - present if "full" transaction details are requested; an array of JSON objects containing:

transaction - Array of Parsed Transaction Objects, containing:

signatures - Array of signatures on the Transaction.

parsedMessage - Parsed Message of the transaction.

accountKeys - parsed Message Account Array of accounts used in the instructions.

instructions - parsed executed instructions for the transaction.

recentBlockhash - recent blockhash from the transaction

addressTableLookups - array of parsed lookup tables used in the transaction

meta - transaction status metadata object, containing null or:

err - Error if transaction failed, null if transaction succeeded.

fee - fee this transaction was charged, as u64 integer.

preBalances - array of u64 account balances from before the transaction was processed.

postBalances - array of u64 account balances after the transaction was processed.

parsedInnerInstructions - List of inner instructions or omitted if inner instruction recording was not yet enabled during this transaction.

preTokenBalances - List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.

postTokenBalances - List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.

logMessages - array of string log messages or omitted if log message recording was not yet enabled during this transaction.

rewards - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block.

pubkey - The public key, as base-58 encoded string, of the account that received the reward.

lamports - Number of reward lamports credited or debited by the account, as an i64.

postBalance - Account balance in lamports after the reward was applied

rewardType - Type of reward: currently only "rent", other types may be added in the future

commission - Vote account commission when the reward was credited, only present for voting and staking rewards

loadedAddresses - Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params.

writable - Ordered list of base-58 encoded addresses for writable loaded accounts.

writable - Ordered list of base-58 encoded addresses for readonly loaded accounts.

version - Transaction version. Undefined if maxSupportedTransactionVersion is not set in request params.

rewards - present if rewards are requested; an array of JSON objects containing:

pubkey - The public key, as base-58 encoded string, of the account that received the reward.

lamports - Number of reward lamports credited or debited by the account, as an i64.

postBalance - Account balance in lamports after the reward was applied

rewardType - Type of reward: currently only "rent", other types may be added in the future

commission - Vote account commission when the reward was credited, only present for voting and staking rewards

blockTime - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available.

blockHeight - the number of blocks beneath this block.

Code Examples:

const web3 = require("@solana/web3.js");
(async () => {
  const solana = new web3.Connection("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/");
  console.log(
    await solana.getParsedBlock(94101948, { maxSupportedTransactionVersion: 0 })
  );
})();
Ready to get started? Create a free account