Search code examples
solanametaplex

MintAccount can't be found


I want to create an NFT using the Metaplex SDK with react. But when i execute this function, it throws following error:

AccountNotFoundError: 
The account of type [MintAccount] was not found at the provided address 
[7SYH47nGcK5fnMmf6zoW75BWpdxDAyq8DBRbagMdsPKJ].

This is the function i'm trying to execute:

  async function mint() {
    const links = await uploadMetadata();
    console.log("Cover: " + links.cover);
    console.log("Text: " + links.text);
    console.log("Metadata: " + links.metadata);
    const { nft } = await metaplex.nfts().create({
      uri: links.metadata,
      name: title,
      sellerFeeBasisPoints: 500, // Represents 5.00%.
    });
    console.log(nft);
  }```

Solution

  • This is a metaplex SDK error.

    The issues is that metaplex sdk is trying to read after writing to solana. The issues with that is obviously that the changes have yet to be propagated throughout the chain.

    To fix this add the optional commitment argument { commitment: "finalized" }

    Your code will now look like this

    
    async function mint() {
        const links = await uploadMetadata();
        console.log("Cover: " + links.cover);
        console.log("Text: " + links.text);
        console.log("Metadata: " + links.metadata);
        const { nft } = await metaplex.nfts().create(
            {
                uri: links.metadata,
                name: title,
                sellerFeeBasisPoints: 500, // Represents 5.00%.
            },
            { commitment: "finalized" }
        );
        console.log(nft);
    }