elliotdotsol / candy-machine-v3-ui

Launch your own Responsive Metaplex Candy Machine V3 UI within minutes.
https://wearekite-cmv3-ui.vercel.app
72 stars 112 forks source link

Error on mint in production #7

Closed arkitoure closed 1 year ago

arkitoure commented 1 year ago

Hello @wearekite! First off thx for your efforts on this, best implementation atm.

Im having an issue when deploying in Vercel. Mint is configured correctly but when going to mint an NFT transaction always fails to simulate and mint. Getting a strange error in the console that perhaps you might have seen before?

MetaplexError: CandyGuardProgram > Unknown Program Error

Source: Program > CandyGuardProgram [Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g] Problem: The program [CandyGuardProgram] at address [Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g] raised an error that is not recognized by the programs registered by the SDK. Solution: Unfortunately, you will need to check the unparsed error below to investigate what went wrong. To get more helpful error messages, ensure the program that failed is registered by the SDK and provides an "errorResolver" method.

Caused By: Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 4: custom program error: 0x17a3

It seems like the candy machine ID does not read and returns this error. Since candy guard is engaged, the authority of the candy machine changes to the guard. Could this be the cause of this error? Is there an extra step required to authorize minting on the front end through the candy guard authority?

elliotdotsol commented 1 year ago

Hey @arkitoure,

I have personally not yet experienced this problem.

Would you mind emailing me your live CM link (preferably devnet) hosted on Vercel? You can reach me at hello@kite.studio.

arkitoure commented 1 year ago

Hey thx @wearekite. Message on the way.

mariospeterman commented 1 year ago

Hi there,

First of all, I want to express my appreciation for the incredible work and effort you've put into this project for the community. I am, however, experiencing the same issue as discussed earlier in this thread. It appears that using Sugar CLI > 2.0.0 creates a Candy Machine v3 with a MintV1 account, which is causing the error and suggesting upgrading to a MintV2 account. I would like to know how you set up your Candy Machine v3.

@arkitoure @wearekite, could you please share which Sugar CLI version you used or if you set up the Candy Machine v3 using a different library?

Thank you in advance for your help!

arkitoure commented 1 year ago

Hello @mariospeterman ... we are currently working on this issue with several tests to see if we can repeat it. On my side, we are also using SugarCLI/Rust but will run on with the JS Umi library to see the result. Will be posting the outcomes here today.

Using the most recent SugarCLI crate: https://crates.io/crates/sugar-cli

mariospeterman commented 1 year ago

Hi @arkitoure I have tried different versions of Sugar CLI, but unfortunately, none of them have worked for me. I am looking forward to the results of your tests and hoping that the Umi library might provide a solution to this issue.

arkitoure commented 1 year ago

Hi @mariospeterman Just to add, I might just skip ahead to the Umi library now for a test since your explanation is detailed enough for me to believe this may be a bug with the SugarCLI. I was about to do another SugarCLI test on devnet but if you are experiencing a similar issue we already have a repeated similar result.

Can you do one thing though? Run "sugar show" cmd on the collection you are having an issue with and post the output of the "account version"?

elliotdotsol commented 1 year ago

Hey @mariospeterman & @arkitoure

Seems that you are using the regular Sugar CLI, not the version built for Candy Machine which is currently still in alpha.

Use the latest [Sugar CMv3 CLI](https://github.com/metaplex-foundation/sugar/releases/tag/sugar-cmv3-alpha.3. Would explain the issue at hand.

If you're on Windows, you can download the .exe file and reference it in your project like ./sugar.exe -V Screenshot 2023-04-29 142131

Let me know if this has resolved the issues at hand so I can close the issue 👍

arkitoure commented 1 year ago

Hi @wearekite ...hmm, this is slightly confusing. Does this mean the most recent update (a month ago) to the SugarCLI is another version to this alpha from Dec.? I have to look deeper into the code base so conflicts are not created on the file dependencies. Things can get a little tricky when running multiple versions of the same thing. Let me run some quick tests, brb.

elliotdotsol commented 1 year ago

Hey @arkitoure,

Completely understandable. The current documentation about sugar is pretty two-sided, the one article mentioning SugarV2 also supports CMv3, while the other mentions Sugar is only for CMv2 unless it has the cmv3 prefix then it suppport CMv3.

I am going off my personal knowledge with Sugar and having read their documentation through and through, so I could very well be wrong here. But that Sugar CLI currently only supports a different Mint version than their SugarCMv3 CLI.

This would explain why my CMv3 UI breaks with newer (or/and not cmv3 specific) Sugar versions.

To support my argument: See article 1, a tutorial for launching a candy machine with the regular Sugar. If you scroll to the bottom of that article you will find a link that leads to their CMv2 UI. For which I would think that that article is a guide for creating a CMv2 with regular Sugar.

To even better support my argument & where I first learnt Sugar for CMv3 is article 2 where they mention to install the alpha version of sugar; sugar-cmv3 image

Test it out, and see if it works. Sugar is still new, so you might find documentation that is outdated so always be sure to check when the articles are updated, you can find when at the bottom of each article.

Example: This is article (article 2 linked in this comment) was updated just 3 days ago on Apr 26th. image

arkitoure commented 1 year ago

Ok looked deeper into the code and it looks like the current version is accurate as it was merged into SugarCLI v2beta1. Check the branch merge here: https://github.com/metaplex-foundation/sugar/compare/sugar-cmv3-alpha.3...v2.0.0-beta.1

So the current version (v2.1.1) should be ok to use for CMv3 deployments. Im still going to move on with my tests now anyway just to eliminate any possibilities.

elliotdotsol commented 1 year ago

Ok looked deeper into the code and it looks like the current version is accurate as it was merged into SugarCLI v2beta1. Check the branch merge here: metaplex-foundation/sugar@sugar-cmv3-alpha.3...v2.0.0-beta.1

So the current version (v2.1.1) should be ok to use for CMv3 deployments. Im still going to move on with my tests now anyway just to eliminate any possibilities.

Quickly checked for myself too. What I found is that only their SugarV2-beta releases are merged with SugarV1.1.2-alpha-cmv3, not their newer versions Their base (stable version) v2.0.0 image

and their v2.0.0-beta.1&2 image

So seems to me that using their newest Sugar versions still don't support CMv3 fully, but their v2.0.0-beta versions do.

elliotdotsol commented 1 year ago

Commenting to update on a quick test that I have run with SugarV2-beta.2 image

All went well, mint worked and showed up in wallet on the latest deployment of my UI

Will repeat test with SugarV2.1.1

elliotdotsol commented 1 year ago

SugarV2.1.1 test also completed: image

This one caused the same error stated in the opening message of this issue. Meaning it did not work.

TLDR; Use v2.0.0-beta.2 (latest as of posting this message) which supports CMv3 Account version v1, which this UI currently only supports.

Will look into adding functionality for CMv3 Account version v2 (which supports pNFT, royalty enforcement)

arkitoure commented 1 year ago

@wearekite thx for pinpointing this issue. The rollback of version has worked. UI now functions as expected.

To those who use the Rust Crate of the SugarCLI, safe rollback was as follows:

cargo uninstall -p sugar-cli -v cargo install --version 2.0.0-beta.2 sugar-cli -v

(remove the optional -v, verbose flag, if desired)