> For the complete documentation index, see [llms.txt](https://docs.quipuswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quipuswap.com/smart-contracts/farming/tfarm-contract/entrypoints-overview/fa2-entrypoints/balance_of.md).

# balance\_of

An entrypoint that retrieves a user's staked tokens amount and sends it to the callback contract. Works exactly like FA2 **balance\_of** entrypoint according to [TZIP-012](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md).

### Call parameters

```pascaligo
type token_id_type      is nat

type bal_request_type   is [@layout:comb] record [
  owner                   : address;
  token_id                : token_id_type;
]

type bal_response_type  is [@layout:comb] record [
  request                 : bal_request_type;
  balance                 : nat;
]

type balance_of_type    is [@layout:comb] record [
  requests                : list(bal_request_type);
  callback                : contract(list(bal_response_type));
]
```

#### bal\_request\_type

| Field      | Type            | Description     |
| ---------- | --------------- | --------------- |
| owner      | address         | Owner of tokens |
| toeken\_id | token\_id\_type | Token ID        |

#### bal\_response\_type

| Field    | Type                                    | Description        |
| -------- | --------------------------------------- | ------------------ |
| requests | [bal\_request\_type](#bal_request_type) | Balance of request |
| balance  | nat                                     | Balance of token   |

#### balance\_of\_type

<table><thead><tr><th>Field</th><th width="286.1463414634146">Type</th><th>Description</th></tr></thead><tbody><tr><td>requests</td><td>list(<a href="#bal_response_type">bal_response_type</a>)</td><td>Balance of requests</td></tr><tr><td>callback</td><td>contract(list(<a href="#bal_response_type">bal_response_type</a>))</td><td>Callback contract</td></tr></tbody></table>

### Usage

{% tabs %}
{% tab title="🌮 Taquito" %}

```javascript
const tFarmAddress = "KT1...";
const params = [
    {
        owner: "tz1.../KT1...",
        token_id: 1,
    },
    ...
];
const tFarm = await tezos.contract.at(tFarmAddress);
const result = await tFarm.contract.views
  .balance_of(params)
  .read();
```

{% endtab %}
{% endtabs %}

### Errors

An entrypoint doesn't throw any error.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.quipuswap.com/smart-contracts/farming/tfarm-contract/entrypoints-overview/fa2-entrypoints/balance_of.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
