@metaplex-foundation/mpl-candy-machine-core
Version:
MPL Candy Machine Core JavaScript API. This MPL package is for the current generation of the Candy Machine Core (a.k.a. Candy Machine V3).
141 lines • 4.84 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSetCollectionV2Instruction = exports.setCollectionV2InstructionDiscriminator = exports.setCollectionV2Struct = void 0;
const beet = __importStar(require("@metaplex-foundation/beet"));
const web3 = __importStar(require("@solana/web3.js"));
exports.setCollectionV2Struct = new beet.BeetArgsStruct([['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], 'SetCollectionV2InstructionArgs');
exports.setCollectionV2InstructionDiscriminator = [229, 35, 61, 91, 15, 14, 99, 160];
function createSetCollectionV2Instruction(accounts, programId = new web3.PublicKey('CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR')) {
var _a, _b, _c;
const [data] = exports.setCollectionV2Struct.serialize({
instructionDiscriminator: exports.setCollectionV2InstructionDiscriminator,
});
const keys = [
{
pubkey: accounts.candyMachine,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.authority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.authorityPda,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.payer,
isWritable: true,
isSigner: true,
},
{
pubkey: accounts.collectionUpdateAuthority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMint,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.collectionDelegateRecord,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.newCollectionUpdateAuthority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.newCollectionMint,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.newCollectionMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.newCollectionMasterEdition,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.newCollectionDelegateRecord,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.tokenMetadataProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: (_a = accounts.systemProgram) !== null && _a !== void 0 ? _a : web3.SystemProgram.programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.sysvarInstructions,
isWritable: false,
isSigner: false,
},
{
pubkey: (_b = accounts.authorizationRulesProgram) !== null && _b !== void 0 ? _b : programId,
isWritable: false,
isSigner: false,
},
{
pubkey: (_c = accounts.authorizationRules) !== null && _c !== void 0 ? _c : programId,
isWritable: false,
isSigner: false,
},
];
if (accounts.anchorRemainingAccounts != null) {
for (const acc of accounts.anchorRemainingAccounts) {
keys.push(acc);
}
}
const ix = new web3.TransactionInstruction({
programId,
keys,
data,
});
return ix;
}
exports.createSetCollectionV2Instruction = createSetCollectionV2Instruction;
//# sourceMappingURL=setCollectionV2.js.map