@metaplex-foundation/mpl-candy-guard
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -235,4 +235,19 @@ declare type ErrorWithCode = Error & { | ||
} | ||
export declare class AllocationNotInitializedError extends Error { | ||
readonly code: number; | ||
readonly name: string; | ||
constructor(); | ||
} | ||
export declare class AllocationLimitReachedError extends Error { | ||
readonly code: number; | ||
readonly name: string; | ||
constructor(); | ||
} | ||
export declare class AllocationGuardNotEnabledError extends Error { | ||
readonly code: number; | ||
readonly name: string; | ||
constructor(); | ||
} | ||
export declare function errorFromCode(code: number): MaybeErrorWithCode; | ||
export declare function errorFromName(name: string): MaybeErrorWithCode; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.errorFromName = exports.errorFromCode = exports.ExceededProgramListSizeError = exports.UnauthorizedProgramFoundError = exports.DuplicatedMintLimitIdError = exports.DuplicatedGroupLabelError = exports.UnlockNotEnabledError = exports.ThawNotEnabledError = exports.ExceededMaximumFreezePeriodError = exports.FreezeEscrowAlreadyExistsError = exports.MissingFreezePeriodError = exports.FreezeNotInitializedError = exports.FreezeGuardNotEnabledError = exports.MissingFreezeInstructionError = exports.AddressNotAuthorizedError = exports.MaximumRedeemedAmountError = exports.MissingNftError = exports.InvalidNftCollectionError = exports.AllowedMintLimitReachedError = exports.AllowedListNotEnabledError = exports.MissingAllowedListProofError = exports.AddressNotFoundInAllowedListError = exports.InvalidMintTimeError = exports.AfterEndDateError = exports.GatewayTokenInvalidError = exports.MissingRequiredSignatureError = exports.TokenTransferFailedError = exports.NotEnoughTokensError = exports.TokenBurnFailedError = exports.NotEnoughSOLError = exports.MintNotLiveError = exports.MintNotLastTransactionError = exports.CollectionUpdateAuthorityKeyMismatchError = exports.MissingCollectionAccountsError = exports.CollectionKeyMismatchError = exports.InstructionNotFoundError = exports.CandyMachineEmptyError = exports.ExceededLengthError = exports.GroupNotFoundError = exports.RequiredGroupLabelNotFoundError = exports.NumericalOverflowErrorError = exports.MissingRemainingAccountError = exports.UninitializedError = exports.IncorrectOwnerError = exports.DataIncrementLimitExceededError = exports.PublicKeyMismatchError = exports.DeserializationErrorError = exports.InvalidAccountSizeError = void 0; | ||
exports.errorFromCode = exports.AllocationGuardNotEnabledError = exports.AllocationLimitReachedError = exports.AllocationNotInitializedError = exports.ExceededProgramListSizeError = exports.UnauthorizedProgramFoundError = exports.DuplicatedMintLimitIdError = exports.DuplicatedGroupLabelError = exports.UnlockNotEnabledError = exports.ThawNotEnabledError = exports.ExceededMaximumFreezePeriodError = exports.FreezeEscrowAlreadyExistsError = exports.MissingFreezePeriodError = exports.FreezeNotInitializedError = exports.FreezeGuardNotEnabledError = exports.MissingFreezeInstructionError = exports.AddressNotAuthorizedError = exports.MaximumRedeemedAmountError = exports.MissingNftError = exports.InvalidNftCollectionError = exports.AllowedMintLimitReachedError = exports.AllowedListNotEnabledError = exports.MissingAllowedListProofError = exports.AddressNotFoundInAllowedListError = exports.InvalidMintTimeError = exports.AfterEndDateError = exports.GatewayTokenInvalidError = exports.MissingRequiredSignatureError = exports.TokenTransferFailedError = exports.NotEnoughTokensError = exports.TokenBurnFailedError = exports.NotEnoughSOLError = exports.MintNotLiveError = exports.MintNotLastTransactionError = exports.CollectionUpdateAuthorityKeyMismatchError = exports.MissingCollectionAccountsError = exports.CollectionKeyMismatchError = exports.InstructionNotFoundError = exports.CandyMachineEmptyError = exports.ExceededLengthError = exports.GroupNotFoundError = exports.RequiredGroupLabelNotFoundError = exports.NumericalOverflowErrorError = exports.MissingRemainingAccountError = exports.UninitializedError = exports.IncorrectOwnerError = exports.DataIncrementLimitExceededError = exports.PublicKeyMismatchError = exports.DeserializationErrorError = exports.InvalidAccountSizeError = void 0; | ||
exports.errorFromName = void 0; | ||
const createErrorFromCodeLookup = new Map(); | ||
@@ -604,2 +605,41 @@ const createErrorFromNameLookup = new Map(); | ||
createErrorFromNameLookup.set('ExceededProgramListSize', () => new ExceededProgramListSizeError()); | ||
class AllocationNotInitializedError extends Error { | ||
constructor() { | ||
super('Allocation PDA not initialized'); | ||
this.code = 0x179e; | ||
this.name = 'AllocationNotInitialized'; | ||
if (typeof Error.captureStackTrace === 'function') { | ||
Error.captureStackTrace(this, AllocationNotInitializedError); | ||
} | ||
} | ||
} | ||
exports.AllocationNotInitializedError = AllocationNotInitializedError; | ||
createErrorFromCodeLookup.set(0x179e, () => new AllocationNotInitializedError()); | ||
createErrorFromNameLookup.set('AllocationNotInitialized', () => new AllocationNotInitializedError()); | ||
class AllocationLimitReachedError extends Error { | ||
constructor() { | ||
super('Allocation limit was reached'); | ||
this.code = 0x179f; | ||
this.name = 'AllocationLimitReached'; | ||
if (typeof Error.captureStackTrace === 'function') { | ||
Error.captureStackTrace(this, AllocationLimitReachedError); | ||
} | ||
} | ||
} | ||
exports.AllocationLimitReachedError = AllocationLimitReachedError; | ||
createErrorFromCodeLookup.set(0x179f, () => new AllocationLimitReachedError()); | ||
createErrorFromNameLookup.set('AllocationLimitReached', () => new AllocationLimitReachedError()); | ||
class AllocationGuardNotEnabledError extends Error { | ||
constructor() { | ||
super('Allocation guard must be enabled'); | ||
this.code = 0x17a0; | ||
this.name = 'AllocationGuardNotEnabled'; | ||
if (typeof Error.captureStackTrace === 'function') { | ||
Error.captureStackTrace(this, AllocationGuardNotEnabledError); | ||
} | ||
} | ||
} | ||
exports.AllocationGuardNotEnabledError = AllocationGuardNotEnabledError; | ||
createErrorFromCodeLookup.set(0x17a0, () => new AllocationGuardNotEnabledError()); | ||
createErrorFromNameLookup.set('AllocationGuardNotEnabled', () => new AllocationGuardNotEnabledError()); | ||
function errorFromCode(code) { | ||
@@ -606,0 +646,0 @@ const createError = createErrorFromCodeLookup.get(code); |
@@ -21,2 +21,3 @@ import * as beet from '@metaplex-foundation/beet'; | ||
import { ProgramGate } from './ProgramGate'; | ||
import { Allocation } from './Allocation'; | ||
export declare type GuardSet = { | ||
@@ -42,3 +43,4 @@ botTax: beet.COption<BotTax>; | ||
programGate: beet.COption<ProgramGate>; | ||
allocation: beet.COption<Allocation>; | ||
}; | ||
export declare const guardSetBeet: beet.FixableBeetArgsStruct<GuardSet>; |
@@ -47,2 +47,3 @@ "use strict"; | ||
const ProgramGate_1 = require("./ProgramGate"); | ||
const Allocation_1 = require("./Allocation"); | ||
exports.guardSetBeet = new beet.FixableBeetArgsStruct([ | ||
@@ -68,3 +69,4 @@ ['botTax', beet.coption(BotTax_1.botTaxBeet)], | ||
['programGate', beet.coption(ProgramGate_1.programGateBeet)], | ||
['allocation', beet.coption(Allocation_1.allocationBeet)], | ||
], 'GuardSet'); | ||
//# sourceMappingURL=GuardSet.js.map |
@@ -21,4 +21,5 @@ import * as beet from '@metaplex-foundation/beet'; | ||
FreezeTokenPayment = 17, | ||
ProgramGate = 18 | ||
ProgramGate = 18, | ||
Allocation = 19 | ||
} | ||
export declare const guardTypeBeet: beet.FixedSizeBeet<GuardType, GuardType>; |
@@ -49,4 +49,5 @@ "use strict"; | ||
GuardType[GuardType["ProgramGate"] = 18] = "ProgramGate"; | ||
GuardType[GuardType["Allocation"] = 19] = "Allocation"; | ||
})(GuardType = exports.GuardType || (exports.GuardType = {})); | ||
exports.guardTypeBeet = beet.fixedScalarEnum(GuardType); | ||
//# sourceMappingURL=GuardType.js.map |
export * from './AddressGate'; | ||
export * from './Allocation'; | ||
export * from './AllowList'; | ||
@@ -16,2 +17,3 @@ export * from './AllowListProof'; | ||
export * from './MintLimit'; | ||
export * from './MintTracker'; | ||
export * from './NftBurn'; | ||
@@ -18,0 +20,0 @@ export * from './NftGate'; |
@@ -18,2 +18,3 @@ "use strict"; | ||
__exportStar(require("./AddressGate"), exports); | ||
__exportStar(require("./Allocation"), exports); | ||
__exportStar(require("./AllowList"), exports); | ||
@@ -33,2 +34,3 @@ __exportStar(require("./AllowListProof"), exports); | ||
__exportStar(require("./MintLimit"), exports); | ||
__exportStar(require("./MintTracker"), exports); | ||
__exportStar(require("./NftBurn"), exports); | ||
@@ -35,0 +37,0 @@ __exportStar(require("./NftGate"), exports); |
@@ -60,2 +60,3 @@ "use strict"; | ||
programGate: 164, | ||
allocation: 5, | ||
}; | ||
@@ -82,2 +83,3 @@ const GUARDS_NAME = [ | ||
'programGate', | ||
'allocation', | ||
]; | ||
@@ -93,3 +95,3 @@ const GUARDS_COUNT = GUARDS_NAME.length; | ||
} | ||
const [botTaxEnabled, solPaymentEnabled, tokenPaymentEnabled, startDateEnabled, thirdPartySignerEnabled, tokenGateEnabled, gatekeeperEnabled, endDateEnabled, allowListEnabled, mintLimitEnabled, nftPaymentEnabled, redeemedAmountEnabled, addressGateEnabled, nftGateEnabled, nftBurnEnabled, tokenBurnEnabled, freezeSolPaymentEnabled, freezeTokenPaymentEnabled, programGateEnabled,] = guards; | ||
const [botTaxEnabled, solPaymentEnabled, tokenPaymentEnabled, startDateEnabled, thirdPartySignerEnabled, tokenGateEnabled, gatekeeperEnabled, endDateEnabled, allowListEnabled, mintLimitEnabled, nftPaymentEnabled, redeemedAmountEnabled, addressGateEnabled, nftGateEnabled, nftBurnEnabled, tokenBurnEnabled, freezeSolPaymentEnabled, freezeTokenPaymentEnabled, programGateEnabled, allocationEnabled,] = guards; | ||
return { | ||
@@ -115,2 +117,3 @@ botTaxEnabled, | ||
programGateEnabled, | ||
allocationEnabled, | ||
}; | ||
@@ -176,5 +179,5 @@ } | ||
function deserializeGuardSet(buffer) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; | ||
const guards = guardsFromData(buffer); | ||
const { botTaxEnabled, startDateEnabled, solPaymentEnabled, tokenPaymentEnabled, thirdPartySignerEnabled, tokenGateEnabled, gatekeeperEnabled, endDateEnabled, allowListEnabled, mintLimitEnabled, nftPaymentEnabled, redeemedAmountEnabled, addressGateEnabled, nftGateEnabled, nftBurnEnabled, tokenBurnEnabled, freezeSolPaymentEnabled, freezeTokenPaymentEnabled, programGateEnabled, } = guards; | ||
const { botTaxEnabled, startDateEnabled, solPaymentEnabled, tokenPaymentEnabled, thirdPartySignerEnabled, tokenGateEnabled, gatekeeperEnabled, endDateEnabled, allowListEnabled, mintLimitEnabled, nftPaymentEnabled, redeemedAmountEnabled, addressGateEnabled, nftGateEnabled, nftBurnEnabled, tokenBurnEnabled, freezeSolPaymentEnabled, freezeTokenPaymentEnabled, programGateEnabled, allocationEnabled, } = guards; | ||
(0, log_1.logDebug)('Guards: %O', guards); | ||
@@ -278,2 +281,7 @@ let cursor = beet.u64.byteSize; | ||
} | ||
if (allocationEnabled) { | ||
const [allocation] = generated_1.allocationBeet.deserialize(buffer, cursor); | ||
data.allocation = allocation; | ||
cursor += GUARDS_SIZE.allocation; | ||
} | ||
return { | ||
@@ -300,2 +308,3 @@ guardSet: { | ||
programGate: (_u = data.programGate) !== null && _u !== void 0 ? _u : null, | ||
allocation: (_v = data.allocation) !== null && _v !== void 0 ? _v : null, | ||
}, | ||
@@ -430,2 +439,8 @@ offset: cursor, | ||
index++; | ||
if (guardSet.allocation) { | ||
generated_1.allocationBeet.write(buffer, offset, guardSet.allocation); | ||
offset += GUARDS_SIZE.allocation; | ||
features |= 1 << index; | ||
} | ||
index++; | ||
beet_1.u64.write(buffer, start, features); | ||
@@ -432,0 +447,0 @@ return offset; |
{ | ||
"name": "@metaplex-foundation/mpl-candy-guard", | ||
"version": "0.3.0", | ||
"programVersion": "0.2.0", | ||
"version": "0.3.1", | ||
"programVersion": "0.2.1", | ||
"description": "MPL Candy Guard JavaScript API. This MPL package is for the current generation of the Candy Guard", | ||
@@ -47,3 +47,3 @@ "main": "dist/src/index.js", | ||
"@metaplex-foundation/cusper": "^0.0.2", | ||
"@solana/web3.js": "^1.56.2", | ||
"@solana/web3.js": "^1.66.2", | ||
"bn.js": "^5.2.0" | ||
@@ -59,3 +59,3 @@ }, | ||
"@noble/hashes": "^1.1.2", | ||
"@solana/spl-token": "^0.2.0", | ||
"@solana/spl-token": "^0.3.6", | ||
"@types/bn.js": "^5.1.0", | ||
@@ -62,0 +62,0 @@ "@types/debug": "^4.1.7", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227689
146
3792
Updated@solana/web3.js@^1.66.2