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

TokenGate Guard disconnects Guard ID #10

Open
S4tyras opened this issue Apr 1, 2024 · 0 comments
Open

TokenGate Guard disconnects Guard ID #10

S4tyras opened this issue Apr 1, 2024 · 0 comments

Comments

@S4tyras
Copy link

S4tyras commented Apr 1, 2024

As we try to add a TokenGate to it we get a "Account does not have correct owner" warning from the UI

creating the config.json guard in sugar seems to disconnect the guard from the candy-machine:
"guards": {
"default": {

  "mintLimit": {
    "id": 1,
    "limit": 1
  },
  "startDate": {
    "date": "2024-04-01 06:00:00 +0000"
  },
  "endDate": {
    "date": "2024-04-02 18:00:00 +0000"
  },
  "tokenGate": {
    "amount": 100000,
    "mint": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
  }
}

}

For now we ended up in adding the token Gate at the end and define the public key, but I am not sure if this is correct.
If we only define the tokenGate in the index.tsx and not in the candy-machine config in suger, we get another error: "Public Key mismatch"

const enabledGuardsKeys =
  guards && Object.keys(guards).filter((guardKey) => guards[guardKey])

let mintArgs: Partial<DefaultGuardSetMintArgs> = {}


const tokenMintPublicKeyString = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
const tokenMint = publicKey(tokenMintPublicKeyString);

// If there are enabled guards, set the mintArgs
if (enabledGuardsKeys.length) {
  // Map enabled guards and set mintArgs automatically based on the fields defined in each guard
  enabledGuardsKeys.forEach((guardKey) => {
    const guardObject = unwrapOption(candyGuard.guards[guardKey]);
    if (!guardObject) return null;

    mintArgs = { ...mintArgs, [guardKey]: some(guardObject) };
  });
}

mintArgs.tokenGate = some({ mint: tokenMint });
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

1 participant