token_acl_interface/
lib.rs1use solana_pubkey::{pubkey, Pubkey};
2
3pub mod error;
4pub mod instruction;
5pub mod offchain;
6pub mod onchain;
7
8pub const FREEZE_EXTRA_ACCOUNT_METAS_SEED: &[u8] = b"freeze_extra_account_metas";
9pub const THAW_EXTRA_ACCOUNT_METAS_SEED: &[u8] = b"thaw_extra_account_metas";
10pub const FLAG_ACCOUNT_SEED: &[u8] = b"FLAG_ACCOUNT";
11
12pub const TOKEN_ACL_ID: Pubkey = pubkey!("TACLkU6CiCdkQN2MjoyDkVg2yAH9zkxiHDsiztQ52TP");
13
14pub fn collect_thaw_extra_account_metas(mint: &Pubkey) -> [&[u8]; 2] {
15 [THAW_EXTRA_ACCOUNT_METAS_SEED, mint.as_ref()]
16}
17
18pub fn collect_freeze_extra_account_metas(mint: &Pubkey) -> [&[u8]; 2] {
19 [FREEZE_EXTRA_ACCOUNT_METAS_SEED, mint.as_ref()]
20}
21
22pub fn collect_flag_account(token_account: &Pubkey) -> [&[u8]; 2] {
23 [FLAG_ACCOUNT_SEED, token_account.as_ref()]
24}
25
26pub fn get_thaw_extra_account_metas_address_and_bump_seed(
27 mint: &Pubkey,
28 program_id: &Pubkey,
29) -> (Pubkey, u8) {
30 Pubkey::find_program_address(&collect_thaw_extra_account_metas(mint), program_id)
31}
32
33pub fn get_freeze_extra_account_metas_address_and_bump_seed(
34 mint: &Pubkey,
35 program_id: &Pubkey,
36) -> (Pubkey, u8) {
37 Pubkey::find_program_address(&collect_freeze_extra_account_metas(mint), program_id)
38}
39
40pub fn get_thaw_extra_account_metas_address(mint: &Pubkey, program_id: &Pubkey) -> Pubkey {
41 get_thaw_extra_account_metas_address_and_bump_seed(mint, program_id).0
42}
43
44pub fn get_freeze_extra_account_metas_address(mint: &Pubkey, program_id: &Pubkey) -> Pubkey {
45 get_freeze_extra_account_metas_address_and_bump_seed(mint, program_id).0
46}
47
48pub fn get_flag_account_address(token_account: &Pubkey, program_id: &Pubkey) -> Pubkey {
49 Pubkey::find_program_address(&collect_flag_account(token_account), program_id).0
50}