js icon indicating copy to clipboard operation
js copied to clipboard

Allocation guard is not registered in the SDK

Open sohrab- opened this issue 2 years ago • 3 comments

There is a 20th guard, called allocation, in the on-chain program but it is not registered in the SDK.

Let's say I add a 21st custom guard, below allocation, to the on-chain program and register it with the SDK, when trying to create the Candy Machine, the SDK seems to serialise the settings for this new custom guard into the allocation guard settings, i.e. off-by-one.

  • Should allocation be registered by default?
  • Is there a workaround with the SDK that let us proceed without registering allocation?
    • Create a guard manifest for allocation and register it myself?
    • Can I somehow fudge the feature flag list so I don't have to register allocation?

sohrab- avatar May 05 '23 06:05 sohrab-

Here is the manifest if anyone needs the work-around:

import {
  CandyGuardManifest,
  createSerializerFromBeet,
} from "@metaplex-foundation/js";
import {
  Allocation,
  allocationBeet,
} from "@metaplex-foundation/mpl-candy-guard";

export const allocationGuardManifest: CandyGuardManifest<Allocation> = {
  name: "allocation",
  settingsBytes: 5,
  settingsSerializer: createSerializerFromBeet(allocationBeet),
};

Btw this ☝️ is not enough if you are planning to use the allocation guard. That's just enough to skip it to get to our custom guards

sohrab- avatar May 05 '23 08:05 sohrab-

Hi there, thanks for that. Would you be able to PR this into the SDK?

lorisleiva avatar May 05 '23 09:05 lorisleiva

Lemme see if I can understand what it does. The manifest is easy enough but need to know what it does to write the proper unit tests 😅

sohrab- avatar May 07 '23 03:05 sohrab-