diff --git a/clients/js/src/generated/instructions/mintToCollectionV1.ts b/clients/js/src/generated/instructions/mintToCollectionV1.ts index 4a6b0421..b7e702e6 100644 --- a/clients/js/src/generated/instructions/mintToCollectionV1.ts +++ b/clients/js/src/generated/instructions/mintToCollectionV1.ts @@ -220,7 +220,7 @@ export function mintToCollectionV1( } if (!resolvedAccounts.bubblegumSigner.value) { resolvedAccounts.bubblegumSigner.value = publicKey( - '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK' + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); } if (!resolvedAccounts.logWrapper.value) { @@ -238,11 +238,9 @@ export function mintToCollectionV1( resolvedAccounts.compressionProgram.isWritable = false; } if (!resolvedAccounts.tokenMetadataProgram.value) { - resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey( - 'mplTokenMetadata', - 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + resolvedAccounts.tokenMetadataProgram.value = publicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); - resolvedAccounts.tokenMetadataProgram.isWritable = false; } if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( diff --git a/clients/js/src/generated/instructions/setAndVerifyCollection.ts b/clients/js/src/generated/instructions/setAndVerifyCollection.ts index 65357ec4..a0a25032 100644 --- a/clients/js/src/generated/instructions/setAndVerifyCollection.ts +++ b/clients/js/src/generated/instructions/setAndVerifyCollection.ts @@ -262,7 +262,7 @@ export function setAndVerifyCollection( } if (!resolvedAccounts.bubblegumSigner.value) { resolvedAccounts.bubblegumSigner.value = publicKey( - '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK' + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); } if (!resolvedAccounts.logWrapper.value) { @@ -280,11 +280,9 @@ export function setAndVerifyCollection( resolvedAccounts.compressionProgram.isWritable = false; } if (!resolvedAccounts.tokenMetadataProgram.value) { - resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey( - 'mplTokenMetadata', - 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + resolvedAccounts.tokenMetadataProgram.value = publicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); - resolvedAccounts.tokenMetadataProgram.isWritable = false; } if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( diff --git a/clients/js/src/generated/instructions/unverifyCollection.ts b/clients/js/src/generated/instructions/unverifyCollection.ts index 1551df9a..c17f1cd3 100644 --- a/clients/js/src/generated/instructions/unverifyCollection.ts +++ b/clients/js/src/generated/instructions/unverifyCollection.ts @@ -258,7 +258,7 @@ export function unverifyCollection( } if (!resolvedAccounts.bubblegumSigner.value) { resolvedAccounts.bubblegumSigner.value = publicKey( - '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK' + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); } if (!resolvedAccounts.logWrapper.value) { @@ -276,11 +276,9 @@ export function unverifyCollection( resolvedAccounts.compressionProgram.isWritable = false; } if (!resolvedAccounts.tokenMetadataProgram.value) { - resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey( - 'mplTokenMetadata', - 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + resolvedAccounts.tokenMetadataProgram.value = publicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); - resolvedAccounts.tokenMetadataProgram.isWritable = false; } if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts index 0f9a74de..ca2133c0 100644 --- a/clients/js/src/generated/instructions/updateMetadata.ts +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -13,6 +13,7 @@ import { PublicKey, Signer, TransactionBuilder, + publicKey, transactionBuilder, } from '@metaplex-foundation/umi'; import { @@ -230,11 +231,9 @@ export function updateMetadata( resolvedAccounts.compressionProgram.isWritable = false; } if (!resolvedAccounts.tokenMetadataProgram.value) { - resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey( - 'mplTokenMetadata', - 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + resolvedAccounts.tokenMetadataProgram.value = publicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); - resolvedAccounts.tokenMetadataProgram.isWritable = false; } if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( diff --git a/clients/js/src/generated/instructions/verifyCollection.ts b/clients/js/src/generated/instructions/verifyCollection.ts index e54d111d..9d2a41b8 100644 --- a/clients/js/src/generated/instructions/verifyCollection.ts +++ b/clients/js/src/generated/instructions/verifyCollection.ts @@ -254,7 +254,7 @@ export function verifyCollection( } if (!resolvedAccounts.bubblegumSigner.value) { resolvedAccounts.bubblegumSigner.value = publicKey( - '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK' + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); } if (!resolvedAccounts.logWrapper.value) { @@ -272,11 +272,9 @@ export function verifyCollection( resolvedAccounts.compressionProgram.isWritable = false; } if (!resolvedAccounts.tokenMetadataProgram.value) { - resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey( - 'mplTokenMetadata', - 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + resolvedAccounts.tokenMetadataProgram.value = publicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' ); - resolvedAccounts.tokenMetadataProgram.isWritable = false; } if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( diff --git a/clients/js/src/leafAssetId.ts b/clients/js/src/leafAssetId.ts index fcc3675c..5b366146 100644 --- a/clients/js/src/leafAssetId.ts +++ b/clients/js/src/leafAssetId.ts @@ -55,7 +55,7 @@ export async function parseLeafFromMintToCollectionV1Transaction( if (innerInstructions) { const leaf = getLeafSchemaSerializer().deserialize( - innerInstructions[0].instructions[1].data.slice(8) + innerInstructions[0].instructions[0].data.slice(8) ); return leaf[0]; } diff --git a/clients/js/test/parseMintV1.test.ts b/clients/js/test/parseMintV1.test.ts index 738dc1fe..c997a4aa 100644 --- a/clients/js/test/parseMintV1.test.ts +++ b/clients/js/test/parseMintV1.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-await-in-loop */ import { defaultPublicKey, generateSigner, @@ -22,7 +23,7 @@ test('it can parse the leaf from mint instructions', async (t) => { const umi = await createUmi(); const merkleTree = await createTree(umi); const leafOwner = generateSigner(umi).publicKey; - let merkleTreeAccount = await fetchMerkleTree(umi, merkleTree); + const merkleTreeAccount = await fetchMerkleTree(umi, merkleTree); t.is(merkleTreeAccount.tree.sequenceNumber, 0n); t.is(merkleTreeAccount.tree.activeIndex, 0n); t.is(merkleTreeAccount.tree.bufferSize, 1n); @@ -59,7 +60,7 @@ test('it can parse the leaf from mintToCollection instructions)', async (t) => { const umi = await createUmi(); const merkleTree = await createTree(umi); const leafOwner = generateSigner(umi).publicKey; - let merkleTreeAccount = await fetchMerkleTree(umi, merkleTree); + const merkleTreeAccount = await fetchMerkleTree(umi, merkleTree); t.is(merkleTreeAccount.tree.sequenceNumber, 0n); t.is(merkleTreeAccount.tree.activeIndex, 0n); t.is(merkleTreeAccount.tree.bufferSize, 1n); diff --git a/clients/rust/src/generated/instructions/mint_to_collection_v1.rs b/clients/rust/src/generated/instructions/mint_to_collection_v1.rs index 43a0b9d6..957bc76d 100644 --- a/clients/rust/src/generated/instructions/mint_to_collection_v1.rs +++ b/clients/rust/src/generated/instructions/mint_to_collection_v1.rs @@ -266,7 +266,7 @@ impl MintToCollectionV1Builder { self.collection_edition = Some(collection_edition); self } - /// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn bubblegum_signer( &mut self, @@ -290,7 +290,7 @@ impl MintToCollectionV1Builder { self.compression_program = Some(compression_program); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn token_metadata_program( &mut self, @@ -352,7 +352,7 @@ impl MintToCollectionV1Builder { .collection_edition .expect("collection_edition is not set"), bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!( - "4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK" + "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY" )), log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" @@ -361,7 +361,7 @@ impl MintToCollectionV1Builder { "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" )), token_metadata_program: self.token_metadata_program.unwrap_or( - solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), ), system_program: self .system_program diff --git a/clients/rust/src/generated/instructions/set_and_verify_collection.rs b/clients/rust/src/generated/instructions/set_and_verify_collection.rs index 0515710b..63395054 100644 --- a/clients/rust/src/generated/instructions/set_and_verify_collection.rs +++ b/clients/rust/src/generated/instructions/set_and_verify_collection.rs @@ -285,7 +285,7 @@ impl SetAndVerifyCollectionBuilder { self.collection_edition = Some(collection_edition); self } - /// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn bubblegum_signer( &mut self, @@ -309,7 +309,7 @@ impl SetAndVerifyCollectionBuilder { self.compression_program = Some(compression_program); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn token_metadata_program( &mut self, @@ -401,7 +401,7 @@ impl SetAndVerifyCollectionBuilder { .collection_edition .expect("collection_edition is not set"), bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!( - "4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK" + "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY" )), log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" @@ -410,7 +410,7 @@ impl SetAndVerifyCollectionBuilder { "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" )), token_metadata_program: self.token_metadata_program.unwrap_or( - solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), ), system_program: self .system_program diff --git a/clients/rust/src/generated/instructions/unverify_collection.rs b/clients/rust/src/generated/instructions/unverify_collection.rs index b138b3ed..0f855024 100644 --- a/clients/rust/src/generated/instructions/unverify_collection.rs +++ b/clients/rust/src/generated/instructions/unverify_collection.rs @@ -281,7 +281,7 @@ impl UnverifyCollectionBuilder { self.collection_edition = Some(collection_edition); self } - /// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn bubblegum_signer( &mut self, @@ -305,7 +305,7 @@ impl UnverifyCollectionBuilder { self.compression_program = Some(compression_program); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn token_metadata_program( &mut self, @@ -392,7 +392,7 @@ impl UnverifyCollectionBuilder { .collection_edition .expect("collection_edition is not set"), bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!( - "4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK" + "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY" )), log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" @@ -401,7 +401,7 @@ impl UnverifyCollectionBuilder { "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" )), token_metadata_program: self.token_metadata_program.unwrap_or( - solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), ), system_program: self .system_program diff --git a/clients/rust/src/generated/instructions/update_metadata.rs b/clients/rust/src/generated/instructions/update_metadata.rs index 3b841df6..229d5cc4 100644 --- a/clients/rust/src/generated/instructions/update_metadata.rs +++ b/clients/rust/src/generated/instructions/update_metadata.rs @@ -266,7 +266,7 @@ impl UpdateMetadataBuilder { self.compression_program = Some(compression_program); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn token_metadata_program( &mut self, @@ -344,7 +344,7 @@ impl UpdateMetadataBuilder { "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" )), token_metadata_program: self.token_metadata_program.unwrap_or( - solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), ), system_program: self .system_program diff --git a/clients/rust/src/generated/instructions/verify_collection.rs b/clients/rust/src/generated/instructions/verify_collection.rs index d04b8044..5a00bc9f 100644 --- a/clients/rust/src/generated/instructions/verify_collection.rs +++ b/clients/rust/src/generated/instructions/verify_collection.rs @@ -279,7 +279,7 @@ impl VerifyCollectionBuilder { self.collection_edition = Some(collection_edition); self } - /// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn bubblegum_signer( &mut self, @@ -303,7 +303,7 @@ impl VerifyCollectionBuilder { self.compression_program = Some(compression_program); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` + /// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']` #[inline(always)] pub fn token_metadata_program( &mut self, @@ -390,7 +390,7 @@ impl VerifyCollectionBuilder { .collection_edition .expect("collection_edition is not set"), bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!( - "4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK" + "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY" )), log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" @@ -399,7 +399,7 @@ impl VerifyCollectionBuilder { "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" )), token_metadata_program: self.token_metadata_program.unwrap_or( - solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), ), system_program: self .system_program diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index ba649dd8..14c2e3f5 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -5,7 +5,7 @@ const k = require("@metaplex-foundation/kinobi"); const clientDir = path.join(__dirname, "..", "clients"); const idlDir = path.join(__dirname, "..", "idls"); -// Instanciate Kinobi withtout DefaultVisitor. +// Instantiate Kinobi without DefaultVisitor. const kinobi = k.createFromIdls( [ path.join(idlDir, "bubblegum.json"), @@ -148,7 +148,24 @@ kinobi.update( ]) ); -// Set default account values accross multiple instructions. +const deprecatedTmIxes = [ + "mintToCollectionV1", + "setAndVerifyCollection", + "unverifyCollection", + "updateMetadata", + "verifyCollection", +]; +let deprecatedIxUpdaters = []; +for (let ix of deprecatedTmIxes) { + deprecatedIxUpdaters.push( + { + account: "tokenMetadataProgram", + instruction: ix, + ...k.publicKeyDefault("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), + }) +} + +// Set default account values across multiple instructions. kinobi.update( new k.SetInstructionAccountDefaultValuesVisitor([ { @@ -198,7 +215,7 @@ kinobi.update( { account: "bubblegumSigner", ignoreIfOptional: true, - ...k.publicKeyDefault("4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"), + ...k.publicKeyDefault("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"), }, { account: "collectionMetadata", @@ -226,6 +243,7 @@ kinobi.update( ignoreIfOptional: true, ...k.identityDefault(), }, + ...deprecatedIxUpdaters, ]) ); diff --git a/programs/bubblegum/program/src/processor/mint_to_collection.rs b/programs/bubblegum/program/src/processor/mint_to_collection.rs index fd835233..3fecffa0 100644 --- a/programs/bubblegum/program/src/processor/mint_to_collection.rs +++ b/programs/bubblegum/program/src/processor/mint_to_collection.rs @@ -6,10 +6,8 @@ use spl_account_compression::{program::SplAccountCompression, Noop}; use crate::{ error::BubblegumError, state::{ - leaf_schema::LeafSchema, - metaplex_adapter::MetadataArgs, - metaplex_anchor::{MplTokenMetadata, TokenMetadata}, - TreeConfig, COLLECTION_CPI_PREFIX, + leaf_schema::LeafSchema, metaplex_adapter::MetadataArgs, metaplex_anchor::TokenMetadata, + TreeConfig, }, }; @@ -43,15 +41,12 @@ pub struct MintToCollectionV1<'info> { pub collection_metadata: Box>, /// CHECK: This account is checked in the instruction pub edition_account: UncheckedAccount<'info>, - /// CHECK: This is just used as a signing PDA. - #[account( - seeds = [COLLECTION_CPI_PREFIX.as_ref()], - bump, - )] + /// CHECK: This is no longer needed but kept for backwards compatibility. pub bubblegum_signer: UncheckedAccount<'info>, pub log_wrapper: Program<'info, Noop>, pub compression_program: Program<'info, SplAccountCompression>, - pub token_metadata_program: Program<'info, MplTokenMetadata>, + /// CHECK: This is no longer needed but kept for backwards compatibility. + pub token_metadata_program: UncheckedAccount<'info>, pub system_program: Program<'info, System>, } @@ -76,8 +71,6 @@ pub(crate) fn mint_to_collection_v1( .accounts .collection_authority_record_pda .to_account_info(); - let bubblegum_signer = ctx.accounts.bubblegum_signer.to_account_info(); - let token_metadata_program = ctx.accounts.token_metadata_program.to_account_info(); if !authority.is_public { require!( @@ -112,9 +105,6 @@ pub(crate) fn mint_to_collection_v1( &collection_authority, &collection_authority_record_pda, &edition_account, - &bubblegum_signer, - ctx.bumps["bubblegum_signer"], - &token_metadata_program, &mut message, true, )?; diff --git a/programs/bubblegum/program/src/processor/mod.rs b/programs/bubblegum/program/src/processor/mod.rs index 62b72a26..ca61dd6e 100644 --- a/programs/bubblegum/program/src/processor/mod.rs +++ b/programs/bubblegum/program/src/processor/mod.rs @@ -1,8 +1,4 @@ use anchor_lang::prelude::*; -use mpl_token_metadata::{ - instructions::BubblegumSetCollectionSizeCpiBuilder, - types::{CollectionDetails, SetCollectionSizeArgs}, -}; use solana_program::{account_info::AccountInfo, pubkey::Pubkey}; use spl_account_compression::wrap_application_data_v1; @@ -13,7 +9,6 @@ use crate::{ leaf_schema::LeafSchema, metaplex_adapter::{self, Creator, MetadataArgs}, metaplex_anchor::TokenMetadata, - COLLECTION_CPI_PREFIX, }, utils::{get_asset_id, hash_creators, hash_metadata, replace_leaf}, }; @@ -164,9 +159,6 @@ fn process_collection_verification_mpl_only<'info>( collection_authority: &AccountInfo<'info>, collection_authority_record_pda: &AccountInfo<'info>, edition_account: &AccountInfo<'info>, - bubblegum_signer: &AccountInfo<'info>, - bubblegum_bump: u8, - token_metadata_program: &AccountInfo<'info>, message: &mut MetadataArgs, verify: bool, ) -> Result<()> { @@ -179,7 +171,7 @@ fn process_collection_verification_mpl_only<'info>( // Verify correct account ownerships. require!( - *collection_metadata.to_account_info().owner == token_metadata_program.key(), + *collection_metadata.to_account_info().owner == mpl_token_metadata::ID, BubblegumError::IncorrectOwner ); require!( @@ -187,7 +179,7 @@ fn process_collection_verification_mpl_only<'info>( BubblegumError::IncorrectOwner ); require!( - *edition_account.owner == token_metadata_program.key(), + *edition_account.owner == mpl_token_metadata::ID, BubblegumError::IncorrectOwner ); @@ -214,35 +206,6 @@ fn process_collection_verification_mpl_only<'info>( return Err(BubblegumError::CollectionNotFound.into()); } - // If this is a sized collection, then increment or decrement collection size. - if let Some(details) = &collection_metadata.collection_details { - // Increment or decrement existing size. - let new_size = match details { - CollectionDetails::V1 { size } => { - if verify { - size.checked_add(1) - .ok_or(BubblegumError::NumericalOverflowError)? - } else { - size.checked_sub(1) - .ok_or(BubblegumError::NumericalOverflowError)? - } - } - }; - - // CPI into Token Metadata program to change the collection size. - - BubblegumSetCollectionSizeCpiBuilder::new(token_metadata_program) - .collection_metadata(&collection_metadata.to_account_info()) - .collection_authority(collection_authority) - .collection_mint(collection_mint) - .bubblegum_signer(bubblegum_signer) - .collection_authority_record(collection_authority_record) - .set_collection_size_args(SetCollectionSizeArgs { size: new_size }) - .invoke_signed(&[&[COLLECTION_CPI_PREFIX.as_bytes(), &[bubblegum_bump]]])?; - } else { - return Err(BubblegumError::CollectionMustBeSized.into()); - } - Ok(()) } @@ -268,8 +231,6 @@ fn process_collection_verification<'info>( .accounts .collection_authority_record_pda .to_account_info(); - let bubblegum_signer = ctx.accounts.bubblegum_signer.to_account_info(); - let token_metadata_program = ctx.accounts.token_metadata_program.to_account_info(); // User-provided metadata must result in same user-provided data hash. let incoming_data_hash = hash_metadata(&message)?; @@ -304,9 +265,6 @@ fn process_collection_verification<'info>( &collection_authority, &collection_authority_record_pda, &edition_account, - &bubblegum_signer, - ctx.bumps["bubblegum_signer"], - &token_metadata_program, &mut message, verify, )?; diff --git a/programs/bubblegum/program/src/processor/update_metadata.rs b/programs/bubblegum/program/src/processor/update_metadata.rs index 6c1f127c..31bf1ac8 100644 --- a/programs/bubblegum/program/src/processor/update_metadata.rs +++ b/programs/bubblegum/program/src/processor/update_metadata.rs @@ -7,7 +7,7 @@ use crate::{ state::{ leaf_schema::LeafSchema, metaplex_adapter::{Collection, Creator, MetadataArgs, UpdateArgs}, - metaplex_anchor::{MplTokenMetadata, TokenMetadata}, + metaplex_anchor::TokenMetadata, TreeConfig, }, utils::{get_asset_id, hash_creators, hash_metadata, replace_leaf}, @@ -41,7 +41,8 @@ pub struct UpdateMetadata<'info> { pub merkle_tree: UncheckedAccount<'info>, pub log_wrapper: Program<'info, Noop>, pub compression_program: Program<'info, SplAccountCompression>, - pub token_metadata_program: Program<'info, MplTokenMetadata>, + /// CHECK: This is no longer needed but kept for backwards compatibility. + pub token_metadata_program: UncheckedAccount<'info>, pub system_program: Program<'info, System>, } @@ -52,7 +53,6 @@ fn assert_authority_matches_collection<'info>( collection_mint: &AccountInfo<'info>, collection_metadata_account_info: &AccountInfo, collection_metadata: &TokenMetadata, - token_metadata_program: &Program<'info, MplTokenMetadata>, ) -> Result<()> { // Mint account must match Collection mint require!( @@ -66,7 +66,7 @@ fn assert_authority_matches_collection<'info>( ); // Verify correct account ownerships. require!( - *collection_metadata_account_info.owner == token_metadata_program.key(), + *collection_metadata_account_info.owner == mpl_token_metadata::ID, BubblegumError::IncorrectOwner ); // Collection mint must be owned by SPL token @@ -248,7 +248,6 @@ pub fn update_metadata<'info>( collection_mint, &collection_metadata.to_account_info(), collection_metadata, - &ctx.accounts.token_metadata_program, )?; } // No collection or unverified collection case. diff --git a/programs/bubblegum/program/src/processor/verify_collection.rs b/programs/bubblegum/program/src/processor/verify_collection.rs index 67ea7938..58143754 100644 --- a/programs/bubblegum/program/src/processor/verify_collection.rs +++ b/programs/bubblegum/program/src/processor/verify_collection.rs @@ -1,11 +1,7 @@ use anchor_lang::prelude::*; use spl_account_compression::{program::SplAccountCompression, Noop}; -use crate::state::{ - metaplex_adapter::MetadataArgs, - metaplex_anchor::{MplTokenMetadata, TokenMetadata}, - TreeConfig, COLLECTION_CPI_PREFIX, -}; +use crate::state::{metaplex_adapter::MetadataArgs, metaplex_anchor::TokenMetadata, TreeConfig}; use super::process_collection_verification; @@ -40,15 +36,12 @@ pub struct CollectionVerification<'info> { pub collection_metadata: Box>, /// CHECK: This account is checked in the instruction pub edition_account: UncheckedAccount<'info>, - /// CHECK: This is just used as a signing PDA. - #[account( - seeds = [COLLECTION_CPI_PREFIX.as_ref()], - bump, - )] + /// CHECK: This is no longer needed but kept for backwards compatibility. pub bubblegum_signer: UncheckedAccount<'info>, pub log_wrapper: Program<'info, Noop>, pub compression_program: Program<'info, SplAccountCompression>, - pub token_metadata_program: Program<'info, MplTokenMetadata>, + /// CHECK: This is no longer needed but kept for backwards compatibility. + pub token_metadata_program: UncheckedAccount<'info>, pub system_program: Program<'info, System>, }