apl_token_metadata/
lib.rs1#![deny(missing_docs)]
2#![cfg_attr(not(test), forbid(unsafe_code))]
3
4pub mod error;
18pub mod instruction;
19pub mod processor;
20pub mod state;
21
22#[cfg(all(not(feature = "no-entrypoint"), not(test)))]
25mod entrypoint;
26
27use arch_program::{entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey};
28
29arch_program::declare_id!("MetaLUJnthcRKvy3ayXTnVcxaXqca1fbaQox8ChQqAk");
30
31pub fn check_program_account(program_id: &Pubkey) -> ProgramResult {
33 if !check_id(program_id) {
34 return Err(ProgramError::IncorrectProgramId);
35 }
36 Ok(())
37}
38
39pub const METADATA_SEED: &[u8] = b"metadata";
41
42pub const ATTRIBUTES_SEED: &[u8] = b"attributes";
44
45pub fn find_metadata_pda_with_program(program_id: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) {
47 Pubkey::find_program_address(&[METADATA_SEED, mint.as_ref()], program_id)
48}
49
50pub fn find_attributes_pda_with_program(program_id: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) {
52 Pubkey::find_program_address(&[ATTRIBUTES_SEED, mint.as_ref()], program_id)
53}