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
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)Parameter
Type
Description
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();token_id = 0
alice = "tz1..."
bob = "tz2..."
peter = "tz3..."
yupana = ContractInterface.from_michelson(code) # or client.contract(contract_address)...
call = yupana.update_operators([{
"add_operator": {
"owner": alice,
"operator": peter,
"token_id": token_id,
},
},
{
"remove_operator": {
"owner": alice,
"operator": bob,
"token_id": token_id,
},
}
])
opg = call.inject()
Errors
FA2_NOT_OWNER-senderis notownerof account.FA2_TOKEN_UNDEFINED- token identifier is not assigned to any known tokens.
Last updated
