Retrieve the transaction history for a wallet address. This endpoint returns a paginated list of transactions including transfers, swaps, and other on-chain activity.
Transaction history is currently only supported for embedded wallets on Solana mainnet (network ID 101). Responses are cached for 5 seconds.
Parameters
| Parameter | Type | Required | Description |
|---|
| chainName | string | Yes | The blockchain type (SOL for Solana) |
| address | string | Yes | The wallet address to fetch transactions for |
| networkId | number | Yes | The network ID (101 for Solana mainnet) |
| limit | number | No | Number of transactions to return (1-100) |
| offset | string | No | Pagination offset from previous response |
Response
The response includes an array of transactions and a nextOffset for pagination:
| Property | Type | Description |
|---|
| transactions | array | List of transaction objects |
| nextOffset | string | Offset to fetch the next page of transactions |
Each transaction object contains:
| Property | Type | Description |
|---|
| transactionHash | string | The transaction hash |
| blockNumber | number | Block number of the transaction |
| transactionTimestamp | string | ISO 8601 timestamp of the transaction |
| blockHash | string | Hash of the block containing the transaction |
| blockExplorerUrls | string[] | URLs to view the transaction on block explorers |
| fromAddress | string | Sender address |
| toAddress | string | Recipient address |
| labels | string[] | Transaction type labels: sent, receive, or swap |
| assetTransfers | array | Details of assets transferred in the transaction |
| chainName | string | The blockchain type |
| networkId | number | The network ID |
Each asset transfer contains:
| Property | Type | Description |
|---|
| tokenAddress | string | Contract address of the token (empty for native tokens) |
| fromAddress | string | Sender address for this transfer |
| toAddress | string | Recipient address for this transfer |
| amount | number | Amount transferred |
| metadata | object | Token metadata (name, symbol, decimals, imageUri) |
import { useDynamicContext } from "@dynamic-labs/sdk-react-core";
import { useEffect, useState } from "react";
interface Transaction {
transactionHash: string;
blockNumber: number;
transactionTimestamp: string;
fromAddress: string;
toAddress: string;
labels: string[];
blockExplorerUrls: string[];
assetTransfers: {
tokenAddress?: string;
fromAddress: string;
toAddress: string;
amount: number;
metadata?: {
name?: string;
symbol?: string;
decimals?: number;
imageUri?: string;
};
}[];
}
const WalletTransactions = () => {
const { primaryWallet, authToken } = useDynamicContext();
const [transactions, setTransactions] = useState<Transaction[]>([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
const fetchTransactions = async () => {
if (!primaryWallet || !authToken) return;
setLoading(true);
try {
const response = await fetch(
`https://app.dynamic.xyz/api/v0/sdk/${process.env.NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID}/chains/SOL/transactions/${primaryWallet.address}?networkId=101&limit=10`,
{
headers: {
Authorization: `Bearer ${authToken}`,
},
}
);
const data = await response.json();
setTransactions(data.transactions);
} catch (error) {
console.error("Failed to fetch transactions:", error);
} finally {
setLoading(false);
}
};
fetchTransactions();
}, [primaryWallet, authToken]);
if (loading) return <div>Loading transactions...</div>;
return (
<div>
<h2>Transaction History</h2>
{transactions.map((tx) => (
<div key={tx.transactionHash}>
<p>Hash: {tx.transactionHash}</p>
<p>Type: {tx.labels.join(", ")}</p>
<p>Date: {new Date(tx.transactionTimestamp).toLocaleString()}</p>
{tx.assetTransfers.map((transfer, i) => (
<p key={i}>
{transfer.metadata?.symbol}: {transfer.amount}
</p>
))}
<a href={tx.blockExplorerUrls[0]} target="_blank" rel="noopener noreferrer">
View on Explorer
</a>
</div>
))}
</div>
);
};