> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Transaction History

You can retrieve the transaction history for a wallet address by calling the `getTransactionHistory` function.

This function fetches the transaction history for a specified wallet address and chain, returning a list of transactions along with a `nextOffset` for pagination.

<Note>
  Transaction history is supported for embedded wallets on Aptos, Bitcoin, EVM, Solana, Stellar, Sui, TON, and Tron networks. Responses are cached for 5 seconds.

  **Solana:** mainnet (network ID `101`) and devnet (network ID `103`). For devnet, we only retain 2 weeks of transaction history.

  **EVM supported networks:**

  | Network         | Mainnet ID | Testnet ID                            |
  | --------------- | ---------- | ------------------------------------- |
  | Ethereum        | `1`        | `11155111` (Sepolia)                  |
  | Optimism        | `10`       | `11155420` (Sepolia)                  |
  | Rootstock       | `30`       | `31`                                  |
  | BNB Smart Chain | `56`       | `97`                                  |
  | Gnosis          | `100`      | `10200` (Chiado)                      |
  | Unichain        | `130`      | `1301` (Sepolia)                      |
  | Polygon         | `137`      | `80001` (Mumbai), `80002` (Amoy)      |
  | zkSync Era      | `324`      | `300` (Sepolia)                       |
  | Shape           | `360`      | `11011` (Sepolia)                     |
  | World Chain     | `480`      | `4801` (Sepolia)                      |
  | Hyperliquid     | `999`      | `998`                                 |
  | Story           | `1514`     | `1315` (Aeneid)                       |
  | Soneium         | `1868`     | `1946` (Minato)                       |
  | Ronin           | `2020`     | `202601` (Saigon)                     |
  | Abstract        | `2741`     | `11124`                               |
  | ApeChain        | `33139`    | `33111` (Curtis)                      |
  | Arbitrum One    | `42161`    | `421614` (Sepolia)                    |
  | Arbitrum Nova   | `42170`    | —                                     |
  | Celo            | `42220`    | `11142220` (Sepolia)                  |
  | Avalanche       | `43114`    | `43113` (Fuji)                        |
  | Robinhood Chain | —          | `46630`                               |
  | Ink             | `57073`    | `763373` (Sepolia)                    |
  | Linea           | `59144`    | `59141` (Sepolia)                     |
  | Berachain       | `80094`    | `80069` (Bepolia)                     |
  | Blast           | `81457`    | `168587773` (Sepolia)                 |
  | Base            | `8453`     | `84532` (Sepolia)                     |
  | Scroll          | `534352`   | `534351` (Sepolia)                    |
  | Tempo           | `4217`     | `42429` (testnet), `42431` (Moderato) |
  | Zora            | `7777777`  | `999999999` (Sepolia)                 |
</Note>

Supported chains and network IDs:

| Chain   | `chain`   | Network IDs                                                                                                                                                                                                                                                           |
| ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Aptos   | `APTOS`   | `1` (mainnet), `2` (testnet), `3` (devnet)                                                                                                                                                                                                                            |
| Bitcoin | `BTC`     | `1` (mainnet), `2` (testnet)                                                                                                                                                                                                                                          |
| EVM     | `EVM`     | Numeric chain ID (e.g. `1` for Ethereum, `137` for Polygon) — see EVM table above                                                                                                                                                                                     |
| Solana  | `SOL`     | `101` (mainnet), `102` (devnet), `103` (testnet)                                                                                                                                                                                                                      |
| Stellar | `STELLAR` | 32-byte hex genesis hash — `7ac33997544e3175d266bd022439b22cdb16508c01163f26e5cb2a3e1045a979` (mainnet), `cee0302d59844d32bdca915c8203dd44b33fbb7edc19051ea37abedf28ecd472` (testnet), `a3a1c6a78286713e29be0e9785670fa838d13917cd8eaeb4a3579ff1debc7fd5` (futurenet) |
| Sui     | `SUI`     | `501` (mainnet), `502` (testnet), `503` (devnet)                                                                                                                                                                                                                      |
| TON     | `TON`     | `-239` (mainnet), `-3` (testnet)                                                                                                                                                                                                                                      |
| Tron    | `TRON`    | `728126428` (mainnet)                                                                                                                                                                                                                                                 |

## Usage

```javascript theme={"system"}
import { getTransactionHistory } from '@dynamic-labs-sdk/client';

const { transactions, nextOffset } = await getTransactionHistory({
  address: 'CKEAuq1E7hUcrjDcu1xP6nax3YBvEhhq7qaCzDUkPNer',
  chain: 'SOL',
  networkId: 101, // Solana mainnet
  limit: 10,
});

console.log(transactions);

// Fetch next page if available
if (nextOffset) {
  const nextPage = await getTransactionHistory({
    address: 'CKEAuq1E7hUcrjDcu1xP6nax3YBvEhhq7qaCzDUkPNer',
    chain: 'SOL',
    networkId: 101,
    limit: 10,
    offset: nextOffset,
  });
}
```

## React

`useGetTransactionHistory` loads the first page reactively. Because it's keyed on the request, load additional pages on demand by calling `getTransactionHistory` directly in the handler:

```tsx theme={"system"}
import { getTransactionHistory } from '@dynamic-labs-sdk/client';
import { useGetTransactionHistory } from '@dynamic-labs-sdk/react-hooks';
import { useState } from 'react';

function TransactionHistory({ address }) {
  const { data: history } = useGetTransactionHistory({
    address,
    chain: 'SOL',
    networkId: 101,
    limit: 10,
  });

  const [extraPages, setExtraPages] = useState([]);
  const [nextOffset, setNextOffset] = useState(null);

  const firstPage = history?.transactions ?? [];
  const transactions = [...firstPage, ...extraPages];

  const loadMore = async () => {
    const offset = nextOffset ?? history?.nextOffset;
    if (!offset) return;
    const page = await getTransactionHistory({
      address,
      chain: 'SOL',
      networkId: 101,
      limit: 10,
      offset,
    });
    setExtraPages((prev) => [...prev, ...page.transactions]);
    setNextOffset(page.nextOffset);
  };

  return (
    <div>
      <ul>
        {transactions.map((tx) => (
          <li key={tx.transactionHash}>{tx.transactionHash}</li>
        ))}
      </ul>
      {(nextOffset ?? data?.nextOffset) && (
        <button onClick={loadMore}>Load more</button>
      )}
    </div>
  );
}
```

## Parameters

| Parameter      | Type             | Required | Description                                                                                                                                                                                                     |
| -------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `address`      | String           | Yes      | The wallet address to fetch transactions for                                                                                                                                                                    |
| `chain`        | Chain            | Yes      | The chain to query transactions for — see table above                                                                                                                                                           |
| `networkId`    | String \| Number | Yes      | The network ID for the chain — see table above                                                                                                                                                                  |
| `limit`        | Number           | No       | Maximum number of transactions to return                                                                                                                                                                        |
| `offset`       | String           | No       | Pagination offset from previous response                                                                                                                                                                        |
| `tokenAddress` | String           | No       | Token contract address to filter by. Only supported for EVM and Solana. Use `0x0000000000000000000000000000000000000000` for EVM native tokens or `So11111111111111111111111111111111111111112` for native SOL. |

## Response

The function returns a Promise that resolves to an object containing:

| Property       | Type   | Description                                   |
| -------------- | ------ | --------------------------------------------- |
| `transactions` | Array  | List of transaction objects                   |
| `nextOffset`   | String | Offset to fetch the next page of transactions |

### Transaction object

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                                                                                                                     |
| `transactionType`      | String    | Enhanced transaction type (e.g., `TRANSFER`, `SWAP`). Only present for Solana transactions.                                        |
| `source`               | String    | The program or protocol that originated the transaction (e.g., `SYSTEM_PROGRAM`, `JUPITER`). Only present for Solana transactions. |
| `description`          | String    | Human-readable description of the transaction. Only present for Solana transactions.                                               |
| `spam`                 | Boolean   | Whether the transaction is likely spam (e.g., dust attacks). Only present for Solana transactions.                                 |

### Asset transfer object

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 in the token's smallest unit (e.g., lamports for SOL, raw units for SPL tokens). Use `metadata.decimals` to convert to a human-readable value. |
| `metadata`     | Object | Token metadata (name, symbol, decimals, imageUri)                                                                                                                 |

## Related functions

* [Getting Native Balance](/javascript/reference/wallets/get-native-balance)
* [Getting Multichain Token Balances](/javascript/reference/wallets/get-multichain-token-balances)
* [Getting Wallet Accounts](/javascript/reference/wallets/get-wallet-accounts)
