From 01febf201caa80fa36abcf660d2682f041a98348 Mon Sep 17 00:00:00 2001 From: Riku Date: Tue, 18 Apr 2023 11:29:13 +0200 Subject: [PATCH] add comment usage get_order_book_changes --- .../py/trade-in-the-dex.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/_code-samples/trade-in-the-decentralized-exchange/py/trade-in-the-dex.py b/content/_code-samples/trade-in-the-decentralized-exchange/py/trade-in-the-dex.py index 9ad49c7008..e2fe0e06e2 100644 --- a/content/_code-samples/trade-in-the-decentralized-exchange/py/trade-in-the-dex.py +++ b/content/_code-samples/trade-in-the-decentralized-exchange/py/trade-in-the-dex.py @@ -186,6 +186,11 @@ async def main() -> int: balance_changes = get_balance_changes(result.result["meta"]) print(f"Balance Changes:\n{pprint.pformat(balance_changes)}") + # For educational purposes the transaction metadata is analyzed manually in the + # following section. However, there is also a get_order_book_changes(metadata) + # utility function available in the xrpl library, which is generally the easier + # and preferred choice for parsing the metadata and computing orderbook changes. + # Helper to convert an XRPL amount to a string for display def amt_str(amt) -> str: if isinstance(amt, str):