Skip to content

Commit

Permalink
spl: remove mpl create_metadata_account_v2 wrapper that were remove…
Browse files Browse the repository at this point in the history
…d from program (#2480)

* remove mpl ix wrappers that were removed from program

* update changelog
  • Loading branch information
callensm authored May 3, 2023
1 parent c166712 commit ac86e15
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 60 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 2 additions & 55 deletions spl/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<Pubkey>,
) -> Result<()> {
let ix = mpl_token_metadata::instruction::burn_edition_nft(
ID,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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>,
Expand Down

1 comment on commit ac86e15

@vercel
Copy link

@vercel vercel bot commented on ac86e15 May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-lang.com
anchor-docs-git-master-200ms.vercel.app
www.anchor-lang.com
anchor-docs-200ms.vercel.app

Please sign in to comment.