mpl-token-metadata icon indicating copy to clipboard operation
mpl-token-metadata copied to clipboard

`mpl-token-metadata` starting with v2.0.0 does not contain Solana program code anymore

Open andreisilviudragnea opened this issue 2 years ago • 11 comments

Since v2.0.0, mpl-token-metadata is an SDK crate. The crate versions before that included the program code itself too.

Is there any other crate which now contains the removed mpl-token-metadata program code? Our project depends on some helper methods from the mpl-token-metadata program itself and we cannot update our codebase to Solana v1.17 because of this problem, since mpl-token-metadata v1.13.2 does not suport Solana v1.17.

andreisilviudragnea avatar Jan 18 '24 14:01 andreisilviudragnea

@danenbm Any idea about supporting this in the future again?

andreisilviudragnea avatar Feb 06 '24 07:02 andreisilviudragnea

Out of curiosity, what are the helper methods?

Edit: The reason I'm asking is some of the helper methods have been moved to other places in the code, something I found out when I upgraded a project to use the new SDK crate.

samuelvanderwaal avatar Feb 06 '24 19:02 samuelvanderwaal

Yes, please let us know the helper methods you are missing. We would prefer to make sure the Rust client crate works for everyone's use cases rather than publishing the program crate again. We have migrated a few projects from using the program crate to the Rust client crate, and can help with this process.

danenbm avatar Feb 06 '24 19:02 danenbm

Hello, @danenbm @samuelvanderwaal @blockiosaurus. We are using some items from token_metadata Solana program for emulating some token_metadata instructions on our side: https://github.com/neonlabsorg/neon-evm/blob/develop/evm_loader/program/src/external_programs/metaplex.rs

I also tried adding token_metadata = { git = "https://github.com/metaplex-foundation/mpl-token-metadata.git" } as a dependency to Cargo.toml, but I cannot do that because of Solana v1.17 version mismatch, since token_metadata crate does not support Solana v1.17 (as many other Metaplex dependencies of token_metadata).

My trials so far can be checked on this branch: https://github.com/neonlabsorg/neon-evm/tree/solana-1.17.6

andreisilviudragnea avatar Feb 15 '24 08:02 andreisilviudragnea

same here, the PDA utils would be super helpful

null-prophet avatar Feb 19 '24 03:02 null-prophet

@null-prophet all of the PDA helpers should be present in the new clients.

blockiosaurus avatar Feb 19 '24 04:02 blockiosaurus

@null-prophet all of the PDA helpers should be present in the new clients.

can you show me where as I searched the code for specific references and looked at the rust docs.

find_master_edition_account I couldn't find anywhere in the crate code.

image

https://docs.rs/mpl-token-metadata/latest/mpl_token_metadata/all.html?search=find_master_edition_account

Am I looking in the wrong place?

null-prophet avatar Feb 19 '24 21:02 null-prophet

PDA finders now live on their respective accounts. https://docs.rs/mpl-token-metadata/latest/mpl_token_metadata/accounts/struct.MasterEdition.html#method.find_pda

blockiosaurus avatar Feb 19 '24 21:02 blockiosaurus

Thanks @blockiosaurus

How would I then access these if I was using these accounts or the original PDA methods in the checks for an account struct in Anchor? Sorry, I'm just new to this ecosystem and finding it hard to find any up to date information on the best way to do things. I'm following along with some NFT minting tutorials to get me up to speed but they are relying on much older v1.x instances of this crate.

    /// CHECK - address
    #[account(
        mut,
        address=find_metadata_account(&mint.key()).0,
    )]
    pub metadata_account: AccountInfo<'info>, // new
    /// CHECK: address
    #[account(
        mut,
        address=find_master_edition_account(&mint.key()).0,
    )]
    pub master_edition_account: AccountInfo<'info>, 

null-prophet avatar Feb 19 '24 21:02 null-prophet

Thanks @blockiosaurus

How would I then access these if I was using these accounts or the original PDA methods in the checks for an account struct in Anchor? Sorry, I'm just new to this ecosystem and finding it hard to find any up to date information on the best way to do things. I'm following along with some NFT minting tutorials to get me up to speed but they are relying on much older v1.x instances of this crate.

    /// CHECK - address
    #[account(
        mut,
        address=find_metadata_account(&mint.key()).0,
    )]
    pub metadata_account: AccountInfo<'info>, // new
    /// CHECK: address
    #[account(
        mut,
        address=find_master_edition_account(&mint.key()).0,
    )]
    pub master_edition_account: AccountInfo<'info>, 

It would be Metadata::find_pda(&mint.key()).0 and MasterEdition::find_pda(&mint.key()).0

samuelvanderwaal avatar Feb 20 '24 01:02 samuelvanderwaal

@blockiosaurus @danenbm @samuelvanderwaal In my case, we are missing some helpers and some constants present in mpl-token-metadata v1.13.2:

use mpl_token_metadata::assertions::collection::assert_collection_update_is_valid;
use mpl_token_metadata::assertions::uses::assert_valid_use;
use mpl_token_metadata::utils::{assert_data_valid, assert_initialized, puff_out_data_fields};
use mpl_token_metadata::state::{CREATE_FEE, MAX_MASTER_EDITION_LEN, MAX_METADATA_LEN};
use mpl_token_metadata::instruction::{
    CreateMasterEditionArgs, CreateMetadataAccountArgsV3, MetadataInstruction,
};

We use them in this file here: https://github.com/neonlabsorg/neon-evm/blob/develop/evm_loader/program/src/external_programs/metaplex.rs

andreisilviudragnea avatar Feb 20 '24 09:02 andreisilviudragnea

Sorry for the delayed response. You have probably already worked around this by now, but wanted to let you know that at this point we are pretty far down the path of not releasing program crates. I think the best bet for your use case is forking it. And since cargo supports GitHub deps it should be fairly straightforward. Can that work for your scenario?

danenbm avatar Jul 02 '24 05:07 danenbm

We just duplicated some missing constants from the program code, it should be ok for us for now.

andreisilviudragnea avatar Jul 02 '24 07:07 andreisilviudragnea