import { Buffer } from 'buffer';
import { PROGRAM_ID } from '@metaplex-solarti/mpl-token-metadata';
import { Pda } from '../../types/Pda.mjs';
import { toBigNumber } from '../../types/BigNumber.mjs';

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

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

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

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

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

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

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

export { findCollectionAuthorityRecordPda, findEditionMarkerPda, findEditionPda, findMasterEditionV2Pda, findMetadataPda, findProgramAsBurnerPda, findUseAuthorityRecordPda };
//# sourceMappingURL=pdas.mjs.map
