Skip to main content
Returns paginated account activity: deposits, withdrawals, liquidations, and funding payments.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().
import { getActivity } from '@lifi/perps-sdk';

const activity = await getActivity(client, {
  provider: 'hyperliquid',
  address: userAddress,
  limit: 50,
});

for (const item of activity.items) {
  console.log(item.type, item.timestamp);
  if (item.type === 'FUNDING') {
    console.log(item.market.baseAsset.displaySymbol, item.amount, item.fundingRate);
  }
}

// Pagination
if (activity.pagination.hasMore) {
  const nextPage = await getActivity(client, {
    provider: 'hyperliquid',
    address: userAddress,
    cursor: activity.pagination.cursor,
  });
}

Filtering by type

import { getActivity, ActivityType } from '@lifi/perps-sdk';

// Only funding payments
const funding = await getActivity(client, {
  provider: 'hyperliquid',
  address: userAddress,
  type: [ActivityType.FUNDING],
});

// Deposits and withdrawals
const transfers = await getActivity(client, {
  provider: 'hyperliquid',
  address: userAddress,
  type: [ActivityType.DEPOSIT, ActivityType.WITHDRAWAL],
});

Parameters

ParameterTypeRequiredDescription
clientPerpsSDKClientYesSDK client
params.providerstringYesDEX identifier
params.addressstringYesUser’s wallet address
params.cursorstringNoPagination cursor from previous response
params.limitnumberNoItems per page (default 50, max 200)
params.startTimenumberNoFilter: activity after this timestamp (ms)
params.endTimenumberNoFilter: activity before this timestamp (ms)
params.typeActivityType[]NoFilter by activity type(s)
optionsSDKRequestOptionsNoRequest options

Returns

ActivitiesResponse:
FieldTypeDescription
providerstringProvider identifier
itemsActivityItem[]Activity items (discriminated union by type)
paginationPaginationPagination metadata

ActivityType enum

ValueDescription
DEPOSITFunds deposited
WITHDRAWALFunds withdrawn
FUNDINGFunding payment on position
LIQUIDATIONPosition liquidated
TRANSFERInternal transfer between two accounts on the same L2 (currently Lighter only)

Activity item fields

All items share id, provider, type, and timestamp. Additional fields depend on type: DEPOSIT (DepositActivity): amount, explorerLink? (block-explorer URL for the on-chain deposit tx) WITHDRAWAL (WithdrawalActivity): amount, fee, explorerLink? (block-explorer URL for the on-chain withdrawal tx) FUNDING (FundingActivity): market (MarketDisplay), amount (negative = paid), positionSize, fundingRate LIQUIDATION (LiquidationActivity): liquidatedNotionalPosition, accountValue, leverageType, liquidatedPositions[] (each with market: MarketDisplay and size) TRANSFER (TransferActivity): direction ('IN' or 'OUT', relative to the queried account), counterpartyAccountIndex? (L2 account integer — Lighter), counterpartyAddress? (wallet address — Hyperliquid), asset (string symbol), amount, meta?, explorerLink? (block-explorer URL for the on-chain transfer tx). At least one of counterpartyAccountIndex / counterpartyAddress is always present; either may appear alone or alongside the other.

Classification enums

Fill.classification values are drawn from FillClassification. Activity items that originate from non-fill events use one of three single-value classification enums (typically not user-facing — they describe the on-chain event that produced the activity):
EnumValues
LiquidationClassification'Liquidated'
FundingClassification'Funding'
TransferClassification'Deposit', 'Withdrawal'
API Reference: GET /activity