1

Per the Metaplex token-standard documentation, "the Token Standard is set automatically by the Token Metadata program and cannot be manually updated" and "If the token has no (Master) Edition account (ensuring its supply can be > 1) and uses zero decimals places, it is a FungibleAsset."

However, attempting to use createMetadataAccountV3 from @metaplex-foundation/mpl-token-metadata on a token with no edition and with decimals results in the error 0x99, "Instruction not supported for ProgrammableNonFungible assets".

The calling code:

const mint = new PublicKey(mintPubkeyString);

const endpoint = clusterApiUrl(cluster);
const umi = createUmi(endpoint);

const mplProgramId = new PublicKey(
  "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
);
const [metadata] = PublicKey.findProgramAddressSync(
  [Buffer.from("metadata"), mplProgramId.toBytes(), mint.toBytes()],
  mplProgramId
);

const umiMintAuthorityKeypair: UmiKeypair = {
  publicKey: fromWeb3JsPublicKey(mintAuthorityKeypair.publicKey),
  secretKey: mintAuthorityKeypair.secretKey,
};
const mintAuthoritySigner: UmiSigner = createSignerFromKeypair(
  umi,
  umiMintAuthorityKeypair
);
umi.use(keypairIdentity(umiMintAuthorityKeypair));

tokenMetadata = {
  name: "KTest",
  symbol: "KTEST",
  uri: "https://foo.com/bar",
  sellerFeeBasisPoints: 200,
  collection: null,
  creators: null,
  uses: null,
};

const args: CreateMetadataAccountV3InstructionArgs = {
  data: tokenMetadata,
  isMutable: true,
  collectionDetails: null,
};

const accounts: CreateMetadataAccountV3InstructionAccounts = {
  metadata: fromWeb3JsPublicKey(metadata),
  mint: fromWeb3JsPublicKey(mint),
  payer: mintAuthoritySigner,
  mintAuthority: mintAuthoritySigner,
  updateAuthority: fromWeb3JsPublicKey(mintAuthorityKeypair.publicKey),
};

const builder = createMetadataAccountV3(umi, { ...accounts, ...args });
builder.getInstructions().forEach((ix) => console.log(ix));
const confirmResult = await builder.sendAndConfirm(umi);
console.log("Transaction confirmation: ", confirmResult);

This results in the transaction data

data: Uint8Array(84) [
   33,   5,   0,   0,   0,  75,  84, 101, 115, 116,   5,   0,
    0,   0,  75,  84,  69,  83,  84,  54,   0,   0,   0, 104,
  116, 116, 112, 115,  58,  47,  47, 107, 105, 114, 111, 115,
   99, 111, 105, 110,  46,  99, 111, 109,  47, 116, 111, 107,
  101, 110,  45, 109, 101, 116,  97, 100,  97, 116,  97,  47,
  107, 105, 114, 111, 115,  45, 115, 111, 108,  97, 110,  97,
   46, 106, 115, 111, 110, 200,   0,   0,   0,   0,   1,   0
]

With the full transaction (in base58) being T7Z6dqJLpe476CpJLkDe7ewfurXBWMfL9mwMbK7rnPYkfcQ76YoSbaBuKg8wzpbx4spMwSxQqCcEL5HNDAqjX46CUPMXD92XGWPyvjy9kgRdNy9AYd6zPpGzrSRee7JYjNryqTssZZ68RV9pZYyMRKX941BBtyEiHBPkjLK9cybzQNjZwRxhc2ooTKvYKBzFunYYv7bUwwi55TRfbUKvDRsnxy8egkAwbJc9ARyTe6r1M3zDw5sjcLL81VLy8Wm7akPYF4zTvMpybtyrn9wNSW8oVxkZqqX94y8LWqgvHomxPqPRWEGPV2eXxprEWpT87UP3rDCEfMazWA3EWSff5AzUxTEuo5q

2
  • 1
    Hi, can you please show how you're calling the instruction? Sample code would be great, or a serialized transaction or a transaction with skipPreflight = true also works. Commented Dec 24, 2023 at 8:45
  • @KartikSoneji Thank you, I have added the relevant code as well as the serialized transaction.
    – JTB
    Commented Dec 27, 2023 at 9:51

2 Answers 2

1

You cannot use the legacy createMetadataAccountV3 instruction to create ProgrammableNonFungibles.

Instead, you must use the newest handlers to create and manage your pNFTs. Namely, you will need to use the create and mint instructions within the same transaction. However, when using the Umi SDK, you can use the createProgrammableNft helper function like so:

import { percentAmount, generateSigner } from '@metaplex-foundation/umi'
import { createProgrammableNft } from '@metaplex-foundation/mpl-token-metadata'

const mint = generateSigner(umi)
await createProgrammableNft(umi, {
  mint,
  name: 'My Programmable NFT',
  uri: 'https://example.com/my-programmable-nft.json',
  sellerFeeBasisPoints: percentAmount(5.5),
}).sendAndConfirm(umi)
4
  • Thank you very much, but the token in this case is a fungible asset.
    – JTB
    Commented Jan 9 at 15:45
  • I'm afraid there is currently no such thing as a programmable fungible asset. To create a non-programmable fungible asset, you may use the createFungible helper function instead. Commented Jan 9 at 16:06
  • The object in this case is not to create an asset, but to create metadata for an existing, non-programmable, fungible token.
    – JTB
    Commented Jan 10 at 17:41
  • Gotcha! Sorry for the confusion. These create helpers are basically a juxtaposition of the create and mint instructions. What you want is the createV1 function which will only create the Metadata account if the mint account already exists. Technically you should be able to do this with the legacy createMetadataAccountV3 instruction though. The full transaction log would be helpful to debug why the program think you’re trying to create a pNFT. Commented Jan 10 at 19:16
0

To answer the question, That's a misleading error message in the source of Metaplex, the error gets thrown if your asset is pNFT or Token2022, the latter seems to be your issue.

I made a PR here to fix that, if it does get merged, should be available in newer versions.

https://github.com/metaplex-foundation/mpl-token-metadata/pull/79

0

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.