This is a list with some python scripts that can be useful whilst developing NFT collections on any chain.
- File conversion to JSON format
- Degrade file names by a number
- Remove leading zeros in file name
- Collect metadata_link and mint_account and bundle them in one JSON file
Let's say you have a bunch of wallets that you want to airdrop some NFTs to. But you have received a CSV or TXT file with for example the following format:
walletAddress, numberOfNFTs
msKvnWvUr6tgitEWyduHVFuUgaNKarXRcn,1
mig1oqWaWnJYFduRAEdtswvLEQ4ubQuDhh,5
It will then convert it to a JSON format that looks like this:
{
"msKvnWvUr6tgitEWyduHVFuUgaNKarXRcn": 1,
"mig1oqWaWnJYFduRAEdtswvLEQ4ubQuDhh": 5
}
Then with the JSON file you can use it to airdrop NFTs with popular tools such as Sugar Airdrop for Solana Candy Machine.
Same concept as version 1 but for strings. We've used this script to replace NFT attributes in the metadata. For example this CSV or TXT format:
string1, string2
string3, string4
Will convert to this:
{
"string1": "string2",
"string3": "string4"
}
Useful to mass replace a lot of strings based of a JSON format.
Let's say you have received assets for a Solana NFT collection but they are named in the following format:
1.png, 2.png, 3.png, etc.
1.json, 2.json, 3.json, etc.
But you need this format:
0.png, 1.png, 2.png, etc.
0.json, 1.json, 2.json, etc.
You can use this script to accomplish that for however many files you have in a matter of seconds.
Let's say you're developing a NFT collection but have received files that are named in the following format:
0001.png, 0002.png, 0003.png, etc.
0001.json, 0002.json, 0003.json, etc.
But you need this format:
1.png, 2.png, 3.png, etc.
1.json, 2.json, 3.json, etc.
You can use this script to accomplish that for however many files you have in a matter of seconds.
This script is useful for Solana NFT development with Metaplex Candy Machine & Metaboss.
Sometimes revealing using sugar reveal
does not work due to how the function works, then you need Metaboss to mass update all your NFTs' URIs. To collect them all, you can use this script.
In your cache.json file (from your deployed NFT collection on Solana) you need the metadata_link
from your items.
Your cache.json
items look something like this:
"items": {
"0": {
"name": "NFT #1",
"image_hash": "hiddenForPrivacy",
"image_link": "hiddenForPrivacy",
"metadata_hash": "hiddenForPrivacy",
"metadata_link": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls",
"onChain": false
},
"1": {
"name": "NFT #2",
"image_hash": "hiddenForPrivacy",
"image_link": "hiddenForPrivacy",
"metadata_hash": "hiddenForPrivacy",
"metadata_link": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw",
"onChain": false
}
}
But you also need the mint_account
from your current 'hidden' NFTs that are deployed onchain. These you get by using the metaboss snapshot
command.
The file generated by Metaboss looks something like this:
[
{
"owner_wallet": "hiddenForPrivacy",
"mint_account": "xZ43...",
"metadata_account": "hiddenForPrivacy",
"associated_token_address": "hiddenForPrivacy"
},
{
"owner_wallet": "hiddenForPrivacy",
"mint_account": "71bk...",
"metadata_account": "hiddenForPrivacy",
"associated_token_address": "hiddenForPrivacy"
}
]
From this file the script extracts only the mint_account
and from your cache.json file it only extracts the metadata_link
and bundles them together in one file with the format that Metaboss accepts:
[
{
"mint_account": "xZ43...",
"new_uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls"
},
{
"mint_account": "71bk...",
"new_uri": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw"
}
]
If you have any feedback, want to collaborate or need support, please reach out to us at hello@kite.studio