taler-typescript-core

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

commit e76071abac37fae340b8c126438a0b4f6553c857
parent eb6c37a897206bedb244d7f205c22299a228f953
Author: Florian Dold <florian@dold.me>
Date:   Fri, 13 Feb 2026 18:59:59 +0100

wallet-core: refactor notifications

Diffstat:
Mpackages/taler-wallet-core/src/refresh.ts | 38+++++++++-----------------------------
1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts @@ -70,7 +70,6 @@ import { TransactionState, TransactionType, URL, - WalletNotification, } from "@gnu-taler/taler-util"; import { HttpResponse, @@ -243,50 +242,31 @@ export class RefreshTransactionContext implements TransactionContext { } async deleteTransaction(): Promise<void> { - const res = await this.wex.db.runReadWriteTx( - { - storeNames: ["refreshGroups", "refreshSessions", "tombstones"], - }, - async (tx) => { - return this.deleteTransactionInTx(tx); - }, - ); - for (const notif of res.notifs) { - this.wex.ws.notify(notif); - } + const res = await this.wex.db.runAllStoresReadWriteTx({}, async (tx) => { + return this.deleteTransactionInTx(tx); + }); } async deleteTransactionInTx( tx: WalletDbReadWriteTransaction< - ["refreshGroups", "refreshSessions", "tombstones"] + ["refreshGroups", "refreshSessions", "tombstones", "transactionsMeta"] >, - ): Promise<{ notifs: WalletNotification[] }> { - const notifs: WalletNotification[] = []; - const rg = await tx.refreshGroups.get(this.refreshGroupId); + ): Promise<void> { + const [rg, h] = await this.getRecordHandle(tx); if (!rg) { logger.warn( `unable to delete transaction ${this.transactionId}, not found`, ); - return { notifs }; + return; } - const oldTxState = computeRefreshTransactionState(rg); const sessions = await tx.refreshSessions.indexes.byRefreshGroupId.getAll( rg.refreshGroupId, ); for (const s of sessions) { await tx.refreshSessions.delete([s.refreshGroupId, s.coinIndex]); } + await h.update(undefined); await tx.refreshGroups.delete(rg.refreshGroupId); - notifs.push({ - type: NotificationType.TransactionStateTransition, - transactionId: this.transactionId, - oldTxState, - newTxState: { - major: TransactionMajorState.Deleted, - }, - newStId: -1, - }); - return { notifs }; } async suspendTransaction(): Promise<void> { @@ -409,7 +389,7 @@ export async function getTotalRefreshCost( * Considers refresh fees, withdrawal fees after refresh and amounts too small * to refresh. */ -export function getTotalRefreshCostInternal( +function getTotalRefreshCostInternal( denoms: DenominationRecord[], refreshedDenom: DenominationInfo, amountLeft: AmountJson,