metaplex-foundation / js

A JavaScript SDK for interacting with Metaplex's programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allocation guard is not registered in the SDK

sohrab- opened this issue · comments

commented

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?
commented

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

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

commented

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 😅