UNPKG

@magiceden/magiceden-sdk

Version:

A TypeScript SDK for interacting with Magic Eden's API across multiple chains.

73 lines (72 loc) 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MintParams = exports.SolanaMintParamsSchema = exports.EvmMintParamsSchema = exports.BaseMintParamsSchema = void 0; const zod_1 = require("zod"); const chains_1 = require("../../chains"); const protocol_1 = require("../../protocol"); const primitives_1 = require("../../solana/primitives"); const shared_1 = require("./shared"); /** * Parameters for minting NFTs */ exports.BaseMintParamsSchema = zod_1.z.object({ /** * The chain to mint on */ chain: zod_1.z.nativeEnum(chains_1.Blockchain).describe('Chain to mint on'), /** * The collection ID to mint from */ collectionId: zod_1.z.string().describe('Collection ID to mint from'), /** * The number of NFTs to mint */ nftAmount: zod_1.z.number().int().min(1).describe('Number of NFTs to mint'), /** * The ID of the mint stage */ stageId: zod_1.z.string().optional().describe('ID of the mint stage'), /** * The kind of mint stage */ kind: zod_1.z.nativeEnum(shared_1.MintStageKind).describe('Kind of mint stage'), }); exports.EvmMintParamsSchema = exports.BaseMintParamsSchema.extend({ /** * The EVM chain to mint on */ chain: chains_1.ZodEvmBlockchain.describe('Chain to mint on'), /** * The token protocol type */ protocol: zod_1.z.nativeEnum(protocol_1.EvmProtocolType).describe('Token protocol type'), /** * The token ID for ERC-1155 */ tokenId: zod_1.z.number().int().optional().describe('Token ID for ERC-1155'), }); exports.SolanaMintParamsSchema = exports.BaseMintParamsSchema.extend({ /** * The Solana chain to mint on */ chain: zod_1.z.literal(chains_1.Blockchain.SOLANA).describe('Chain to mint on'), /** * The candy machine ID */ candyMachineId: primitives_1.zSolanaAddress.describe('Candy machine ID'), /** * The collection symbol */ symbol: primitives_1.SolanaSymbol.describe('Collection symbol'), /** * The recipient address */ recipient: primitives_1.zSolanaAddress .optional() .describe('Recipient address (if not specified, then recipient === payer)'), /** * The number of NFTs to mint */ nftAmount: zod_1.z.number().int().min(1).max(5).describe('Number of NFTs to mint (max 5 for Solana)'), }); exports.MintParams = zod_1.z.union([exports.EvmMintParamsSchema, exports.SolanaMintParamsSchema]);