# @metaplex/cli aka Candy Machine Help ## Format * Folder with files named from 0-1.png * JSON file with attributes, format - Array with indices matching images - Contains: title, description and array of traits ({"display_type":"number","trait_type":"generation","value":2}) ## Quick Start ### 1. Build Install dependencies inside `js` folder ```bash cd metaplex/js yarn install yarn bootstrap yarn build ``` Build `metaplex` cli tool ```bash yarn run package:macos // or npx pkg . -d --targets node14-macos-x64 --output bin/macos/metaplex ``` Add metaplex cli to $PATH ```bash sudo cp bin/macos/metaplex /usr/local/bin ``` Alternatively use can use unpacked version after `build` with node command: ``` node ./build/candy-machine-cli.js ``` ### 2. Use Upload assets to the arweave and register for candy-machine (get keypair path with `solana config get`). Should follow [Metaplex NFT Standard](https://docs.metaplex.com/nft-standard) ```bash metaplex upload ./assets --env devnet -k path_to_your_keypair ``` Verify assets ```bash metaplex verify -k path_to_your_keypair ``` Start candy_machine ```bash metaplex create_candy_machine -e devnet -k path_to_your_keypair ``` Set sale start date ```bash metaplex update_candy_machine -d "20 Sep 2021 10:12:00 GMT" -k path_to_your_keypair ``` Mint NFT to your wallet ```bash metaplex mint_one_token -e devnet -k path_to_your_keypair ``` Verify NFT inside your wallet. Should be one new token with balance `1` ```bash spl-token accounts ``` ## Assets Folder * Folder with file pairs named from with growing integer numbers starting from 0.png and 0.json * the image has to be a `PNG` * JSON format can be checked out here: https://docs.metaplex.com/nft-standard. example below: ```json { "name": "Solflare X NFT", "symbol": "", "description": "Celebratory Solflare NFT for the Solflare X launch", "seller_fee_basis_points": 0, "image": "image.png", "animation_url": "https://www.arweave.net/efgh1234?ext=mp4", "external_url": "https://solflare.com", "attributes": [ { "trait_type": "web", "value": "yes" }, { "trait_type": "mobile", "value": "yes" }, { "trait_type": "extension", "value": "yes" } ], "collection": { "name": "Solflare X NFT", "family": "Solflare" }, "properties": { "files": [ { "uri": "image.png", "type": "image/png" }, ], "category": "image", "creators": [ { "address": "creator_sol_address", "share": 100 } ] } } ``` ## SPL Token use The main modifications are: `create_candy_machine` has two new options `spl-token` and `spl-token-account`. `spl-token` specifies the spl token to price the mint in. `spl-token-account` specifies the token account the mint payments are sent to. `mint_one_token` has one new option `spl-token-account`. This specifies the token account the user wishes to pay from. Example usage: ```bash metaplex create_candy_machine --env devnet --keypair /Users/crisp/.config/solana/id.json --spl-token 91MgcgxP8vNg66bb9YDPLdBVbMo5spM9uHbWho85A117 --spl-token-account AQiwnd9uVyY39n32ZWnmpwEgBeq9TQJsBHeq3jWDKpvf metaplex mint_one_token --env devnet --keypair /Users/crisp/.config/solana/id.json --spl-token-account AQiwnd9uVyY39n32ZWnmpwEgBeq9TQJsBHeq3jWDKpvf ```