UNPKG

@magiceden/magiceden-sdk

Version:

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

92 lines (91 loc) 3.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TakeItemOfferParams = exports.SolanaTakeItemOfferParamsSchema = exports.EvmMultipleTakeItemOfferParamsSchema = exports.EvmTakeItemOfferParamsSchema = exports.BaseTakeItemOfferParamsSchema = void 0; const zod_1 = require("zod"); const chains_1 = require("../../chains"); /** * Parameters for taking an NFT offer */ exports.BaseTakeItemOfferParamsSchema = 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'), }); exports.EvmTakeItemOfferParamsSchema = exports.BaseTakeItemOfferParamsSchema.extend({ /** * The number of tokens to sell */ quantity: zod_1.z.number().optional().describe('The number of tokens to sell.'), /** * The order ID to sell into */ orderId: zod_1.z.string().optional().describe('Optional order id to sell into.'), }); exports.EvmMultipleTakeItemOfferParamsSchema = zod_1.z.object({ /** * The EVM chain to take the item offer on */ chain: chains_1.ZodEvmBlockchain.describe('The chain to take the item offer on'), /** * The take item offer parameters */ items: zod_1.z.array(exports.EvmTakeItemOfferParamsSchema).describe('The take item offer parameters'), }); exports.SolanaTakeItemOfferParamsSchema = exports.BaseTakeItemOfferParamsSchema.extend({ /** * The buyer's wallet address */ buyer: zod_1.z.string().describe("The buyer's wallet address"), /** * The original offer price */ price: zod_1.z.string().describe('The original offer price'), /** * The new price to accept */ newPrice: zod_1.z.string().describe('The new price to accept'), /** * 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'), /** * The seller referral address */ sellerReferral: zod_1.z.string().optional().describe('Seller referral address'), /** * The buyer expiry timestamp */ buyerExpiry: zod_1.z.number().optional().describe('Buyer expiry timestamp'), /** * The seller expiry timestamp */ sellerExpiry: zod_1.z.number().optional().describe('Seller expiry timestamp'), /** * 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.TakeItemOfferParams = zod_1.z.union([ exports.EvmMultipleTakeItemOfferParamsSchema, exports.SolanaTakeItemOfferParamsSchema, ]);