aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/tip.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/tip.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index bc10e346d..f47f76623 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -32,8 +32,10 @@ import {
} from "../types/dbTypes";
import {
getExchangeWithdrawalInfo,
- selectWithdrawalDenoms,
denomSelectionInfoToState,
+ updateWithdrawalDenoms,
+ getPossibleWithdrawalDenoms,
+ selectWithdrawalDenominations,
} from "./withdraw";
import { updateExchangeFromUrl } from "./exchanges";
import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto";
@@ -92,12 +94,15 @@ export async function prepareTip(
);
const walletTipId = encodeCrock(getRandomBytes(32));
- const selectedDenoms = await selectWithdrawalDenoms(
- ws,
- tipPickupStatus.exchange_url,
+ await updateWithdrawalDenoms(ws, tipPickupStatus.exchange_url);
+ const denoms = await getPossibleWithdrawalDenoms(ws, tipPickupStatus.exchange_url);
+ const selectedDenoms = await selectWithdrawalDenominations(
amount,
+ denoms
);
+ const secretSeed = encodeCrock(getRandomBytes(64));
+
tipRecord = {
walletTipId: walletTipId,
acceptedTimestamp: undefined,
@@ -105,7 +110,6 @@ export async function prepareTip(
tipExpiration: tipPickupStatus.expiration,
exchangeBaseUrl: tipPickupStatus.exchange_url,
merchantBaseUrl: res.merchantBaseUrl,
- planchets: undefined,
createdTimestamp: getTimestampNow(),
merchantTipId: res.merchantTipId,
tipAmountEffective: Amounts.sub(
@@ -117,6 +121,7 @@ export async function prepareTip(
lastError: undefined,
denomsSel: denomSelectionInfoToState(selectedDenoms),
pickedUpTimestamp: undefined,
+ secretSeed,
};
await ws.db.put(Stores.tips, tipRecord);
}
@@ -316,6 +321,7 @@ async function processTipImpl(
exchangeBaseUrl: tipRecord.exchangeBaseUrl,
status: CoinStatus.Fresh,
suspended: false,
+ coinEvHash: planchet.coinEvHash,
});
}