metaplex-foundation / mpl-token-metadata

Program to attach additional data to Fungible or Non-Fungible tokens on Solana.
https://developers.metaplex.com/token-metadata
Other
124 stars 65 forks source link

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

Closed andreisilviudragnea closed 3 months ago

andreisilviudragnea commented 8 months ago

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 commented 7 months ago

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

samuelvanderwaal commented 7 months ago

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.

danenbm commented 7 months ago

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.

andreisilviudragnea commented 7 months ago

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

null-prophet commented 7 months ago

same here, the PDA utils would be super helpful

blockiosaurus commented 7 months ago

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

null-prophet commented 7 months ago

@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?

blockiosaurus commented 7 months ago

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

null-prophet commented 7 months ago

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>, 
samuelvanderwaal commented 7 months ago

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

andreisilviudragnea commented 7 months ago

@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

danenbm commented 3 months ago

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?

andreisilviudragnea commented 3 months ago

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