UNPKG

@apillon/cli

Version:
101 lines 5.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createNftsCommands = void 0; const commander_1 = require("commander"); const nft_service_1 = require("./nft.service"); const options_1 = require("../../lib/options"); const sdk_1 = require("@apillon/sdk"); const utils_1 = require("../../lib/utils"); function createNftsCommands(cli) { const nfts = cli .command('nfts') .description('Commands for managing NFT collections and tokens on Apillon platform'); // COLLECTIONS const listCollectionsCommand = nfts .command('list-collections') .description('List NFT collections owned by project') .addOption(new commander_1.Option('--status <collection-status>', 'Status of the collection (optional) Choose from:\n' + ` ${sdk_1.CollectionStatus.CREATED}: Created\n` + ` ${sdk_1.CollectionStatus.DEPLOY_INITIATED}: Deploy Initiated\n` + ` ${sdk_1.CollectionStatus.DEPLOYING}: Deploying\n` + ` ${sdk_1.CollectionStatus.DEPLOYED}: Deployed\n` + ` ${sdk_1.CollectionStatus.TRANSFERRED}: Transferred\n` + ` ${sdk_1.CollectionStatus.FAILED}: Failed\n`).choices((0, utils_1.enumValues)(sdk_1.CollectionStatus))) .action(async function () { await (0, nft_service_1.listCollections)(this.optsWithGlobals()); }); (0, options_1.addPaginationOptions)(listCollectionsCommand); nfts .command('get-collection') .description('Get NFT collection details.') .requiredOption('--uuid <collection uuid>', 'Collection UUID') .action(async function () { await (0, nft_service_1.getCollection)(this.optsWithGlobals()); }); nfts .command('create-collection') .description('Create NFT collection from JSON file') .argument('<file-path>', 'path to JSON data file of type ICreateCollection') .addOption(new commander_1.Option('--substrate', 'Create the collection on substrate environment')) .action(async function (filePath) { await (0, nft_service_1.createCollection)(filePath, this.optsWithGlobals()); }); nfts .command('mint-nft') .description('Mint NFT from collection') .requiredOption('--uuid <collection uuid>', 'Collection UUID') .requiredOption('-a, --address <string>', 'Address which will receive minted NFTs.') .requiredOption('-q, --quantity <integer>', 'Number of NFTs to mint.', '1') .action(async function () { await (0, nft_service_1.mintCollectionNft)(this.optsWithGlobals()); }); nfts .command('nest-mint-nft') .description('Nest mint NFT child collection to parent NFT') .requiredOption('--uuid <collection uuid>', 'Child collection UUID') .requiredOption('-c, --parent-collection <string>', 'Parent collection UUID to which child NFTs will be minted to.') .requiredOption('-p, --parent-nft <string>', 'Parent NFT ID to which child NFTs will be minted to') .requiredOption('-q, --quantity <integer>', 'Number of child NFTs to mint', '1') .action(async function () { await (0, nft_service_1.nestMintCollectionNft)(this.optsWithGlobals()); }); nfts .command('burn-nft') .description('Burn NFT token') .requiredOption('--uuid <collection uuid>', 'Collection UUID') .requiredOption('-t, --token-id <integer>', 'NFT ID which will be burned') .action(async function () { await (0, nft_service_1.burnCollectionNft)(this.optsWithGlobals()); }); nfts .command('transfer-collection') .description('Transfer NFT collection ownership to a new wallet address') .requiredOption('--uuid <collection uuid>', 'Collection UUID') .requiredOption('-a, --address <string>', 'Address which you want to transferred collection ownership to') .action(async function () { await (0, nft_service_1.transferCollectionOwnership)(this.optsWithGlobals()); }); // TRANSACTIONS const listCollectionTransactionsCommand = nfts .command('list-transactions') .description('List NFT transactions for specific collection') .requiredOption('--uuid <collection uuid>', 'Collection UUID') .addOption(new commander_1.Option('--status <transaction-status>', 'Status of the transaction (optional) Choose from:\n' + ` ${sdk_1.TransactionStatus.PENDING}: Pending\n` + ` ${sdk_1.TransactionStatus.CONFIRMED}: Confirmed\n` + ` ${sdk_1.TransactionStatus.FAILED}: Failed\n` + ` ${sdk_1.TransactionStatus.ERROR}: Error\n`).choices((0, utils_1.enumValues)(sdk_1.TransactionStatus))) .addOption(new commander_1.Option('-t, --type <transaction-type>', 'Transaction type (optional) Choose from:\n' + ` ${sdk_1.TransactionType.DEPLOY_CONTRACT}: Deploy Contract\n` + ` ${sdk_1.TransactionType.TRANSFER_CONTRACT_OWNERSHIP}: Transfer Contract Ownership\n` + ` ${sdk_1.TransactionType.MINT_NFT}: Mint NFT\n` + ` ${sdk_1.TransactionType.SET_COLLECTION_BASE_URI}: Set Collection Base URI\n` + ` ${sdk_1.TransactionType.BURN_NFT}: Burn NFT\n` + ` ${sdk_1.TransactionType.NEST_MINT_NFT}: Nest Mint NFT\n`).choices((0, utils_1.enumValues)(sdk_1.TransactionType))) .action(async function () { await (0, nft_service_1.listCollectionTransactions)(this.optsWithGlobals()); }); (0, options_1.addPaginationOptions)(listCollectionTransactionsCommand); } exports.createNftsCommands = createNftsCommands; //# sourceMappingURL=nfts.commands.js.map