update_token_metadata

An entrypoint that updates LP token metadata. Also can add a new fields to an existing metadata.

Call parameters

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

type upd_tok_meta_t     is [@layout:comb] record [
  token_id                : token_id_t;
  token_info              : list(metadata_pair_t);
]

metadata_pair_t

FieldTypeDescription

key

string

Metadata key

value

bytes

Metadata value

upd_tok_meta_t

FieldTypeDescription

token_id

token_id_t (nat)

Token's (pool's) ID

token_info

Token's metadata

Usage

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

await operation.confirmation();

Errors

  • 108 - pair (pool) with the specified token_id not listed.

  • 402 - sender of the transaction is not a manager.

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

Last updated