Score:0

Let user(s) chose to mint a specific NFT from a solana collection

as flag

I have a collection of images to transform in NFTs. For that purpose I have selected to work with solana blockchain, since it is fast and cheap.

I have used the following software resources:

  • solana-cli
  • node.js
  • metaplex
  • candy-machine-mint

In order to publish a collection, I needed to order the tokens from 0.png to Nth-1.png, and I have done some tests on solana devnet. In fact, I have the project almost done; the problem is that I would like to implement a "feature" which does not exist yet (2021-11-13): let the user chose the id (from 0 to n-1) of the NFT that he will mint.

Actually, the NFTs from the same collection are minted in sequence, or with a random order if they were shuffled before the written to the candy machine.

How is it possible to change the src code to achieve the objective of minting one item with a specific id, selected by the user, from the full collection?

I have looked at the code from the main rep: candy-machine-mint - https://github.com/exiled-apes/candy-machine-mint, and some of its deppendencies: @solana/spl-token" - https://www.npmjs.com/package/@solana/spl-token , but I didn't figure out how to achieve the desired goal. Any help on that will be appreciated, thank you.

NOTE, in detail, the procedure I have made to create the solana NFTs was following, mainly: https://www.youtube.com/watch?v=4LLx7SMAOag [ how to create an nft minting website updated (windows, mac, linux) ], and https://hackmd.io/@levicook/HJcDneEWF [ metaplex candy machine ], such that, my procedure which went well was:

1. download node.js, from https://nodejs.org/en/download/, and then:
    >> sudo cp -r node-v16.13.0-linux-x64/{bin,include,lib,share} /usr/local/
    (in ubuntu v20.04)
         
2. go to a terminal, create a forder for the project and:
>> npm install git

3. go to the desired folder, and the do:
>> git clone https://github.com/metaplex-foundation/metaplex
>> cd ./metaplex/
>> sudo npm install -g ts-node

4. install solana:
>> sh -c "$(curl -sSfL https://release.solana.com/v1.8.2/install)"
    # ref.: https://docs.solana.com/cli/install-solana-cli-tools

5. run:
export PATH="/home/<USER_NAME>/.local/share/solana/install/active_release/bin:$PATH"
    (replace <USER_NAME> by user name).

6. check the solana version:
>> solana --version

7. configure the url of solana:
>> solana config set --url <...>
whre in <...> we shal insert the url for salana dev or main, for instance:
        https://api.devnet.solana.com

8. create the keys:
>> solana-keygen new --outfile <...>.json
it asks for a new password, and then...
---> and then we obtain a pubkey and a frase seed;

9. configure the wallet:
>> solana config set --keypair <...>.json

10. check the money at the wallet:
>> solana balance

11. add money, with the command airdrop, or with the phantom browse extension, or etc.;

12. create a new folder called "assets" with the images *.pngs and the files *.jsons:
0.png
0.json
...
<n-1>.pngs
<n-1>.json

13. view the instruction on how to create the *.jsons at: https://docs.metaplex.com/nft-standard , and insert the pubkey in each json:
- name: ...
- description: ...
- seller_fee_basis_points: ...
- image: image.png
- external_url: ...
- attributes: [... ]
- creators: ...
- address: ...

14. install yarn:
>> sudo npm install --global yarn

15. create the collection:
>> cd ./metaplex/js/
>> yarn build
>> yarn install
>> yarn bootstrap

16. put the "asssets" folder with the collection in the metaplex folder;

17. run:
>> ts-node js/packages/cli/src/candy-machine-cli.ts upload ./assets --env <...> --keypair <...>.json
    the fisrt place with <...> shall be: devnet or mainnet-beta;
---> we obtian a public candy machine key,and a folder called ".cache" which has the data sent to the "arweave" server, which is the server that stores the nfts *.pngs.

18. create a candy machine with the price:
>> ts-node js/packages/cli/src/candy-machine-cli.ts create_candy_machine --env <...> --keypair <...>.json --price <...>

19. update the candy machine
>> ts-node js/packages/cli/src/candy-machine-cli.ts update_candy_machine --keypair <...>.json --date '3 oct 2021 00:00:00 GMT'
---> insert a date, and then save the output timestamp.

20. afterwards, clone the project "candy-machine-mint":
>> cd ~/desktop/<folder_of_the_project>
>> git clone https://github.com/exiled-apes/candy-machine-mint.git

21. open the project's folder:
>> cd ./candy-machine-mint

22. then, run:
>> yarn build
>> yarn install

23. copy/rename the file ".env.example" to ".env";

24. fill the variables with the values obtained previously; optional: replace "devnet" by "mainnet-beta";

25. init the system:
>> yarn start

26. go to the website, at localhost:3000;

27. connect the phantom, click on "mint", and accept; observe if the nft appears at "your collectibles" - repeat. 

28. optionally, check the transaction: click on "recent activity" and select the transaction from the list; copy the signature and go to solscan.io, and read the records.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.