From b312d0d388b09bea6a15b4402350e6767fc0d1bd Mon Sep 17 00:00:00 2001 From: Csongor Kiss Date: Mon, 8 Apr 2024 19:33:23 +0200 Subject: [PATCH] solana: pass token_program to ATA (support token22) The associated token program instructions default to the legacy SPL token program. We pass the token_program as an argument to support token2022 tokens too. --- .../src/instructions/initialize.rs | 1 + .../src/instructions/release_inbound.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/solana/programs/example-native-token-transfers/src/instructions/initialize.rs b/solana/programs/example-native-token-transfers/src/instructions/initialize.rs index b6150ac32..555dfd316 100644 --- a/solana/programs/example-native-token-transfers/src/instructions/initialize.rs +++ b/solana/programs/example-native-token-transfers/src/instructions/initialize.rs @@ -65,6 +65,7 @@ pub struct Initialize<'info> { payer = payer, associated_token::mint = mint, associated_token::authority = token_authority, + associated_token::token_program = token_program, )] /// The custody account that holds tokens in locking mode. /// NOTE: the account is unconditionally initialized, but not used in diff --git a/solana/programs/example-native-token-transfers/src/instructions/release_inbound.rs b/solana/programs/example-native-token-transfers/src/instructions/release_inbound.rs index 60cdbb6b5..4d4d3d03e 100644 --- a/solana/programs/example-native-token-transfers/src/instructions/release_inbound.rs +++ b/solana/programs/example-native-token-transfers/src/instructions/release_inbound.rs @@ -21,7 +21,8 @@ pub struct ReleaseInbound<'info> { #[account( mut, associated_token::authority = inbox_item.recipient_address, - associated_token::mint = mint + associated_token::mint = mint, + associated_token::token_program = token_program, )] pub recipient: InterfaceAccount<'info, token_interface::TokenAccount>,