Skip to Content
FunctionsAccountgetTransactions

getTransactions

Fetches recent transactions for a given address with simple pagination support.

Usage

page.tsx
import { useConnection } from "@solana/wallet-adapter-react"; import { getTransactions } from "@okito/sdk"; const {connection} = useConnection(); const wallet = useWallet(); const options = { limit: 5, //The number of transactions to fetch(Max 500) before: "", //The signature to fetch from until: "", //The signature to fetch to commitment: "processed" //The commitment level to use } const transactionHistory = await getTransactions(connection,address,options)

The default values of the params( limit = 20, commitment = “confirmed” ) will be used if not provided.

Capabilities

  • Limit, before, until parameters for pagination
  • Batching under the hood for efficient lookups
  • Returns parsed transactions when available

Parameters

NameTypeDefault
connection
Connection
Solana connection instance.
address
PublicKey | string
Address to query.
options
TransactionHistoryOptions
Limit, before, until, commitment.

Response

NameTypeDefault
transactions?
ParsedTransactionWithMeta[]
The transactions fetched
—
success
boolean
Whether the transactions were fetched successfully
error?
string
The error message if the transactions were not fetched successfully
—
signatures?
ConfirmedSignatureInfo[]
The raw signatures fetched
—
hasMore?
boolean
Whether there are more transactions to fetch
—

Types

ParsedTransactionWithMeta

NameTypeDefault
slot
number
The slot during which the transaction was processed
—
transaction
ParsedTransaction
The transaction details
—
meta
ParsedTransactionMeta | null
The metadata produced from the transaction
—
blockTime
number | null
The unix timestamp of when the transaction was processed
—
version
TransactionVersion | undefined

ConfirmedSignatureInfo

NameTypeDefault
signature
string
The signature of the transaction
—
slot
number
The slot during which the transaction was processed
—
err
TransactionError | null
The error produced from the transaction
—
memo
'string' | null
The memo associated with the transaction(if any)
—
blockTime
number | null
The unix timestamp of when the transaction was processed
—
confirmationStatus
'processed' | 'confirmed' | 'finalized' | undefined
The confirmation status of the transaction
—
Last updated on