samuelvanderwaal / metaboss

The Metaplex NFT-standard Swiss Army Knife tool.
Apache License 2.0
690 stars 220 forks source link

Questions on update data #11

Closed doogyhatts closed 3 years ago

doogyhatts commented 3 years ago

Hi, I have an NFT that was created by candy machine before but it had a spelling error in one of the traits. I suppose I have to put in the additional data for . But what is ? Must its 'share' be 50? thanks!

samuelvanderwaal commented 3 years ago

So you're trying to update the Data struct of your NFT with metaboss update data, correct? The way to do that is:

metaboss update data --acount <MINT_ACCOUNT> --keypair <UPDATE_AUTHORITY> --new-datea-file <NEW_DATA_FILE

The --acount option is the NFT's token mint account. The --keypair option is the path to the update authority keypair for the NFT, the one you used to create the candy machine with, and the --new-data-file is the JSON formatted file with the new data for your NFT. This includes the new uri if you're updating the external JSON metadata.

Make sure you create your JSON file with the candy machine as a verified creator if you wish to keep it on the NFT. Test the command on a test NFT on devnet so you understand what you are doing before running it on mainnet.

doogyhatts commented 3 years ago

Hi Samuel, Ok I tried it on the devnet. I realised that the parsing of the json file is not following the token metadata standard. For example, the "creators" section is within "properties". But the command line gave an error that no creators are specified in the json file. Another example is the "uri". I happened to use "image".

Would it be possible to get the parsing of the json file to follow the token metadata standard?

samuelvanderwaal commented 3 years ago

The JSON file is supposed to be formatted for the on-chain Data struct. This is how you update the on-chain data for your NFT. For the external JSON metadata you need to create the new Arweave link and then use that as your URI in the on-chain data.

samuelvanderwaal commented 3 years ago

@edwinzeng2005 btw, if all you need to do is update some traits, you can just create the new Arweave link with the updated traits and use metaboss update uri instead, and then you don't need to pass in all the on-chain data fields. However, if you do that, make sure you're only changing the attributes and none of the on-chain data or your NFT will end up with metadata out-of-sync with the on-chain data.

doogyhatts commented 3 years ago

Hi Samuel, Thank you for the explanation! I managed to get the new Arweave link but when I run 'update uri', I encountered a transaction simulation error on the devnet. Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x7 [5 log messages]

I suppose the 'mint account' is the public key of the nft. How should I resolve this error?

The NFT was minted on the devnet previously and now resides in a wallet. How would the keypair parameter be affected? I got the Arweave link from the cache that was associated with the devnet keypair from candy-factory. Or should the keypair parameter actually referring to the private key of the wallet?

But I still got the same transaction simulation error anyway.

samuelvanderwaal commented 3 years ago

@edwinzeng2005 0x7 is a Token Metadata error code:

0x7: 
    Token Metadata            | UpdateAuthorityIncorrect: Update Authority given does not match

It looks like you are using a keypair that is not the update authority of the NFT. You need to pass the update authority keypair to metaboss using the -k option.

doogyhatts commented 3 years ago

@samuelvanderwaal Apparently, I don't think I will be able to get it working on the devnet because the test data was minted using the Phantom wallet address, which does not give a correct private key format for input.

So I tried to do it on the mainnet instead based on what I understood so far, which also previously used the Solflare wallet's private key. This time, there was no transaction simulation error. Instead it gave a 'no account data found' error.

I had used the wallet's private key as the keypair, the token address as the account, and the arweave link (compressed) as the uri.

samuelvanderwaal commented 3 years ago

Yeah, I will add the Phantom private key format as an input soon.

"no account data found" means you're using an account with no metadata associated with it. Can you provide the account address you're using here or send it to me on Discord?

doogyhatts commented 3 years ago

Here is the token address: GwndDLQNP8TY1Kcsn2pb5kSpYfGTEaV3oyj16obUNARq

samuelvanderwaal commented 3 years ago

The token looks fine and I can decode it with Metaboss. Remember that Metaboss defaults to devnet, so you need to either set your Solana config to use mainnet or pass in a mainnet rpc url with the --rpc option.

ewelton commented 3 years ago

I am also getting the -32002 error as of today, both with version 0.1.0 and 0.2.0

Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x26 [5 log messages]

Caused by:
    RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x26 [5 log messages]

troubleshooting this, I am suspecting it is because the update authority is not one of the creators?

I just noticed this error today - and suspect it is unrelated to the thread above - but thought I would mention it just in case it was useful - as this seems to be an active topic at the moment ;)

samuelvanderwaal commented 3 years ago

I am also getting the -32002 error as of today, both with version 0.1.0 and 0.2.0

Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x26 [5 log messages]

Caused by:
    RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x26 [5 log messages]

troubleshooting this, I am suspecting it is because the update authority is not one of the creators?

I just noticed this error today - and suspect it is unrelated to the thread above - but thought I would mention it just in case it was useful - as this seems to be an active topic at the moment ;)

Yep, this is mostly likely due to the bug where the update authority must also be a creator. Error code 0x26:

    Token Metadata            | MustBeOneOfCreators: If using a creators array, you must be one of the creators listed
doogyhatts commented 3 years ago

The token looks fine and I can decode it with Metaboss. Remember that Metaboss defaults to devnet, so you need to either set your Solana config to use mainnet or pass in a mainnet rpc url with the --rpc option.

I see. I have got it working! The spelling error has been resolved. Turns out that the system was on devnet after I checked the network details.

Thank you very much!

samuelvanderwaal commented 3 years ago

Awesome! I'm glad Metaboss was able to solve your NFT issue.