metaplex-foundation / js

A JavaScript SDK for interacting with Metaplex's programs
357 stars 182 forks source link

Transaction too large #262

Closed ruskid closed 2 years ago

ruskid commented 2 years ago

Hi, I am getting: "Transaction too large: 1283 > 1232" when minting an NFT with collectionAuthority

return await this.metaplex
      .nfts()
      .create({
        uri: input.jsonURL,
        name: input.name,
        isMutable: true,
        symbol: SYMBOL,
        sellerFeeBasisPoints: 0,
        creators,
        isCollection: false,
        maxSupply: toBigNumber(0), // prevent editions, prints etc

        payer: input.creators.minterSigner,
        mintAuthority: input.creators.AuthoritySigner,
        updateAuthority: input.creators.AuthoritySigner,
        tokenOwner: new PublicKey(input.creators.createdByPublicKey),

        // set and verify collection
        collection: new PublicKey(input.collection.collectionMintPublicKey),
        collectionAuthority: input.collection.collectionUpdateAuthority,
        collectionAuthorityIsDelegated: false,
      } as CreateNftInput)
      .run()

is the issue with RPC or Solana?

lorisleiva commented 2 years ago

Hi there 👋

Are you running this on a local test validator that's using an old version of Solana?

They recently-ish increased the transaction size which allowed this SDK to provide more features within the same transaction.

ruskid commented 2 years ago

hey, thanks for your work!

It's not a Metaplex issue but a Solana limit. I removed some NFT creators and attributes to get the transaction lighter

lorisleiva commented 2 years ago

Is this happening with the latest version of Solana though?

I'm curious to know if the latest changes they did on the transaction limit is still going to cause some issues for the SDK.

ruskid commented 2 years ago

do you mean the version of @solana/web3.js? I am using ^1.44.0

ruskid commented 2 years ago

Oh, I just managed to get the version of Solana from the Alchemy node. it's "solana-core":"1.10.34"

lorisleiva commented 2 years ago

Ah okay, thanks for that. Unfortunately, they already bumped the tx size on that version so looks like we've got to be careful on the SDK with this operation.

Instead of changing the creator array, I'd suggest removing the collectionAuthority and collectionAuthorityIsDelegated parameters so that the transaction doesn't include the instruction that verifies the collection.

You can then use metaplex.nfts().verifyCollection(...).run() to achieve this in a different transaction.

lorisleiva commented 2 years ago

Hi there 👋

I'm going to close this since it seems like you fixed your issue by splitting your transaction but feel free to open a new issue with updated information if you need to.

Thanks for raising this.