Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 3c8c186

Browse files
committed
use spl-program-ids in associated-token-address crate
1 parent 846404a commit 3c8c186

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

associated-token-address/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ edition = "2021"
99

1010
[dependencies]
1111
solana-program = "2.0.0"
12+
spl-program-ids = { path = "../program-ids", version = "1.0.0" }
1213

1314
[package.metadata.docs.rs]
1415
targets = ["x86_64-unknown-linux-gnu"]

associated-token-address/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ pub fn get_associated_token_address_and_bump_seed(
2020
)
2121
}
2222

23-
const TOKEN_PROGRAM_ID: Pubkey = solana_program::pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
24-
/// Program ID for the Associated Token Program
25-
pub const ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = solana_program::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
26-
2723
/// Derives the associated token account address for the given wallet address
2824
/// and token mint
2925
pub fn get_associated_token_address(
@@ -33,7 +29,7 @@ pub fn get_associated_token_address(
3329
get_associated_token_address_with_program_id(
3430
wallet_address,
3531
token_mint_address,
36-
&TOKEN_PROGRAM_ID,
32+
&spl_program_ids::spl_token::ID,
3733
)
3834
}
3935

@@ -47,7 +43,7 @@ pub fn get_associated_token_address_with_program_id(
4743
get_associated_token_address_and_bump_seed(
4844
wallet_address,
4945
token_mint_address,
50-
&ASSOCIATED_TOKEN_PROGRAM_ID,
46+
&spl_program_ids::spl_associated_token_account::ID,
5147
token_program_id,
5248
)
5349
.0

0 commit comments

Comments
 (0)