User Activities

Learn how to fetch users’ activity records across Aave v4.


View detailed activity history covering supplies, borrows, repayments, withdrawals, liquidations, and swaps, with built-in pagination support.

Activity Data Structure

Activity data provides detailed information about all user activities, including:

  • Transaction details: timestamp, transaction hash, chain, amount

  • Activity types: supply, borrow, withdraw, repay, liquidated, collateral management

  • User performing the activity

  • Type-specific details like reserve, spoke, and amounts

The following TypeScript interfaces illustrate the core activity types:

type ActivityItem =  | BorrowActivity  | SupplyActivity  | WithdrawActivity  | RepayActivity  | LiquidatedActivity  | UsingAsCollateralActivity;

Fetching User Activities

Fetch users' activities with filtering and pagination.

Use the useActivities hook to fetch paginated activities for a user.

import { type ActivitiesRequest, useActivities } from "@aave/react";
function ActivitiesList({ request }: { request: ActivitiesRequest }) {  const { data, loading, error } = useActivities(request);
  if (loading) return <div>Loading…</div>;
  if (error) return <div>Error: {error.message}</div>;
  // data: PaginatedActivitiesResult  return (    <div>      {data.items.map((activity) => (        <div key={activity.id}>          <h4>{activity.__typename}</h4>          <p>Time: {activity.timestamp.toLocaleString()}</p>          <p>Tx: {activity.txHash}</p>        </div>      ))}    </div>  );}

See below some examples of how to use the hook.

import { evmAddress, chainId } from "@aave/react";
const { data, loading, error } = useActivities({  query: {    chainIds: [chainId(1)],  },  user: evmAddress("0x456…"),});

Filter by specific activity types.

Activity Types
import { evmAddress, ActivityType } from "@aave/react";
const { data, loading, error } = useActivities({  query: {    // your query criteria  },  user: evmAddress("0x456…"),  types: [    ActivityType.Borrow,    ActivityType.Supply,    ActivityType.Repay,    ActivityType.Withdraw,  ],});

Specify a different currency for displaying fiat amounts.

Custom Currency
import { evmAddress, Currency } from "@aave/react";
const { data, loading, error } = useActivities({  query: {    // your query criteria  },  user: evmAddress("0x456…"),  currency: Currency.Eur,});

Handle Pagination

Navigate through large activity history sets using cursor-based pagination.

Use the pagination information from the response to implement next/previous navigation.

Basic Pagination
import {  useActivities,  evmAddress,  chainId,  PageSize,  type Cursor,} from "@aave/react";import { useState } from "react";
function PaginatedActivities() {  const [cursor, setCursor] = useState<Cursor | null>();
  const { data, loading, error } = useActivities({    query: { chainIds: [chainId(1)] },    user: evmAddress("0x456…"),    pageSize: PageSize.Ten,    cursor,  });
  if (loading) return <div>Loading…</div>;
  if (error) return <div>Error: {error.message}</div>;
  return (    <div>      <h3>Transaction History</h3>      {data.items.map((activity) => (        <div key={activity.id}>          <p>            {activity.__typename}: {activity.txHash}          </p>        </div>      ))}
      <div>        <button          onClick={() => setCursor(data.pageInfo.prev)}          disabled={!data.pageInfo.prev}        >          Previous        </button>        <button          onClick={() => setCursor(data.pageInfo.next)}          disabled={!data.pageInfo.next}        >          Next        </button>      </div>    </div>  );}

Network Fees

Fetch the network fee (gas cost) and its historical fiat value for a specific activity transaction.

This experimental AaveKit React hook currently works only with Viem or Wagmi integrations. Support for additional wallet libraries may be added later.

Use the useNetworkFee hook to fetch the network fee for an activity by fetching the transaction receipt and converting the gas cost to both native and fiat amounts.

Viem
import { type ActivityItem, Currency } from "@aave/react";import { useNetworkFee } from "@aave/react/viem";
function ActivityFee({ activity }: { activity: ActivityItem }) {  const {    data: fee,    loading,    error,  } = useNetworkFee({    query: { activity },    currency: Currency.Eur,  });
  if (loading) return <p>Loading fee…</p>;  if (error) return <p>Error: {error.message}</p>;
  return (    <p>      Network Fee: {fee.amount.value.toDisplayString(2)} {fee.token.info.symbol}      <span>{fee.fiatAmount.symbol}        {fee.fiatAmount.value.toDisplayString(2)}      </span>    </p>  );}

Like other declarative hooks, the useNetworkFee hook can be used in React Suspense mode and implements pausable mode.

const { data: fee } = useNetworkFee({  query: { activity },  currency: Currency.Eur,  suspense: true,});