Closed askindus closed 3 years ago
I did not find an example of how exactly to use UpdateMetadataAccount correctly and tried it out.
In MetadataProgramData.cs Line 171 https://github.com/bmresearch/Solnet.Metaplex/blob/1e645368b02f94081b2b0b576b047ffd61d20df1/Solnet.Metaplex/MetadataProgramData.cs#L171
should maybe be
writer.Write( (byte) MetadataProgramInstructions.Values.UpdateMetadataAccount );
instead of
writer.Write( (byte) MetadataProgramInstructions.Values.CreateMetadataAccount );
? I tried it out using
var tx = MetadataProgram.UpdateMetadataAccount(mintMetadataPublicKey, updateAuthority, updateAuthority, new MetadataParameters() { creators = new List<Solnet.Metaplex.Creator>() { new Solnet.Metaplex.Creator(updateAuthority, 100) }, name = "customname", sellerFeeBasisPoints = 200, symbol = "", uri = "customurl" }, false); var blockHash = _client.GetRecentBlockHash(); byte[] TX1 = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) .AddInstruction(tx) .Build(new List<Account> { wallet.Account }); var txSim = _client.SimulateTransaction(TX1);
and I get following error:
{"jsonrpc":"2.0","result":{"context":{"slot":99070261},"value":{"accounts":null,"err":{"InstructionError":[0,"InvalidError"]},"logs":["Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]","Program log: Error: BorshIoError","Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3732 of 200000 compute units","Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: program returned invalid error code"]}},"id":3}
What I'm doint wrong and could you please share an working example?
I don't think you are doing anything wrong + you are correct on the bug, it's the wrong instruction enum. I'm working on a example, hope to merge very soon.
I did not find an example of how exactly to use UpdateMetadataAccount correctly and tried it out.
In MetadataProgramData.cs Line 171 https://github.com/bmresearch/Solnet.Metaplex/blob/1e645368b02f94081b2b0b576b047ffd61d20df1/Solnet.Metaplex/MetadataProgramData.cs#L171
should maybe be
writer.Write( (byte) MetadataProgramInstructions.Values.UpdateMetadataAccount );
instead of
writer.Write( (byte) MetadataProgramInstructions.Values.CreateMetadataAccount );
? I tried it out using
and I get following error:
{"jsonrpc":"2.0","result":{"context":{"slot":99070261},"value":{"accounts":null,"err":{"InstructionError":[0,"InvalidError"]},"logs":["Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]","Program log: Error: BorshIoError","Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3732 of 200000 compute units","Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: program returned invalid error code"]}},"id":3}
What I'm doint wrong and could you please share an working example?