solanasolana-web3jsmetaplexcandy-machine

Error: Invalid option 'tokenMint' after connecting phantom wallet to Candy Machine UI


I'm currently integrating the Candy Machine UI from the QuickNode documentation (link: https://www.quicknode.com/guides/solana-development/nfts/how-to-deploy-an-nft-collection-on-solana-using-sugar-candy-machine#set-up-a-minting-site) into my web application. I've successfully connected my wallet to the Candy Machine UI, but unfortunately, I encounter the following error after doing so in the console as the mint button seems disabled:

Error: Invalid option tokenMint
    at OptionLayout.decode (index.ts:148:1)
    at Structure. decode (Layout.js:1234:1)
    at AccountsCoder.decode (accounts.ts:51:1)
    at AccountClient.fetchNullable (account.ts:143:1)
    at async AccountClient.fetch (account.ts:152:1)
    at async getProgramState (candy-machine.ts:178:1)
    at async Promise.all (:3000/index 0)
    at async getCandyMachineState (candy-machine.ts:187:1)
    at async Home.tsx:99:1
  1. I installed dependencies with npm i
  2. then I started the application using npm start.

but I got an error Error: error:0308010C:digital envelope routines::unsupported.so I added --openssl-legacy-provider to package.json and it worked then I connected the wallet to a webpage after that it looked like this: disabled mint button

so I went through the console and saw the error Error: Invalid option tokenMint.

it should look like this: Desired Output


Solution

    1. be aware that you are using a outdated guide here. The UI that you are trying to use only supports candy machine v2. If you install sugar like the guide says it will create a candy machine v3 (account version 2) though. The UI will not work with it.

    2. the digital envelope routines::unsupported.so error is related to using a wrong node version.

    1. The error Error: Invalid option tokenMint indicates that you are using a whitelist token and either do not have it in your wallet or set it incorrectly in your sugar config.

    Instead of using this outdated guide i would rather use a UI that can work with the latest sugar and candy machine version. e.g. https://github.com/MarkSackerberg/umi-cmv3-ui-inofficial