I am using the following Anchor dependencies:
anchor-lang = "0.27.0"
anchor-spl = { version = "0.27.0", features = ["metadata"] }
But it breaks when compiling because seems like the create_metadata_accounts_v2
function doesn't exist anymore within the mpl_token_metadata
library:
error[E0425]: cannot find function `create_metadata_accounts_v2` in module `mpl_token_metadata::instruction`
--> src/metadata.rs:24:47
|
24 | let ix = mpl_token_metadata::instruction::create_metadata_accounts_v2(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `create_metadata_accounts_v3`
I am just using it to obtain the token metadata:
use anchor_spl::metadata::MetadataAccount;
#[derive(Accounts)]
pub struct Allowed<'info> {
#[account()]
pub signer: Signer<'info>,
...
...
#[account(
seeds = [b"metadata", mpl_token_metadata::ID.as_ref(), metadata.mint.key().as_ref()],
seeds::program = mpl_token_metadata::ID,
constraint = metadata.mint == token.as_ref().unwrap().mint @ Unauthorized,
bump,
)]
pub metadata: Option<Account<'info, MetadataAccount>>,
}
Does somebody know how to fix this issue?