
{# 
    total_wallet_balances - Title showing the wallet total balance + amount confirmed and unconfirmed (if there is any unconfirmed amount).

    total_wallet_balances(
            _("Some title"),
            amount_total, 
            amount_confirmed,
            amount_unconfirmed, 
            amount_immature, 
            balance,            # needs to be passed for liquid
            rescan_progress,    # Possible values: True, False, 0..1.    Disable: False or 0,  Enable otherwise.
            wallet_alias,       # wallet_alias to check the rescan_progress.   
                                # If the wallet alias exists it shows specter.info["utxorescan"], otherwise rescan_progress is used
            specter) 

    Calling example for a single wallet:
        total_wallet_balances("", wallet.amount_total, wallet.amount_confirmed,  wallet.amount_unconfirmed, wallet.amount_immature, wallet.balance, wallet.rescan_progress, wallet.alias, specter)
 #}
{% macro total_wallet_balances(title, amount_total, amount_confirmed, amount_unconfirmed, amount_immature, balance, rescan_progress, alias, specter) -%}
    <div>
        <div>            
            {% if title %}
                <!-- <div data-style="text-align: center; width:100%; line-height:30px; font-size: 1.2em;">{{ title }}</div> -->
            {% endif %}
            <table>
                <tr>
                    <td>Total amount:</td>
                    <td id="fullbalance_amount" class="right-align">{{ amount_total | btcunitamount_fixed_decimals | safe }}</td>
                    <td>
                        {% if specter.unit == 'sat' %}
                            sats
                        {% else %}
                            {% if specter.is_testnet %}t{%endif%}{% if specter.is_liquid %}L{%endif%}BTC
                        {% endif %}
                        {% if specter.price_check %} 
                            <td class="right-align">
                                <span class="note">({{ amount_total | altunit }})</span>
                            </td> 
                        {% endif %}
                    </td> 
                </tr>                             
                {% if amount_unconfirmed > 0 or amount_immature > 0 %}
                    <tr>
                        <td>Confirmed:</td>
                        <td id="confirmed_amount" class="right-align">{{ amount_confirmed | btcunitamount_fixed_decimals | safe }}</td>
                        <td>
                            {% if specter.unit == 'sat' %}
                                sats
                            {% else %}
                                {% if specter.is_testnet %}t{%endif%}{% if specter.is_liquid %}L{%endif%}BTC
                            {% endif %}
                            {% if specter.price_check %} 
                                <td class="right-align">
                                    <span class="note">({{ amount_confirmed | altunit }})</span>
                                </td> 
                            {% endif %}
                        </td>
                    </tr>                             
                    {% if amount_unconfirmed > 0 %}
                    <tr>
                        <td>Unconfirmed:</td>
                        <td id="unconfirmed_amount" class="right-align">{{ amount_unconfirmed | btcunitamount_fixed_decimals | safe }}</td>
                        <td>
                            {% if specter.unit == 'sat' %}
                                sats
                            {% else %}
                                {% if specter.is_testnet %}t{%endif%}{% if specter.is_liquid %}L{%endif%}BTC
                            {% endif %}
                            {% if specter.price_check %} 
                                <td class="right-align">
                                    <span class="note">({{ amount_unconfirmed | altunit }})</span>
                                </td> 
                            {% endif %}
                        </td>
                    </tr>                             
                    {% endif %}
                {% endif %}
                {% if amount_immature > 0  %}
                <tr>
                    <td data-style="display: flex;">
                        <span>Immature:</span>
                        <!-- <tool-tip width="200px"> -->
                        <!--     <h4 slot="title">{{ _("What are immature outputs?") }}</h4> -->
                        <!--     <span slot="paragraph"> -->
                        <!--     {{ _('The UTXO of coinbase transactions (mining rewards) have the special condition that they cannot be spent for at least 100 blocks. Their amount is not included in the total balance here.') }} -->
                        <!--     {% if specter.chain == "regtest" %}{{ _('You see these outputs because you are using regtest and have mined blocks.')}}{% endif %} -->
                        <!--     </span> -->
                        <!-- </tool-tip> -->
                    <td class="right-align">{{ amount_immature | btcunitamount_fixed_decimals | safe }}</td>
                    </td>      
                    <td> 
                        {% if specter.unit == 'sat' %}
                            sats
                        {% else %}
                            {% if specter.is_testnet %}t{%endif%}{% if specter.is_liquid %}L{%endif%}BTC
                        {% endif %}
                        {% if specter.price_check %} 
                            <td class="right-align">
                                <span class="note">({{ amount_immature | altunit }})</span>
                            </td>
                        {% endif %}
                    </td>
                </tr>                             
                {% endif %}
                {% if specter.is_liquid %}
                    {% if balance.get("assets", {}) %}
                    <tr>                             
                        <td>Liquid Assets:</td>
                        <td colspan="2">
                            {% include 'includes/overlay/liquid_assets_registry.html' %}
                            <button type="button" class="btn" onclick="showPageOverlay('liquid-assets-registry')">{{ _("Show assets list") }}</button>
                        </td>
                    </tr>                             
                        {% for asset in balance.get("assets",{}).keys() | sort %}
                            <td></td>
                            {% set balance = balance.get("assets",{}).get(asset, {}) %}
                            <td class="right-align">
                                {{ (balance.get("trusted", 0) + balance.get("untrusted_pending", 0) + balance.get("immature", 0)) | btcunitamount_fixed_decimals | safe }}</td>
                            <td>
                                <asset-label data-asset="{{asset}}" data-label="{{asset | assetlabel}}" edit-mode="enabled"></asset-label>
                            </td>
                        {% endfor %}
                    {% endif %}
                {% endif %}
            </table>
        </div>
    </div>
    {% if rescan_progress or specter.utxorescanwallet == alias %}
        <div id="wallet_rescan_data" data-style="display: contents;">
            {% if rescan_progress %}
                <div class="flex p-4 mt-3 mb-4 bg-dark-600 rounded-lg" role="alert">
                  <svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
                  <span class="sr-only">Info</span>
                  <div>
                    <span class="font-medium">Rescanning blockchain: <span id="{{ alias }}_balances_wallet_rescan_percents">{{ rescan_progress * 100 }}</span>%</span>
                    Total balance and transactions history may show outdated data during scanning.<br>Please wait until the scanning is complete before you start using the wallet.
                  </div>
                </div>
            {% endif %}
            {% if specter.utxorescanwallet == alias %}
                <div class="flex p-4 mt-3 mb-4 bg-dark-600 rounded-lg" role="alert">
                  <svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
                  <span class="sr-only">Info</span>
                  <div>
                    <span class="font-medium">Scanning the UTXO set: <span id="{{ alias }}_balances_wallet_rescan_percents">{{ specter.info["utxorescan"] }}</span>%</span>
                    Total balance may show outdated data during scanning.<br>Please wait until the scanning is complete before you start using the wallet.
                  </div>
                </div>
            {% endif %}
        </div>
    {% endif %}
{%- endmacro %}
