Balance Views Grouped By Keyset (#652)

* balance view per keyset + relative changes.
    Still lacking: settings changes

* import unit

* fix 0 balance

* settings

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
lollerfirst
2025-02-17 12:55:28 +01:00
committed by GitHub
parent 23a706d873
commit 0c40bbbc08
4 changed files with 66 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ from typing import List
import pytest
from cashu.core.base import BlindedMessage, Proof
from cashu.core.base import BlindedMessage, MintKeyset, Proof, Unit
from cashu.core.crypto.b_dhke import step1_alice
from cashu.core.helpers import calculate_number_of_blank_outputs
from cashu.core.models import PostMintQuoteRequest
@@ -218,7 +218,11 @@ async def test_generate_change_promises_returns_empty_if_no_outputs(ledger: Ledg
@pytest.mark.asyncio
async def test_get_balance(ledger: Ledger):
balance = await ledger.get_balance()
unit = Unit["sat"]
active_keyset: MintKeyset = next(
filter(lambda k: k.active and k.unit == unit, ledger.keysets.values())
)
balance = await ledger.get_balance(active_keyset)
assert balance == 0