"use strict";
/**
 * This code was AUTOGENERATED using the kinobi library.
 * Please DO NOT EDIT THIS FILE, instead use visitors
 * to add features, then rerun kinobi to update it.
 *
 * @see https://github.com/metaplex-foundation/kinobi
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.mintNewEditionFromMasterEditionViaVaultProxy = exports.getMintNewEditionFromMasterEditionViaVaultProxyInstructionDataSerializer = void 0;
const umi_1 = require("@metaplex-foundation/umi");
const serializers_1 = require("@metaplex-foundation/umi/serializers");
const shared_1 = require("../shared");
const types_1 = require("../types");
function getMintNewEditionFromMasterEditionViaVaultProxyInstructionDataSerializer() {
    return (0, serializers_1.mapSerializer)((0, serializers_1.struct)([
        ['discriminator', (0, serializers_1.u8)()],
        [
            'mintNewEditionFromMasterEditionViaTokenArgs',
            (0, types_1.getMintNewEditionFromMasterEditionViaTokenArgsSerializer)(),
        ],
    ], {
        description: 'MintNewEditionFromMasterEditionViaVaultProxyInstructionData',
    }), (value) => ({ ...value, discriminator: 13 }));
}
exports.getMintNewEditionFromMasterEditionViaVaultProxyInstructionDataSerializer = getMintNewEditionFromMasterEditionViaVaultProxyInstructionDataSerializer;
// Instruction.
function mintNewEditionFromMasterEditionViaVaultProxy(context, input) {
    // Program ID.
    const programId = context.programs.getPublicKey('mplTokenMetadata', 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s');
    // Accounts.
    const resolvedAccounts = {
        newMetadata: {
            index: 0,
            isWritable: true,
            value: input.newMetadata ?? null,
        },
        newEdition: {
            index: 1,
            isWritable: true,
            value: input.newEdition ?? null,
        },
        masterEdition: {
            index: 2,
            isWritable: true,
            value: input.masterEdition ?? null,
        },
        newMint: {
            index: 3,
            isWritable: true,
            value: input.newMint ?? null,
        },
        editionMarkPda: {
            index: 4,
            isWritable: true,
            value: input.editionMarkPda ?? null,
        },
        newMintAuthority: {
            index: 5,
            isWritable: false,
            value: input.newMintAuthority ?? null,
        },
        payer: {
            index: 6,
            isWritable: true,
            value: input.payer ?? null,
        },
        vaultAuthority: {
            index: 7,
            isWritable: false,
            value: input.vaultAuthority ?? null,
        },
        safetyDepositStore: {
            index: 8,
            isWritable: false,
            value: input.safetyDepositStore ?? null,
        },
        safetyDepositBox: {
            index: 9,
            isWritable: false,
            value: input.safetyDepositBox ?? null,
        },
        vault: {
            index: 10,
            isWritable: false,
            value: input.vault ?? null,
        },
        newMetadataUpdateAuthority: {
            index: 11,
            isWritable: false,
            value: input.newMetadataUpdateAuthority ?? null,
        },
        metadata: {
            index: 12,
            isWritable: false,
            value: input.metadata ?? null,
        },
        tokenProgram: {
            index: 13,
            isWritable: false,
            value: input.tokenProgram ?? null,
        },
        tokenVaultProgram: {
            index: 14,
            isWritable: false,
            value: input.tokenVaultProgram ?? null,
        },
        systemProgram: {
            index: 15,
            isWritable: false,
            value: input.systemProgram ?? null,
        },
        rent: {
            index: 16,
            isWritable: false,
            value: input.rent ?? null,
        },
    };
    // Arguments.
    const resolvedArgs = { ...input };
    // Default values.
    if (!resolvedAccounts.payer.value) {
        resolvedAccounts.payer.value = context.payer;
    }
    if (!resolvedAccounts.tokenProgram.value) {
        resolvedAccounts.tokenProgram.value = context.programs.getPublicKey('splToken', 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');
        resolvedAccounts.tokenProgram.isWritable = false;
    }
    if (!resolvedAccounts.systemProgram.value) {
        resolvedAccounts.systemProgram.value = context.programs.getPublicKey('splSystem', '11111111111111111111111111111111');
        resolvedAccounts.systemProgram.isWritable = false;
    }
    // Accounts in order.
    const orderedAccounts = Object.values(resolvedAccounts).sort((a, b) => a.index - b.index);
    // Keys and Signers.
    const [keys, signers] = (0, shared_1.getAccountMetasAndSigners)(orderedAccounts, 'omitted', programId);
    // Data.
    const data = getMintNewEditionFromMasterEditionViaVaultProxyInstructionDataSerializer().serialize(resolvedArgs);
    // Bytes Created On Chain.
    const bytesCreatedOnChain = 0;
    return (0, umi_1.transactionBuilder)([
        { instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
    ]);
}
exports.mintNewEditionFromMasterEditionViaVaultProxy = mintNewEditionFromMasterEditionViaVaultProxy;
//# sourceMappingURL=mintNewEditionFromMasterEditionViaVaultProxy.js.map