# Account Methods

### `balanceOf()`

Retrieves the token balance of an account in the Papaya protocol.

```typescript
async balanceOf(account?: string): Promise<number>
```

**Parameters:**

* `account`: (Optional) The address to check the balance of. If not provided, uses the connected signer's address.

**Returns:** The account balance in its raw blockchain format. Use `formatOutput()` to convert to a human-readable number.

**Example:**

```typescript
// Get raw balance
const rawBalance = await papaya.balanceOf();

// Convert to human-readable format
const balance = formatOutput(BigInt(rawBalance), 18);
console.log(`My balance: ${balance} USDT`);
```

### `getUserInfo()`

Gets detailed information about a user's account.

```typescript
async getUserInfo(account?: string): Promise<UserInfo>
```

**Parameters:**

* `account`: (Optional) The address to get info for. If not provided, uses the connected signer's address.

**Returns:** A `UserInfo` object with the following properties:

* `balance`: The account balance in raw blockchain format
* `incomeRate`: The rate at which the account is receiving subscriptions (raw format)
* `outgoingRate`: The rate at which the account is paying subscriptions (raw format)
* `updated`: The timestamp when the account was last updated

{% hint style="info" %}
The `incomeRate` and `outgoingRate` values are rates in their raw blockchain format. You should use the [utility functions](/sdk/utilities.md) to convert them to human-readable values, typically per month.
{% endhint %}

**Example:**

```typescript
// Get raw user info
const userInfo = await papaya.getUserInfo();

// Convert to human-readable format
const formattedUserInfo = {
  balance: formatOutput(BigInt(userInfo.balance), 18),
  incomeRate: convertRateToPeriod(Number(formatOutput(userInfo.incomeRate, 18)), RatePeriod.MONTH),
  outgoingRate: convertRateToPeriod(Number(formatOutput(userInfo.outgoingRate, 18)), RatePeriod.MONTH),
  updated: new Date(Number(userInfo.updated) * 1000).toLocaleString()
};

console.log(`Balance: ${formattedUserInfo.balance} USDT`);
console.log(`Income rate: ${formattedUserInfo.incomeRate} USDT per month`);
console.log(`Outgoing rate: ${formattedUserInfo.outgoingRate} USDT per month`);
console.log(`Last updated: ${formattedUserInfo.updated}`);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.papaya.finance/sdk/api-reference/account-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
