Drop
Drop is a feature that enables NFT minting through smart contracts deployed with Lootex Studio. This SDK module provides a simple and intuitive interface for building customized minting pages for your NFT collections.
Getting Started
To deploy and configure your own NFT drop:
- Contact contact@lootex.io to create your drop
- Configure minting parameters like price, supply, and sale phases on Lootex Studio
- Use this SDK module to integrate minting functionality into your application
Building a Minting Page
Creating a minting page involves three main steps:
- Fetching drop data
- Preparing mint parameters for a wallet
- Building the mint transaction
1. Fetching Drop Data
Use getDrop
to retrieve essential information about your NFT drop, including:
- Total supply
- Minted amount
- Current price
- Sale phase status
- End time
- …and more
import { getDrop } from 'lootex/drop'
import { createClient } from 'lootex/client'
// Initialize the client
const client = createClient({
apiKey: 'your-api-key'
})
// Fetch drop data
const drop = await getDrop({
chainId: 1, // Ethereum mainnet
contractAddress: '0x123', // Your drop contract address
client,
})
console.log(drop) // Contains all the metadata and current minting conditions of the drop
2. Preparing Mint Parameters
After a user connects their wallet, use prepareMint
to check:
- Individual wallet mint eligibility
- Whitelist status
- Maximum mintable amount
- Specific pricing for the wallet
const mintData = await prepareMint({
client,
drop,
conditionId: 0, // Sale phase ID
walletAddress: '0x123', // Connected wallet address
})
console.log(mintData.maxMintableAmount) // Maximum total amount this wallet can mint
console.log(mintData.availableAmount) // Maximum amount this wallet can mint
console.log(mintData.unitPrice) // Price per NFT for this wallet
console.log(mintData.isWhitelistMint) // Whether the wallet is whitelisted
3. Building the Mint Transaction
Finally, construct the transaction data for minting:
// Build mint transaction
const action = await mint({
client,
drop,
walletAddress,
whitelistData: mintData.whitelistData, // Optional: Include if using whitelist
isWhitelistMint: mintData.isWhitelistMint,
quantity: 1, // Number of NFTs to mint
})
// Get transaction data
const txData = await action.buildTransaction()
// Execute the transaction using your preferred web3 provider
const transactionReceipt = await yourWalletProvider.sendTransaction(txData)