blocto / solana-go-sdk

Solana Golang SDK
https://blocto.github.io/solana-go-sdk/
MIT License
370 stars 95 forks source link

Create Metadata Accounts -"Program log: Incorrect account owner" #52

Closed rahulanand20 closed 2 years ago

rahulanand20 commented 2 years ago

failed to send tx, err: rpc response error: { "code": -32002, "message": "Transaction simulation failed: Error processing Instruction 2: custom program error: 0x39", "data": { "accounts": null, "err": { "InstructionError": [ 2, { "Custom": 57 } ] }, "logs": [ "Program 11111111111111111111111111111111 invoke [1]", "Program 11111111111111111111111111111111 success", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb invoke [1]", "Program log: Instruction: InitializeMint", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb consumed 2923 of 1400000 compute units", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb success", "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]", "Program log: (Deprecated as of 1.1.0) Instruction: Create Metadata Accounts", "Program log: Incorrect account owner", "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 4273 of 1397077 compute units", "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x39" ], "unitsConsumed": 2923 } }

Could help with the error.

yihau commented 2 years ago

there is an example https://portto.github.io/solana-go-sdk/nft/mint-a-nft.html seems you deploy a token program on GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb basically we will use the official ones TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

rahulanand20 commented 2 years ago

If that is the case. I want to write my own smart contract and then deploy it to the devnet .How can that be done

yihau commented 2 years ago

If you would like to use your custom token program. you should also deploy your own metadata program. Even you need to modify logic in the origin program if needed. I don't really recommend you do this. You may

  1. most of wallet don't support you due to they all only recognize official ones
  2. you may need to do a lot of modification to original code and maintain it

I'll suggest you only use official programs for these stuff.

rahulanand20 commented 2 years ago

Thanks for the prompt reply.. I have deployed the token metadata of metaplex-program-library and put the deployed address. But still getting the same error

failed to send tx, err: rpc response error: { "code": -32002, "message": "Transaction simulation failed: Error processing Instruction 2: custom program error: 0x39", "data": { "accounts": null, "err": { "InstructionError": [ 2, { "Custom": 57 } ] }, "logs": [ "Program 11111111111111111111111111111111 invoke [1]", "Program 11111111111111111111111111111111 success", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb invoke [1]", "Program log: Instruction: InitializeMint", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb consumed 2923 of 1400000 compute units", "Program GxhenTpDpvFWdVkiaoCd3W1RMpCVzswe9mLnRexMNUbb success", "Program AyUX9DuAZVro5MWCW7S1jSv5zioAiMGxu9ZNHaah2vzE invoke [1]", "Program log: Instruction: Create Metadata Accounts", "Program log: Incorrect account owner", "Program AyUX9DuAZVro5MWCW7S1jSv5zioAiMGxu9ZNHaah2vzE consumed 4014 of 1397077 compute units", "Program AyUX9DuAZVro5MWCW7S1jSv5zioAiMGxu9ZNHaah2vzE failed: custom program error: 0x39" ], "unitsConsumed": 2923 } }

yihau commented 2 years ago

as I said, you will need to modify origin program to suit your current situation. The program don't expect you use your own own program.

https://github.com/metaplex-foundation/metaplex-program-library/blob/master/token-metadata/program/src/utils.rs#L864

Also, this error isn't related to this SDK.

rahulanand20 commented 2 years ago

After the modification we are getting this error :failed to send tx, err: rpc response error: { "code": -32002, "message": "Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0", "data": { "accounts": null, "err": { "InstructionError": [ 0, { "Custom": 0 } ] }, "logs": [ "Program 11111111111111111111111111111111 invoke [1]", "Create Account: account Address { address: AyUX9DuAZVro5MWCW7S1jSv5zioAiMGxu9ZNHaah2vzE, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0" ], "unitsConsumed": 0 } } exit status 1

yihau commented 2 years ago

I think you have already highlighted the error. Don't create an account twice. Also, I'm going to close this issue. Your issue isn't related to this SDK.