crab_nft_minter
v1.0.0
Published
An advanced NFT minter with many features.
Maintainers
Readme
Crab NFT Minter
Overview
Crab NFT Minter is an advanced, feature-rich npm package designed to simplify and enhance the process of minting Non-Fungible Tokens (NFTs). This tool provides a comprehensive suite of functionalities for both beginners and experienced developers, enabling seamless interaction with various blockchain networks and offering extensive customization options for NFT creation.
Features
- Multi-chain Support: Easily mint NFTs on popular blockchain networks such as Ethereum, Polygon, Binance Smart Chain, and more.
- Batch Minting: Mint multiple NFTs in a single transaction, significantly reducing gas fees and saving time.
- Customizable Metadata: Full control over NFT metadata, including name, description, image, attributes, and external links.
- IPFS Integration: Seamless integration with IPFS (InterPlanetary File System) for decentralized storage of NFT assets and metadata.
- Royalty Management: Define and enforce creator royalties directly within the smart contract.
- Whitelisting Capabilities: Implement whitelists for exclusive minting events or pre-sales.
- Gas Optimization: Smart contract designs and minting strategies optimized for lower gas consumption.
- Event Tracking: Comprehensive event logging for monitoring minting activities and user interactions.
- Error Handling: Robust error handling and detailed logging for easier debugging and troubleshooting.
- Flexible API: A well-documented and easy-to-use API for programmatic NFT minting.
- Security Audited: Smart contracts are designed with security best practices and are ready for auditing.
Installation
To install the Crab NFT Minter package, use npm or yarn:
npm install crab_nft_minter
# or
yarn add crab_nft_minterUsage
Basic Minting Example
const CrabMinter = require('crab_nft_minter');
async function mintNFT() {
const minter = new CrabMinter({
privateKey: 'YOUR_PRIVATE_KEY',
rpcUrl: 'YOUR_RPC_URL',
contractAddress: 'YOUR_NFT_CONTRACT_ADDRESS'
});
const metadata = {
name: 'My Awesome NFT',
description: 'This is a description of my awesome NFT.',
image: 'ipfs://YOUR_IPFS_IMAGE_HASH',
attributes: [
{ trait_type: 'Background', value: 'Blue' },
{ trait_type: 'Eyes', value: 'Red' }
]
};
try {
const transactionHash = await minter.mint(metadata, 'RECIPIENT_ADDRESS');
console.log('NFT minted successfully! Transaction Hash:', transactionHash);
} catch (error) {
console.error('Error minting NFT:', error);
}
}
mintNFT();Batch Minting Example
const CrabMinter = require('crab_nft_minter');
async function batchMintNFTs() {
const minter = new CrabMinter({
privateKey: 'YOUR_PRIVATE_KEY',
rpcUrl: 'YOUR_RPC_URL',
contractAddress: 'YOUR_NFT_CONTRACT_ADDRESS'
});
const nftsToMint = [
{ metadata: { name: 'NFT 1', description: '...', image: 'ipfs://...' }, recipient: 'ADDRESS_1' },
{ metadata: { name: 'NFT 2', description: '...', image: 'ipfs://...' }, recipient: 'ADDRESS_2' }
];
try {
const transactionHash = await minter.batchMint(nftsToMint);
console.log('NFTs batch minted successfully! Transaction Hash:', transactionHash);
} catch (error) {
console.error('Error batch minting NFTs:', error);
}
}
batchMintNFTs();Configuration
The CrabMinter constructor accepts an options object with the following properties:
privateKey(string): Your wallet's private key. Handle with extreme care and never expose in public repositories.rpcUrl(string): The RPC URL of the blockchain network you want to connect to (e.g.,https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID).contractAddress(string): The address of your NFT smart contract.ipfsGateway(string, optional): Custom IPFS gateway URL. Defaults to a public gateway.
Development
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
Running Tests
npm testContributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the ISC License.
