Creating custom NFT collections with Candy Machine
Creating candy machine
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<api-key>");
var body = {
"network": "devnet",
"wallet": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY",
"symbol": "IDT",
"max_supply": 0,
"royalty": 0,
"collection": "7KnYuwbcG3EDLBnpUTovGN1WjpB1WvvyNuMgjRezG33s",
"items_available": 50,
"bulk_item_settings": {
"name": "Identical #$ID+1$",
"uri": "https: //some.uri/abc/path"
},
"groups": [
{
"label": "token",
"guards": {
"tokenPayment": {
"amount": 1000000,
"destination": "AUE3Z8m8HDg8fLaho1XcQzxmmM9bNwKkdLqqkWAdR5Et",
"mint": "4831mWZ5kJxer8VbLVfARG4jz7zgXKdwkDrGp5Lf4xbY"
}
}
},
{
"label": "sol",
"guards": {
"solPayment": {
"amount": 0.5,
"destination": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY"
},
}
}
]
};
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: JSON.stringify(body),
redirect: 'follow'
};
fetch("{{url}}/candy_machine/create", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));Minting token from candy machine
Conclusion
Last updated