taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit b623a7a8f3ec11488e31c194cf8f3a40471a0c67
parent 9b56e419e4b2d2e94f68ae96e176b7c4e3479e58
Author: Florian Dold <florian@dold.me>
Date:   Wed, 18 Mar 2026 20:34:37 +0100

wallet-core: more DB cleanup

Diffstat:
Mpackages/taler-wallet-core/src/donau.ts | 3+--
Mpackages/taler-wallet-core/src/pay-merchant.ts | 13++++++-------
Mpackages/taler-wallet-core/src/pay-peer-push-credit.ts | 3+--
Mpackages/taler-wallet-core/src/transactions.ts | 6+++---
4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/packages/taler-wallet-core/src/donau.ts b/packages/taler-wallet-core/src/donau.ts @@ -59,7 +59,6 @@ import { DonationReceiptRecord, DonationReceiptStatus, } from "./db.js"; -import { IdbWalletTransaction } from "./dbtx.js"; import { WalletExecutionContext } from "./index.js"; /** @@ -397,7 +396,7 @@ export async function generateDonauPlanchets( wex: WalletExecutionContext, proposalId: string, ): Promise<void> { - const res = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + const res = await wex.runLegacyWalletDbTx(async (tx) => { const rec = await tx.purchases.get(proposalId); if (!rec) { return undefined; diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -173,7 +173,6 @@ import { WalletDbReadOnlyTransaction, WalletDbReadWriteTransaction, } from "./db.js"; -import { IdbWalletTransaction } from "./dbtx.js"; import { acceptDonauBlindSigs, generateDonauPlanchets } from "./donau.js"; import { getScopeForAllCoins, getScopeForAllExchanges } from "./exchanges.js"; import { @@ -1829,7 +1828,7 @@ async function checkPaymentByProposalId( claimToken: purchaseRec.claimToken, }); - const scopes = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + const scopes = await wex.runLegacyWalletDbTx(async (tx) => { let exchangeUrls = contractTerms.exchanges.map((x) => x.url); return await getScopeForAllExchanges(tx, exchangeUrls); }); @@ -1888,7 +1887,7 @@ async function checkPaymentByProposalId( res.insufficientBalanceDetails, )}`, ); - let scopes = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + let scopes = await wex.runLegacyWalletDbTx(async (tx) => { return getScopeForAllExchanges(tx, allowedExchangeUrls); }); return { @@ -1918,7 +1917,7 @@ async function checkPaymentByProposalId( const exchanges = new Set<string>(coins.map((x) => x.exchangeBaseUrl)); - const scopes = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + const scopes = await wex.runLegacyWalletDbTx(async (tx) => { return await getScopeForAllExchanges(tx, [...exchanges]); }); @@ -2444,7 +2443,7 @@ export async function getChoicesForPayment( } const choices: ChoiceSelectionDetail[] = []; - await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + await wex.runLegacyWalletDbTx(async (tx) => { const tokenSels: SelectPayTokensResult[] = []; const contractTerms: MerchantContractTerms = d.contractTerms; switch (contractTerms.version) { @@ -3244,7 +3243,7 @@ async function processPurchasePay( } const budikeypairs: BlindedDonationReceiptKeyPair[] = []; // FIXME: Merge with transaction above - const res = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + const res = await wex.runLegacyWalletDbTx(async (tx) => { const recs = await tx.donationPlanchets.indexes.byProposalId.getAll(proposalId); for (const rec of recs) { @@ -4056,7 +4055,7 @@ async function processPurchaseDialogShared( const proposalId = purchase.proposalId; logger.trace(`processing dialog-shared for proposal ${proposalId}`); const ctx = new PayMerchantTransactionContext(wex, proposalId); - const txRes = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + const txRes = await wex.runLegacyWalletDbTx(async (tx) => { const rec = await tx.purchases.get(proposalId); if (!rec) { return undefined; diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/pay-peer-push-credit.ts @@ -523,8 +523,7 @@ export async function preparePeerPushCredit( ); const currency = Amounts.currencyOf(existing.existingContractTerms.amount); const exchangeBaseUrl = existing.existingPushInc.exchangeBaseUrl; - const scopeInfo = await wex.db.runAllStoresReadOnlyTx( - {}, + const scopeInfo = await wex.runLegacyWalletDbTx( async (tx) => await getExchangeScopeInfo(tx, exchangeBaseUrl, currency), ); return { diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts @@ -161,7 +161,7 @@ export async function getTransactionById( case TransactionType.PeerPullDebit: case TransactionType.Refund: { const ctx = await getContextForTransaction(wex, req.transactionId); - const txDetails = await wex.db.runAllStoresReadOnlyTx({}, async (tx) => + const txDetails = await wex.runLegacyWalletDbTx(async (tx) => ctx.lookupFullTransaction(tx, { includeContractTerms: req.includeContractTerms, }), @@ -379,7 +379,7 @@ export async function getTransactionsV2( const resultTransactions: Transaction[] = []; - await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + await wex.runLegacyWalletDbTx(async (tx) => { let forwards = transactionsRequest?.limit == null || transactionsRequest.limit >= 0; let limit = @@ -475,7 +475,7 @@ export async function getTransactions( ); } - await wex.db.runAllStoresReadOnlyTx({}, async (tx) => { + await wex.runLegacyWalletDbTx(async (tx) => { const allMetaTransactions = await tx.transactionsMeta.indexes.byStatus.getAll(keyRange); for (const metaTx of allMetaTransactions) {