Aave V4 User Activities
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: core operations (supply, borrow, withdraw, repay), liquidations, position settings, and swaps
- 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
| UpdatedDynamicConfigActivity
| UpdatedRiskPremiumActivity
| TokenSwapActivity
| SupplySwapActivity
| BorrowSwapActivity
| RepayWithSupplyActivity
| WithdrawSwapActivity
| LeverageActivity;
interface BorrowActivity {
__typename: "BorrowActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
borrowed: Erc20Amount;
chain: Chain;
}
interface BorrowSwapActivity {
__typename: "BorrowSwapActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
sell: PositionAmount;
buy: PositionAmount;
explorerUrl: string;
orderClass: SwapOrderClass;
kind: BorrowSwapKind;
status: SwapActivityStatus;
}
interface SupplyActivity {
__typename: "SupplyActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
supplied: Erc20Amount;
chain: Chain;
}
interface SupplySwapActivity {
__typename: "SupplySwapActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
sell: PositionAmount;
buy: PositionAmount;
explorerUrl: string;
orderClass: SwapOrderClass;
kind: SupplySwapKind;
status: SwapActivityStatus;
}
interface WithdrawActivity {
__typename: "WithdrawActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
withdrawn: Erc20Amount;
chain: Chain;
}
interface WithdrawSwapActivity {
__typename: "WithdrawSwapActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
withdraw: PositionAmount;
buy: TokenAmount;
explorerUrl: string;
orderClass: SwapOrderClass;
kind: WithdrawSwapKind;
status: SwapActivityStatus;
}
interface RepayActivity {
__typename: "RepayActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
repaid: Erc20Amount;
chain: Chain;
}
interface RepayWithSupplyActivity {
__typename: "RepayWithSupplyActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
repay: PositionAmount;
supply: PositionAmount;
explorerUrl: string;
orderClass: SwapOrderClass;
kind: RepayWithSupplyKind;
status: SwapActivityStatus;
}
interface LiquidatedActivity {
__typename: "LiquidatedActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
collateralReserve: ReserveInfo;
collateral: Erc20Amount;
liquidatorReceived: Erc20Amount;
liquidationFee: Erc20Amount;
debtReserve: ReserveInfo;
debt: Erc20Amount;
liquidator: EvmAddress;
liquidationHealthFactor: HealthFactor;
chain: Chain;
}
interface UsingAsCollateralActivity {
__typename: "UsingAsCollateralActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
enabledAsCollateral: boolean;
chain: Chain;
}
interface UpdatedDynamicConfigActivity {
__typename: "UpdatedDynamicConfigActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
reserve: ReserveInfo;
collateralFactor: PercentNumberChangeSnapshot;
maxLiquidationBonus: PercentNumberChangeSnapshot;
liquidationFee: PercentNumberChangeSnapshot;
chain: Chain;
}
interface UpdatedRiskPremiumActivity {
__typename: "UpdatedRiskPremiumActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash;
spoke: Spoke;
premium: PercentNumberChangeSnapshot;
chain: Chain;
}
interface TokenSwapActivity {
__typename: "TokenSwapActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
sell: TokenAmount;
buy: TokenAmount;
explorerUrl: string;
orderClass: SwapOrderClass;
kind: TokenSwapKind;
status: SwapActivityStatus;
}
interface LeverageActivity {
__typename: "LeverageActivity";
id: string;
user: EvmAddress;
timestamp: Date;
txHash: TxHash | null;
chain: Chain;
collateral: PositionAmount;
debt: PositionAmount;
multiplier: BigDecimal;
explorerUrl: string;
orderClass: SwapOrderClass;
status: SwapActivityStatus;
}
interface PercentNumberChangeSnapshot {
before: PercentNumber;
after: PercentNumber;
}
The following GraphQL fragments illustrate the core activity types:
fragment ActivityItem on ActivityItem {
__typename
... on BorrowActivity {
...BorrowActivity
}
... on SupplyActivity {
...SupplyActivity
}
... on WithdrawActivity {
...WithdrawActivity
}
... on RepayActivity {
...RepayActivity
}
... on LiquidatedActivity {
...LiquidatedActivity
}
... on UsingAsCollateralActivity {
...UsingAsCollateralActivity
}
... on UpdatedDynamicConfigActivity {
...UpdatedDynamicConfigActivity
}
... on UpdatedRiskPremiumActivity {
...UpdatedRiskPremiumActivity
}
... on TokenSwapActivity {
...TokenSwapActivity
}
... on SupplySwapActivity {
...SupplySwapActivity
}
... on BorrowSwapActivity {
...BorrowSwapActivity
}
... on RepayWithSupplyActivity {
...RepayWithSupplyActivity
}
... on WithdrawSwapActivity {
...WithdrawSwapActivity
}
... on LeverageActivity {
...LeverageActivity
}
}
fragment BorrowActivity on BorrowActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
borrowed {
...Erc20Amount
}
chain {
...Chain
}
}
fragment BorrowSwapActivity on BorrowSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...PositionAmount
}
buy {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment SupplyActivity on SupplyActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
supplied {
...Erc20Amount
}
chain {
...Chain
}
}
fragment SupplySwapActivity on SupplySwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...PositionAmount
}
buy {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment WithdrawActivity on WithdrawActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
withdrawn {
...Erc20Amount
}
chain {
...Chain
}
}
fragment WithdrawSwapActivity on WithdrawSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
withdraw {
...PositionAmount
}
buy {
...TokenAmount
}
explorerUrl
orderClass
kind
status
}
fragment RepayActivity on RepayActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
repaid {
...Erc20Amount
}
chain {
...Chain
}
}
fragment RepayWithSupplyActivity on RepayWithSupplyActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
repay {
...PositionAmount
}
supply {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment LiquidatedActivity on LiquidatedActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
collateralReserve {
...ReserveInfo
}
collateral {
...Erc20Amount
}
liquidatorReceived {
...Erc20Amount
}
liquidationFee {
...Erc20Amount
}
debtReserve {
...ReserveInfo
}
debt {
...Erc20Amount
}
liquidator
liquidationHealthFactor
chain {
...Chain
}
}
fragment UsingAsCollateralActivity on UsingAsCollateralActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
enabledAsCollateral
chain {
...Chain
}
}
fragment TokenSwapActivity on TokenSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...TokenAmount
}
buy {
...TokenAmount
}
explorerUrl
orderClass
kind
status
}
fragment LeverageActivity on LeverageActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
collateral {
...PositionAmount
}
debt {
...PositionAmount
}
multiplier
explorerUrl
orderClass
status
}
fragment UpdatedDynamicConfigActivity on UpdatedDynamicConfigActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
collateralFactor {
...PercentNumberChangeSnapshot
}
maxLiquidationBonus {
...PercentNumberChangeSnapshot
}
liquidationFee {
...PercentNumberChangeSnapshot
}
chain {
...Chain
}
}
fragment UpdatedRiskPremiumActivity on UpdatedRiskPremiumActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
premium {
...PercentNumberChangeSnapshot
}
chain {
...Chain
}
}
fragment PercentNumberChangeSnapshot on PercentNumberChangeSnapshot {
__typename
before {
...PercentNumber
}
after {
...PercentNumber
}
}
Fetching User Activities
Fetch users' activities with filtering and pagination.
Use the use hook in React, the activities action in TypeScript, or the activities query in GraphQL 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>
);
}
import { type ActivitiesRequest, useActivities } from "@aave/react";
function ActivitiesList({ request }: { request: ActivitiesRequest }) {
const { data } = useActivities({
...request,
suspense: true,
});
// 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>
);
}
import { activities } from "@aave/client/actions";
import { evmAddress, chainId } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
chainIds: [chainId(1)],
},
user: evmAddress("0x456…"),
});
if (result.isOk()) {
console.log("Activities:", result.value);
// result.value: PaginatedActivitiesResult
} else {
console.error("Error:", result.error);
}
import { activities } from "@aave/client/actions";
import { evmAddress, chainId } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
spoke: {
address: evmAddress("0x123…"),
chainId: chainId(1),
},
},
user: evmAddress("0x456…"),
});
if (result.isOk()) {
console.log("Activities:", result.value);
// result.value: PaginatedActivitiesResult
} else {
console.error("Error:", result.error);
}
import { activities } from "@aave/client/actions";
import { evmAddress, chainId, txHash } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
txHash: {
txHash: txHash("0xabc123…"),
chainId: chainId(1),
},
},
user: evmAddress("0x456…"),
});
if (result.isOk()) {
// result.value: PaginatedActivitiesResult
console.log("Activities:", result.value);
} else {
console.error("Error:", result.error);
}
import { activities } from "@aave/client/actions";
import { evmAddress } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
userPositionId: position.id, // position: UserPosition
},
user: evmAddress("0x456…"),
});
if (result.isOk()) {
console.log("Activities:", result.value);
// result.value: PaginatedActivitiesResult
} else {
console.error("Error:", result.error);
}
import { AaveClient } from "@aave/client";
export const client = AaveClient.create();
query ($request: ActivitiesRequest!, $currency: Currency! = USD) {
activities(request: $request) {
items {
... on BorrowActivity {
...BorrowActivity
}
... on SupplyActivity {
...SupplyActivity
}
... on WithdrawActivity {
...WithdrawActivity
}
... on RepayActivity {
...RepayActivity
}
... on LiquidatedActivity {
...LiquidatedActivity
}
... on UsingAsCollateralActivity {
...UsingAsCollateralActivity
}
... on UpdatedDynamicConfigActivity {
...UpdatedDynamicConfigActivity
}
... on UpdatedRiskPremiumActivity {
...UpdatedRiskPremiumActivity
}
... on TokenSwapActivity {
...TokenSwapActivity
}
... on SupplySwapActivity {
...SupplySwapActivity
}
... on BorrowSwapActivity {
...BorrowSwapActivity
}
... on RepayWithSupplyActivity {
...RepayWithSupplyActivity
}
... on WithdrawSwapActivity {
...WithdrawSwapActivity
}
... on LeverageActivity {
...LeverageActivity
}
}
pageInfo {
next
prev
}
}
}
fragment BorrowActivity on BorrowActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
borrowed {
...Erc20Amount
}
chain {
...Chain
}
}
fragment BorrowSwapActivity on BorrowSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...PositionAmount
}
buy {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment SupplyActivity on SupplyActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
supplied {
...Erc20Amount
}
chain {
...Chain
}
}
fragment SupplySwapActivity on SupplySwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...PositionAmount
}
buy {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment WithdrawActivity on WithdrawActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
withdrawn {
...Erc20Amount
}
chain {
...Chain
}
}
fragment WithdrawSwapActivity on WithdrawSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
withdraw {
...PositionAmount
}
buy {
...TokenAmount
}
explorerUrl
orderClass
kind
status
}
fragment RepayActivity on RepayActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
repaid {
...Erc20Amount
}
chain {
...Chain
}
}
fragment RepayWithSupplyActivity on RepayWithSupplyActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
repay {
...PositionAmount
}
supply {
...PositionAmount
}
explorerUrl
orderClass
kind
status
}
fragment LiquidatedActivity on LiquidatedActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
collateral {
...Erc20Amount
}
liquidatorReceived {
...Erc20Amount
}
liquidationFee {
...Erc20Amount
}
collateralReserve {
...ReserveInfo
}
debt {
...Erc20Amount
}
debtReserve {
...ReserveInfo
}
liquidator
liquidationHealthFactor
chain {
...Chain
}
}
fragment UsingAsCollateralActivity on UsingAsCollateralActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
enabledAsCollateral
chain {
...Chain
}
}
fragment TokenSwapActivity on TokenSwapActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
sell {
...TokenAmount
}
buy {
...TokenAmount
}
explorerUrl
orderClass
kind
status
}
fragment LeverageActivity on LeverageActivity {
__typename
id
user
timestamp
txHash
chain {
...Chain
}
collateral {
...PositionAmount
}
debt {
...PositionAmount
}
multiplier
explorerUrl
orderClass
status
}
fragment UpdatedDynamicConfigActivity on UpdatedDynamicConfigActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
reserve {
...ReserveInfo
}
collateralFactor {
...PercentNumberChangeSnapshot
}
maxLiquidationBonus {
...PercentNumberChangeSnapshot
}
liquidationFee {
...PercentNumberChangeSnapshot
}
chain {
...Chain
}
}
fragment UpdatedRiskPremiumActivity on UpdatedRiskPremiumActivity {
__typename
id
user
timestamp
txHash
spoke {
...Spoke
}
premium {
...PercentNumberChangeSnapshot
}
chain {
...Chain
}
}
fragment PercentNumberChangeSnapshot on PercentNumberChangeSnapshot {
__typename
before {
...PercentNumber
}
after {
...PercentNumber
}
}
In React and GraphQL, see below some examples of how to use the hook or query.
import { evmAddress, chainId } from "@aave/react";
const request: ActivitiesRequest = {
query: {
chainIds: [chainId(1)],
},
user: evmAddress("0x456…"),
};
import { evmAddress, chainId } from "@aave/react";
const request: ActivitiesRequest = {
query: {
spoke: {
address: evmAddress("0x123…"),
chainId: chainId(1),
},
},
user: evmAddress("0x456…"),
};
import { evmAddress, chainId, txHash } from "@aave/react";
const request: ActivitiesRequest = {
query: {
txHash: {
txHash: txHash("0xabc123…"),
chainId: chainId(1),
},
},
user: evmAddress("0x456…"),
};
import { evmAddress } from "@aave/react";
const request: ActivitiesRequest = {
query: {
userPositionId: position.id, // position: UserPosition
},
user: evmAddress("0x456…"),
};
{
"request": {
"query": {
"chainIds": [1]
},
"user": "0x456…"
}
}
{
"request": {
"query": {
"spoke": {
"address": "0x123…",
"chainId": 1
}
},
"user": "0x456…"
}
}
{
"request": {
"query": {
"txHash": {
"txHash": "0xabc123…",
"chainId": 1
}
},
"user": "0x456…"
}
}
{
"request": {
"query": {
"userPositionId": "SGVsbG8h"
},
"user": "0x456…"
}
}
Filter by specific activity types. In GraphQL, use the types field.
import { evmAddress, ActivityType } from "@aave/react";
const request: ActivitiesRequest = {
query: {
// your query criteria
},
user: evmAddress("0x456…"),
types: [
ActivityType.Borrow,
ActivityType.Supply,
ActivityType.Repay,
ActivityType.Withdraw,
],
};
import { evmAddress, ActivityType } from "@aave/react";
const request: ActivitiesRequest = {
query: {
// your query criteria
},
user: evmAddress("0x456…"),
types: [
ActivityType.TokenToTokenSwap,
ActivityType.SupplySwap,
ActivityType.BorrowSwap,
ActivityType.RepayWithSupply,
ActivityType.WithdrawSwap,
],
};
import { activities } from "@aave/client/actions";
import { evmAddress, ActivityType } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
// your query criteria
},
user: evmAddress("0x456…"),
types: [
ActivityType.Borrow,
ActivityType.Supply,
ActivityType.Repay,
ActivityType.Withdraw,
],
});
import { activities } from "@aave/client/actions";
import { evmAddress, ActivityType } from "@aave/client";
import { client } from "./client";
const result = await activities(client, {
query: {
// your query criteria
},
user: evmAddress("0x456…"),
types: [
ActivityType.TokenToTokenSwap,
ActivityType.SupplySwap,
ActivityType.BorrowSwap,
ActivityType.RepayWithSupply,
ActivityType.WithdrawSwap,
],
});
{
"request": {
"query": {
// your query criteria
},
"user": "0x456…",
"types": ["BORROW", "SUPPLY", "REPAY", "WITHDRAW"]
}
}
{
"request": {
"query": {
// your query criteria
},
"user": "0x456…",
"types": [
"TOKEN_TO_TOKEN_SWAP",
"SUPPLY_SWAP",
"BORROW_SWAP",
"REPAY_WITH_SUPPLY",
"WITHDRAW_SWAP"
]
}
}
Finally, specify a different currency for displaying fiat amounts.
- React: You can also specify a different time window.
- GraphQL: Use the
currencyargument.
import { evmAddress, TimeWindow } from "@aave/react";
const { data, loading, error } = useActivities({
query: {
// your query criteria
},
user: evmAddress("0x456…"),
timeWindow: TimeWindow.LastWeek,
});
import { evmAddress, Currency } from "@aave/react";
const { data, loading, error } = useActivities({
query: {
// your query criteria
},
user: evmAddress("0x456…"),
currency: Currency.Eur,
});
import { activities } from "@aave/client/actions";
import { evmAddress, Currency } from "@aave/client";
import { client } from "./client";
const result = await activities(
client,
{
query: {
// your query criteria
},
user: evmAddress("0x456…"),
},
{
currency: Currency.Eur,
},
);
{
"request": {
"query": {
// your query criteria
},
"user": "0x456…"
},
"currency": "EUR"
}
Handle Pagination
Navigate through large activity history sets using cursor-based pagination.
Use the page field from the response to implement cursor-based pagination. Navigate back and forward using the prev and next cursors.
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) => (
<p key={activity.id}>
{activity.__typename}: {activity.txHash}
</p>
))}
<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>
);
}
import { activities } from "@aave/client/actions";
import { evmAddress, chainId, PageSize, type Cursor } from "@aave/client";
import { client } from "./client";
let cursor: Cursor | undefined;
const all = [];
while (true) {
const res = await activities(client, {
query: { chainIds: [chainId(1)] },
user: evmAddress("0x456…"),
pageSize: PageSize.Ten,
cursor,
});
if (!res.isOk()) throw res.error;
const { items, pageInfo } = res.value;
all.push(...items);
cursor = pageInfo.next ?? undefined;
if (!cursor) break;
}
console.log("Activities:", all);
{
"request": {
"query": {
// your query criteria
},
"user": "0x456…",
"pageSize": "TEN"
}
}
In GraphQL, the response includes pagination information as follows.
{
"data": {
"activities": {
"items": […],
"pageInfo": {
"prev": "abc123…",
"next": "xyz789…"
}
}
}
}
In GraphQL, navigate to subsequent or previous pages using respectively the next or prev cursors from page.
{
"request": {
"query": {
// your query criteria
},
"user": "0x456…",
"pageSize": "TEN",
"cursor": "xyz789…"
}
}
Network Fees
Fetch the network fee (gas cost) and its historical fiat value for a specific activity transaction.
This experimental hook works only with Viem or Wagmi integrations.
Use the use 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.
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.exchange.symbol}
{fee.exchange.value.toDisplayString(2)}
</span>
</p>
);
}
Like other declarative hooks, the use hook can be used in React Suspense mode and implements pausable mode.
const { data: fee } = useNetworkFee({
query: { activity },
currency: Currency.Eur,
suspense: true,
});
function ActivityFee({
activity,
}: {
activity: ActivityItem | null | undefined;
}) {
const { data: fee, paused } = useNetworkFee({
query: {
activity,
},
pause: !activity,
});
// …
}