From ac86e15756b8bde5d15fde5ebe0f46f47bcb5049 Mon Sep 17 00:00:00 2001 From: Matthew Callens Date: Wed, 3 May 2023 17:53:46 -0500 Subject: [PATCH] spl: remove mpl `create_metadata_account_v2` wrapper that were removed from program (#2480) * remove mpl ix wrappers that were removed from program * update changelog --- CHANGELOG.md | 1 + Cargo.lock | 8 +++---- spl/Cargo.toml | 2 +- spl/src/metadata.rs | 57 ++------------------------------------------- 4 files changed, 8 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e4703c31..68c1b397e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The minor version will be incremented upon a breaking change and the patch versi ### Breaking - lang: Identifiers that are intended for internal usage(`program_id`, `accounts`, `ix_data`, `remaining_accounts`) have been renamed with `__` prefix ([#2464](https://github.com/coral-xyz/anchor/pull/2464)) +- spl: Remove the `metadata::create_metadata_account_v2` deprecated wrapper since it was removed from token metadata program ([#2480](https://github.com/coral-xyz/anchor/pull/2480)) ## [0.27.0] - 2023-03-08 diff --git a/Cargo.lock b/Cargo.lock index 38b49d6f22..a56e49d6c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2380,9 +2380,9 @@ dependencies = [ [[package]] name = "mpl-token-metadata" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8831a402e72f24052d019a83d72b70c38673caaf198e6e345575a77f98166b1" +checksum = "aed414104154928aa995a44a0a474c449d04ce5a4ee6c975ad41c5d2912f0dfe" dependencies = [ "arrayref", "borsh", @@ -2410,9 +2410,9 @@ dependencies = [ [[package]] name = "mpl-utils" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc48e64c50dba956acb46eec86d6968ef0401ef37031426da479f1f2b592066" +checksum = "822133b6cba8f9a43e5e0e189813be63dd795858f54155c729833be472ffdb51" dependencies = [ "arrayref", "borsh", diff --git a/spl/Cargo.toml b/spl/Cargo.toml index 659503c80f..3d4b200632 100644 --- a/spl/Cargo.toml +++ b/spl/Cargo.toml @@ -28,7 +28,7 @@ solana-program = "1.14.16" spl-token = { version = "3.5.0", features = ["no-entrypoint"], optional = true } spl-token-2022 = { version = "0.5.0", features = ["no-entrypoint"], optional = true } spl-associated-token-account = { version = "1.1.1", features = ["no-entrypoint"], optional = true } -mpl-token-metadata = { version = "^1.9.0", optional = true, features = ["no-entrypoint"] } +mpl-token-metadata = { version = "^1.11.0", optional = true, features = ["no-entrypoint"] } # TODO: Remove after updating to latest version of platform-tools. # Latest solana version(1.14.17) as of 2023-05-01 comes with rustc 1.62.0-dev but MSRV for latest diff --git a/spl/src/metadata.rs b/spl/src/metadata.rs index 98e1672e65..9e2020d57e 100644 --- a/spl/src/metadata.rs +++ b/spl/src/metadata.rs @@ -1,5 +1,6 @@ use anchor_lang::context::CpiContext; -use anchor_lang::{Accounts, ErrorCode, Result, ToAccountInfos}; +use anchor_lang::error::ErrorCode; +use anchor_lang::{Accounts, Result, ToAccountInfos}; use mpl_token_metadata::state::{CollectionDetails, DataV2, TokenMetadataAccount}; use mpl_token_metadata::ID; use solana_program::account_info::AccountInfo; @@ -50,7 +51,6 @@ pub fn bubblegum_set_collection_size<'info>( pub fn burn_edition_nft<'info>( ctx: CpiContext<'_, '_, '_, 'info, BurnEditionNft<'info>>, - collection_metadata: Option, ) -> Result<()> { let ix = mpl_token_metadata::instruction::burn_edition_nft( ID, @@ -95,47 +95,6 @@ pub fn burn_nft<'info>( .map_err(Into::into) } -#[deprecated(note = "internal instructions deprecated by Metaplex")] -pub fn create_metadata_accounts_v2<'info>( - ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV2<'info>>, - data: DataV2, - is_mutable: bool, - update_authority_is_signer: bool, -) -> Result<()> { - let DataV2 { - name, - symbol, - uri, - creators, - seller_fee_basis_points, - collection, - uses, - } = data; - let ix = mpl_token_metadata::instruction::create_metadata_accounts_v2( - ID, - *ctx.accounts.metadata.key, - *ctx.accounts.mint.key, - *ctx.accounts.mint_authority.key, - *ctx.accounts.payer.key, - *ctx.accounts.update_authority.key, - name, - symbol, - uri, - creators, - seller_fee_basis_points, - update_authority_is_signer, - is_mutable, - collection, - uses, - ); - solana_program::program::invoke_signed( - &ix, - &ToAccountInfos::to_account_infos(&ctx), - ctx.signer_seeds, - ) - .map_err(Into::into) -} - pub fn create_metadata_accounts_v3<'info>( ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV3<'info>>, data: DataV2, @@ -595,18 +554,6 @@ pub struct BurnNft<'info> { pub spl_token: AccountInfo<'info>, } -#[deprecated(note = "internal instructions deprecated by Metaplex")] -#[derive(Accounts)] -pub struct CreateMetadataAccountsV2<'info> { - pub metadata: AccountInfo<'info>, - pub mint: AccountInfo<'info>, - pub mint_authority: AccountInfo<'info>, - pub payer: AccountInfo<'info>, - pub update_authority: AccountInfo<'info>, - pub system_program: AccountInfo<'info>, - pub rent: AccountInfo<'info>, -} - #[derive(Accounts)] pub struct CreateMetadataAccountsV3<'info> { pub metadata: AccountInfo<'info>,