diff options
author | Florian Dold <florian@dold.me> | 2024-02-27 17:39:58 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-02-27 17:40:03 +0100 |
commit | 523280b3862b528512ff93c651bc0d9ed632fbf6 (patch) | |
tree | b99f866db59b572685c8c7215136270e22210ca2 /packages/taler-wallet-core/src/reward.ts | |
parent | 3a889c177dd35a114d2c95efd296274cd185ce52 (diff) | |
download | wallet-core-523280b3862b528512ff93c651bc0d9ed632fbf6.tar.gz wallet-core-523280b3862b528512ff93c651bc0d9ed632fbf6.tar.bz2 wallet-core-523280b3862b528512ff93c651bc0d9ed632fbf6.zip |
wallet-core: thread through wallet execution context
Diffstat (limited to 'packages/taler-wallet-core/src/reward.ts')
-rw-r--r-- | packages/taler-wallet-core/src/reward.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/taler-wallet-core/src/reward.ts b/packages/taler-wallet-core/src/reward.ts index 51eb0f5bd..b8cf41326 100644 --- a/packages/taler-wallet-core/src/reward.ts +++ b/packages/taler-wallet-core/src/reward.ts @@ -42,7 +42,7 @@ import { constructTransactionIdentifier, notifyTransition, } from "./transactions.js"; -import { InternalWalletState } from "./wallet.js"; +import { InternalWalletState, WalletExecutionContext } from "./wallet.js"; const logger = new Logger("operations/tip.ts"); @@ -51,7 +51,7 @@ export class RewardTransactionContext implements TransactionContext { public taskId: TaskIdStr; constructor( - public ws: InternalWalletState, + public wex: WalletExecutionContext, public walletRewardId: string, ) { this.transactionId = constructTransactionIdentifier({ @@ -65,8 +65,8 @@ export class RewardTransactionContext implements TransactionContext { } async deleteTransaction(): Promise<void> { - const { ws, walletRewardId } = this; - await ws.db.runReadWriteTx(["rewards", "tombstones"], async (tx) => { + const { wex, walletRewardId } = this; + await wex.db.runReadWriteTx(["rewards", "tombstones"], async (tx) => { const tipRecord = await tx.rewards.get(walletRewardId); if (tipRecord) { await tx.rewards.delete(walletRewardId); @@ -78,8 +78,8 @@ export class RewardTransactionContext implements TransactionContext { } async suspendTransaction(): Promise<void> { - const { ws, walletRewardId, transactionId, taskId: retryTag } = this; - const transitionInfo = await ws.db.runReadWriteTx( + const { wex, walletRewardId, transactionId, taskId } = this; + const transitionInfo = await wex.db.runReadWriteTx( ["rewards"], async (tx) => { const tipRec = await tx.rewards.get(walletRewardId); @@ -115,12 +115,12 @@ export class RewardTransactionContext implements TransactionContext { return undefined; }, ); - notifyTransition(ws, transactionId, transitionInfo); + notifyTransition(wex, transactionId, transitionInfo); } async abortTransaction(): Promise<void> { - const { ws, walletRewardId, transactionId, taskId: retryTag } = this; - const transitionInfo = await ws.db.runReadWriteTx( + const { wex, walletRewardId, transactionId } = this; + const transitionInfo = await wex.db.runReadWriteTx( ["rewards"], async (tx) => { const tipRec = await tx.rewards.get(walletRewardId); @@ -155,11 +155,11 @@ export class RewardTransactionContext implements TransactionContext { return undefined; }, ); - notifyTransition(ws, transactionId, transitionInfo); + notifyTransition(wex, transactionId, transitionInfo); } async resumeTransaction(): Promise<void> { - const { ws, walletRewardId, transactionId, taskId: retryTag } = this; + const { wex: ws, walletRewardId, transactionId, taskId: retryTag } = this; const transitionInfo = await ws.db.runReadWriteTx( ["rewards"], async (tx) => { @@ -199,7 +199,7 @@ export class RewardTransactionContext implements TransactionContext { } async failTransaction(): Promise<void> { - const { ws, walletRewardId, transactionId, taskId: retryTag } = this; + const { wex: ws, walletRewardId, transactionId, taskId: retryTag } = this; const transitionInfo = await ws.db.runReadWriteTx( ["rewards"], async (tx) => { |