I need to get the transaction records. This information seems to be in XDR. How can I parse it in Java?
If you have the Transaction XDR encoded as a base64 string, you can use
Transaction.fromEnvelopeXdr(string) to get a
Transaction object back.
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
- Ledger count
- created_at (datetime of transaction)
- source_account_sequence (sequence number of source account's transaction)
- fee_paid (in stroops)
- memo (content of memo field)
I have just written a patch for the Java SDK to deserialize TransactionEnvelope XDR.
If you can wait, hopefully it will be approved and merged. After which you can simply call
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.
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.