I am new to stellar develop. Recently I got an issue when running some code that was fine before. The code is trying to get a transaction from a transaction response. Here is the code,

public Transaction getTransaction(TransactionResponse transactionResponse) 
   byte[] bytes = Base64.getDecoder().decode(transactionResponse.getEnvelopeXdr());
   TransactionEnvelope transactionEnvelope = TransactionEnvelope.decode(new XdrDataInputStream(new ByteArrayInputStream(bytes)));
   return transactionEnvelope.getTx();

This code runs fine before, but recently it always give errors "java.lang.RuntimeException: Unknown enum value: 2" at TransactionEnvelope.decode (the second line).

Does anyone know why? Is this the right way to get a transaction from a transactionResponse. I have tested the string from transactionResponse.getEnvelopeXdr() in Stellar lab, it can show the whole transaction envelope.


Thank you for help!

  • the code is using stellar sdk 0.6.0 and I see the latest version is 0.17.0, is that possible that this issue is due to version.
    – Ming Wu
    Jun 3, 2020 at 22:27
  • Thanks, Johan. I have contacted java stellar sdk github and I was told that it is due to the version. I have to use the latest version. However, I can not find any insruction on how to get a transaction from a transaction response using the latest version. Just wondering whether you have any idea on it or know where I can find the right documentation. Thanks
    – Ming Wu
    Jun 8, 2020 at 3:45


Your Answer

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

Browse other questions tagged or ask your own question.