aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-11-02 17:42:14 +0100
committerFlorian Dold <florian@dold.me>2022-11-02 18:23:17 +0100
commitd50294f76e0aa357d690a933bb6d696a2f6aef1b (patch)
treeabe961337c5df1614b5095bce6c5b09e761cda2c /packages/taler-wallet-core/src/operations/withdraw.ts
parent6c3ef31d9a7ba44829e779afed0af9be3ab23723 (diff)
downloadwallet-core-d50294f76e0aa357d690a933bb6d696a2f6aef1b.tar.xz
wallet-core: DB FIXMEs (amount format)
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index a9ecdf369..76bbec416 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -167,8 +167,8 @@ export function selectWithdrawalDenominations(
denomPubHash: string;
}[] = [];
- let totalCoinValue = Amounts.getZero(amountAvailable.currency);
- let totalWithdrawCost = Amounts.getZero(amountAvailable.currency);
+ let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency);
+ let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency);
denoms = denoms.filter(isWithdrawableDenom);
denoms.sort((d1, d2) =>
@@ -223,8 +223,8 @@ export function selectWithdrawalDenominations(
return {
selectedDenoms,
- totalCoinValue,
- totalWithdrawCost,
+ totalCoinValue: Amounts.stringify(totalCoinValue),
+ totalWithdrawCost: Amounts.stringify(totalCoinValue),
};
}
@@ -238,8 +238,8 @@ export function selectForcedWithdrawalDenominations(
denomPubHash: string;
}[] = [];
- let totalCoinValue = Amounts.getZero(amountAvailable.currency);
- let totalWithdrawCost = Amounts.getZero(amountAvailable.currency);
+ let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency);
+ let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency);
denoms = denoms.filter(isWithdrawableDenom);
denoms.sort((d1, d2) =>
@@ -279,8 +279,8 @@ export function selectForcedWithdrawalDenominations(
return {
selectedDenoms,
- totalCoinValue,
- totalWithdrawCost,
+ totalCoinValue: Amounts.stringify(totalCoinValue),
+ totalWithdrawCost: Amounts.stringify(totalWithdrawCost),
};
}
@@ -416,10 +416,10 @@ async function processPlanchetGenerate(
checkDbInvariant(!!denom);
const r = await ws.cryptoApi.createPlanchet({
denomPub: denom.denomPub,
- feeWithdraw: denom.feeWithdraw,
+ feeWithdraw: Amounts.parseOrThrow(denom.feeWithdraw),
reservePriv: withdrawalGroup.reservePriv,
reservePub: withdrawalGroup.reservePub,
- value: denom.value,
+ value: Amounts.parseOrThrow(denom.value),
coinIndex: coinIdx,
secretSeed: withdrawalGroup.secretSeed,
restrictAge: withdrawalGroup.restrictAge,
@@ -950,7 +950,7 @@ async function queryReserve(
return;
}
wg.status = WithdrawalGroupStatus.Ready;
- wg.reserveBalanceAmount = Amounts.parse(result.response.balance);
+ wg.reserveBalanceAmount = Amounts.stringify(result.response.balance);
await tx.withdrawalGroups.put(wg);
});
@@ -1427,7 +1427,7 @@ export async function getFundingPaytoUrisTx(
export function augmentPaytoUrisForWithdrawal(
plainPaytoUris: string[],
reservePub: string,
- instructedAmount: AmountJson,
+ instructedAmount: AmountLike,
): string[] {
return plainPaytoUris.map((x) =>
addPaytoQueryParams(x, {
@@ -1732,7 +1732,7 @@ export async function internalCreateWithdrawalGroup(
denomSelUid,
denomsSel: initialDenomSel,
exchangeBaseUrl: canonExchange,
- instructedAmount: amount,
+ instructedAmount: Amounts.stringify(amount),
timestampStart: now,
rawWithdrawalAmount: initialDenomSel.totalWithdrawCost,
effectiveWithdrawalAmount: initialDenomSel.totalCoinValue,