summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-27 19:21:53 +0100
committerFlorian Dold <florian@dold.me>2024-03-27 19:21:53 +0100
commitbe0f21389bb2c206344ed9c4f78c72ae84d5548d (patch)
tree0cfd3e03657d67bc50892afd46f89753d0ad853e /packages
parent3a1a56704da4d77a2bbedd70a7fe4d26b00165fb (diff)
downloadwallet-core-be0f21389bb2c206344ed9c4f78c72ae84d5548d.tar.gz
wallet-core-be0f21389bb2c206344ed9c4f78c72ae84d5548d.tar.bz2
wallet-core-be0f21389bb2c206344ed9c4f78c72ae84d5548d.zip
wallet-core: empty balance item for exchanges that are used or have accepted ToS
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/balance.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/balance.ts b/packages/taler-wallet-core/src/balance.ts
index 5e3562ba2..50996b8de 100644
--- a/packages/taler-wallet-core/src/balance.ts
+++ b/packages/taler-wallet-core/src/balance.ts
@@ -67,6 +67,7 @@ import {
import { ExchangeRestrictionSpec, findMatchingWire } from "./coinSelection.js";
import {
DepositOperationStatus,
+ ExchangeEntryDbRecordStatus,
OPERATION_STATUS_ACTIVE_FIRST,
OPERATION_STATUS_ACTIVE_LAST,
RefreshGroupRecord,
@@ -304,6 +305,18 @@ export async function getBalancesInsideTransaction(
OPERATION_STATUS_ACTIVE_LAST,
);
+ await tx.exchanges.iter().forEachAsync(async (ex) => {
+ if (
+ ex.entryStatus === ExchangeEntryDbRecordStatus.Used ||
+ ex.tosAcceptedTimestamp != null
+ ) {
+ const det = await getExchangeWireDetailsInTx(tx, ex.baseUrl);
+ if (det) {
+ await balanceStore.addZero(det.currency, ex.baseUrl);
+ }
+ }
+ });
+
await tx.coinAvailability.iter().forEachAsync(async (ca) => {
const count = ca.visibleCoinCount ?? 0;
await balanceStore.addZero(ca.currency, ca.exchangeBaseUrl);