diff options
-rw-r--r-- | packages/taler-wallet-core/src/operations/exchanges.ts | 14 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index 766af27a8..ca3ea8af6 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -272,18 +272,30 @@ export async function acceptExchangeTermsOfService( exchangeBaseUrl: string, etag: string | undefined, ): Promise<void> { - await ws.db + const notif = await ws.db .mktx((x) => [x.exchanges, x.exchangeDetails]) .runReadWrite(async (tx) => { const exch = await tx.exchanges.get(exchangeBaseUrl); if (exch && exch.tosCurrentEtag) { + const oldExchangeState = getExchangeState(exch); exch.tosAcceptedEtag = exch.tosCurrentEtag; exch.tosAcceptedTimestamp = timestampPreciseToDb( TalerPreciseTimestamp.now(), ); await tx.exchanges.put(exch); + const newExchangeState = getExchangeState(exch); + return { + type: NotificationType.ExchangeStateTransition, + exchangeBaseUrl, + newExchangeState: newExchangeState, + oldExchangeState: oldExchangeState, + } satisfies WalletNotification; } + return undefined; }); + if (notif) { + ws.notify(notif); + } } async function validateWireInfo( diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 56f1d91bb..8221abea6 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -34,7 +34,6 @@ import { DenomSelectionState, Duration, ExchangeBatchWithdrawRequest, - ExchangeListItem, ExchangeUpdateStatus, ExchangeWireAccount, ExchangeWithdrawBatchResponse, @@ -100,11 +99,7 @@ import { WithdrawalGroupStatus, WithdrawalRecordType, } from "../db.js"; -import { - ExchangeEntryDbRecordStatus, - isWithdrawableDenom, - timestampPreciseToDb, -} from "../index.js"; +import { isWithdrawableDenom, timestampPreciseToDb } from "../index.js"; import { InternalWalletState } from "../internal-wallet-state.js"; import { TaskIdentifiers, @@ -113,7 +108,6 @@ import { constructTaskIdentifier, makeCoinAvailable, makeCoinsVisible, - makeExchangeListItem, runLongpollAsync, } from "../operations/common.js"; import { PendingTaskType } from "../pending-types.js"; |