metaplex-foundation / js

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

Update method - Can't use this function on unsized collection #319

Closed jesign closed 2 years ago

jesign commented 2 years ago

Hi i'm getting this error when updating an NFT that belongs to an unsized collection:

key: 'metaplex.errors.program.parsed_program_error', title: "TokenMetadataProgram > Can't use this function on unsized collection", problem: The program [TokenMetadataProgram] at address [metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s] raised an error of code [101] that translates to "Can't use this function on unsized collection"., solution: 'Check the error message provided by the program.', source: 'program', sourceDetails: 'TokenMetadataProgram [metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s]',

i used the update method to update.

const result = await metaplex.nfts().update({ nftOrSft: nft, uri: newUri }).run();

i also tried to add a collectionIsSized: true in the params. but it still doesn't work. how do we update NFTs that belong to unsized collection now?

myyellowshoe commented 2 years ago

I wonder if you could use migrateToSizedCollectionNft function to fix this issue?

migrateToSizedCollectionNft.ts

Jack-R-Long commented 2 years ago

Same issue here! I posted on stack exchange https://solana.stackexchange.com/questions/3469/error-with-newly-migrated-certified-nft-collection

jesign commented 2 years ago

@myyellowshoe , it would make a new error, it says Cannot verify collection in this instruction.

jesign commented 2 years ago

it seems like unverifying the collection before updating works. but i will have to verify it again. is this the expected behaviour?

lorisleiva commented 2 years ago

Hi there 👋

Thank you for raising this. It's a bug, I've been able to reproduce it on a regression test. Fixing this and publishing a new version today (it will have to be a minor jump since main contains some small breaking changes for other modules).

lorisleiva commented 2 years ago

I will publish this as version 0.16.0 today. Let me know if that didn't fix your issue and I'll reopen it. 🤞

jesign commented 2 years ago

Thank you Loris! i'll check it out.

On Fri, 30 Sept 2022 at 19:36, Loris Leiva @.***> wrote:

I will publish this as version 0.16.0 today. Let me know if that didn't fix your issue and I'll reopen it. 🤞

— Reply to this email directly, view it on GitHub https://github.com/metaplex-foundation/js/issues/319#issuecomment-1263461338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFSIJRCUF5SRHROK2JMTFLWA3GDRANCNFSM6AAAAAAQYP6CUE . You are receiving this because you authored the thread.Message ID: @.***>

fa8ster commented 1 year ago

image I tried

let address = new web3.PublicKey(
    "Co3XhKHJAefgWYmrZFnVx4GKq5xWBsqfHEuedgEjBvNn"
  );
  let nft = await metaplex.nfts().findByMint({ mintAddress: address });

  let result = await metaplex.nfts().update({
    nftOrSft: nft,
    name: "SAM #9998",
  });

but the issue seems to be remaining. It's also an unsized MCC. Using 0.17.6

It looks like the NFT.json Object is not adjusted properly CleanShot 2022-12-02 at 12 34 07

fa8ster commented 1 year ago

I had to upload a new json and it worked

const { uri: newUri } = await metaplex.nfts().uploadMetadata({
    ...nft.json,
    name: "SAM #6665",
  });

  let result = await metaplex.nfts().update({
    nftOrSft: nft,
    name: "SAM #6665",
    uri: newUri,
  });