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.

Call parameters

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

Balance of request

balance

nat

Balance of token

balance_of_type

Field
Type
Description

requests

Balance of requests

callback

contract(list(bal_response_type))

Callback contract

Usage

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

Errors

An entrypoint doesn't throw any error.

Last updated