Prerequisites
Before you can use your own smart contract with Crossmint, ensure that:- Your smart contract has a free minting function that allows Crossmint to mint NFTs without paying any fees.
- Your smart contract complies with the ERC721 standard (for NFTs) or ERC1155 standard (for SFTs).
Currently, this feature is only available for EVM chains. Support for Solana and other chains is coming soon.
Integration Guide
1. Register Your Smart Contract
First, you need to register your smart contract with Crossmint:cURL
2. Contract Review
After registering your contract, the Crossmint team will review it to ensure compatibility with our infrastructure. This typically takes 1-2 business days.During the review process, we’ll verify that your contract has the necessary free minting function and complies with
the required standards.
3. Mint NFTs
Once your contract is approved, you can start minting NFTs using the Crossmint API:cURL
The
$RECIPIENT_ADDRESS
placeholder will be automatically replaced with the recipient’s address by Crossmint.Contract Function Parameters
When using your own smart contract, you need to specify the contract function to call and its parameters:- name: The name of the function in your smart contract that mints NFTs.
- params: An array of parameters to pass to the function.
- name: The parameter name as defined in your smart contract.
- type: The parameter type (e.g., address, uint256, string).
- value: The value to pass to the parameter.
You cannot pass custom metadata as a parameter. Metadata is controlled at the smart contract level when using your
own contract.
Example: Minting with a Custom Contract
Here’s an example of minting an NFT using a custom contract with amintTo
function:
Best Practices
When using your own smart contract with Crossmint:- Test Thoroughly: Test your contract integration in the staging environment before moving to production.
- Function Visibility: Ensure your minting function has the appropriate visibility and access controls.
- Gas Optimization: Optimize your contract to minimize gas costs for minting operations.
- Error Handling: Implement proper error handling in your contract to provide meaningful error messages.
FAQs
Can I use an existing deployed contract?
Can I use an existing deployed contract?
Yes, you can use an existing deployed contract as long as it meets the prerequisites mentioned above.
What if my contract doesn't have a free minting function?
What if my contract doesn't have a free minting function?
Your contract must have a function that allows Crossmint to mint NFTs without paying any fees. If your contract
doesn’t have this, you’ll need to modify it or deploy a new version.
Can I use Crossmint's email delivery with my own contract?
Can I use Crossmint's email delivery with my own contract?
Yes, you can still use Crossmint’s email delivery system with your own contract. Just specify an email recipient
in the mint request.
How do I handle token IDs with my custom contract?
How do I handle token IDs with my custom contract?
Token ID management depends on your contract implementation. You can either pass a specific token ID as a
parameter or let your contract handle token ID assignment internally.