UNPKG

@macalinao/grill

Version:

Modern Solana development kit for React applications with automatic account batching, caching, and transaction notifications

28 lines (25 loc) 789 B
import type { GetTransactionApi, Rpc, Signature } from "@solana/kit"; /** * Gets a confirmed transaction from the blockchain with parsed JSON encoding * @param rpc - The RPC client with GetTransactionApi * @param signature - The transaction signature to fetch * @returns The transaction details or null if not found */ export const getConfirmedTransaction = async ( rpc: Rpc<GetTransactionApi>, signature: Signature, ) => { return await rpc .getTransaction(signature, { commitment: "confirmed", maxSupportedTransactionVersion: 0, encoding: "jsonParsed", }) .send(); }; /** * Type for a confirmed transaction fetched from the blockchain */ export type ConfirmedTransaction = NonNullable< Awaited<ReturnType<typeof getConfirmedTransaction>> >;