Only TEE wallets support fetching transaction history. Calling
getTransactions on a wallet that
isn’t a TEE wallet returns an error.Use the
getTransactions method on an embedded wallet to fetch its paginated transaction history.func getTransactions(_ params: GetTransactionsParams) async throws -> TransactionsPage
Usage
// Ethereum
guard let ethereumWallet = privy.user?.embeddedEthereumWallets.first else { return }
let params = GetTransactionsParams(
chain: .base,
assets: ["eth"],
limit: 20
)
let page = try await ethereumWallet.getTransactions(params)
for transaction in page.transactions {
print(transaction.transactionHash ?? "pending", transaction.status)
}
// Fetch the next page, if any
if let nextCursor = page.nextCursor {
let nextPage = try await ethereumWallet.getTransactions(
GetTransactionsParams(chain: .base, assets: ["eth"], limit: 20, cursor: nextCursor)
)
}
// Solana
guard let solanaWallet = privy.user?.embeddedSolanaWallets.first else { return }
let page = try await solanaWallet.getTransactions(
GetTransactionsParams(chain: .solana, assets: ["sol"], limit: 20)
)
Parameters
The filters and pagination options for the transaction history request.
Hide child attributes
Hide child attributes
The chain to fetch transactions for, e.g.
.base, .ethereum, .solana, or
.custom(chainSlug) for other supported chains.Filter by named asset, e.g.
["eth"] or ["usdc"]. Mutually exclusive with tokens.Filter by token contract address (EVM) or mint address (Solana). Mutually exclusive
with
assets.Filter to a single transaction by its hash. EVM hashes are
0x-prefixed 64 hex
characters; Solana hashes are 87-88 base58 characters.The maximum number of transactions to return in this page.
A pagination cursor from a previous
TransactionsPage.nextCursor, used to fetch the
next page of results.Whether to include transactions from archived wallets. Defaults to
false.Returns
The requested page of transaction history.
Hide child attributes
Hide child attributes
The transactions in this page.
Show child attributes
Show child attributes
The CAIP-2 chain ID for the network the transaction was broadcasted on, e.g.
eip155:8453.The hash of the transaction, if it has been broadcasted.
The ERC-4337 user operation hash, for smart-contract wallets only.
The current status of the transaction:
.broadcasted, .confirmed,
.executionReverted, .failed, .replaced, .finalized, .providerError,
.pending, or .unknown(rawValue).The creation time of the transaction, in milliseconds since the Unix epoch.
Whether gas for the transaction was sponsored.
Privy’s internal ID for the transaction, if available.
The ID of the wallet that sent the transaction.
Additional details about the transaction, present for transfer transactions.
Show child attributes
Show child attributes
.transferSent, .transferReceived, or .unknown(rawValue).The address that sent the transaction.
The Privy user ID for the sender, if known.
The address that received the transaction.
The Privy user ID for the recipient, if known.
The chain the transaction occurred on.
The asset transferred, e.g.
"eth" or a token contract/mint address.The raw transferred amount, as a string to avoid floating-point precision loss.
The number of decimals for
rawValue.Formatted, human-readable amounts for the transfer.
A cursor for fetching the next page of results.
nil if there are no more results.
