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