0

Link is here: https://github.com/solana-developers/program-examples/blob/main/tokens/create-token/solang/tests/create-token.ts

It gives two examples. One for creating SPL tokens the other for NFTs. Going through the two I find no difference. I wonder if there should be a difference here:

const metadataAddress = await metaplex
  .nfts()
  .pdas()
  .metadata({ mint: mintKeypair.publicKey })

Both SPL token and NFTs use " metaplex.nfts() ", so I guess here is something miswritten. Should SPL token use metaplex.spl() or something like that?

0

1 Answer 1

1

NFTs on Solana are also derived from the SPL Token Program but with decimals field set to 0 to signify non-fungibility. If you look at the code linked, createTokenMint function takes different inputs for decimals field in both cases.

// For SPL Token 
const tx = await program.methods
      .createTokenMint(
        wallet.publicKey, // freeze authority
        9, // decimals for the mint
        tokenTitle, // token name
        tokenSymbol, // token symbol
        tokenUri // token uri (off-chain metadata)
      )

// For NFT
const tx = await program.methods
      .createTokenMint(
        wallet.publicKey,
        0, // decimals for the mint, 0 for NFTs "non-fungible"
        tokenTitle,
        tokenSymbol,
        tokenUri
      )

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.