Liz
Liz

Reputation: 5

How to create a new candy machine after testing to test again within project?

So I've been playing around and testing Candy machine on devnet, have the mint site set up and everything seems to be working ok. I want to test again as i have no more assets to mint so need to set up a new candy machine in the project. I've searched around for a solution and saw that deleting the .cache folder will allow you to create a new candy machine and or deleting the mainnet-beta-temp.json or devnet-temp.json file in your .cache folder allowing you to use the keypair you were using before. Can someone confirm if this is true or tell me what the best way to go about this. Thanks!

Upvotes: -1

Views: 447

Answers (1)

WrathionTBP
WrathionTBP

Reputation: 867

erasing the cache is not the best way to create a new Candy Machine, because you need that cache in the future to close the candy machine account and get the rent back into ur account using the withdraw command.

The best way to create and use a new CandyMachine (devnet or mainnet) is using the -c parameter on any CandyMachineV2 command.

For example the following commandts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k ~/.config/solana/devnet.json -cp config.json -c example ./assets will create a new cache file called devnet-example.json because you set -e devnet and -c example. Then to use this CandyMachine in future commands you just have to add -e devnet and -c example in the command that you wanna use.

Take in mind that -c can be any name that you want and this will create (or use) the cache file inside .cache. Just make sure, if you create a new candy machine for devnet or mainnet-beta, to pass the same -c name that you used to create the Candy Machine.

By the way, if you dont set -c on any command it will use temp as default and thats why you wont be able to use/create a new Candy Machine unless you erase the cache file/folder. But my recommendation is to use the -c param instead to ensure the using and creation of the Candy Machine.

Upvotes: 1

Related Questions