Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssociatedTokenAccountsExample and SimpleMintToExample fail #222

Closed
mariomatic opened this issue Oct 4, 2021 · 5 comments · Fixed by #226
Closed

AssociatedTokenAccountsExample and SimpleMintToExample fail #222

mariomatic opened this issue Oct 4, 2021 · 5 comments · Fixed by #226
Assignees
Labels
bug Something isn't working

Comments

@mariomatic
Copy link

Describe the bug
Example 0 (AssociatedTokenAccountsExample) ,
example 19 ( SimpleMintToExample )
fail.

To Reproduce
dotnet run in Solnet.Examples dir.

Example 0:


0
11:13:19 info: Solnet.Rpc.IRpcClient[0]
      Sending request: {"method":"getRecentBlockhash","jsonrpc":"2.0","id":0}
11:13:20 info: Solnet.Rpc.IRpcClient[0]
      Result: {"jsonrpc":"2.0","result":{"context":{"slot":96731006},"value":{"blockhash":"BGDgAAFnAELbBgsuxkWQzsoT8JptokRS6Y65uN1GPpAd","feeCalculator":{"lamportsPerSignature":5000}}},"id":0}

11:13:20 info: Solnet.Rpc.IRpcClient[1]
      Sending request: {"method":"getMinimumBalanceForRentExemption","params":[165],"jsonrpc":"2.0","id":1}
11:13:20 info: Solnet.Rpc.IRpcClient[1]
      Result: {"jsonrpc":"2.0","result":2039280,"id":1}

11:13:20 info: Solnet.Rpc.IRpcClient[2]
      Sending request: {"method":"getMinimumBalanceForRentExemption","params":[82],"jsonrpc":"2.0","id":2}
11:13:20 info: Solnet.Rpc.IRpcClient[2]
      Result: {"jsonrpc":"2.0","result":1461600,"id":2}

MinBalanceForRentExemption Account >> 2039280
MinBalanceForRentExemption Mint Account >> 1461600
OwnerAccount: 5omQJtDUHA3gMFdHEQg1zZSvcBUVzey5WaKWYRmqF1Vj
MintAccount: 4NtWFCwJDebDw16pEPh9JJo9XkuufK1tvY8A2MmkrsRP
InitialAccount: DEy4VaFFqTn6MweESovsbA5mUDMD2a99qnT8YMKSrCF3
Tx Data: A1A1g/Zcb74/x3gMyA/Rp0g37sr8Eu4Fz0L5QGG9s7ZzKYlIDKQCus30IbW73ytzADWon3/Yar2y3mpoyGHdIAkVUCjSCK6GNCLzJki41Hk9Kvu6h3AWBkGWHMbzjAjSL6UvPa7V3xchJeUhjyGb5JwmxTkBNKjDnAdkCHy2Mb0Buh+nnz/M0qyU7dPbmF2Wq8wHvZSYOTu5BMFJXarLDMaTktMlOoew61I4eGHE+djf8qx4Cb+7MO8grpTLlay8CwMABAdHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsjIufmhfmLYafkn+wYT8PjILCx/u5irGAZdwhnT3wTvmteAuXjC0v3fJPxNHqt3mRa6rMw2hPrVTwJFnI5jNIrIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAan1RcZLFxRIYzJTD1K8X9Y2u4Im6H9ROPb2YoAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkFSlNQ+F3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oJh66cjv60opIPaQrhHa+oaf14qabsSo/oZmm9HJS65qBgMCAAE0AAAAAGBNFgAAAAAAUgAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUCAQRDAAJHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgFHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgMCAAI0AAAAAPAdHwAAAAAApQAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUEAgEABAEBBQMBAgAJB0BCDwAAAAAABgECEkhlbGxvIGZyb20gU29sLk5ldA==
11:13:20 info: Solnet.Rpc.IRpcClient[0]
      Sending request: {"method":"simulateTransaction","params":["A1A1g/Zcb74/x3gMyA/Rp0g37sr8Eu4Fz0L5QGG9s7ZzKYlIDKQCus30IbW73ytzADWon3/Yar2y3mpoyGHdIAkVUCjSCK6GNCLzJki41Hk9Kvu6h3AWBkGWHMbzjAjSL6UvPa7V3xchJeUhjyGb5JwmxTkBNKjDnAdkCHy2Mb0Buh\u002Bnnz/M0qyU7dPbmF2Wq8wHvZSYOTu5BMFJXarLDMaTktMlOoew61I4eGHE\u002Bdjf8qx4Cb\u002B7MO8grpTLlay8CwMABAdHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsjIufmhfmLYafkn\u002BwYT8PjILCx/u5irGAZdwhnT3wTvmteAuXjC0v3fJPxNHqt3mRa6rMw2hPrVTwJFnI5jNIrIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAan1RcZLFxRIYzJTD1K8X9Y2u4Im6H9ROPb2YoAAAAABt324ddloZPZy\u002BFGzut5rBy0he1fWzeROoz1hX7/AKkFSlNQ\u002BF3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oJh66cjv60opIPaQrhHa\u002Boaf14qabsSo/oZmm9HJS65qBgMCAAE0AAAAAGBNFgAAAAAAUgAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUCAQRDAAJHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgFHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgMCAAI0AAAAAPAdHwAAAAAApQAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUEAgEABAEBBQMBAgAJB0BCDwAAAAAABgECEkhlbGxvIGZyb20gU29sLk5ldA==",{"encoding":"base64"}],"jsonrpc":"2.0","id":0}
11:13:20 info: Solnet.Rpc.IRpcClient[0]
      Result: {"jsonrpc":"2.0","result":{"context":{"slot":96731008},"value":{"accounts":null,"err":{"InstructionError":[0,{"Custom":0}]},"logs":["Program 11111111111111111111111111111111 invoke [1]","Create Account: account Address { address: 4NtWFCwJDebDw16pEPh9JJo9XkuufK1tvY8A2MmkrsRP, base: None } already in use","Program 11111111111111111111111111111111 failed: custom program error: 0x0"]}},"id":0}

Transaction Simulation:
        Error: Solnet.Rpc.Models.TransactionError
        Logs:
                Program 11111111111111111111111111111111 invoke [1]
                Create Account: account Address { address: 4NtWFCwJDebDw16pEPh9JJo9XkuufK1tvY8A2MmkrsRP, base: None } already in use
                Program 11111111111111111111111111111111 failed: custom program error: 0x0

11:13:20 info: Solnet.Rpc.IRpcClient[1]
      Sending request: {"method":"sendTransaction","params":["A1A1g/Zcb74/x3gMyA/Rp0g37sr8Eu4Fz0L5QGG9s7ZzKYlIDKQCus30IbW73ytzADWon3/Yar2y3mpoyGHdIAkVUCjSCK6GNCLzJki41Hk9Kvu6h3AWBkGWHMbzjAjSL6UvPa7V3xchJeUhjyGb5JwmxTkBNKjDnAdkCHy2Mb0Buh\u002Bnnz/M0qyU7dPbmF2Wq8wHvZSYOTu5BMFJXarLDMaTktMlOoew61I4eGHE\u002Bdjf8qx4Cb\u002B7MO8grpTLlay8CwMABAdHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsjIufmhfmLYafkn\u002BwYT8PjILCx/u5irGAZdwhnT3wTvmteAuXjC0v3fJPxNHqt3mRa6rMw2hPrVTwJFnI5jNIrIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAan1RcZLFxRIYzJTD1K8X9Y2u4Im6H9ROPb2YoAAAAABt324ddloZPZy\u002BFGzut5rBy0he1fWzeROoz1hX7/AKkFSlNQ\u002BF3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oJh66cjv60opIPaQrhHa\u002Boaf14qabsSo/oZmm9HJS65qBgMCAAE0AAAAAGBNFgAAAAAAUgAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUCAQRDAAJHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgFHaauXIEuoP7DK7hf3ho8eB05SFYGg2J2UN52qZbcXsgMCAAI0AAAAAPAdHwAAAAAApQAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQUEAgEABAEBBQMBAgAJB0BCDwAAAAAABgECEkhlbGxvIGZyb20gU29sLk5ldA==",{"encoding":"base64"}],"jsonrpc":"2.0","id":1}
11:13:20 info: Solnet.Rpc.IRpcClient[1]
      Result: {"jsonrpc":"2.0","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: 4NtWFCwJDebDw16pEPh9JJo9XkuufK1tvY8A2MmkrsRP, base: None } already in use","Program 11111111111111111111111111111111 failed: custom program error: 0x0"]}},"id":1}

Tx Signature: 
11:13:20 info: Solnet.Rpc.IRpcClient[2]
      Sending request: {"method":"getTransaction","params":[{"encoding":"json"}],"jsonrpc":"2.0","id":2}
11:13:20 info: Solnet.Rpc.IRpcClient[2]
      Result: {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params: invalid type: map, expected a string."},"id":2}

11:13:25 info: Solnet.Rpc.IRpcClient[3]
      Sending request: {"method":"getTransaction","params":[{"encoding":"json"}],"jsonrpc":"2.0","id":3}
11:13:25 info: Solnet.Rpc.IRpcClient[3]
      Result: {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params: invalid type: map, expected a string."},"id":3}

11:13:30 info: Solnet.Rpc.IRpcClient[4]
      Sending request: {"method":"getTransaction","params":[{"encoding":"json"}],"jsonrpc":"2.0","id":4}
11:13:30 info: Solnet.Rpc.IRpcClient[4]
      Result: {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params: invalid type: map, expected a string."},"id":4}

Example 19 :

19
11:15:54 info: Solnet.Rpc.IRpcClient[0]
      Sending request: {"method":"getRecentBlockhash","jsonrpc":"2.0","id":0}
11:15:54 info: Solnet.Rpc.IRpcClient[0]
      Result: {"jsonrpc":"2.0","result":{"context":{"slot":96731121},"value":{"blockhash":"7EXcmqbbmBjUsmTTjpay3dBJgbD87puTmMwpDF4axCUC","feeCalculator":{"lamportsPerSignature":5000}}},"id":0}

11:15:54 info: Solnet.Rpc.IRpcClient[1]
      Sending request: {"method":"getMinimumBalanceForRentExemption","params":[165],"jsonrpc":"2.0","id":1}
11:15:54 info: Solnet.Rpc.IRpcClient[1]
      Result: {"jsonrpc":"2.0","result":2039280,"id":1}

MinBalanceForRentExemption Account >> 2039280
11:15:54 info: Solnet.Rpc.IRpcClient[2]
      Sending request: {"method":"getMinimumBalanceForRentExemption","params":[82],"jsonrpc":"2.0","id":2}
11:15:54 info: Solnet.Rpc.IRpcClient[2]
      Result: {"jsonrpc":"2.0","result":1461600,"id":2}

MinBalanceForRentExemption Mint Account >> 1461600
MintAccount: J6WZY5nuYGJmfFtBGZaXgwZSRVuLWxNR6gd4d3XTHqTk
OwnerAccount: 5omQJtDUHA3gMFdHEQg1zZSvcBUVzey5WaKWYRmqF1Vj
InitialAccount: Gg12mmahG97PDACxKiBta7ch2kkqDkXUzjn5oAcbPZct
Tx: AX/wXS8qmY9nAh2SOf+U1O9DHlNTI2rWoDS6Y7MNvbKKVaoFewGZ9d26PpVwarDB51wqVr3+qRmqlPwhvgMPlQwCAQIFR2mrlyBLqD+wyu4X94aPHgdOUhWBoNidlDedqmW3F7Lo3P1wGEk66aVctmlS8TwDMC0F8YyfV1lCeyay0HFuUf4AAajK+Dt7AHzpNyQpMLfMDxb3r2T1UUbVQedlcfEvBt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkFSlNQ+F3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oFydSmM0EnRaGqLb7UoYMJpCM8PuJVBJx7eCRf6TvzW9AgMDAgEACQdAeH0BAAAAAAQBARJIZWxsbyBmcm9tIFNvbC5OZXQ=
11:15:54 info: Solnet.Rpc.IRpcClient[3]
      Sending request: {"method":"simulateTransaction","params":["AX/wXS8qmY9nAh2SOf\u002BU1O9DHlNTI2rWoDS6Y7MNvbKKVaoFewGZ9d26PpVwarDB51wqVr3\u002BqRmqlPwhvgMPlQwCAQIFR2mrlyBLqD\u002Bwyu4X94aPHgdOUhWBoNidlDedqmW3F7Lo3P1wGEk66aVctmlS8TwDMC0F8YyfV1lCeyay0HFuUf4AAajK\u002BDt7AHzpNyQpMLfMDxb3r2T1UUbVQedlcfEvBt324ddloZPZy\u002BFGzut5rBy0he1fWzeROoz1hX7/AKkFSlNQ\u002BF3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oFydSmM0EnRaGqLb7UoYMJpCM8PuJVBJx7eCRf6TvzW9AgMDAgEACQdAeH0BAAAAAAQBARJIZWxsbyBmcm9tIFNvbC5OZXQ=",{"encoding":"base64"}],"jsonrpc":"2.0","id":3}
11:15:54 info: Solnet.Rpc.IRpcClient[3]
      Result: {"jsonrpc":"2.0","error":{"code":-32602,"message":"invalid transaction: index out of bounds"},"id":3}

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Solnet.Examples.SimpleMintToExample.Run() in D:\play\Solnet\src\Solnet.Examples\TransactionBuilderExample.cs:line 159
   at Solnet.Examples.ExampleExplorer.Main(String[] args) in D:\play\Solnet\src\Solnet.Examples\ExampleExplorer.cs:line 32
@mariomatic mariomatic added the bug Something isn't working label Oct 4, 2021
@mariomatic mariomatic changed the title [Bug] AssociatedTokenAccountsExample and SimpleMintToExample fail AssociatedTokenAccountsExample and SimpleMintToExample fail Oct 4, 2021
@hoakbuilds
Copy link
Member

In the first example the address is already in use, the owner already has an ATA for that specific mint, all you need to do is use a different owner address and it should be ok.

Would have to do a bit more digging to figure out what's going on in the second one but odds are it has to do with signatures.

@hoakbuilds
Copy link
Member

In the second example, add initialAccount to the list of signers after the owner or change the account that is passed into MemoProgram to the owner. This is because the way I implemented the first version of the Memo Program it requires the account to be a signer.

@mariomatic
Copy link
Author

Can cofirm. Adding initalAccount as a signer fixes the example.

@hoakbuilds
Copy link
Member

Good! Closing this then.

@hoakbuilds hoakbuilds reopened this Oct 7, 2021
@hoakbuilds
Copy link
Member

Reopened so a quick patch can be done to the SimpleMintTo example in reference to this because more people keep asking the same.

Should also add more info to the docs regarding the examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants