aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/deposits.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/deposits.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 406d658af..1cb051365 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -268,7 +268,7 @@ export async function getFeeForDeposit(
prevPayCoins: [],
});
- if (!payCoinSel) {
+ if (payCoinSel.type !== "success") {
throw Error("insufficient funds");
}
@@ -276,7 +276,7 @@ export async function getFeeForDeposit(
ws,
p.targetType,
amount,
- payCoinSel,
+ payCoinSel.coinSel,
);
}
@@ -355,16 +355,16 @@ export async function prepareDepositGroup(
prevPayCoins: [],
});
- if (!payCoinSel) {
+ if (payCoinSel.type !== "success") {
throw Error("insufficient funds");
}
- const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel);
+ const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel.coinSel);
const effectiveDepositAmount = await getEffectiveDepositAmount(
ws,
p.targetType,
- payCoinSel,
+ payCoinSel.coinSel,
);
return {
@@ -452,18 +452,18 @@ export async function createDepositGroup(
prevPayCoins: [],
});
- if (!payCoinSel) {
+ if (payCoinSel.type !== "success") {
throw Error("insufficient funds");
}
- const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel);
+ const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel.coinSel);
const depositGroupId = encodeCrock(getRandomBytes(32));
const effectiveDepositAmount = await getEffectiveDepositAmount(
ws,
p.targetType,
- payCoinSel,
+ payCoinSel.coinSel,
);
const depositGroup: DepositGroupRecord = {
@@ -474,9 +474,9 @@ export async function createDepositGroup(
noncePub: noncePair.pub,
timestampCreated: AbsoluteTime.toTimestamp(now),
timestampFinished: undefined,
- payCoinSelection: payCoinSel,
+ payCoinSelection: payCoinSel.coinSel,
payCoinSelectionUid: encodeCrock(getRandomBytes(32)),
- depositedPerCoin: payCoinSel.coinPubs.map(() => false),
+ depositedPerCoin: payCoinSel.coinSel.coinPubs.map(() => false),
merchantPriv: merchantPair.priv,
merchantPub: merchantPair.pub,
totalPayCost: Amounts.stringify(totalDepositCost),
@@ -500,8 +500,8 @@ export async function createDepositGroup(
.runReadWrite(async (tx) => {
await spendCoins(ws, tx, {
allocationId: `txn:deposit:${depositGroup.depositGroupId}`,
- coinPubs: payCoinSel.coinPubs,
- contributions: payCoinSel.coinContributions.map((x) =>
+ coinPubs: payCoinSel.coinSel.coinPubs,
+ contributions: payCoinSel.coinSel.coinContributions.map((x) =>
Amounts.parseOrThrow(x),
),
refreshReason: RefreshReason.PayDeposit,