Skip to main content

MarketPlace DTO

Schema for marketplace information used in drop APIs.

Description

The MarketPlace DTO schema defines the structure of marketplace information for NFT drops, including marketplace name, URL, and icon for supported trading platforms.

Class Validator Schema

import { IsString } from "class-validator";

export class MarketPlaceDto {
@IsString()
name: string;

@IsString()
url: string;

@IsString()
icon: string;
}

TypeScript Type

interface MarketPlaceDto {
name: string;
url: string;
icon: string;
}

Example

{
"name": "OpenSea",
"url": "https://opensea.io/collection/my-nft-drop",
"icon": "https://opensea.io/favicon.ico"
}

Field Descriptions

FieldTypeRequiredDescription
namestringYesMarketplace name
urlstringYesMarketplace URL
iconstringYesMarketplace icon URL

Example Response

{
"id": "marketplace-1",
"name": "OpenSea",
"url": "https://opensea.io"
}

Field Descriptions

FieldTypeRequiredDescription
idstringYesUnique identifier for the marketplace
namestringYesHuman-readable marketplace name
urlstringYesURL to the marketplace website

Common Marketplaces

Typical marketplace names include:

  • OpenSea: Largest NFT marketplace
  • Magic Eden: Solana-focused marketplace
  • Blur: Ethereum NFT marketplace
  • LooksRare: Community-driven marketplace
  • X2Y2: NFT marketplace with trading features

Usage Example

// Example marketplace configuration
const marketplaces = [
{
id: "marketplace-1",
name: "OpenSea",
url: "https://opensea.io",
},
{
id: "marketplace-2",
name: "Magic Eden",
url: "https://magiceden.io",
},
{
id: "marketplace-3",
name: "Blur",
url: "https://blur.io",
},
];

// Get marketplace by name
const getMarketplaceByName = (name) => {
return marketplaces.find((mp) => mp.name === name);
};

const opensea = getMarketplaceByName("OpenSea");
console.log("OpenSea URL:", opensea?.url);

Validation Rules

  • id: Must be a unique string identifier
  • name: Must be a non-empty string
  • url: Must be a valid URL string

Next Steps