create
Usage
Below is a basic example of how to call the create function.
import { mintclub } from 'mint.club-v2-sdk'
import { useWalletClient } from 'wagmi'
import { mainnet } from 'viem/chains'
import { curveData } from './data'
function CreateNFTExample() {
const { data: walletClient } = useWalletClient()
const handleCreate = async () => {
await mintclub
.withWalletClient({
...walletClient,
chain: mainnet,
} as any)
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
decimals: 18,
},
curveData,
metadataUrl: 'ipfs://...',
})
}
return <button onClick={handleCreate}>Create NFT</button>
}Return Value
TransactionReceipt | undefined
The receipt for the signed transaction.
Parameters
name
- Type:
string
The nft name.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
curveData,
metadataUrl: 'ipfs://...' | 'https://...',
})reserveToken
- Type:
{ address: '0x${string}'; decimals: number }
The reserve nft to use for the bonding curve. This is the nft that will be used to mint new tokens.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
curveData,
metadataUrl: 'ipfs://...' | 'https://...',
})metadataUrl
- Type:
IpfsHashUrl|HttpUrl
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address //
decimals: 18,
},
curveData,
metadataUrl: 'ipfs://...' | 'https://...',
})curveData (conditionally required)
If stepData is not provided, curveData is required.
It will automatically generate a bonding curve step with the given curve type.
curveData is an object with the following properties:
curveType
- Type:
string
Can be one of : "LINEAR" "EXPONENTIAL" "LOGARITHMIC" "FLAT"
stepCount
- Type:
number
This is the number of steps the curve will have. The more steps, the more granular the curve will be. Since this data is stored on-chain, Greater stepCount will result in higher gas costs.
maxSupply
- Type:
number
The maximum supply of the nft.
initialMintingPrice
- Type:
number
The initial price of the nft on the bonding curve.
finalMintingPrice
- Type:
number
The final price of the nft on the bonding curve.
creatorAllocation (optional)
- Type:
number - Default:
0
The amount of tokens that will be allocated to the creator of the bonding curve upon deployment.
import { curveData } from './curve-data'
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
curveData,
})stepData (conditionally required)
- Type:
{ rangeTo: number; price: number }[]
If curveData is not provided, stepData is required.
Steps that will be used to construct the bonding curve. The rangeTo property is the number of tokens that will be minted until the given price. The price property is the price of the nft in the reserve nft.
If price is 0, the first rangeTo tokens will be allocated to the creator of the bonding curve.
buyRoyalty (optional)
- Type:
number - Default:
0.03
buyRoyalty is the percentage of the buy trade fee that will go to the creator.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
curveData,
buyRoyalty: 0.03,
})sellRoyalty (optional)
- Type:
number - Default:
0.03
sellRoyalty is the percentage of the sell trade fee that will go to the creator.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
curveData,
sellRoyalty: 0.03,
})onSignatureRequest (optional)
- Type:
onSignatureRequest?: () => void; - Default:
undefined
Callback function for when the user is requested to sign the transaction.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
onSignatureRequest: () => {},
})onSigned (optional)
- Type:
onSigned?: (txHash: '0x${string}') => void; - Default:
undefined
Callback function for when the user is signs the transaction.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
onSigned: (txHash) => {},
})onSuccess (optional)
- Type:
onSuccess?: (receipt: TransactionReceipt) => void; - Default:
undefined
Callback function for when the transaction is successful.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
onSuccess: (receipt) => {},
})onError (optional)
- Type:
onError?: (error: unknown) => void; - Default:
undefined
Callback function for when the transaction fails. This also includes when the user rejects the transaction.
await mintclub
.network('ethereum')
.nft('MNFT')
.create({
name: 'Mint Club Collection',
reserveToken: {
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH nft address
decimals: 18,
},
onError: (error) => {},
})