XDR

XDR, also known as External Data Representation, is used throughout the Stellar network and protocol. The ledger, transactions, results, history, and even the messages passed between computers running stellar-core are encoded using XDR.

stellar_sdk.xdr module provides a complete ability to build and parse XDR.

This example shows how to parse XDR string into an XDR object.

 1"""
 2This example shows how to parse XDR string into an XDR object.
 3But please note that if you need to parse a transaction envelope,
 4please refer to `parse_transaction_envelope.py`
 5"""
 6from stellar_sdk.xdr import TransactionResult
 7
 8result_xdr = "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAAAAAABAAAAAD/jlpBCTX53ogvts02Ryn5GjO6gx0qW3/3ARB+gOh/nAAAAADGRC/wAAAAAAAAAAU5VQwAAAAAAR74W04RzO2ryJo94Oi0FUs0KHIVQisRnpe9FWrqvumQAAAAAAEFWjwjgcksQkG4uAAAAAAAAAAAAAAAA"
 9transaction_result = TransactionResult.from_xdr(result_xdr)
10print(transaction_result.fee_charged)
11print(transaction_result.result.code)