diff options
Diffstat (limited to 'packages/taler-wallet-core/src/shepherd.ts')
-rw-r--r-- | packages/taler-wallet-core/src/shepherd.ts | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts index ec0f6a76e..e3a0bd609 100644 --- a/packages/taler-wallet-core/src/shepherd.ts +++ b/packages/taler-wallet-core/src/shepherd.ts @@ -93,7 +93,7 @@ import { constructTransactionIdentifier, parseTransactionIdentifier, } from "./transactions.js"; -import { InternalWalletState } from "./wallet.js"; +import { InternalWalletState, WalletExecutionContext } from "./wallet.js"; import { computeWithdrawalTransactionStatus, processWithdrawalGroup, @@ -563,66 +563,41 @@ async function callOperationHandlerForTaskId( taskId: TaskIdStr, cancellationToken: CancellationToken, ): Promise<TaskRunResult> { + const wex: WalletExecutionContext = { + ws, + cancellationToken, + cryptoApi: ws.cryptoApi, + db: ws.db, + http: ws.http, + taskScheduler: ws.taskScheduler, + oc: { + observe(event) {}, + }, + }; const pending = parseTaskIdentifier(taskId); switch (pending.tag) { case PendingTaskType.ExchangeUpdate: - return await updateExchangeFromUrlHandler( - ws, - pending.exchangeBaseUrl, - cancellationToken, - ); + return await updateExchangeFromUrlHandler(wex, pending.exchangeBaseUrl); case PendingTaskType.Refresh: - return await processRefreshGroup( - ws, - pending.refreshGroupId, - cancellationToken, - ); + return await processRefreshGroup(wex, pending.refreshGroupId); case PendingTaskType.Withdraw: - return await processWithdrawalGroup( - ws, - pending.withdrawalGroupId, - cancellationToken, - ); + return await processWithdrawalGroup(wex, pending.withdrawalGroupId); case PendingTaskType.Purchase: - return await processPurchase(ws, pending.proposalId, cancellationToken); + return await processPurchase(wex, pending.proposalId); case PendingTaskType.Recoup: - return await processRecoupGroup( - ws, - pending.recoupGroupId, - cancellationToken, - ); + return await processRecoupGroup(wex, pending.recoupGroupId); case PendingTaskType.Deposit: - return await processDepositGroup( - ws, - pending.depositGroupId, - cancellationToken, - ); + return await processDepositGroup(wex, pending.depositGroupId); case PendingTaskType.Backup: - return await processBackupForProvider(ws, pending.backupProviderBaseUrl); + return await processBackupForProvider(wex, pending.backupProviderBaseUrl); case PendingTaskType.PeerPushDebit: - return await processPeerPushDebit( - ws, - pending.pursePub, - cancellationToken, - ); + return await processPeerPushDebit(wex, pending.pursePub); case PendingTaskType.PeerPullCredit: - return await processPeerPullCredit( - ws, - pending.pursePub, - cancellationToken, - ); + return await processPeerPullCredit(wex, pending.pursePub); case PendingTaskType.PeerPullDebit: - return await processPeerPullDebit( - ws, - pending.peerPullDebitId, - cancellationToken, - ); + return await processPeerPullDebit(wex, pending.peerPullDebitId); case PendingTaskType.PeerPushCredit: - return await processPeerPushCredit( - ws, - pending.peerPushCreditId, - cancellationToken, - ); + return await processPeerPushCredit(wex, pending.peerPushCreditId); case PendingTaskType.RewardPickup: throw Error("not supported anymore"); default: |