update_token_metadata

An entrypoint that updates share token metadata. Also can add new fields.

Call parameters

type meta_pair_type     is [@layout:comb] record [
  key                     : string;
  value                   : bytes;
]

type upd_tok_meta_type  is [@layout:comb] record [
  token_id                : nat;
  token_info              : list(meta_pair_type);
]

meta_pair_type

FieldTypeDescription

key

string

Metadata key

value

bytes

Metadata value

upd_tok_meta_type

FieldTypeDescription

token_id

nat

Token's (farm's) ID

token_info

Token's metadata

Usage

const qFarmAddress = "KT1...";
const params = {
    token_id: 1,
    token_info: [
        {
           key: "name",
           value: Buffer.from("wWBTC/TEZ FA2 Staking Share").toString("hex"),
        },
        {
           key: "new_field",
           value: Buffer.from("New value").toString("hex"),
        },
        ...
    ],
};
const qFarm = await tezos.contract.at(qFarmAddress);
const operation = await qFarm.methodsObject.update_token_metadata(params).send();

await operation.confirmation();

Errors

  • Not-admin - sender of the transaction is not current administrator.

  • QSystem/farm-not-set - farming with fid parameter doesn't exist.

Last updated