Mint Phase DTO
Schema for mint phase definitions used in drop APIs.
Description
The Mint Phase DTO schema defines the structure of mint phase information for NFT drops, including phase name, pricing, and currency information.
Class Validator Schema
import { IsNumber, IsString } from "class-validator";
export class MintPhaseDto {
@IsString()
name: string;
@IsNumber()
price: number;
@IsString()
currency: string;
}
TypeScript Type
interface MintPhaseDto {
name: string;
price: number;
currency: string;
}
Example
{
"name": "Early Bird",
"price": 0.05,
"currency": "ETH"
}
Field Descriptions
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Phase name |
price | number | Yes | Phase price |
currency | string | Yes | Price currency |
Example Response
{
"id": "phase-1",
"name": "Whitelist",
"startDate": 1640995200000,
"endDate": 1641081600000
}
Field Descriptions
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier for the minting phase |
name | string | Yes | Human-readable phase name |
startDate | number | Yes | Phase start timestamp in milliseconds |
endDate | number | Yes | Phase end timestamp in milliseconds |
Common Minting Phases
Typical minting phase names include:
- Whitelist: Early access for whitelisted addresses
- Public: Open minting for everyone
- VIP: Exclusive minting for VIP members
- Presale: Early sale before public launch
- Dutch Auction: Decreasing price auction
- Fixed Price: Standard fixed price minting
Usage Example
// Example minting phase configuration
const mintPhases = [
{
id: "phase-1",
name: "Whitelist",
startDate: 1640995200000, // Jan 1, 2022 00:00:00 UTC
endDate: 1641081600000, // Jan 2, 2022 00:00:00 UTC
},
{
id: "phase-2",
name: "Public",
startDate: 1641081600000, // Jan 2, 2022 00:00:00 UTC
endDate: 1641254400000, // Jan 4, 2022 00:00:00 UTC
},
];
// Check if a phase is currently active
const isPhaseActive = (phase, currentTime = Date.now()) => {
return currentTime >= phase.startDate && currentTime <= phase.endDate;
};
// Get current active phase
const getCurrentPhase = () => {
return mintPhases.find((phase) => isPhaseActive(phase));
};
const currentPhase = getCurrentPhase();
if (currentPhase) {
console.log("Current phase:", currentPhase.name);
} else {
console.log("No active minting phase");
}
Validation Rules
- id: Must be a unique string identifier
- name: Must be a non-empty string
- startDate: Must be a valid timestamp
- endDate: Must be after startDate
- Timing: Phases should not overlap (enforced by business logic)
Phase Scheduling Best Practices
- Sequential Phases: Ensure phases don't overlap
- Clear Naming: Use descriptive names for each phase
- Adequate Duration: Give users enough time to mint
- Buffer Time: Include small gaps between phases if needed
Related Schemas
- Drop DTO - Main drop structure that contains minting phases
- Create Drop Request - Creating drops with minting phases
- RarityDto - Rarity tier definitions
- MarketPlaceDto - Marketplace information
- API Schemas Overview