Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid option tokenMint #2291

Open
tadeoaguilar opened this issue Apr 13, 2023 · 4 comments
Open

Error: Invalid option tokenMint #2291

tadeoaguilar opened this issue Apr 13, 2023 · 4 comments

Comments

@tadeoaguilar
Copy link

I have an error when using project-serum/anchor library to fetch the status of a Candy Machine.
It throws:

Unhandled Runtime Error
Error: Invalid option tokenMint

My code is the following:

` const provider = getProvider();

    // Get metadata about your deployed candy machine program
    const idl = await Program.fetchIdl(candyMachineProgram, provider);
   
    // Create a program that you can call
    const program = new Program(idl, candyMachineProgram, provider);
   
    // Fetch the metadata from your candy machine
   **//This is the line of code that is failing**
    const candyMachine = await program.account.candyMachine.fetch(
        "A8N1TGFxC3eesH4vtQuLiCMHdBDZNuVJM925q5xhN71z"
    );

`

Please, any help with this issue will be highly appreciated.

@JeffKGabriel
Copy link

Yes for me as well- Error: Invalid option tokenMint

i am using candy-machine-ui , npm i, create .env, and insert my REACT_APP_CANDY_MACHINE_ID=***

I wonder if it has todo with candy-machine-ui using "@project-serum/anchor": "^0.17.0", dependency - im not sure

in candy-machine-ui it looks like it is happening at getCandyMachineState , Home.tsx line: 99 ->
which calls candy-machine.ts and im seeing issues resolving
const state: any = await program.account.candyMachine.fetch(candyMachineId);

program.account.candyMachine looks like it has the following attributes from logs

_coder:
_idlAccount:
_programId:
_provider:
_size:
coder: (...)
programId:(...)
provider:(...)
size:(...)

but getProgramState() doesnt seem to get past this line await program.account.candyMachine.fetch(

@tadeoaguilar
Copy link
Author

I tried changing the anchor version to other stable releases but no luck at all. I found that Metaplex has recently updated the documentation. There are new ways to connect with the Cany Machine, I will try and update here.
https://docs.metaplex.com/programs/candy-machine/how-to-guides/my-first-candy-machine-part2

@tadeoaguilar
Copy link
Author

tadeoaguilar commented Apr 19, 2023

Haha, some progress with the new Metaplex guide. I have a different error now.

:82 Uncaught (in promise) TypeError: (0 , types_BigNumber_mjs__WEBPACK_IMPORTED_MODULE_3_.toBigNumber)(...).toBuffer is not a function
at toCandyMachine (CandyMachine.mjs:82:54)
at Object.handle (findCandyMachineByAddress.mjs:59:40)
at async Disposable.run (Disposable.mjs:22:1)
toCandyMachine @ CandyMachine.m

image

@tanlethanh
Copy link

tanlethanh commented Jul 6, 2023

For those who still find the answer, the problem is using the incorrect program id (candy machine v1, v2, or v3) for the account. You can search at https://explorer.solana.com/ by your CANDY_MACHINE_ID and find assigned program id, the actual program id that suits your candy machine version. Then set the id to candyMachineProgram in above snippet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants