'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var buffer = require('buffer');
var mplTokenMetadata = require('@metaplex-solarti/mpl-token-metadata');
var Pda = require('../../types/Pda.cjs');
var BigNumber = require('../../types/BigNumber.cjs');

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().metadata(...)` instead.
 */
const findMetadataPda = (mint, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer()]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().masterEdition(...)` instead.
 */
const findMasterEditionV2Pda = (mint, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer(), buffer.Buffer.from('edition', 'utf8')]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().edition(...)` instead.
 */
const findEditionPda = (mint, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer(), buffer.Buffer.from('edition', 'utf8')]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().editionMarker(...)` instead.
 */
const findEditionMarkerPda = (mint, edition, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer(), buffer.Buffer.from('edition', 'utf8'), buffer.Buffer.from(edition.div(BigNumber.toBigNumber(248)).toString())]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().collectionAuthorityRecord(...)` instead.
 */
const findCollectionAuthorityRecordPda = (mint, collectionAuthority, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer(), buffer.Buffer.from('collection_authority', 'utf8'), collectionAuthority.toBuffer()]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().useAuthorityRecord(...)` instead.
 */
const findUseAuthorityRecordPda = (mint, useAuthority, programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), mint.toBuffer(), buffer.Buffer.from('user', 'utf8'), useAuthority.toBuffer()]);
};

/**
 * @group Pdas
 * @deprecated Please use `metaplex.nfts().pdas().burner(...)` instead.
 */
const findProgramAsBurnerPda = (programId = mplTokenMetadata.PROGRAM_ID) => {
  return Pda.Pda.find(programId, [buffer.Buffer.from('metadata', 'utf8'), programId.toBuffer(), buffer.Buffer.from('burn', 'utf8')]);
};

exports.findCollectionAuthorityRecordPda = findCollectionAuthorityRecordPda;
exports.findEditionMarkerPda = findEditionMarkerPda;
exports.findEditionPda = findEditionPda;
exports.findMasterEditionV2Pda = findMasterEditionV2Pda;
exports.findMetadataPda = findMetadataPda;
exports.findProgramAsBurnerPda = findProgramAsBurnerPda;
exports.findUseAuthorityRecordPda = findUseAuthorityRecordPda;
//# sourceMappingURL=pdas.cjs.map
