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!