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
| Parameter | Type | Required | Description |
|---|
client | PerpsSDKClient | Yes | SDK client |
params.provider | string | Yes | DEX identifier |
params.address | string | Yes | User’s wallet address |
params.cursor | string | No | Pagination cursor from previous response |
params.limit | number | No | Items per page (default 50, max 200) |
params.startTime | number | No | Filter: activity after this timestamp (ms) |
params.endTime | number | No | Filter: activity before this timestamp (ms) |
params.type | ActivityType[] | No | Filter by activity type(s) |
options | SDKRequestOptions | No | Request options |
Returns
ActivitiesResponse:
| Field | Type | Description |
|---|
provider | string | Provider identifier |
items | ActivityItem[] | Activity items (discriminated union by type) |
pagination | Pagination | Pagination metadata |
ActivityType enum
| Value | Description |
|---|
DEPOSIT | Funds deposited |
WITHDRAWAL | Funds withdrawn |
FUNDING | Funding payment on position |
LIQUIDATION | Position liquidated |
TRANSFER | Internal 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):
| Enum | Values |
|---|
LiquidationClassification | 'Liquidated' |
FundingClassification | 'Funding' |
TransferClassification | 'Deposit', 'Withdrawal' |
API Reference: GET /activity