1

I have been trying to execute an anchor build command in my program, but I am facing some errors for the mpl_token_metadata package.

The error is pointed out for the below block of code:

use mpl_token_metadata::{
    pda::{find_master_edition_account, find_metadata_account},
    state::DataV2,
};

The mpl_token_metadata version I am using is:

mpl-token-metadata = "4.1.2" 

The other dependencies in my cargo.toml file is:

anchor-lang = { version = "0.30.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.30.0", features = ["metadata"] }

The error I am getting is: enter image description here

Can someone help me understand and solve this error?

1 Answer 1

1

These imports are for older versions

From the latest version import them like this

use mpl_token_metadata::accounts::{ MasterEdition, Metadata as MetadataAccount };

usage

    #[account(
        mut,
        address = MetadataAccount::find_pda(&mint.key()).0,
    )]
    pub metadata_account: UncheckedAccount<'info>,

    #[account(
        mut,
        address = MasterEdition::find_pda(&mint.key()).0,
    )]
    pub master_edition_account: UncheckedAccount<'info>,

docs.rs reference

1
  • 1
    Thanks ser, the solution worked. I updated my imports, and made necessary changes in code. Commented Apr 29 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.