
{# 
    total_wallet_balances - Title showing the wallet total balance + amount confirmed and unconfirmed (if there is any unconfirmed amount).
    Parameters:
    - wallet: Wallet object
    - specter: Specter object
 #}
{% macro total_wallet_balances(wallet, specter) -%}
    <h1>
        <small style="line-height:30px">Total balance:</small><br>
        <span style="color: #fff">
            <span id="fullbalance_amount">{{ wallet.fullbalance | btcunitamount }}</span>
            {% if specter.unit == 'sat' %}
				sats
			{% else %}
				{% if specter.is_testnet %}t{%endif%}{% if specter.is_liquid %}L{%endif%}BTC
			{% endif %}
        </span><br>
        <span class="note">{{ wallet.fullbalance | altunit }}</span>
        {% if wallet.balance.get("untrusted_pending", 0) or wallet.balance.get("immature", 0) %}<br>
            <small>( {{ wallet.balance.get("trusted", 0) | btcunitamount }} confirmed,
                     {% if wallet.balance.get("untrusted_pending", 0) %}
                        {{ wallet.balance.get("untrusted_pending", 0) | btcunitamount }} pending
                     {% endif %}
                     {% if wallet.balance.get("immature", 0) %}
                        {{ wallet.balance.get("immature", 0) | btcunitamount }} immature
                     {% endif %}
            )</small>
        {% endif %}
        {% if specter.is_liquid %}
        {% if wallet.balance.get("assets", {}) %}
            <div style="margin-bottom: 15px;">
                <small style="line-height:30px">Assets:<br>
                {% for asset in wallet.balance.get("assets",{}).keys() | sort %}
                    {% set balance = wallet.balance.get("assets",{}).get(asset, {}) %}
                    <div style="margin: 0 10px; display: inline-block;">
                        {{ (balance.get("trusted", 0) + balance.get("untrusted_pending", 0) + balance.get("immature", 0)) | btcamount }}
                        <asset-label data-asset="{{asset}}" data-label="{{asset | assetlabel}}" edit-mode="enabled"></asset-label>
                    </div>
                {% endfor %}
                </small>
            </div>
        {% endif %}
        {% include 'includes/overlay/liquid_assets_registry.html' %}
        <small style="line-height: 30px;">
            <button type="button" class="btn" style="margin: auto;" onclick="showPageOverlay('liquid-assets-registry')">{{ _("Show assets list") }}</button>
        </small>
        <br>
        {% endif %}
    </h1>
    {% if wallet.rescan_progress or specter.utxorescanwallet == wallet.alias %}
        <span id="wallet_rescan_data" style="display: contents;">
            <h2>Rescanning blockchain: <span id="{{ wallet.alias }}_balances_wallet_rescan_percents">{{ "%.2f"|format(specter.info["utxorescan"] if specter.utxorescanwallet == wallet.alias else wallet.rescan_progress * 100) }}</span>%</h2>
            <span class="warning">
                <img src="{{ url_for('static', filename='img/info_sign.svg') }}" style="width: 20px;"/><br>
                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.
            </span>
        </span>
    {% endif %}
{%- endmacro %}
