1

I am unable to find logs of failed solana program invocation (on devnet) when I invoke the program with Java solana client(this solanaj library). However, when I invoke the same program using @solana/web3.js - then I am able to find logs of failed program invocations on devnet.

For instance - this is a simple solana program that I wrote that simply returns error.

In the transaction history section of the onchain program, you can find failed results with logged error. However, when I invoke the same program with java client (this solanaj library), I don't see the failed result on the devnet explorer, however I do get a failed error response in the java program.

Web3 program invocation code is as follows:

let txid = await sendAndConfirmTransaction(connection, tx, signers, {
skipPreflight: true,
preflightCommitment: "confirmed",
commitment: "confirmed",
});

Java program invocation code is as follows:

final String transactionId = rpcClient.getApi().sendTransaction(transaction);

I suspect that this could be because web3 invokes sendAndConfirmTransaction where as java client invokes sendTransaction. There is no support in the java client to invoke sendAndConfirmTransaction. Another suspicion I have is on additional parameters namely skipPreflight, preflightCommitment, commitment that I can pass through web3 client but there is no such support in the java client library.

Any kind of help will be much appreciated!

1 Answer 1

2

Could be that the Java client is not skipping Preflight, aka. Transaction simulation, which means that if you have a transaction that automatically fails, the client won't even send the transaction.

1
  • I am writing a custom java client to vet this out now. I will update the thread. Thanks!
    – SnoopyMe
    Commented Jul 6, 2023 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.