diff --git a/clients/js/src/generated/instructions/mintV1.ts b/clients/js/src/generated/instructions/mintV1.ts index 2c2f494c..03fa5a80 100644 --- a/clients/js/src/generated/instructions/mintV1.ts +++ b/clients/js/src/generated/instructions/mintV1.ts @@ -288,7 +288,7 @@ export function mintV1( } if (!resolvedAccounts.splAtaProgram.value) { resolvedAccounts.splAtaProgram.value = context.programs.getPublicKey( - 'splAssociatedToken', + 'splAssociatedTokenProgram', 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' ); resolvedAccounts.splAtaProgram.isWritable = false; diff --git a/clients/js/src/generated/instructions/printV1.ts b/clients/js/src/generated/instructions/printV1.ts index b35ca9ae..e501627d 100644 --- a/clients/js/src/generated/instructions/printV1.ts +++ b/clients/js/src/generated/instructions/printV1.ts @@ -311,7 +311,7 @@ export function printV1( } if (!resolvedAccounts.splAtaProgram.value) { resolvedAccounts.splAtaProgram.value = context.programs.getPublicKey( - 'splAssociatedToken', + 'splAssociatedTokenProgram', 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' ); resolvedAccounts.splAtaProgram.isWritable = false; diff --git a/clients/js/src/generated/instructions/transferV1.ts b/clients/js/src/generated/instructions/transferV1.ts index 9ac0a40f..fe8bed5e 100644 --- a/clients/js/src/generated/instructions/transferV1.ts +++ b/clients/js/src/generated/instructions/transferV1.ts @@ -307,7 +307,7 @@ export function transferV1( } if (!resolvedAccounts.splAtaProgram.value) { resolvedAccounts.splAtaProgram.value = context.programs.getPublicKey( - 'splAssociatedToken', + 'splAssociatedTokenProgram', 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' ); resolvedAccounts.splAtaProgram.isWritable = false; diff --git a/clients/rust/src/generated/accounts/collection_authority_record.rs b/clients/rust/src/generated/accounts/collection_authority_record.rs index 37f55038..13f7a97d 100644 --- a/clients/rust/src/generated/accounts/collection_authority_record.rs +++ b/clients/rust/src/generated/accounts/collection_authority_record.rs @@ -19,18 +19,6 @@ pub struct CollectionAuthorityRecord { } impl CollectionAuthorityRecord { - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `CollectionAuthorityRecord::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `CollectionAuthorityRecord::PREFIX.1` - /// 4. collection_authority (`Pubkey`) - pub const PREFIX: (&'static [u8], &'static [u8]) = - ("metadata".as_bytes(), "collection_authority".as_bytes()); - pub fn create_pda( mint: Pubkey, collection_authority: Pubkey, diff --git a/clients/rust/src/generated/accounts/edition_marker.rs b/clients/rust/src/generated/accounts/edition_marker.rs index 55cf3e69..bfcdde76 100644 --- a/clients/rust/src/generated/accounts/edition_marker.rs +++ b/clients/rust/src/generated/accounts/edition_marker.rs @@ -19,17 +19,6 @@ pub struct EditionMarker { impl EditionMarker { pub const LEN: usize = 32; - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `EditionMarker::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `EditionMarker::PREFIX.1` - /// 4. edition_marker (`&str`) - pub const PREFIX: (&'static [u8], &'static [u8]) = - ("metadata".as_bytes(), "edition".as_bytes()); pub fn create_pda( mint: Pubkey, diff --git a/clients/rust/src/generated/accounts/edition_marker_v2.rs b/clients/rust/src/generated/accounts/edition_marker_v2.rs index 2c01a670..f65060ba 100644 --- a/clients/rust/src/generated/accounts/edition_marker_v2.rs +++ b/clients/rust/src/generated/accounts/edition_marker_v2.rs @@ -18,21 +18,6 @@ pub struct EditionMarkerV2 { } impl EditionMarkerV2 { - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `EditionMarkerV2::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `EditionMarkerV2::PREFIX.1` - /// 4. `EditionMarkerV2::PREFIX.2` - pub const PREFIX: (&'static [u8], &'static [u8], &'static [u8]) = ( - "metadata".as_bytes(), - "edition".as_bytes(), - "marker".as_bytes(), - ); - pub fn create_pda( mint: Pubkey, bump: u8, diff --git a/clients/rust/src/generated/accounts/master_edition.rs b/clients/rust/src/generated/accounts/master_edition.rs index 654dcae5..4416edc7 100644 --- a/clients/rust/src/generated/accounts/master_edition.rs +++ b/clients/rust/src/generated/accounts/master_edition.rs @@ -19,17 +19,6 @@ pub struct MasterEdition { } impl MasterEdition { - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `MasterEdition::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `MasterEdition::PREFIX.1` - pub const PREFIX: (&'static [u8], &'static [u8]) = - ("metadata".as_bytes(), "edition".as_bytes()); - pub fn create_pda( mint: Pubkey, bump: u8, diff --git a/clients/rust/src/generated/accounts/metadata.rs b/clients/rust/src/generated/accounts/metadata.rs index 728505ad..1cf3a826 100644 --- a/clients/rust/src/generated/accounts/metadata.rs +++ b/clients/rust/src/generated/accounts/metadata.rs @@ -46,15 +46,6 @@ pub struct Metadata { } impl Metadata { - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `Metadata::PREFIX` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - pub const PREFIX: &'static [u8] = "metadata".as_bytes(); - pub fn create_pda( mint: Pubkey, bump: u8, diff --git a/clients/rust/src/generated/accounts/metadata_delegate_record.rs b/clients/rust/src/generated/accounts/metadata_delegate_record.rs index 4adf49cf..ed8a89ba 100644 --- a/clients/rust/src/generated/accounts/metadata_delegate_record.rs +++ b/clients/rust/src/generated/accounts/metadata_delegate_record.rs @@ -35,17 +35,6 @@ pub struct MetadataDelegateRecord { impl MetadataDelegateRecord { pub const LEN: usize = 98; - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `MetadataDelegateRecord::PREFIX` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. delegate_role (`MetadataDelegateRoleSeed`) - /// 4. update_authority (`Pubkey`) - /// 5. delegate (`Pubkey`) - pub const PREFIX: &'static [u8] = "metadata".as_bytes(); pub fn create_pda( mint: Pubkey, diff --git a/clients/rust/src/generated/accounts/mod.rs b/clients/rust/src/generated/accounts/mod.rs index b3750e14..94bed0c0 100644 --- a/clients/rust/src/generated/accounts/mod.rs +++ b/clients/rust/src/generated/accounts/mod.rs @@ -5,24 +5,24 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -pub(crate) mod r#collection_authority_record; -pub(crate) mod r#edition; -pub(crate) mod r#edition_marker; -pub(crate) mod r#edition_marker_v2; -pub(crate) mod r#master_edition; -pub(crate) mod r#metadata; -pub(crate) mod r#metadata_delegate_record; -pub(crate) mod r#token_owned_escrow; -pub(crate) mod r#token_record; -pub(crate) mod r#use_authority_record; +pub(crate) mod collection_authority_record; +pub(crate) mod edition; +pub(crate) mod edition_marker; +pub(crate) mod edition_marker_v2; +pub(crate) mod master_edition; +pub(crate) mod metadata; +pub(crate) mod metadata_delegate_record; +pub(crate) mod token_owned_escrow; +pub(crate) mod token_record; +pub(crate) mod use_authority_record; -pub use self::r#collection_authority_record::*; -pub use self::r#edition::*; -pub use self::r#edition_marker::*; -pub use self::r#edition_marker_v2::*; -pub use self::r#master_edition::*; -pub use self::r#metadata::*; -pub use self::r#metadata_delegate_record::*; -pub use self::r#token_owned_escrow::*; -pub use self::r#token_record::*; -pub use self::r#use_authority_record::*; +pub use self::collection_authority_record::*; +pub use self::edition::*; +pub use self::edition_marker::*; +pub use self::edition_marker_v2::*; +pub use self::master_edition::*; +pub use self::metadata::*; +pub use self::metadata_delegate_record::*; +pub use self::token_owned_escrow::*; +pub use self::token_record::*; +pub use self::use_authority_record::*; diff --git a/clients/rust/src/generated/accounts/token_record.rs b/clients/rust/src/generated/accounts/token_record.rs index b94caf15..2cc34fb2 100644 --- a/clients/rust/src/generated/accounts/token_record.rs +++ b/clients/rust/src/generated/accounts/token_record.rs @@ -26,17 +26,6 @@ pub struct TokenRecord { impl TokenRecord { pub const LEN: usize = 80; - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `TokenRecord::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `TokenRecord::PREFIX.1` - /// 4. token (`Pubkey`) - pub const PREFIX: (&'static [u8], &'static [u8]) = - ("metadata".as_bytes(), "token_record".as_bytes()); pub fn create_pda( mint: Pubkey, diff --git a/clients/rust/src/generated/accounts/use_authority_record.rs b/clients/rust/src/generated/accounts/use_authority_record.rs index d7325cdb..4f642ceb 100644 --- a/clients/rust/src/generated/accounts/use_authority_record.rs +++ b/clients/rust/src/generated/accounts/use_authority_record.rs @@ -20,16 +20,6 @@ pub struct UseAuthorityRecord { impl UseAuthorityRecord { pub const LEN: usize = 10; - /// Prefix values used to generate a PDA for this account. - /// - /// Values are positional and appear in the following order: - /// - /// 0. `UseAuthorityRecord::PREFIX.0` - /// 1. `crate::MPL_TOKEN_METADATA_ID` - /// 2. mint (`Pubkey`) - /// 3. `UseAuthorityRecord::PREFIX.1` - /// 4. use_authority (`Pubkey`) - pub const PREFIX: (&'static [u8], &'static [u8]) = ("metadata".as_bytes(), "user".as_bytes()); pub fn create_pda( mint: Pubkey, diff --git a/clients/rust/src/generated/instructions/mint.rs b/clients/rust/src/generated/instructions/mint.rs index d2003f0a..694f3406 100644 --- a/clients/rust/src/generated/instructions/mint.rs +++ b/clients/rust/src/generated/instructions/mint.rs @@ -36,7 +36,7 @@ pub struct Mint { /// SPL Token program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Token Authorization Rules program pub authorization_rules_program: Option, /// Token Authorization Rules account @@ -130,10 +130,17 @@ impl Mint { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( authorization_rules_program, @@ -327,14 +334,14 @@ impl MintBuilder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -401,9 +408,7 @@ impl MintBuilder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, authorization_rules_program: self.authorization_rules_program, authorization_rules: self.authorization_rules, }; @@ -442,7 +447,7 @@ pub struct MintCpiAccounts<'a, 'b> { /// SPL Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -478,7 +483,7 @@ pub struct MintCpi<'a, 'b> { /// SPL Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -623,10 +628,17 @@ impl<'a, 'b> MintCpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( *authorization_rules_program.key, @@ -687,7 +699,9 @@ impl<'a, 'b> MintCpi<'a, 'b> { account_infos.push(self.system_program.clone()); account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } if let Some(authorization_rules_program) = self.authorization_rules_program { account_infos.push(authorization_rules_program.clone()); } @@ -722,7 +736,7 @@ impl<'a, 'b> MintCpi<'a, 'b> { /// 9. `[]` system_program /// 10. `[]` sysvar_instructions /// 11. `[]` spl_token_program -/// 12. `[]` spl_ata_program +/// 12. `[optional]` spl_ata_program /// 13. `[optional]` authorization_rules_program /// 14. `[optional]` authorization_rules pub struct MintCpiBuilder<'a, 'b> { @@ -856,13 +870,14 @@ impl<'a, 'b> MintCpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -974,10 +989,7 @@ impl<'a, 'b> MintCpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, authorization_rules_program: self.instruction.authorization_rules_program, diff --git a/clients/rust/src/generated/instructions/mint_v1.rs b/clients/rust/src/generated/instructions/mint_v1.rs index 1d0f28c0..3878c6cd 100644 --- a/clients/rust/src/generated/instructions/mint_v1.rs +++ b/clients/rust/src/generated/instructions/mint_v1.rs @@ -36,7 +36,7 @@ pub struct MintV1 { /// SPL Token program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Token Authorization Rules program pub authorization_rules_program: Option, /// Token Authorization Rules account @@ -130,10 +130,17 @@ impl MintV1 { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( authorization_rules_program, @@ -333,14 +340,14 @@ impl MintV1Builder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -414,9 +421,7 @@ impl MintV1Builder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, authorization_rules_program: self.authorization_rules_program, authorization_rules: self.authorization_rules, }; @@ -456,7 +461,7 @@ pub struct MintV1CpiAccounts<'a, 'b> { /// SPL Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -492,7 +497,7 @@ pub struct MintV1Cpi<'a, 'b> { /// SPL Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -637,10 +642,17 @@ impl<'a, 'b> MintV1Cpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( *authorization_rules_program.key, @@ -701,7 +713,9 @@ impl<'a, 'b> MintV1Cpi<'a, 'b> { account_infos.push(self.system_program.clone()); account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } if let Some(authorization_rules_program) = self.authorization_rules_program { account_infos.push(authorization_rules_program.clone()); } @@ -736,7 +750,7 @@ impl<'a, 'b> MintV1Cpi<'a, 'b> { /// 9. `[]` system_program /// 10. `[]` sysvar_instructions /// 11. `[]` spl_token_program -/// 12. `[]` spl_ata_program +/// 12. `[optional]` spl_ata_program /// 13. `[optional]` authorization_rules_program /// 14. `[optional]` authorization_rules pub struct MintV1CpiBuilder<'a, 'b> { @@ -871,13 +885,14 @@ impl<'a, 'b> MintV1CpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -993,10 +1008,7 @@ impl<'a, 'b> MintV1CpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, authorization_rules_program: self.instruction.authorization_rules_program, diff --git a/clients/rust/src/generated/instructions/print.rs b/clients/rust/src/generated/instructions/print.rs index 3fa7bbd1..f85e328c 100644 --- a/clients/rust/src/generated/instructions/print.rs +++ b/clients/rust/src/generated/instructions/print.rs @@ -42,7 +42,7 @@ pub struct Print { /// Token program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Instructions sysvar account pub sysvar_instructions: solana_program::pubkey::Pubkey, /// System program @@ -129,10 +129,17 @@ impl Print { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } accounts.push(solana_program::instruction::AccountMeta::new_readonly( self.sysvar_instructions, false, @@ -346,14 +353,14 @@ impl PrintBuilder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']` @@ -428,9 +435,7 @@ impl PrintBuilder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( "Sysvar1nstructions1111111111111111111111111" )), @@ -479,7 +484,7 @@ pub struct PrintCpiAccounts<'a, 'b> { /// Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Instructions sysvar account pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>, /// System program @@ -521,7 +526,7 @@ pub struct PrintCpi<'a, 'b> { /// Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Instructions sysvar account pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>, /// System program @@ -660,10 +665,17 @@ impl<'a, 'b> PrintCpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } accounts.push(solana_program::instruction::AccountMeta::new_readonly( *self.sysvar_instructions.key, false, @@ -707,7 +719,9 @@ impl<'a, 'b> PrintCpi<'a, 'b> { account_infos.push(self.master_metadata.clone()); account_infos.push(self.update_authority.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.system_program.clone()); remaining_accounts @@ -741,7 +755,7 @@ impl<'a, 'b> PrintCpi<'a, 'b> { /// 12. `[]` master_metadata /// 13. `[]` update_authority /// 14. `[]` spl_token_program -/// 15. `[]` spl_ata_program +/// 15. `[optional]` spl_ata_program /// 16. `[]` sysvar_instructions /// 17. `[]` system_program pub struct PrintCpiBuilder<'a, 'b> { @@ -908,13 +922,14 @@ impl<'a, 'b> PrintCpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// Instructions sysvar account @@ -1057,10 +1072,7 @@ impl<'a, 'b> PrintCpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, sysvar_instructions: self .instruction diff --git a/clients/rust/src/generated/instructions/print_v1.rs b/clients/rust/src/generated/instructions/print_v1.rs index de0550fb..398cd06a 100644 --- a/clients/rust/src/generated/instructions/print_v1.rs +++ b/clients/rust/src/generated/instructions/print_v1.rs @@ -41,7 +41,7 @@ pub struct PrintV1 { /// Token program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Instructions sysvar account pub sysvar_instructions: solana_program::pubkey::Pubkey, /// System program @@ -128,10 +128,17 @@ impl PrintV1 { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } accounts.push(solana_program::instruction::AccountMeta::new_readonly( self.sysvar_instructions, false, @@ -353,14 +360,14 @@ impl PrintV1Builder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']` @@ -435,9 +442,7 @@ impl PrintV1Builder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( "Sysvar1nstructions1111111111111111111111111" )), @@ -489,7 +494,7 @@ pub struct PrintV1CpiAccounts<'a, 'b> { /// Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Instructions sysvar account pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>, /// System program @@ -531,7 +536,7 @@ pub struct PrintV1Cpi<'a, 'b> { /// Token program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Instructions sysvar account pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>, /// System program @@ -670,10 +675,17 @@ impl<'a, 'b> PrintV1Cpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } accounts.push(solana_program::instruction::AccountMeta::new_readonly( *self.sysvar_instructions.key, false, @@ -717,7 +729,9 @@ impl<'a, 'b> PrintV1Cpi<'a, 'b> { account_infos.push(self.master_metadata.clone()); account_infos.push(self.update_authority.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.system_program.clone()); remaining_accounts @@ -751,7 +765,7 @@ impl<'a, 'b> PrintV1Cpi<'a, 'b> { /// 12. `[]` master_metadata /// 13. `[]` update_authority /// 14. `[]` spl_token_program -/// 15. `[]` spl_ata_program +/// 15. `[optional]` spl_ata_program /// 16. `[]` sysvar_instructions /// 17. `[]` system_program pub struct PrintV1CpiBuilder<'a, 'b> { @@ -919,13 +933,14 @@ impl<'a, 'b> PrintV1CpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// Instructions sysvar account @@ -1068,10 +1083,7 @@ impl<'a, 'b> PrintV1CpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, sysvar_instructions: self .instruction diff --git a/clients/rust/src/generated/instructions/transfer.rs b/clients/rust/src/generated/instructions/transfer.rs index 902bec7d..6169cae4 100644 --- a/clients/rust/src/generated/instructions/transfer.rs +++ b/clients/rust/src/generated/instructions/transfer.rs @@ -40,7 +40,7 @@ pub struct Transfer { /// SPL Token Program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Token Authorization Rules Program pub authorization_rules_program: Option, /// Token Authorization Rules account @@ -134,10 +134,17 @@ impl Transfer { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( authorization_rules_program, @@ -346,14 +353,14 @@ impl TransferBuilder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -426,9 +433,7 @@ impl TransferBuilder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, authorization_rules_program: self.authorization_rules_program, authorization_rules: self.authorization_rules, }; @@ -474,7 +479,7 @@ pub struct TransferCpiAccounts<'a, 'b> { /// SPL Token Program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules Program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -514,7 +519,7 @@ pub struct TransferCpi<'a, 'b> { /// SPL Token Program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules Program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -662,10 +667,17 @@ impl<'a, 'b> TransferCpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( *authorization_rules_program.key, @@ -726,7 +738,9 @@ impl<'a, 'b> TransferCpi<'a, 'b> { account_infos.push(self.system_program.clone()); account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } if let Some(authorization_rules_program) = self.authorization_rules_program { account_infos.push(authorization_rules_program.clone()); } @@ -763,7 +777,7 @@ impl<'a, 'b> TransferCpi<'a, 'b> { /// 11. `[]` system_program /// 12. `[]` sysvar_instructions /// 13. `[]` spl_token_program -/// 14. `[]` spl_ata_program +/// 14. `[optional]` spl_ata_program /// 15. `[optional]` authorization_rules_program /// 16. `[optional]` authorization_rules pub struct TransferCpiBuilder<'a, 'b> { @@ -916,13 +930,14 @@ impl<'a, 'b> TransferCpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -1047,10 +1062,7 @@ impl<'a, 'b> TransferCpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, authorization_rules_program: self.instruction.authorization_rules_program, diff --git a/clients/rust/src/generated/instructions/transfer_v1.rs b/clients/rust/src/generated/instructions/transfer_v1.rs index 310272af..563c340c 100644 --- a/clients/rust/src/generated/instructions/transfer_v1.rs +++ b/clients/rust/src/generated/instructions/transfer_v1.rs @@ -40,7 +40,7 @@ pub struct TransferV1 { /// SPL Token Program pub spl_token_program: solana_program::pubkey::Pubkey, /// SPL Associated Token Account program - pub spl_ata_program: solana_program::pubkey::Pubkey, + pub spl_ata_program: Option, /// Token Authorization Rules Program pub authorization_rules_program: Option, /// Token Authorization Rules account @@ -134,10 +134,17 @@ impl TransferV1 { self.spl_token_program, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.spl_ata_program, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_ata_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( authorization_rules_program, @@ -352,14 +359,14 @@ impl TransferV1Builder { self.spl_token_program = Some(spl_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: solana_program::pubkey::Pubkey, + spl_ata_program: Option, ) -> &mut Self { - self.spl_ata_program = Some(spl_ata_program); + self.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -439,9 +446,7 @@ impl TransferV1Builder { spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), - spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( - "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - )), + spl_ata_program: self.spl_ata_program, authorization_rules_program: self.authorization_rules_program, authorization_rules: self.authorization_rules, }; @@ -485,7 +490,7 @@ pub struct TransferV1CpiAccounts<'a, 'b> { /// SPL Token Program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules Program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -525,7 +530,7 @@ pub struct TransferV1Cpi<'a, 'b> { /// SPL Token Program pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// SPL Associated Token Account program - pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + pub spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules Program pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// Token Authorization Rules account @@ -673,10 +678,17 @@ impl<'a, 'b> TransferV1Cpi<'a, 'b> { *self.spl_token_program.key, false, )); - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.spl_ata_program.key, - false, - )); + if let Some(spl_ata_program) = self.spl_ata_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_ata_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } if let Some(authorization_rules_program) = self.authorization_rules_program { accounts.push(solana_program::instruction::AccountMeta::new_readonly( *authorization_rules_program.key, @@ -737,7 +749,9 @@ impl<'a, 'b> TransferV1Cpi<'a, 'b> { account_infos.push(self.system_program.clone()); account_infos.push(self.sysvar_instructions.clone()); account_infos.push(self.spl_token_program.clone()); - account_infos.push(self.spl_ata_program.clone()); + if let Some(spl_ata_program) = self.spl_ata_program { + account_infos.push(spl_ata_program.clone()); + } if let Some(authorization_rules_program) = self.authorization_rules_program { account_infos.push(authorization_rules_program.clone()); } @@ -774,7 +788,7 @@ impl<'a, 'b> TransferV1Cpi<'a, 'b> { /// 11. `[]` system_program /// 12. `[]` sysvar_instructions /// 13. `[]` spl_token_program -/// 14. `[]` spl_ata_program +/// 14. `[optional]` spl_ata_program /// 15. `[optional]` authorization_rules_program /// 16. `[optional]` authorization_rules pub struct TransferV1CpiBuilder<'a, 'b> { @@ -928,13 +942,14 @@ impl<'a, 'b> TransferV1CpiBuilder<'a, 'b> { self.instruction.spl_token_program = Some(spl_token_program); self } + /// `[optional account]` /// SPL Associated Token Account program #[inline(always)] pub fn spl_ata_program( &mut self, - spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>, + spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, ) -> &mut Self { - self.instruction.spl_ata_program = Some(spl_ata_program); + self.instruction.spl_ata_program = spl_ata_program; self } /// `[optional account]` @@ -1063,10 +1078,7 @@ impl<'a, 'b> TransferV1CpiBuilder<'a, 'b> { .spl_token_program .expect("spl_token_program is not set"), - spl_ata_program: self - .instruction - .spl_ata_program - .expect("spl_ata_program is not set"), + spl_ata_program: self.instruction.spl_ata_program, authorization_rules_program: self.instruction.authorization_rules_program, diff --git a/clients/rust/src/generated/types/mod.rs b/clients/rust/src/generated/types/mod.rs index 1d5c2123..f064c7a2 100644 --- a/clients/rust/src/generated/types/mod.rs +++ b/clients/rust/src/generated/types/mod.rs @@ -5,90 +5,90 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -pub(crate) mod r#authority_type; -pub(crate) mod r#authorization_data; -pub(crate) mod r#burn_args; -pub(crate) mod r#collection; -pub(crate) mod r#collection_details; -pub(crate) mod r#collection_details_toggle; -pub(crate) mod r#collection_toggle; -pub(crate) mod r#create_args; -pub(crate) mod r#creator; -pub(crate) mod r#data; -pub(crate) mod r#data_v2; -pub(crate) mod r#delegate_args; -pub(crate) mod r#escrow_authority; -pub(crate) mod r#key; -pub(crate) mod r#lock_args; -pub(crate) mod r#metadata_delegate_role; -pub(crate) mod r#migration_type; -pub(crate) mod r#mint_args; -pub(crate) mod r#mint_new_edition_from_master_edition_via_token_args; -pub(crate) mod r#payload; -pub(crate) mod r#payload_key; -pub(crate) mod r#payload_type; -pub(crate) mod r#print_args; -pub(crate) mod r#print_supply; -pub(crate) mod r#programmable_config; -pub(crate) mod r#proof_info; -pub(crate) mod r#reservation; -pub(crate) mod r#reservation_v1; -pub(crate) mod r#revoke_args; -pub(crate) mod r#rule_set_toggle; -pub(crate) mod r#seeds_vec; -pub(crate) mod r#set_collection_size_args; -pub(crate) mod r#token_delegate_role; -pub(crate) mod r#token_standard; -pub(crate) mod r#token_state; -pub(crate) mod r#transfer_args; -pub(crate) mod r#unlock_args; -pub(crate) mod r#update_args; -pub(crate) mod r#use_args; -pub(crate) mod r#use_method; -pub(crate) mod r#uses; -pub(crate) mod r#uses_toggle; -pub(crate) mod r#verification_args; +pub(crate) mod authority_type; +pub(crate) mod authorization_data; +pub(crate) mod burn_args; +pub(crate) mod collection; +pub(crate) mod collection_details; +pub(crate) mod collection_details_toggle; +pub(crate) mod collection_toggle; +pub(crate) mod create_args; +pub(crate) mod creator; +pub(crate) mod data; +pub(crate) mod data_v2; +pub(crate) mod delegate_args; +pub(crate) mod escrow_authority; +pub(crate) mod key; +pub(crate) mod lock_args; +pub(crate) mod metadata_delegate_role; +pub(crate) mod migration_type; +pub(crate) mod mint_args; +pub(crate) mod mint_new_edition_from_master_edition_via_token_args; +pub(crate) mod payload; +pub(crate) mod payload_key; +pub(crate) mod payload_type; +pub(crate) mod print_args; +pub(crate) mod print_supply; +pub(crate) mod programmable_config; +pub(crate) mod proof_info; +pub(crate) mod reservation; +pub(crate) mod reservation_v1; +pub(crate) mod revoke_args; +pub(crate) mod rule_set_toggle; +pub(crate) mod seeds_vec; +pub(crate) mod set_collection_size_args; +pub(crate) mod token_delegate_role; +pub(crate) mod token_standard; +pub(crate) mod token_state; +pub(crate) mod transfer_args; +pub(crate) mod unlock_args; +pub(crate) mod update_args; +pub(crate) mod use_args; +pub(crate) mod use_method; +pub(crate) mod uses; +pub(crate) mod uses_toggle; +pub(crate) mod verification_args; -pub use self::r#authority_type::*; -pub use self::r#authorization_data::*; -pub use self::r#burn_args::*; -pub use self::r#collection::*; -pub use self::r#collection_details::*; -pub use self::r#collection_details_toggle::*; -pub use self::r#collection_toggle::*; -pub use self::r#create_args::*; -pub use self::r#creator::*; -pub use self::r#data::*; -pub use self::r#data_v2::*; -pub use self::r#delegate_args::*; -pub use self::r#escrow_authority::*; -pub use self::r#key::*; -pub use self::r#lock_args::*; -pub use self::r#metadata_delegate_role::*; -pub use self::r#migration_type::*; -pub use self::r#mint_args::*; -pub use self::r#mint_new_edition_from_master_edition_via_token_args::*; -pub use self::r#payload::*; -pub use self::r#payload_key::*; -pub use self::r#payload_type::*; -pub use self::r#print_args::*; -pub use self::r#print_supply::*; -pub use self::r#programmable_config::*; -pub use self::r#proof_info::*; -pub use self::r#reservation::*; -pub use self::r#reservation_v1::*; -pub use self::r#revoke_args::*; -pub use self::r#rule_set_toggle::*; -pub use self::r#seeds_vec::*; -pub use self::r#set_collection_size_args::*; -pub use self::r#token_delegate_role::*; -pub use self::r#token_standard::*; -pub use self::r#token_state::*; -pub use self::r#transfer_args::*; -pub use self::r#unlock_args::*; -pub use self::r#update_args::*; -pub use self::r#use_args::*; -pub use self::r#use_method::*; -pub use self::r#uses::*; -pub use self::r#uses_toggle::*; -pub use self::r#verification_args::*; +pub use self::authority_type::*; +pub use self::authorization_data::*; +pub use self::burn_args::*; +pub use self::collection::*; +pub use self::collection_details::*; +pub use self::collection_details_toggle::*; +pub use self::collection_toggle::*; +pub use self::create_args::*; +pub use self::creator::*; +pub use self::data::*; +pub use self::data_v2::*; +pub use self::delegate_args::*; +pub use self::escrow_authority::*; +pub use self::key::*; +pub use self::lock_args::*; +pub use self::metadata_delegate_role::*; +pub use self::migration_type::*; +pub use self::mint_args::*; +pub use self::mint_new_edition_from_master_edition_via_token_args::*; +pub use self::payload::*; +pub use self::payload_key::*; +pub use self::payload_type::*; +pub use self::print_args::*; +pub use self::print_supply::*; +pub use self::programmable_config::*; +pub use self::proof_info::*; +pub use self::reservation::*; +pub use self::reservation_v1::*; +pub use self::revoke_args::*; +pub use self::rule_set_toggle::*; +pub use self::seeds_vec::*; +pub use self::set_collection_size_args::*; +pub use self::token_delegate_role::*; +pub use self::token_standard::*; +pub use self::token_state::*; +pub use self::transfer_args::*; +pub use self::unlock_args::*; +pub use self::update_args::*; +pub use self::use_args::*; +pub use self::use_method::*; +pub use self::uses::*; +pub use self::uses_toggle::*; +pub use self::verification_args::*; diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index 07b577ae..dc6a1e9e 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -133,6 +133,13 @@ kinobi.update( ), }), }, + { + account: "splAtaProgram", + ...k.programDefault( + "splAssociatedTokenProgram", + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + ), + }, ]) ); @@ -147,9 +154,9 @@ kinobi.update( create: { bytesCreatedOnChain: k.bytesFromNumber( 82 + // Mint account. - 679 + // Metadata account. - 282 + // Master edition account. - 128 * 3, // 3 account headers. + 679 + // Metadata account. + 282 + // Master edition account. + 128 * 3, // 3 account headers. false ), accounts: { @@ -177,8 +184,8 @@ kinobi.update( mint: { bytesCreatedOnChain: k.bytesFromNumber( 165 + // Token account. - 47 + // Token Record account. - 128 * 2, // 2 account headers. + 47 + // Token Record account. + 128 * 2, // 2 account headers. false ), accounts: { diff --git a/idls/token_metadata.json b/idls/token_metadata.json index 1f05016c..d66b1e10 100644 --- a/idls/token_metadata.json +++ b/idls/token_metadata.json @@ -3246,6 +3246,7 @@ "name": "splAtaProgram", "isMut": false, "isSigner": false, + "isOptional": true, "docs": [ "SPL Associated Token Account program" ] @@ -4062,6 +4063,7 @@ "name": "splAtaProgram", "isMut": false, "isSigner": false, + "isOptional": true, "docs": [ "SPL Associated Token Account program" ] @@ -4642,6 +4644,7 @@ "name": "splAtaProgram", "isMut": false, "isSigner": false, + "isOptional": true, "docs": [ "SPL Associated Token Account program" ] diff --git a/programs/token-metadata/program/src/instruction/metadata.rs b/programs/token-metadata/program/src/instruction/metadata.rs index 834d9bb4..b32a396a 100644 --- a/programs/token-metadata/program/src/instruction/metadata.rs +++ b/programs/token-metadata/program/src/instruction/metadata.rs @@ -704,7 +704,11 @@ impl InstructionBuilder for super::builders::Mint { AccountMeta::new_readonly(self.system_program, false), AccountMeta::new_readonly(self.sysvar_instructions, false), AccountMeta::new_readonly(self.spl_token_program, false), - AccountMeta::new_readonly(self.spl_ata_program, false), + if let Some(spl_ata_program) = self.spl_ata_program { + AccountMeta::new_readonly(spl_ata_program, false) + } else { + AccountMeta::new_readonly(crate::ID, false) + }, ]; // Optional authorization rules accounts if let Some(rules) = &self.authorization_rules { @@ -771,7 +775,11 @@ impl InstructionBuilder for super::builders::Transfer { AccountMeta::new_readonly(self.system_program, false), AccountMeta::new_readonly(self.sysvar_instructions, false), AccountMeta::new_readonly(self.spl_token_program, false), - AccountMeta::new_readonly(self.spl_ata_program, false), + if let Some(spl_ata_program) = self.spl_ata_program { + AccountMeta::new_readonly(spl_ata_program, false) + } else { + AccountMeta::new_readonly(crate::ID, false) + }, ]; // Optional authorization rules accounts if let Some(rules) = &self.authorization_rules { @@ -888,7 +896,11 @@ impl InstructionBuilder for super::builders::Print { AccountMeta::new_readonly(self.master_metadata, false), AccountMeta::new_readonly(self.update_authority, false), AccountMeta::new_readonly(self.spl_token_program, false), - AccountMeta::new_readonly(self.spl_ata_program, false), + if let Some(spl_ata_program) = self.spl_ata_program { + AccountMeta::new_readonly(spl_ata_program, false) + } else { + AccountMeta::new_readonly(crate::ID, false) + }, AccountMeta::new_readonly(self.sysvar_instructions, false), AccountMeta::new_readonly(self.system_program, false), ]; diff --git a/programs/token-metadata/program/src/instruction/mod.rs b/programs/token-metadata/program/src/instruction/mod.rs index 52554a7b..f8a11968 100644 --- a/programs/token-metadata/program/src/instruction/mod.rs +++ b/programs/token-metadata/program/src/instruction/mod.rs @@ -608,7 +608,7 @@ pub enum MetadataInstruction { #[account(9, name="system_program", desc="System program")] #[account(10, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(11, name="spl_token_program", desc="SPL Token program")] - #[account(12, name="spl_ata_program", desc="SPL Associated Token Account program")] + #[account(12, optional, name="spl_ata_program", desc="SPL Associated Token Account program")] #[account(13, optional, name="authorization_rules_program", desc="Token Authorization Rules program")] #[account(14, optional, name="authorization_rules", desc="Token Authorization Rules account")] Mint(MintArgs), @@ -730,7 +730,7 @@ pub enum MetadataInstruction { #[account(11, name="system_program", desc="System Program")] #[account(12, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(13, name="spl_token_program", desc="SPL Token Program")] - #[account(14, name="spl_ata_program", desc="SPL Associated Token Account program")] + #[account(14, optional, name="spl_ata_program", desc="SPL Associated Token Account program")] #[account(15, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(16, optional, name="authorization_rules", desc="Token Authorization Rules account")] Transfer(TransferArgs), @@ -821,7 +821,7 @@ pub enum MetadataInstruction { #[account(12, name="master_metadata", desc="Master record metadata account")] #[account(13, name="update_authority", desc="The update authority of the master edition.")] #[account(14, name="spl_token_program", desc="Token program")] - #[account(15, name="spl_ata_program", desc="SPL Associated Token Account program")] + #[account(15, optional, name="spl_ata_program", desc="SPL Associated Token Account program")] #[account(16, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(17, name="system_program", desc="System program")] #[args(initialize_mint: bool)] diff --git a/programs/token-metadata/program/src/processor/metadata/print.rs b/programs/token-metadata/program/src/processor/metadata/print.rs index fef3a747..3259e11e 100644 --- a/programs/token-metadata/program/src/processor/metadata/print.rs +++ b/programs/token-metadata/program/src/processor/metadata/print.rs @@ -64,7 +64,7 @@ fn print_v1(_program_id: &Pubkey, ctx: Context, args: PrintArgs) -> Progr let update_authority_info = ctx.accounts.update_authority_info; // CHECK: Checked in process_mint_new_edition_from_master_edition_via_token_logic let token_program = ctx.accounts.spl_token_program_info; - let ata_program = ctx.accounts.spl_ata_program_info; + let _ata_program = ctx.accounts.spl_ata_program_info; let sysvar_instructions = ctx.accounts.sysvar_instructions_info; // CHECK: Checked in process_mint_new_edition_from_master_edition_via_token_logic let system_program = ctx.accounts.system_program_info; @@ -175,10 +175,6 @@ fn print_v1(_program_id: &Pubkey, ctx: Context, args: PrintArgs) -> Progr } } - if ata_program.key != &spl_associated_token_account::ID { - return Err(ProgramError::IncorrectProgramId); - } - if sysvar_instructions.key != &sysvar::instructions::ID { return Err(ProgramError::IncorrectProgramId); } diff --git a/programs/token-metadata/program/src/processor/metadata/transfer.rs b/programs/token-metadata/program/src/processor/metadata/transfer.rs index 3f5d2163..84204add 100644 --- a/programs/token-metadata/program/src/processor/metadata/transfer.rs +++ b/programs/token-metadata/program/src/processor/metadata/transfer.rs @@ -175,10 +175,6 @@ fn transfer_v1(program_id: &Pubkey, ctx: Context, args: TransferArgs) assert_token_program_matches_package(ctx.accounts.spl_token_program_info)?; - if ctx.accounts.spl_ata_program_info.key != &spl_associated_token_account::ID { - return Err(ProgramError::IncorrectProgramId); - } - if ctx.accounts.system_program_info.key != &system_program::ID { return Err(ProgramError::IncorrectProgramId); }