summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/dev-experiments.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-23 03:09:40 +0200
committerFlorian Dold <florian@dold.me>2024-04-23 03:09:40 +0200
commit1edc144b3595ae1ab6b8af7a43d26b811b2c2623 (patch)
treedb552f6b4a351eb1d0dae902f4d504031852bda7 /packages/taler-wallet-core/src/dev-experiments.ts
parent4b69853c347071acb73efcde9d4969cf06d0dfcc (diff)
downloadwallet-core-1edc144b3595ae1ab6b8af7a43d26b811b2c2623.tar.gz
wallet-core-1edc144b3595ae1ab6b8af7a43d26b811b2c2623.tar.bz2
wallet-core-1edc144b3595ae1ab6b8af7a43d26b811b2c2623.zip
wallet-core: pass options object to all transactions
Diffstat (limited to 'packages/taler-wallet-core/src/dev-experiments.ts')
-rw-r--r--packages/taler-wallet-core/src/dev-experiments.ts74
1 files changed, 40 insertions, 34 deletions
diff --git a/packages/taler-wallet-core/src/dev-experiments.ts b/packages/taler-wallet-core/src/dev-experiments.ts
index db2ff5d06..5cb9400be 100644
--- a/packages/taler-wallet-core/src/dev-experiments.ts
+++ b/packages/taler-wallet-core/src/dev-experiments.ts
@@ -79,23 +79,26 @@ export async function applyDevExperiment(
}
case "insert-pending-refresh": {
const refreshGroupId = encodeCrock(getRandomBytes(32));
- await wex.db.runReadWriteTx(["refreshGroups"], async (tx) => {
- const newRg: RefreshGroupRecord = {
- currency: "TESTKUDOS",
- expectedOutputPerCoin: [],
- inputPerCoin: [],
- oldCoinPubs: [],
- operationStatus: RefreshOperationStatus.Pending,
- reason: RefreshReason.Manual,
- refreshGroupId,
- statusPerCoin: [],
- timestampCreated: timestampPreciseToDb(TalerPreciseTimestamp.now()),
- timestampFinished: undefined,
- originatingTransactionId: undefined,
- infoPerExchange: {},
- };
- await tx.refreshGroups.put(newRg);
- });
+ await wex.db.runReadWriteTx(
+ { storeNames: ["refreshGroups"] },
+ async (tx) => {
+ const newRg: RefreshGroupRecord = {
+ currency: "TESTKUDOS",
+ expectedOutputPerCoin: [],
+ inputPerCoin: [],
+ oldCoinPubs: [],
+ operationStatus: RefreshOperationStatus.Pending,
+ reason: RefreshReason.Manual,
+ refreshGroupId,
+ statusPerCoin: [],
+ timestampCreated: timestampPreciseToDb(TalerPreciseTimestamp.now()),
+ timestampFinished: undefined,
+ originatingTransactionId: undefined,
+ infoPerExchange: {},
+ };
+ await tx.refreshGroups.put(newRg);
+ },
+ );
wex.taskScheduler.startShepherdTask(
constructTaskIdentifier({
tag: PendingTaskType.Refresh,
@@ -105,23 +108,26 @@ export async function applyDevExperiment(
return;
}
case "insert-denom-loss": {
- await wex.db.runReadWriteTx(["denomLossEvents"], async (tx) => {
- const eventId = encodeCrock(getRandomBytes(32));
- const newRg: DenomLossEventRecord = {
- amount: "TESTKUDOS:42",
- currency: "TESTKUDOS",
- exchangeBaseUrl: "https://exchange.test.taler.net/",
- denomLossEventId: eventId,
- denomPubHashes: [
- encodeCrock(getRandomBytes(64)),
- encodeCrock(getRandomBytes(64)),
- ],
- eventType: DenomLossEventType.DenomExpired,
- status: DenomLossStatus.Done,
- timestampCreated: timestampPreciseToDb(TalerPreciseTimestamp.now()),
- };
- await tx.denomLossEvents.put(newRg);
- });
+ await wex.db.runReadWriteTx(
+ { storeNames: ["denomLossEvents"] },
+ async (tx) => {
+ const eventId = encodeCrock(getRandomBytes(32));
+ const newRg: DenomLossEventRecord = {
+ amount: "TESTKUDOS:42",
+ currency: "TESTKUDOS",
+ exchangeBaseUrl: "https://exchange.test.taler.net/",
+ denomLossEventId: eventId,
+ denomPubHashes: [
+ encodeCrock(getRandomBytes(64)),
+ encodeCrock(getRandomBytes(64)),
+ ],
+ eventType: DenomLossEventType.DenomExpired,
+ status: DenomLossStatus.Done,
+ timestampCreated: timestampPreciseToDb(TalerPreciseTimestamp.now()),
+ };
+ await tx.denomLossEvents.put(newRg);
+ },
+ );
return;
}
}