> ## 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.

# Fetch wallet transactions

> [card] Recommended: JavaScript SDK for React Native
>
> While this SDK is still supported, we recommend using newer [JavaScript SDK](https://docs.dynamic.xyz/docs/javascript/reference/react-native-quickstart.md), which is optimized for React Native, but also comes with a host of other benefits.

Retrieve the transaction history for a wallet address. This endpoint returns a paginated list of transactions including transfers, swaps, and other on-chain activity.

> [!NOTE]
>
> Using the JavaScript SDK? See [getTransactionHistory](https://docs.dynamic.xyz/docs/javascript/reference/wallets/get-transaction-history.md) for a simpler approach.

> [!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) |

Supported chains and network IDs:

| Chain | `chainName` | 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) |

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| chainName | string | Yes | The blockchain type (e.g. `SOL`, `EVM`, `BTC`) — see table above |
| address | string | Yes | The wallet address to fetch transactions for |
| networkId | string | Yes | The network ID for the chain — see table above |
| limit | number | No | Number of transactions to return (1-100) |
| 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 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\[] | Direction of the transaction: `sent`, `received`, or `swap`. EVM events may also include an asset-category label (e.g. `token`) alongside the direction |
| 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. |

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) |

```ts theme={"system"}
    import { dynamicClient } from "./dynamic";

    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;
        };
      }[];
    }

    interface TransactionsResponse {
      transactions: Transaction[];
      nextOffset?: string;
    }

    export async function getWalletTransactions(
      address: string,
      networkId: number,
      limit?: number,
      offset?: string
    ): Promise<TransactionsResponse> {
      const token = dynamicClient.auth.token;
      if (!token) {
        throw new Error("User not authenticated");
      }

      const params = new URLSearchParams({
        networkId: networkId.toString(),
      });

      if (limit) params.append("limit", limit.toString());
      if (offset) params.append("offset", offset);

      const response = await fetch(
        `https://app.dynamic.xyz/api/v0/sdk/${process.env.DYNAMIC_ENVIRONMENT_ID}/chains/SOL/transactions/${address}?${params}`,
        {
          headers: {
            Authorization: `Bearer ${token}`,
          },
        }
      );

      if (!response.ok) {
        throw new Error(`Failed to fetch transactions: ${response.statusText}`);
      }

      return response.json();
    }

    // Usage example
    async function fetchMyTransactions() {
      const wallet = dynamicClient.wallets.primary;
      if (!wallet) return;

      const { transactions, nextOffset } = await getWalletTransactions(
        wallet.address,
        101, // Solana mainnet
        10
      );

      console.log("Transactions:", transactions);

      // Fetch next page if available
      if (nextOffset) {
        const nextPage = await getWalletTransactions(
          wallet.address,
          101,
          10,
          nextOffset
        );
        console.log("Next page:", nextPage.transactions);
      }
    }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.