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
18pub fn id() -> Pubkey {
20 Pubkey::from_slice(b"ArchTokenMetadata111111111111111")
21}
22
23pub fn check_program_account(program_id: &Pubkey) -> ProgramResult {
25 if program_id != &id() {
26 return Err(ProgramError::IncorrectProgramId);
27 }
28 Ok(())
29}
30
31pub const METADATA_SEED: &[u8] = b"metadata";
33
34pub const ATTRIBUTES_SEED: &[u8] = b"attributes";
36
37pub fn find_metadata_pda_with_program(program_id: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) {
39 Pubkey::find_program_address(&[METADATA_SEED, mint.as_ref()], program_id)
40}
41
42pub fn find_attributes_pda_with_program(program_id: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) {
44 Pubkey::find_program_address(&[ATTRIBUTES_SEED, mint.as_ref()], program_id)
45}