0

Hello Solana community,

I'm facing issues assigning metadata (name, ticker, image) to a standard SPL token on the devnet. I've tried the following without success:

Metaboss @metaplex/js ; @metaplex-foundation/js ; @metaplex-foundation/mpl-token-metadata Are there any recommended libraries, SDKs, or CLI tools specifically for assigning metadata to standard SPL tokens? I'm open to any solutions, but would prefer one that I can implement independently, not relying on external platforms like Dexlab's MintingLab or Smithii's Solana Token Creator.

Any help would be greatly appreciated!

Thank you,

2 Answers 2

1

the way I read it, you need a very basic functionality for your tokens, so I think you can do this already with the new token program on Solana without relying on 3rd party tools. The token 22 program is pretty amazing.

https://spl.solana.com/token-2022

3
  • I thoroughly explored the page on the token 2022 program that you've recommended. While it indeed offers some fascinating features and showcases the advancements of the Solana token program, unfortunately, I was not able to find a concrete, ready-made solution for assigning metadata to SPL tokens in the manner I need. It appears that my requirements might need a more specific approach or additional tooling that's not directly covered in the documentation provided. If you or anyone else in the community has further insights, examples, or guidance on how to proceed with assigning metadata? Commented Mar 3 at 11:23
  • Ok, so without your code, it is really hard to understand what you plan to do. The information provided: name, image and symbol should be able to be added via the contract for sure. But there are more things that can be the case why something is not working as expected
    – Björn W
    Commented Mar 4 at 14:09
  • Checkout this video: youtube.com/watch?v=l7EyQUlNAdw
    – Björn W
    Commented Mar 4 at 14:09
0

I recently built a simple vue.js app that can create spl token with metadata. Please check this site. https://solana-create-spl-token.vercel.app/ This works well on mainnet, devnet. I hope you find the following script snippet helpful.

import {Connection, LAMPORTS_PER_SOL, PublicKey, Transaction, SystemProgram, Keypair, TransactionSignature} from @solana/web3.js
import { PROGRAM_ID, createCreateMetadataAccountV3Instruction } from '@metaplex-foundation/mpl-token-metadata'
import { MINT_SIZE, AuthorityType, TOKEN_PROGRAM_ID, createSetAuthorityInstruction, getMinimumBalanceForRentExemptMint, createInitializeMintInstruction, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createMintToInstruction } from '@solana/spl-token';

...

const mintKeypair = Keypair.generate();
const tokenATA = await getAssociatedTokenAddress(mintKeypair.publicKey, publicKey.value);
const metadata = PublicKey.findProgramAddressSync(
    [
        Buffer.from("metadata"),
        PROGRAM_ID.toBuffer(),
        mintKeypair.publicKey.toBuffer(),
    ],
    PROGRAM_ID,
)[0];
const createMetadataInstruction = createCreateMetadataAccountV3Instruction(
    {
        metadata: metadata,
        mint: mintKeypair.publicKey,
        mintAuthority: publicKey.value,
        payer: publicKey.value,
        updateAuthority: publicKey.value,
    },
    {
        createMetadataAccountArgsV3: {
            data: {
                name: tokenName.value,
                symbol: tokenSymbol.value,
                uri: metadataUri.value,
                creators: null,
                sellerFeeBasisPoints: 0,
                uses: null,
                collection: null,
            },
            isMutable: !immutable.value,
            collectionDetails: null,
        },
    },
);

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.