@metaplex-foundation/mpl-candy-guard
Version:
MPL Candy Guard JavaScript API. This MPL package is for the current generation of the Candy Guard
181 lines • 5.89 kB
JavaScript
"use strict";
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.createMintV2Instruction = exports.mintV2InstructionDiscriminator = exports.mintV2Struct = void 0;
const beet = __importStar(require("@metaplex-foundation/beet"));
const web3 = __importStar(require("@solana/web3.js"));
exports.mintV2Struct = new beet.FixableBeetArgsStruct([
['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['mintArgs', beet.bytes],
['label', beet.coption(beet.utf8String)],
], 'MintV2InstructionArgs');
exports.mintV2InstructionDiscriminator = [120, 121, 23, 146, 173, 110, 199, 205];
function createMintV2Instruction(accounts, args, programId = new web3.PublicKey('Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g')) {
var _a, _b, _c, _d, _e, _f;
const [data] = exports.mintV2Struct.serialize({
instructionDiscriminator: exports.mintV2InstructionDiscriminator,
...args,
});
const keys = [
{
pubkey: accounts.candyGuard,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.candyMachineProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.candyMachine,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.candyMachineAuthorityPda,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.payer,
isWritable: true,
isSigner: true,
},
{
pubkey: accounts.minter,
isWritable: true,
isSigner: true,
},
{
pubkey: accounts.nftMint,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.nftMintAuthority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.nftMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.nftMasterEdition,
isWritable: true,
isSigner: false,
},
{
pubkey: (_a = accounts.token) !== null && _a !== void 0 ? _a : programId,
isWritable: accounts.token != null,
isSigner: false,
},
{
pubkey: (_b = accounts.tokenRecord) !== null && _b !== void 0 ? _b : programId,
isWritable: accounts.tokenRecord != null,
isSigner: false,
},
{
pubkey: accounts.collectionDelegateRecord,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMint,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.collectionMasterEdition,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionUpdateAuthority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.tokenMetadataProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.splTokenProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: (_c = accounts.splAtaProgram) !== null && _c !== void 0 ? _c : programId,
isWritable: false,
isSigner: false,
},
{
pubkey: (_d = accounts.systemProgram) !== null && _d !== void 0 ? _d : web3.SystemProgram.programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.sysvarInstructions,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.recentSlothashes,
isWritable: false,
isSigner: false,
},
{
pubkey: (_e = accounts.authorizationRulesProgram) !== null && _e !== void 0 ? _e : programId,
isWritable: false,
isSigner: false,
},
{
pubkey: (_f = accounts.authorizationRules) !== null && _f !== void 0 ? _f : 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.createMintV2Instruction = createMintV2Instruction;
//# sourceMappingURL=mintV2.js.map