> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useProfile

> User profile and account information

```tsx theme={null}
import { useProfile } from "@0xmonaco/react";

const {
  profile,
  balances,
  movements,
  orders,
  loading,
  fetchProfile,
  getPaginatedUserMovements,
  getUserBalances,
  getUserBalanceByAssetId,
  getPaginatedOrders,
} = useProfile();
```

## State

<ResponseField name="profile" type="UserProfile | undefined">
  Core profile metadata (id, address, username, account type, withdrawal status). Undefined until fetched. Does not include balances, movements, or orders.
</ResponseField>

<ResponseField name="balances" type="AccountBalance[]">
  User's token balances. Populated by `fetchProfile()` (first 20) or `getUserBalances()`. Empty array until fetched.
</ResponseField>

<ResponseField name="movements" type="GetPaginatedUserMovementsResponse | undefined">
  User's ledger movements. Populated by `fetchProfile()` (first cursor page, `pageSize` 20) or `getPaginatedUserMovements()`. Undefined until fetched.
</ResponseField>

<ResponseField name="orders" type="GetPaginatedOrdersResponse | undefined">
  User's orders. Populated by `fetchProfile()` (first cursor page, pageSize 20) or `getPaginatedOrders()`. Undefined until fetched.
</ResponseField>

<ResponseField name="loading" type="boolean">
  True while `fetchProfile()` is in flight. Does not reflect individual fetch method calls.
</ResponseField>

## Actions

<ResponseField name="fetchProfile" type="() => Promise<UserProfile>">
  Fetches the core profile and the first page of balances, movements, and orders in parallel. Updates all state fields. Throws if the profile fetch fails; balance/movement/order fetch failures are silent (state remains unchanged for those fields).
</ResponseField>

<ResponseField name="getUserBalances" type="(params?) => Promise<GetUserBalancesResponse>">
  Fetch a cursor page of token balances. Updates `balances` state.

  **Parameters:**

  * `pageSize` (optional): Number of items per page, 1 to 1000 (default: 20). A larger value is rejected, not clamped
  * `pageToken` (optional): cursor — omit or send `""` for the first page, then pass the previous response's `nextPageToken`. The walk seeks on `(token, assetId)` over the set the server overlays with the matching engine's authoritative amounts, so a balance the engine adds mid-walk no longer appears only at the end of the last page

  There is no `page`: the SDK rejects one with a `ValidationError` before sending, and a raw REST request carrying it gets `400`.

  **Returns:** `balances` plus `nextPageToken` — pass it back as `pageToken` and keep going until it comes back empty.
</ResponseField>

<ResponseField name="getUserBalanceByAssetId" type="(assetId: string) => Promise<AccountBalance>">
  Get the balance for a specific asset by its UUID. Does not update `balances` state.
</ResponseField>

<ResponseField name="getPaginatedUserMovements" type="(params?) => Promise<GetPaginatedUserMovementsResponse>">
  Fetch paginated transaction history. Updates `movements` state.

  **Parameters:**

  * `pageSize` (optional): Number of items per page, 1 to 1000 (default: 20). A larger value is rejected, not clamped
  * `pageToken` (optional): cursor — omit or send `""` for the first page, then pass the previous response's `nextPageToken`. The walk seeks on `(createdAt, id)`, both immutable, so a movement written mid-walk cannot make the walk repeat or drop a row
  * `entryType` (optional): Filter by entry type (`LedgerEntryType`, upper-case)
  * `transactionType` (optional): Filter by transaction type (`TransactionType`, upper-case)
  * `assetId` (optional): Filter by asset UUID
  * `orderBy` (optional): `"ASC"` or `"DESC"` (default `"DESC"`); a `pageToken` resumes only under the same `orderBy`

  There is no `page`: the SDK rejects one with a `ValidationError` before sending, and a raw REST request carrying it gets `400`. The filters must match the request that minted the token.

  **Returns:** `movements` plus `nextPageToken` — pass it back as `pageToken` and keep going until it comes back empty.
</ResponseField>

<ResponseField name="getPaginatedOrders" type="(params?) => Promise<GetPaginatedOrdersResponse>">
  Fetch paginated orders. Updates `orders` state.

  **Parameters:**

  * `status`, `tradingPairId`, `tradingMode`, `marginAccountId` (optional): filters
  * `pageSize` (optional): Items per page, up to 1000 (default: 10)
  * `pageToken` (optional): cursor — omit or send `""` for the first page, then pass the previous response's `nextPageToken`. See [Order queries](/sdk/typescript/trades#order-queries)
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.