0

I'm trying to use Metaplex Amman to run a local solana validator that has the Token Metadata program preloaded. I need this to create a token. At least I think I do. Every example I look at, no one is using just the plain old spl library, they're the create_metadata_accounts_v3 function from metaplex.

 let seeds = &["SOLvault".as_bytes(), &[ctx.bumps.vault_info]];
        let signer_seeds = &[&seeds[..]];

        let cpi_context = CpiContext::new(
            ctx.accounts.token_metadata_program.to_account_info(),
            CreateMetadataAccountsV3 {
                metadata: ctx.accounts.metadata.to_account_info(),
                mint: ctx.accounts.mint.to_account_info(),
                // Get the account info for the current program
                mint_authority: ctx.accounts.vault_info.to_account_info(),
                payer: ctx.accounts.payer.to_account_info(),
                update_authority: ctx.accounts.vault_info.to_account_info(),
                system_program: ctx.accounts.system_program.to_account_info(),
                rent: ctx.accounts.rent.to_account_info(),
            },
        )
        .with_signer(signer_seeds);

        let data: DataV2 = DataV2 {
            name: metadata.name,
            symbol: metadata.symbol,
            uri: metadata.uri,
            seller_fee_basis_points: 0,
            creators: None,
            collection: None,
            uses: None,
        };

        create_metadata_accounts_v3(cpi_context, data, true, true, None)?;

Here is my amman config file .ammanrc.js

const LOCALHOST = "http://localhost:8899";
const WSLOCALHOST = "ws://localhost:8900/";

module.exports = {
  validator: {
    killRunningValidators: true,
    programs: [
      {
        label: "Token Metadata Program",
        programId: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
        deployPath: localDeployPath("mpl_token_metadata"),
      },
    ],
    jsonRpcUrl: LOCALHOST,
    websocketUrl: WSLOCALHOST,
    commitment: "singleGossip",
    ledgerDir: ".anchor/ledger",
    resetLedger: true,
    verifyFees: false,
    detached: process.env.CI != null,
  },
  relay: {
    enabled: process.env.CI == null,
    killlRunningRelay: true,
  },
  storage: {
    enabled: process.env.CI == null,
    storageId: "mock-storage",
    clearOnStart: false,
  },
};

function localDeployPath(program) {
  switch (program) {
    case "mpl_token_metadata":
      return "/Users/jake/Github/mpl-token-metadata/programs/.bin/mpl_token_metadata.so";
    default:
      throw new Error(`Unknown program ${program}`);
  }
}

First I looked for the actual token metadata program in the metaplex-program-library repository, but it says that the token metadata program has been moved to its own repository. So I moved to looking at the mpl-token-metadata repository. I have tried building the code here following their README instructions enter image description here

Here is my result

jake@Jakes-MacBook-Pro mpl-token-metadata % pnpm install
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 312ms
jake@Jakes-MacBook-Pro mpl-token-metadata % pnpm programs:build

> @ programs:build /Users/jake/Github/mpl-token-metadata
> ./configs/program-scripts/build.sh

Dumping external programs to: './programs/.bin'
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 41: sha256sum: command not found
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 42: sha256sum: command not found
[ SKIPPED ] on-chain and local binaries are the same for 'mpl_token_auth_rules.so'
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 41: sha256sum: command not found
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 42: sha256sum: command not found
[ SKIPPED ] on-chain and local binaries are the same for 'mpl_system_extras.so'
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 41: sha256sum: command not found
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 42: sha256sum: command not found
[ SKIPPED ] on-chain and local binaries are the same for 'mpl_token_extras.so'
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 41: sha256sum: command not found
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 42: sha256sum: command not found
[ SKIPPED ] on-chain and local binaries are the same for 'rooster.so'
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 41: sha256sum: command not found
/Users/jake/Github/mpl-token-metadata/configs/program-scripts/dump.sh: line 42: sha256sum: command not found
[ SKIPPED ] on-chain and local binaries are the same for 'spl_token_2022.so'

./configs/program-scripts/build.sh: line 24: jq: command not found
jake@Jakes-MacBook-Pro mpl-token-metadata % 

It looks like maybe the build script failed? It's not completely clear. Either way, I don't see the mpl_token_metadata.so file that I need anywhere enter image description here

The token metadata program README says the programs should be in programs/.bin, but there is no mpl_token_metadata.so file there. I'm totally lost on how to get these metaplex programs to work. I swear I'm following all of their README instructions but all of the build scripts fail and I can't find the program file I need. Please help, thanks!

2 Answers 2

3

You can use the Solana CLI to make a dump from the chain

solana program dump metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s mpl_token_metadata.so
0

I think I lost sight of the forest for the trees, trying to figure this out for so long.

Thanks to chatgpt I finally figured out I needed to install some libs that I didn't have and weren't mentioned in the README. brew install coreutils jq

Then I did a rustup update and a cargo clean and deleted the cargo.lock file in token-metadata crate. Finally I ran the build script again, but passing in the correct argument. npm run programs:build token-metadata.

Finally I have the token_metadata.so file. So I also had the name wrong in the title of this post. enter image description here

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.