balance_of

An entrypoint that retrieves a user's LP 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_t         is nat

type balance_request_t  is [@layout:comb] record [
  owner                   : address;
  token_id                : token_id_t;
]

type balance_response_t is [@layout:comb] record [
  request                 : balance_request_t;
  balance                 : nat;
]

type balance_of_t       is [@layout:comb] record [
  requests                : list(balance_request_t);
  callback                : contract(list(balance_response_t));
]

bal_request_t

bal_response_t

balance_of_t

Usage

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

Errors

  • 412 - non payable entrypoint (can't accept TEZ tokens during call of an entrypoint).

  • FA2_TOKEN_UNDEFINED - token with token_id doesn't exist.

Last updated