UNPKG

@magiceden/magiceden-sdk

Version:

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

104 lines (103 loc) 3.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MakeItemOfferParams = exports.SolanaMakeItemOfferParamsSchema = exports.EvmMultipleMakeItemOfferParamsSchema = exports.EvmMakeItemOfferParamsSchema = exports.BaseMakeItemOfferParamsSchema = void 0; const zod_1 = require("zod"); const chains_1 = require("../../chains"); /** * Parameters for making an offer on an NFT */ exports.BaseMakeItemOfferParamsSchema = zod_1.z.object({ /** * The NFT token * * - For EVM, the token is in the format of contractAddress:tokenId * - For Solana, the token is the mint address */ token: zod_1.z .string() .describe('The NFT token in the format of contractAddress:tokenId for EVM and <mint address> for Solana'), /** * The listing price * * - For EVM, the price is in the smallest unit of the token (e.g. Wei for ETH) * - For Solana, the price is in lamports */ price: zod_1.z.string().describe('The offer price'), /** * The offer expiry timestamp */ expiry: zod_1.z.number().optional().describe('Offer expiry timestamp (Unix timestamp in seconds)'), }); exports.EvmMakeItemOfferParamsSchema = exports.BaseMakeItemOfferParamsSchema.extend({ /** * The number of NFTs to bid on */ quantity: zod_1.z.number().optional().describe('Number of NFTs to bid on'), /** * Whether to automatically set royalty amounts and recipients */ automatedRoyalties: zod_1.z .boolean() .optional() .describe('If true, royalty amounts and recipients will be set automatically'), /** * The maximum amount of royalties to pay in basis points (1 BPS = 0.01%) */ royaltyBps: zod_1.z .number() .optional() .describe('Maximum amount of royalties to pay in basis points (1 BPS = 0.01%)'), /** * The currency address for the offer */ currency: zod_1.z .string() .optional() .describe("Currency address for the offer (defaults to chain's native wrapped token)"), }); exports.EvmMultipleMakeItemOfferParamsSchema = zod_1.z.object({ /** * The EVM chain to make the offer on */ chain: chains_1.ZodEvmBlockchain.describe('The chain to make the offer on'), /** * The make item offer parameters */ params: zod_1.z.array(exports.EvmMakeItemOfferParamsSchema).describe('The make item offer parameters'), }); exports.SolanaMakeItemOfferParamsSchema = exports.BaseMakeItemOfferParamsSchema.extend({ /** * The auction house address * * @default AUCTION_HOUSE_ADDRESS (found in constants/solana/marketplace.ts) */ auctionHouseAddress: zod_1.z.string().optional().describe('Auction house address'), /** * The buyer referral address */ buyerReferral: zod_1.z.string().optional().describe('Buyer referral address'), /** * Whether to use buy v2 */ useBuyV2: zod_1.z.boolean().optional().describe('Whether to use buy v2'), /** * The buyer creator royalty percentage */ buyerCreatorRoyaltyPercent: zod_1.z.number().optional().describe('Buyer creator royalty percentage'), /** * The priority fee in micro lamports */ prioFeeMicroLamports: zod_1.z.number().optional().describe('Priority fee in micro lamports'), /** * The maximum priority fee in lamports */ maxPrioFeeLamports: zod_1.z.number().optional().describe('Maximum priority fee in lamports'), /** * The exact priority fee in lamports */ exactPrioFeeLamports: zod_1.z.number().optional().describe('Exact priority fee in lamports'), }); exports.MakeItemOfferParams = zod_1.z.union([ exports.EvmMultipleMakeItemOfferParamsSchema, exports.SolanaMakeItemOfferParamsSchema, ]);