MarkSackerberg / umi-cmv3-ui-inofficial

https://umi-cmv3-ui-inofficial.vercel.app
55 stars 61 forks source link

AllowList guard needs merkle proof before minting #23

Closed pindamonhangaba closed 5 months ago

pindamonhangaba commented 5 months ago

According to the docs (https://developers.metaplex.com/candy-machine/guards/allow-list#validate-a-merkle-proof), you need to create a merkleProof before minting a CM that has an allowList guard

Adding this to mintClick() in mintButton.tsk, somewhere before the mint transaction works:

const singleGuard = candyGuard.groups.find(
      (g) => g.label === newGuardList[guardIndex].label
    );
    if (singleGuard) {
      await route(umi, {
        candyMachine: candyMachine.publicKey,
        guard: "allowList",
        routeArgs: {
          path: "proof",
          merkleRoot: new Uint8Array(
            (
              singleGuard.guards
                .allowList as Option<AllowList> as Some<AllowList>
            ).value.merkleRoot
          ),
          merkleProof: getMerkleProof(
            allowLists.get(singleGuard.label)!,
            publicKey(umi.identity)
          ),
        },
      }).sendAndConfirm(umi);
    }
MarkSackerberg commented 5 months ago

Hey, thanks for flagging. This is already happening though. https://github.com/MarkSackerberg/umi-cmv3-ui-inofficial/blob/8778282f85c48c731a30feccac76a7b976bd3ee6/utils/mintHelper.ts#L265

What exactly was your issue?

pindamonhangaba commented 5 months ago

I had an "Missing allowed list proof" error, but might have been temporary or misconfiguration as I can't reproduce it anymore