getParsedTransaction

Returns transaction details for a confirmed transaction.

This method will use 30 Compute Units.


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

Parameters

  • slot integer The slot number of the block to retrieve encoded as u64 (64-bit unsigned integer) integer.

  • object optional. Configuration object containing the following fields:

    • commitment string. The level of commitment required for the query. The options include:

      • finalized string.

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

      • confirmed string.

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

      • processed string.

        • The node will query its most recent block. Note that the block may not be complete.

  • maxSupportedTransactionVersion boolean. The maximum 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 boolean. The older transaction format with no additional benefit.

  • 0 boolean. The additional support for Address Lookup Tables.

Returns

result The result will be null if the specified transaction is not confirmed otherwise an object with the following fields:

  • slot The slot number in which the transaction was processed.

  • parsedTransaction The parsed transaction object with the following fields:

    • signatures An array of signatures on the transaction.

    • parsedMessage The parsed message of the transaction.

      • accountKeys An array of public keys involved in the transaction.

      • instructions An array of instructions that were executed in the block's transactions.

      • recentBlockhash The recent blockhash from the transaction.

      • addressTableLookups An array of address lookups that were performed during the execution of transactions in the block.

  • blockTime The estimated production time, as Unix timestamp (seconds since the Unix epoch). It's null if not available.

  • meta The transaction status metadata object with the following fields:

    • err Error code if the transaction failed or null if the transaction succeeds.

    • fee The total fees paid by all transactions in the block encoded as u64 integer.

    • preBalances An array of lamport balances for each account in the block before the transactions were processed.

    • postBalances An array of lamport balances for each account in the block after the transactions were processed.

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

    • preTokenBalances An array of token balances for each token account in the block before the transactions were processed (omitted if inner instruction recording is not enabled).

    • postTokenBalances An array of token balances for each token account in the block after the transactions were processed (omitted if inner instruction recording is not enabled).

    • logMessages An array of strings containing any log messages generated by the block's transactions (omitted if inner instruction recording is not enabled).

    • rewards An object containing information about the rewards earned by the block's validators (only present if the rewards are requested). It has the following fields:

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

      • lamports The number of reward lamports credited or debited by the account.

      • postBalance The account balance in lamports after the reward was applied.

      • rewardType The type of reward. It could be fee, rent, voting, staking.

      • commission The vote account commission when the reward was credited, only present for voting and staking rewards.

    • loadedAddresses The list of loaded addresses objects.

      • readonly The ordered list of base-58 encoded addresses for readonly loaded accounts.

      • writable The ordered list of base-58 encoded addresses for writable loaded accounts.

    • version The transaction version. It's undefined if maxSupportedTransactionVersion is not set in the requested parameters.

// Result
{
  blockTime: 1739446039,
  meta: {
    computeUnitsConsumed: 3000,
    err: null,
    fee: 5300,
    innerInstructions: [],
    logMessages: [
      'Program ComputeBudget111111111111111111111111111111 invoke [1]',
      'Program ComputeBudget111111111111111111111111111111 success',
      'Program ComputeBudget111111111111111111111111111111 invoke [1]',
      'Program ComputeBudget111111111111111111111111111111 success',
      ...
    ],
    postBalances: [
      2767842760,    890980, 276098201,
       212321371,   1000100, 187539928,
        10461350,   3822790,  54747962,
         5995100, 715210710,  98915954,
       114402350,  14078660, 502821084,
       925133340, 795109364,  13934364,
         6377321,         1,         1
    ],
    postTokenBalances: [],
    preBalances: [
      2767849860,    890880, 276098101,
       212321271,   1000000, 187539828,
        10461250,   3822690,  54747862,
         5995000, 715210610,  98915854,
       114402250,  14078560, 502820984,
       925133240, 795109264,  13934264,
         6377221,         1,         1
    ],
    preTokenBalances: [],
    rewards: [],
    status: { Ok: null }
  },
  slot: 320370619,
  transaction: {
    message: {
      accountKeys: [Array],
      instructions: [Array],
      recentBlockhash: 'C7KtDumDt16xKWx3vNzCmXVXoztnZge2GFa2zYHC53dZ'
    },
    signatures: [
      '4tUuoRQUV42vAEGphy7bAXGqa6ZSK3zjHDyp4rrMzsAgQi1wvvcuKjZAVexGLnYmu9wNwfUf2jNvuEi9KmYG88jX'
    ]
  },
  version: 'legacy'
}
const web3 = require("@solana/web3.js");
(async () => {
  const solana = new web3.Connection("https://mainnet.solana.validationcloud.io/v1/<YOUR_API_KEY>");
  console.log(
    await solana.getParsedTransaction(
      "4tUuoRQUV42vAEGphy7bAXGqa6ZSK3zjHDyp4rrMzsAgQi1wvvcuKjZAVexGLnYmu9wNwfUf2jNvuEi9KmYG88jX",
      { maxSupportedTransactionVersion: 0 }
    )
  );
})();

Last updated

Was this helpful?