aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/util/coinSelection.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/util/coinSelection.ts')
-rw-r--r--packages/taler-wallet-core/src/util/coinSelection.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts
index 176d636fc..3b986d72b 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -48,7 +48,11 @@ import {
AllowedExchangeInfo,
DenominationRecord,
} from "../db.js";
-import { getExchangeDetails, isWithdrawableDenom } from "../index.js";
+import {
+ getExchangeDetails,
+ isWithdrawableDenom,
+ WalletConfig,
+} from "../index.js";
import { InternalWalletState } from "../internal-wallet-state.js";
import { getMerchantPaymentBalanceDetails } from "../operations/balance.js";
import { checkDbInvariant, checkLogicInvariant } from "./invariants.js";
@@ -664,6 +668,7 @@ export async function selectCandidates(
export function selectWithdrawalDenominations(
amountAvailable: AmountJson,
denoms: DenominationRecord[],
+ denomselAllowLate: boolean = false,
): DenomSelectionState {
let remaining = Amounts.copy(amountAvailable);
@@ -675,7 +680,7 @@ export function selectWithdrawalDenominations(
let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency);
let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency);
- denoms = denoms.filter(isWithdrawableDenom);
+ denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate));
denoms.sort((d1, d2) =>
Amounts.cmp(
DenominationRecord.getValue(d2),
@@ -737,6 +742,7 @@ export function selectForcedWithdrawalDenominations(
amountAvailable: AmountJson,
denoms: DenominationRecord[],
forcedDenomSel: ForcedDenomSel,
+ denomselAllowLate: boolean,
): DenomSelectionState {
const selectedDenoms: {
count: number;
@@ -746,7 +752,7 @@ export function selectForcedWithdrawalDenominations(
let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency);
let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency);
- denoms = denoms.filter(isWithdrawableDenom);
+ denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate));
denoms.sort((d1, d2) =>
Amounts.cmp(
DenominationRecord.getValue(d2),