summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/balance.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/balance.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/balance.ts18
1 files changed, 3 insertions, 15 deletions
diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts
index 28aa5ac70..a20ded2af 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -133,11 +133,7 @@ export async function getBalancesInsideTransaction(
const b = initBalance(ca.currency);
const count = ca.visibleCoinCount ?? 0;
for (let i = 0; i < count; i++) {
- b.available = Amounts.add(b.available, {
- currency: ca.currency,
- fraction: ca.amountFrac,
- value: ca.amountVal,
- }).amount;
+ b.available = Amounts.add(b.available, ca.value).amount;
}
});
@@ -408,11 +404,7 @@ export async function getMerchantPaymentBalanceDetails(
if (ca.currency != req.currency) {
return;
}
- const singleCoinAmount: AmountJson = {
- currency: ca.currency,
- fraction: ca.amountFrac,
- value: ca.amountVal,
- };
+ const singleCoinAmount: AmountJson = Amounts.parseOrThrow(ca.value);
const coinAmount: AmountJson = Amounts.mult(
singleCoinAmount,
ca.freshCoinCount,
@@ -530,11 +522,7 @@ export async function getPeerPaymentBalanceDetailsInTx(
) {
return;
}
- const singleCoinAmount: AmountJson = {
- currency: ca.currency,
- fraction: ca.amountFrac,
- value: ca.amountVal,
- };
+ const singleCoinAmount: AmountJson = Amounts.parseOrThrow(ca.value);
const coinAmount: AmountJson = Amounts.mult(
singleCoinAmount,
ca.freshCoinCount,