From b1ccfcb61224adc3324b6b8d81af0e11714ffe54 Mon Sep 17 00:00:00 2001 From: AlanDXiang Date: Mon, 5 Jan 2026 19:40:47 +0800 Subject: [PATCH] Calculates the sum of Lovelace across all retrieved UTXOs and outputs the aggregated total balance (in ADA) at the end of the script execution. --- examples/more_examples/02_query_address.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/more_examples/02_query_address.py b/examples/more_examples/02_query_address.py index df82f6d2..012cd49f 100644 --- a/examples/more_examples/02_query_address.py +++ b/examples/more_examples/02_query_address.py @@ -65,3 +65,6 @@ print( f"{utxo.tx_hash}#{utxo.tx_index} \t {int(utxo.amount[0].quantity)/1000000} ADA [{tokens}]" ) + +total_lovelace = sum(int(utxo.amount[0].quantity) for utxo in utxos) +print(f"Total Balance: {total_lovelace / 1000000} ADA")