Skip to main content
Account-level reads — account summary, positions, orders, fills, activity, and single-order lookup — are served by the SDK directly from each provider via @lifi/perps-sdk (getAccount, getPositions, getOrders, getFills, getActivity, getOrder). They are not LI.FI HTTP endpoints. This page documents the data shapes those calls return.

getAccount

Returns the account summary including balances, margin, and fee tier.
const account = await getAccount(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
});

Parameters

NameTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address

Shape

{
  "provider": "hyperliquid",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "balances": [
    {
      "categoryId": "perps",
      "asset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" },
      "units": "10000.00",
      "valueUsd": "10000.00"
    }
  ],
  "collateralBalances": [
    {
      "categoryId": "spot",
      "asset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" },
      "units": "2500.00",
      "valueUsd": "2500.00"
    }
  ],
  "marginUsed": "2500.00",
  "unrealizedPnl": "150.00",
  "feeTier": {
    "maker": "0.0002",
    "taker": "0.0005"
  },
  "config": {
    "provider": "hyperliquid",
    "abstractionMode": "unifiedAccount",
    "agents": [],
    "builderFeeApproval": {
      "builderAddress": "0x5678901234abcdef5678901234abcdef56789012",
      "maxFeeRate": "0.001",
      "approved": true
    }
  }
}

AccountResponse fields

FieldTypeDescription
providerstringProvider identifier
addressstringUser’s wallet address
balancesBalance[]Flat, non-collateral holdings. Each Balance is { categoryId, asset, units, valueUsd }.
collateralBalancesBalance[]SDK-determined collateral subset (spot balances in a category’s quote asset).
marginUsedstringTotal margin used across all positions
unrealizedPnlstringTotal unrealized PnL across all positions
feeTierFeeTierMaker and taker fee rates
configAccountConfigProvider-specific account state — see AccountConfig

AccountConfig

Discriminated union of per-provider account configuration state. Narrow with config.provider === '<key>' to access provider-specific fields. Hyperliquid (provider: "hyperliquid"):
FieldTypeDescription
provider"hyperliquid"Discriminator
abstractionModestring | nullActive abstraction variant (e.g. "unifiedAccount", "dexAbstraction", "disabled"). null when abstraction has never been set — the widget falls back to the descriptor’s default ParamOption.
agentsHyperliquidAgent[]Currently-authorised agent wallets. The approveAgent setup descriptor consults this to detect expiry.
builderFeeApprovalHyperliquidBuilderFeeApproval?Builder fee approval state. Absent when no builder is configured.
Lighter (provider: "lighter"):
FieldTypeDescription
provider"lighter"Discriminator
accountIndexnumberL2 integer account identifier — used by the SDK for WASM signing and by the widget when rendering transfer counterparties
apiKeyIndexnumberSlot the SDK has registered (or will register) the session API key in
apiKeyRegisteredbooleanWhether a key is currently live in apiKeyIndex. The registerApiKey setup descriptor consults this to gate trading.
accountTypenumberRaw integer fee/latency tier from Lighter’s /api/v1/account.account_type. Decoded to a human label by the widget once Lighter publishes the numeric→string mapping.
Positions and orders are fetched separately: getPositions and getOrders.
SDK: getAccount()

getPositions

Returns the user’s open positions. Results are paginated.
const result = await getPositions(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
});

Parameters

NameTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address
marketIdstringNoFilter by the canonical Market.id (not display symbol)
limitintegerNoItems per page (default 50, max 100)
cursorstringNoPagination cursor from previous response

Shape

{
  "provider": "hyperliquid",
  "positions": [
    {
      "market": {
        "providerId": "hyperliquid",
        "id": "BTC",
        "categoryId": "hyperliquid",
        "baseAsset": { "providerId": "hyperliquid", "id": "BTC", "displaySymbol": "BTC", "logoURI": "https://assets.li.fi/tokens/btc.png" },
        "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
      },
      "side": "LONG",
      "size": "0.5",
      "entryPrice": "94000.00",
      "markPrice": "95000.50",
      "liquidationPrice": "85000.00",
      "unrealizedPnl": "500.25",
      "leverage": 10,
      "marginUsed": "4700.00",
      "marginMode": "ISOLATED"
    }
  ],
  "pagination": {
    "limit": 50,
    "hasMore": false
  }
}

Position fields

FieldTypeDescription
marketMarketDisplayMarket reference (see below)
side'LONG' | 'SHORT'Position direction
sizestringPosition size
entryPricestringAverage entry price
markPricestringCurrent mark price
liquidationPricestringEstimated liquidation price
unrealizedPnlstringUnrealized profit/loss
leveragenumberCurrent leverage
marginUsedstringMargin allocated
marginMode'ISOLATED' | 'CROSS'Margin mode

MarketDisplay

The MarketDisplay object is used across positions, orders, fills, and activity to identify the market and its underlying assets:
FieldTypeDescription
providerIdstringProvider that owns the market (e.g., "hyperliquid")
idstringProvider’s canonical, stringified market id that uniquely identifies the trading instrument (e.g., "BTC", "xyz:PURR", "@142"; numeric on Lighter)
categoryIdstringProvider category id (e.g., "hyperliquid", "xyz", "spot")
baseAssetAssetBase leg of the market
quoteAssetAssetQuote leg of the market
SDK: getPositions()

getOrders

Returns the user’s open orders and trigger orders. Results are paginated.
const result = await getOrders(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
});

Parameters

NameTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address
marketIdstringNoFilter by the canonical Market.id (not display symbol)
limitintegerNoItems per page (default 50, max 100)
cursorstringNoPagination cursor from previous response

Shape

{
  "provider": "hyperliquid",
  "openOrders": [
    {
      "orderId": "12345678",
      "market": {
        "providerId": "hyperliquid",
        "id": "ETH",
        "categoryId": "hyperliquid",
        "baseAsset": { "providerId": "hyperliquid", "id": "ETH", "displaySymbol": "ETH", "logoURI": "https://assets.li.fi/tokens/eth.png" },
        "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
      },
      "side": "BUY",
      "type": "LIMIT",
      "size": "1.0",
      "price": "3150.00",
      "filledSize": "0",
      "reduceOnly": false,
      "createdAt": "2025-01-15T10:30:00Z"
    }
  ],
  "triggerOrders": [
    {
      "orderId": "87654321",
      "market": {
        "providerId": "hyperliquid",
        "id": "BTC",
        "categoryId": "hyperliquid",
        "baseAsset": { "providerId": "hyperliquid", "id": "BTC", "displaySymbol": "BTC", "logoURI": "https://assets.li.fi/tokens/btc.png" },
        "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
      },
      "type": "TAKE_PROFIT_MARKET",
      "size": "0.1",
      "triggerPrice": "100000.00",
      "createdAt": "2025-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "limit": 50,
    "hasMore": false
  }
}

OpenOrder fields

FieldTypeDescription
orderIdstringOrder ID
marketMarketDisplayMarket reference
side'BUY' | 'SELL'Order direction
typeOrderTypeOrder type: MARKET, LIMIT, STOP_MARKET, STOP_LIMIT, TAKE_PROFIT_MARKET, TAKE_PROFIT_LIMIT, TRIGGER_ONLY
sizestringOrder size
pricestringLimit price
filledSizestringAmount filled
reduceOnlybooleanWhether reduce-only
labelstring?Optional order label
createdAtstringISO 8601 timestamp

TriggerOrder fields

FieldTypeDescription
orderIdstringOrder ID
marketMarketDisplayMarket reference
typeOrderTypeTrigger order type (e.g., TAKE_PROFIT_MARKET, STOP_LIMIT)
sizestringOrder size
triggerPricestringPrice at which the order activates
limitPricestring?Execution limit price (market order if omitted)
labelstring?Optional order label
createdAtstringISO 8601 timestamp
SDK: getOrders()

getFills

Returns paginated order fills. Results are sorted by creation time, newest first.
const fills = await getFills(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
  limit: 50,
});

Parameters

NameTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address
startTimeintegerNoFilter: fills after this timestamp (ms)
endTimeintegerNoFilter: fills before this timestamp (ms)
cursorstringNoPagination cursor from previous response
limitintegerNoItems per page (default 50, max 100)

Shape

The filledSize, fee, and realizedPnl fields are optional — they may be absent on cancelled or rejected orders, and realizedPnl is null when the order did not close a position.
{
  "provider": "hyperliquid",
  "items": [
    {
      "id": "12345678",
      "orderId": "12340001",
      "market": {
        "providerId": "hyperliquid",
        "id": "BTC",
        "categoryId": "hyperliquid",
        "baseAsset": { "providerId": "hyperliquid", "id": "BTC", "displaySymbol": "BTC", "logoURI": "https://assets.li.fi/tokens/btc.png" },
        "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
      },
      "side": "BUY",
      "type": "MARKET",
      "size": "0.5",
      "price": "94000.00",
      "status": "FILLED",
      "liquidity": "taker",
      "filledSize": "0.5",
      "fee": "4.70",
      "realizedPnl": "125.50",
      "startPosition": "0",
      "classification": "Opened Long",
      "createdAt": "2025-01-15T09:00:00Z"
    }
  ],
  "pagination": {
    "limit": 50,
    "hasMore": true,
    "cursor": "abc123"
  }
}

Fill fields

FieldTypeDescription
idstringFill ID
orderIdstringID of the parent order
marketMarketDisplayMarket reference
side'BUY' | 'SELL'Order direction
typeOrderTypeOrder type
sizestringOriginal order size
pricestringFill price
statusFillStatusFILLED, PARTIALLY_FILLED, CANCELLED, REJECTED
liquidityLiquidityRole'maker' or 'taker' — whether the fill provided or removed liquidity
filledSizestring?Amount filled (absent if no fills yet)
feestring?Total fees paid (absent if no fills yet)
realizedPnlstring | null?Realized PnL (present only when closing a position, null otherwise)
startPositionstring?Position size before this fill
classificationFillClassificationHow this fill affected the position (see below)
createdAtstringISO 8601 timestamp
explorerLinkstring?Block-explorer URL for the settling on-chain tx. Absent when the fill has no on-chain tx (every Hyperliquid fill is off-chain).

FillClassification

Describes how the fill affected the user’s position. Wire values are Title Case strings:
ValueDescription
"Opened Long"Opened a new long position from zero
"Opened Short"Opened a new short position from zero
"Increased Long"Added to an existing long position
"Increased Short"Added to an existing short position
"Reduced Long"Partially closed a long position
"Reduced Short"Partially closed a short position
"Closed Long"Fully closed a long position
"Closed Short"Fully closed a short position
"Switched Long"Closed a short and opened a long (crossed zero)
"Switched Short"Closed a long and opened a short (crossed zero)
"Spot Buy"Spot market buy
"Spot Sell"Spot market sell

Pagination

Use the cursor from the response to fetch the next page:
const nextPage = await getFills(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
  cursor: 'abc123',
});
When hasMore is false, there are no more pages. SDK: getFills()

getActivity

Returns paginated account activity: deposits, withdrawals, liquidations, and funding payments.
const activity = await getActivity(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
});

Parameters

NameTypeRequiredDescription
providerstringYesProvider identifier
addressstringYesUser’s wallet address
startTimeintegerNoFilter: activity after this timestamp (ms)
endTimeintegerNoFilter: activity before this timestamp (ms)
cursorstringNoPagination cursor from previous response
limitintegerNoItems per page (default 50, max 200)
typeActivityType[]NoFilter by activity type(s): DEPOSIT, WITHDRAWAL, FUNDING, LIQUIDATION, TRANSFER

Shape

The response contains a discriminated union of activity items — the type field determines which fields are present.
{
  "provider": "hyperliquid",
  "items": [
    {
      "id": "dep-001",
      "provider": "hyperliquid",
      "type": "DEPOSIT",
      "timestamp": "2025-01-15T10:00:00Z",
      "amount": "5000.00"
    },
    {
      "id": "wd-002",
      "provider": "hyperliquid",
      "type": "WITHDRAWAL",
      "timestamp": "2025-01-14T09:00:00Z",
      "amount": "1000.00",
      "fee": "1.00"
    },
    {
      "id": "fund-003",
      "provider": "hyperliquid",
      "type": "FUNDING",
      "timestamp": "2025-01-14T08:00:00Z",
      "market": {
        "providerId": "hyperliquid",
        "id": "BTC",
        "categoryId": "hyperliquid",
        "baseAsset": { "providerId": "hyperliquid", "id": "BTC", "displaySymbol": "BTC", "logoURI": "https://assets.li.fi/tokens/btc.png" },
        "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
      },
      "amount": "-2.50",
      "positionSize": "0.5",
      "fundingRate": "0.0001"
    },
    {
      "id": "liq-004",
      "provider": "hyperliquid",
      "type": "LIQUIDATION",
      "timestamp": "2025-01-13T12:00:00Z",
      "liquidatedNotionalPosition": "50000.00",
      "accountValue": "100.00",
      "leverageType": "Cross",
      "liquidatedPositions": [
        {
          "market": {
            "providerId": "hyperliquid",
            "id": "ETH",
            "categoryId": "hyperliquid",
            "baseAsset": { "providerId": "hyperliquid", "id": "ETH", "displaySymbol": "ETH", "logoURI": "https://assets.li.fi/tokens/eth.png" },
            "quoteAsset": { "providerId": "hyperliquid", "id": "USDC", "displaySymbol": "USDC", "logoURI": "https://assets.li.fi/tokens/usdc.png" }
          },
          "size": "10.0"
        }
      ]
    }
  ],
  "pagination": {
    "limit": 50,
    "hasMore": true,
    "cursor": "abc123"
  }
}

Activity Types

All activity items share these base fields:
FieldTypeDescription
idstringActivity ID
providerstringProvider identifier
typestringActivity type (discriminator)
timestampstringISO 8601 timestamp
DEPOSIT — Funds deposited into the DEX account:
FieldTypeDescription
amountstringDeposit amount
explorerLinkstring?Block-explorer URL for the on-chain deposit tx
WITHDRAWAL — Funds withdrawn from the DEX account:
FieldTypeDescription
amountstringWithdrawal amount
feestringWithdrawal fee
explorerLinkstring?Block-explorer URL for the on-chain withdrawal tx
FUNDING — Funding payment received or paid on an open position:
FieldTypeDescription
marketMarketDisplayMarket reference
amountstringFunding amount (negative = paid)
positionSizestringPosition size at time of funding
fundingRatestringFunding rate applied
LIQUIDATION — Position(s) liquidated:
FieldTypeDescription
liquidatedNotionalPositionstringTotal notional value liquidated
accountValuestringAccount value at time of liquidation
leverageTypestringLeverage type (e.g., "Cross")
liquidatedPositionsLiquidatedPosition[]Positions that were liquidated
Each LiquidatedPosition:
FieldTypeDescription
marketMarketDisplayMarket reference
sizestringPosition size liquidated
TRANSFER — Internal transfer between two accounts on the same provider (currently emitted by Lighter only; the type definition supports Hyperliquid as well). Direction is relative to the queried account. The counterparty is identified by either an account index (integer L2 account identifier — Lighter) or a wallet address (Hyperliquid, where accounts ARE addresses). The shape is a discriminated union: at least one of counterpartyAccountIndex / counterpartyAddress MUST be present, and either may appear alone or alongside the other. Consumers that render counterparties should prefer counterpartyAccountIndex when present (canonical handle on index-based providers) and fall back to a truncated counterpartyAddress otherwise.
FieldTypeDescription
direction'IN' | 'OUT'Direction relative to the queried account
counterpartyAccountIndexnumber?The other side’s account index (required when counterpartyAddress is absent)
counterpartyAddressstring?The other side’s wallet address (required when counterpartyAccountIndex is absent)
assetstringAsset symbol (e.g., "USDC")
amountstringTransfer amount
metaobject?Provider-specific metadata
explorerLinkstring?Block-explorer URL for the on-chain transfer tx

Pagination

Use the cursor from the response to fetch the next page:
const nextPage = await getActivity(client, {
  provider: 'hyperliquid',
  address: '0x1234...',
  cursor: 'abc123',
});
When hasMore is false, there are no more pages. SDK: getActivity()