4

I need to get the transaction records. This information seems to be in XDR. How can I parse it in Java?

1

If you have the Transaction XDR encoded as a base64 string, you can use Transaction.fromEnvelopeXdr(string) to get a Transaction object back.

  • Yes, this works as of 0.3.0 (released late 2018). – Johnny May 7 at 18:47
0

To get the last transactions you can make a request to an Horizon server, if you don't have one you can use public horizon server (horizon.stellar.org) but its limited.

For query transactions you have to call transactions endpoint HERE AN EXAMPLE as you can see there are also human readble informations isn't necessary translating from XDR.

Here the infos that you can receive from transactions' endpoint

  • Transaction's ID/Hash
  • Paging_token
  • Ledger count
  • created_at (datetime of transaction)
  • source_account
  • source_account_sequence (sequence number of source account's transaction)
  • fee_paid (in stroops)
  • operation_count
  • memo_type
  • memo (content of memo field)
0

I have just written a patch for the Java SDK to deserialize TransactionEnvelope XDR.

https://github.com/stellar/java-stellar-sdk/pull/117

If you can wait, hopefully it will be approved and merged. After which you can simply call Transaction.fromEnvelopeXdrBase64(base64String).

If you can't wait, you can copy the code in that PR directly to your project. Specifically, this method and the methods it calls.

0

The XDR classes in the sdk are generated using xdrgen from the xdr idl files in stellar core. So if you want to parse XDR either use the stubs in the sdk or generate them yourself using that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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