1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#![deny(missing_docs)]
#![forbid(unsafe_code)]
mod entrypoint;
pub mod instruction;
pub mod processor;
pub mod tools;
pub use solana_program;
use solana_program::{instruction::Instruction, program_pack::Pack, pubkey::Pubkey};
solana_program::declare_id!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
pub(crate) fn get_associated_token_address_and_bump_seed(
wallet_address: &Pubkey,
spl_token_mint_address: &Pubkey,
program_id: &Pubkey,
) -> (Pubkey, u8) {
get_associated_token_address_and_bump_seed_internal(
wallet_address,
spl_token_mint_address,
program_id,
&spl_token::id(),
)
}
pub fn get_associated_token_address(
wallet_address: &Pubkey,
spl_token_mint_address: &Pubkey,
) -> Pubkey {
get_associated_token_address_and_bump_seed(wallet_address, spl_token_mint_address, &id()).0
}
fn get_associated_token_address_and_bump_seed_internal(
wallet_address: &Pubkey,
spl_token_mint_address: &Pubkey,
program_id: &Pubkey,
token_program_id: &Pubkey,
) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[
&wallet_address.to_bytes(),
&token_program_id.to_bytes(),
&spl_token_mint_address.to_bytes(),
],
program_id,
)
}
#[deprecated(
since = "1.0.4",
note = "please use `instruction::create_associated_token_account` instead"
)]
pub fn create_associated_token_account(
funding_address: &Pubkey,
wallet_address: &Pubkey,
spl_token_mint_address: &Pubkey,
) -> Instruction {
instruction::create_associated_token_account(
funding_address,
wallet_address,
spl_token_mint_address,
)
}