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
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
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!