getTransaction
All the specifications for getTransaction RPC Method on Solana
Returns transaction details for a confirmed transaction
Parameters required for this RPC call
The pubkey of account delegate to query, as base-58 encoded string.
A JSON object with one of the following fields:
mint: Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or
programId: Pubkey of the Token program that owns the accounts, as base-58 encoded string
configuration : This contains the following parameters, all are optional fields.
commitment: The commitment describes how finalized a block is at that point in time. Commitment levels processed, confirmed and finalized are supported, defaults to finalized.
dataSlice: Request a slice of the account's data.
length: <usize>- number of bytes to returnoffset: <usize>- byte offset from which to start reading
maxSupportedTransactionVersion: Currently, the only valid value for this parameter is
0. Setting it to0allows you to fetch all transactions, including both Versioned and legacy transactions.encoding: Encoding format for each returned transaction. The supported options are json, jsonParsed, base58 and base64. You can know more about Parsed responses more on Solana docs.
curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5Pj5fCupXLUePYn18JkY8SrRaWFiUctuDTRwvUy2ML9yvkENLb1QMYbcBGcBXRrSVDjp7RjUwk9a3rLC6gpvtYpZ",
{
"commitment": "confirmed",
"maxSupportedTransactionVersion": 0,
"encoding": "json"
}
]
}
'import { Connection, PublicKey, clusterApiUrl, type GetVersionedTransactionConfig, } from "@solana/web3.js";
const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");
let signature =
"5zSQuTcWsPy2cVAshBXWuJJXLwMD1GbgMpz3iq4xgwiV1s6mxYRbYb7qBiRGZd1xvDcYhQQRBKoNcnW8eKtcyZWg";
let config: GetVersionedTransactionConfig = {
commitment: "finalized",
maxSupportedTransactionVersion: 0,
};
let transaction = await connection.getTransaction(signature, config);
console.log(transaction);Last updated
Was this helpful?