diff options
author | Florian Dold <florian@dold.me> | 2024-02-27 14:05:33 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-02-27 14:05:33 +0100 |
commit | 41f34031ae934e8c802cdbb73fffb5a39c9c6a68 (patch) | |
tree | 9ee8b7da472fdc01d8d5d87d552fdaf7c0eb00ee /packages/taler-wallet-core/src | |
parent | 4e0bdf4da06738c7a9d2420937a20cabd62ae28e (diff) | |
download | wallet-core-41f34031ae934e8c802cdbb73fffb5a39c9c6a68.tar.xz |
-simplify
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 13762d6e6..f21db0531 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -54,13 +54,11 @@ import { TestingWaitTransactionRequest, TimerAPI, TimerGroup, - TransactionState, TransactionType, ValidateIbanResponse, WalletCoreVersion, WalletNotification, WithdrawalDetailsForAmount, - assertUnreachable, checkDbInvariant, codecForAbortTransaction, codecForAcceptBankIntegratedWithdrawalRequest, @@ -174,7 +172,6 @@ import { timestampProtocolToDb, } from "./db.js"; import { - computeDepositTransactionStatus, createDepositGroup, generateDepositGroupTxId, prepareDepositGroup, @@ -192,8 +189,13 @@ import { lookupExchangeByUri, } from "./exchanges.js"; import { - computePayMerchantTransactionState, - computeRefundTransactionState, + convertDepositAmount, + convertPeerPushAmount, + convertWithdrawalAmount, + getMaxDepositAmount, + getMaxPeerPushAmount, +} from "./instructedAmountConversion.js"; +import { confirmPay, getContractTermsDetails, preparePayForTemplate, @@ -204,27 +206,22 @@ import { } from "./pay-merchant.js"; import { checkPeerPullPaymentInitiation, - computePeerPullCreditTransactionState, initiatePeerPullPayment, } from "./pay-peer-pull-credit.js"; import { - computePeerPullDebitTransactionState, confirmPeerPullDebit, preparePeerPullDebit, } from "./pay-peer-pull-debit.js"; import { - computePeerPushCreditTransactionState, confirmPeerPushCredit, preparePeerPushCredit, } from "./pay-peer-push-credit.js"; import { checkPeerPushDebit, - computePeerPushDebitTransactionState, initiatePeerPushDebit, } from "./pay-peer-push-debit.js"; import { DbAccess } from "./query.js"; -import { computeRefreshTransactionState, forceRefresh } from "./refresh.js"; -import { computeRewardTransactionStatus } from "./reward.js"; +import { forceRefresh } from "./refresh.js"; import { TaskScheduler } from "./shepherd.js"; import { runIntegrationTest, @@ -249,13 +246,6 @@ import { suspendTransaction, } from "./transactions.js"; import { - convertDepositAmount, - convertPeerPushAmount, - convertWithdrawalAmount, - getMaxDepositAmount, - getMaxPeerPushAmount, -} from "./instructedAmountConversion.js"; -import { WALLET_BANK_CONVERSION_API_PROTOCOL_VERSION, WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, WALLET_COREBANK_API_PROTOCOL_VERSION, @@ -272,7 +262,6 @@ import { } from "./wallet-api-types.js"; import { acceptWithdrawalFromUri, - computeWithdrawalTransactionStatus, createManualWithdrawal, getExchangeWithdrawalInfo, getWithdrawalDetailsForUri, @@ -287,13 +276,6 @@ export type NotificationListener = (n: WalletNotification) => void; type CancelFn = () => void; -async function runTaskLoop( - ws: InternalWalletState, - opts: RetryLoopOpts = {}, -): Promise<void> { - await ws.taskScheduler.run(opts); -} - /** * Insert the hard-coded defaults for exchanges, coins and * auditors into the database, unless these defaults have @@ -480,9 +462,9 @@ async function dumpCoins(ws: InternalWalletState): Promise<CoinDumpJson> { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -1443,7 +1425,7 @@ export class Wallet { async runTaskLoop(opts?: RetryLoopOpts): Promise<void> { await this.ws.ensureWalletDbOpen(); - return runTaskLoop(this.ws, opts); + return this.ws.taskScheduler.run(opts); } async handleCoreApiRequest( @@ -1627,7 +1609,8 @@ export class InternalWalletState { if (this.isTaskLoopRunning) { return; } - runTaskLoop(this) + this.taskScheduler + .run() .catch((e) => { logger.error("error running task loop"); logger.error(`err: ${e}`); |