summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/tip.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2020-12-16 17:59:04 +0100
committerFlorian Dold <florian@dold.me>2020-12-16 17:59:04 +0100
commitbafb52edff4d56bcb9e3c3d0a260f507c517b08c (patch)
tree09b484a8cedc9893f5ea7593a98fadde075eafa3 /packages/taler-wallet-core/src/operations/tip.ts
parentc09c5bbe625566fc61c811160d2ccdab263327fa (diff)
downloadwallet-core-bafb52edff4d56bcb9e3c3d0a260f507c517b08c.tar.gz
wallet-core-bafb52edff4d56bcb9e3c3d0a260f507c517b08c.tar.bz2
wallet-core-bafb52edff4d56bcb9e3c3d0a260f507c517b08c.zip
don't store reserve history anymore, adjust withdrawal implementation accordingly
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,
});
}