This function is used to set or revokes approval for a specific operator to manage all tokens of the sender.
import { L1XProvider, NFTSetApprovalForAllArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: NFTSetApprovalForAllArg = {
attrib: {
contract_address: "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
operator_address: "4669899603735f7b06645c73fb73376b4a5c6f43",
approved: true,
},
private_key: "YOUR_PRIVATE_KEY",
fee_limit: 0,
};
l1xProvider.tokens.NFT.setApprovalForAll(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
The attribute for setting approval for all tokens.
{
attrib: {
contract_address: "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
operator_address: "4669899603735f7b06645c73fb73376b4a5c6f43",
approved: true,
},
private_key: "YOUR_PRIVATE_KEY",
fee_limit: 0,
}
The response of the set approval operation.
{
"hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb",
}