Skip to content

Commit

Permalink
Fix create_associated_token_account for spl_token_2022::ID
Browse files Browse the repository at this point in the history
  • Loading branch information
andreisilviudragnea committed Aug 14, 2024
1 parent c5d935d commit f0d5f07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/extensions/client/banks_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ impl ClientExtensions for BanksClient {
token_program_id: &Pubkey,
) -> Result<Pubkey, Box<dyn std::error::Error>> {
let latest_blockhash = self.get_latest_blockhash().await?;
let associated_token_account = get_associated_token_address(account, mint);
let associated_token_account =
get_associated_token_address_with_program_id(account, mint, token_program_id);
let ix =
create_associated_token_account_ix(&payer.pubkey(), account, mint, token_program_id);

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use solana_sdk::{
transaction::Transaction,
};
use spl_associated_token_account::{
get_associated_token_address,
get_associated_token_address_with_program_id,
instruction::create_associated_token_account as create_associated_token_account_ix,
};

Expand Down
3 changes: 2 additions & 1 deletion src/extensions/client/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ impl ClientExtensions for RpcClient {
payer: &Keypair,
token_program_id: &Pubkey,
) -> Result<Pubkey, Box<dyn std::error::Error>> {
let associated_token_account = get_associated_token_address(account, mint);
let associated_token_account =
get_associated_token_address_with_program_id(account, mint, token_program_id);

let tx = self
.transaction_from_instructions(
Expand Down

0 comments on commit f0d5f07

Please sign in to comment.