0

I am trying to mint an NFT using a mixture of @solana/spl-token and @metaplex-foundation/js.

I create the mint account:

createMint(
    connection,
    payer,
    mintAuthority,
    freezeAuthority,
    0
  );

Then, try to mint the token to a token account (already exists):

metaplex.nfts().create(
    {
      useExistingMint: mintAddress,
      tokenOwner: ownerAddress,
      uri,
      sellerFeeBasisPoints: 0,
      maxSupply: 1,
      isMutable: false,
      tokenAddress, // Already exists
      updateAuthority: payer,
      mintAuthority: payer
    },
    { payer } // I do not use `metaplex.identity()`
  );

I get the following error:

Error: failed to send transaction: Transaction simulation failed: This program may not be used for executing instructions

My main thinking is the issue is related to useExistingMint:

The address of the existing mint account that should be converted into an NFT. The account at this address should have the right requirements to become an NFT, e.g. its supply should contains exactly 1 token.

https://metaplex-foundation.github.io/js/types/js.CreateNftInput.html

Because the mint account has a supply of 0. However, I am not aware of any way to create a mint account with a supply of 1, without minting a token to an account?

Any help is appreciated.

2
  • Hello @Sky020, Could you please let me know the purpose of this instructions? Why do you need to create a mint first? Why don't you use the useNewMint instead of the useExistingMint? Mar 15, 2023 at 20:25
  • @DoublersKay I am creating the mint account in a different step (at a different time) to when I need the token minted.
    – Sky020
    Mar 15, 2023 at 23:19

1 Answer 1

3

Turns out using [email protected] was the issue.

What I am trying to do is completely possible, after downgrading to current stable: 1.13.7


What lead me to figure this out, is I was unable to use a simple Metaplex program which previously worked:

  const metaplex = Metaplex.make(connection);
  const createResponse = await metaplex.nfts().create(
    {
      name: 'Test',
      uri: 'http://localhost:3002/meta/...',
      sellerFeeBasisPoints: 1000,
      maxSupply: 1,
      updateAuthority: payer,
      mintAuthority: payer
    },
    { payer }
  );

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.