update_operators

params of updateOperatorParams -> (list(op), storage upd)

Implementation of FA2 interface method, more info about FA2 update_operators you can read in the link below.

Types

yToken/fa2Types.ligo
type tokenId is nat

type operatorParam is [@layout:comb] record [
  owner                 : address;
  operator              : address;
  token_id              : tokenId;
]

type updateOperatorParam is
| Add_operator        of operatorParam // adds operator
| Remove_operator     of operatorParam // removes operator

type updateOperatorParams is list(updateOperatorParam)
ParameterTypeDescription

owner

address

account owner tokens

to_

address

account operator tokens

token_id

nat

token identifier

Usage

const tokenId = 0; // or new BigNumber(0) or "0"
const alice = "tz1..."
const bob = "tz2..."
const peter = "tz3..."
const yupana = await tezos.contract.at(yTokenAddress);
const operation = await yupana.methods.update_operators([
        {
          add_operator: {
            owner: alice,
            operator: peter,
            token_id: tokenId,
          },
        },
        {
          remove_operator: {
            owner: alice,
            operator: bob,
            token_id: tokenId,
          },
        }
      ]).send();
await operation.confirmation();

Errors

  • FA2_NOT_OWNER - sender is not owner of account.

  • FA2_TOKEN_UNDEFINED - token identifier is not assigned to any known tokens.

Last updated