diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
9 files changed, 17 insertions, 61 deletions
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index d3c72d164..7bf07ab2a 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -29,9 +29,6 @@ import { DenominationStatus, WireFee, ExchangeUpdateReason, - ExchangeUpdatedEventRecord, - initRetryInfo, - updateRetryInfoTimeout, } from "../types/dbTypes"; import { canonicalizeBaseUrl } from "../util/helpers"; import * as Amounts from "../util/amounts"; @@ -64,6 +61,7 @@ import { URL } from "../util/url"; import { reconcileReserveHistory } from "../util/reserveHistoryUtil"; import { checkDbInvariant } from "../util/invariants"; import { NotificationType } from "../types/notifications"; +import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries"; const logger = new Logger("exchanges.ts"); @@ -292,7 +290,7 @@ async function updateExchangeFinalize( return; } await ws.db.runWithWriteTransaction( - [Stores.exchanges, Stores.exchangeUpdatedEvents], + [Stores.exchanges], async (tx) => { const r = await tx.get(Stores.exchanges, exchangeBaseUrl); if (!r) { @@ -307,11 +305,6 @@ async function updateExchangeFinalize( // as now new denominations might be available. r.nextRefreshCheck = undefined; await tx.put(Stores.exchanges, r); - const updateEvent: ExchangeUpdatedEventRecord = { - exchangeBaseUrl: exchange.baseUrl, - timestamp: getTimestampNow(), - }; - await tx.put(Stores.exchangeUpdatedEvents, updateEvent); }, ); } @@ -557,7 +550,7 @@ export async function getExchangeTrust( ); if (currencyRecord) { for (const trustedExchange of currencyRecord.exchanges) { - if (trustedExchange.exchangePub === exchangeDetails.masterPublicKey) { + if (trustedExchange.exchangeMasterPub === exchangeDetails.masterPublicKey) { isTrusted = true; break; } diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index 50f863e48..c655aa7d8 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -27,15 +27,11 @@ import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto"; import { CoinStatus, - initRetryInfo, ProposalRecord, ProposalStatus, PurchaseRecord, Stores, - updateRetryInfoTimeout, - PayEventRecord, WalletContractData, - getRetryDuration, CoinRecord, DenominationRecord, } from "../types/dbTypes"; @@ -80,6 +76,7 @@ import { } from "../util/http"; import { TalerErrorCode } from "../TalerErrorCode"; import { URL } from "../util/url"; +import { initRetryInfo, updateRetryInfoTimeout, getRetryDuration } from "../util/retries"; /** * Logger. @@ -833,7 +830,7 @@ async function storeFirstPaySuccess( ): Promise<void> { const now = getTimestampNow(); await ws.db.runWithWriteTransaction( - [Stores.purchases, Stores.payEvents], + [Stores.purchases], async (tx) => { const purchase = await tx.get(Stores.purchases, proposalId); @@ -864,13 +861,6 @@ async function storeFirstPaySuccess( } await tx.put(Stores.purchases, purchase); - const payEvent: PayEventRecord = { - proposalId, - sessionId, - timestamp: now, - isReplay: !isFirst, - }; - await tx.put(Stores.payEvents, payEvent); }, ); } @@ -881,7 +871,7 @@ async function storePayReplaySuccess( sessionId: string | undefined, ): Promise<void> { await ws.db.runWithWriteTransaction( - [Stores.purchases, Stores.payEvents], + [Stores.purchases], async (tx) => { const purchase = await tx.get(Stores.purchases, proposalId); diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts index 3f53d93ed..634869ece 100644 --- a/packages/taler-wallet-core/src/operations/recoup.ts +++ b/packages/taler-wallet-core/src/operations/recoup.ts @@ -34,14 +34,11 @@ import { RefreshCoinSource, ReserveRecordStatus, RecoupGroupRecord, - initRetryInfo, - updateRetryInfoTimeout, } from "../types/dbTypes"; import { codecForRecoupConfirmation } from "../types/talerTypes"; import { NotificationType } from "../types/notifications"; import { - forceQueryReserve, getReserveRequestTimeout, processReserve, } from "./reserves"; @@ -56,6 +53,7 @@ import { guardOperationException } from "./errors"; import { readSuccessResponseJsonOrThrow } from "../util/http"; import { URL } from "../util/url"; import { Logger } from "../util/logging"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; const logger = new Logger("operations/recoup.ts"); diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index a7082a501..a6917c285 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -19,11 +19,9 @@ import { DenominationRecord, Stores, CoinStatus, - RefreshPlanchetRecord, + RefreshPlanchet, CoinRecord, RefreshSessionRecord, - initRetryInfo, - updateRetryInfoTimeout, RefreshGroupRecord, CoinSourceType, } from "../types/dbTypes"; @@ -56,8 +54,6 @@ import { } from "../util/time"; import { readSuccessResponseJsonOrThrow, - HttpResponse, - throwUnexpectedRequestError, } from "../util/http"; import { codecForExchangeMeltResponse, @@ -65,6 +61,7 @@ import { } from "../types/talerTypes"; import { URL } from "../util/url"; import { checkDbInvariant } from "../util/invariants"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; const logger = new Logger("refresh.ts"); @@ -326,7 +323,7 @@ async function refreshReveal( throw Error("inconsistent database"); } - const evs = planchets.map((x: RefreshPlanchetRecord) => x.coinEv); + const evs = planchets.map((x: RefreshPlanchet) => x.coinEv); const linkSigs: string[] = []; for (let i = 0; i < refreshSession.newDenoms.length; i++) { diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index 0c89e5241..d49675c09 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -32,8 +32,6 @@ import { } from "../types/walletTypes"; import { Stores, - updateRetryInfoTimeout, - initRetryInfo, CoinStatus, RefundReason, RefundState, @@ -55,6 +53,7 @@ import { Logger } from "../util/logging"; import { readSuccessResponseJsonOrThrow } from "../util/http"; import { TransactionHandle } from "../util/query"; import { URL } from "../util/url"; +import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries"; const logger = new Logger("refund.ts"); @@ -265,7 +264,6 @@ async function acceptRefunds( Stores.coins, Stores.denominations, Stores.refreshGroups, - Stores.refundEvents, ], async (tx) => { const p = await tx.get(Stores.purchases, proposalId); diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts index b4fa3b23e..6db203472 100644 --- a/packages/taler-wallet-core/src/operations/reserves.ts +++ b/packages/taler-wallet-core/src/operations/reserves.ts @@ -28,14 +28,9 @@ import { CurrencyRecord, Stores, WithdrawalGroupRecord, - initRetryInfo, - updateRetryInfoTimeout, - ReserveUpdatedEventRecord, WalletReserveHistoryItemType, - WithdrawalSourceType, ReserveHistoryRecord, ReserveBankInfo, - getRetryDuration, } from "../types/dbTypes"; import { Logger } from "../util/logging"; import { Amounts } from "../util/amounts"; @@ -86,6 +81,7 @@ import { } from "../util/http"; import { codecForAny } from "../util/codec"; import { URL } from "../util/url"; +import { initRetryInfo, getRetryDuration, updateRetryInfoTimeout } from "../util/retries"; const logger = new Logger("reserves.ts"); @@ -206,8 +202,8 @@ export async function createReserve( if (!isAudited && !isTrusted) { currencyRecord.exchanges.push({ - baseUrl: req.exchange, - exchangePub: exchangeDetails.masterPublicKey, + exchangeBaseUrl: req.exchange, + exchangeMasterPub: exchangeDetails.masterPublicKey, }); } @@ -554,7 +550,7 @@ async function updateReserve( const currency = balance.currency; let updateSummary: ReserveHistorySummary | undefined; await ws.db.runWithWriteTransaction( - [Stores.reserves, Stores.reserveUpdatedEvents, Stores.reserveHistory], + [Stores.reserves, Stores.reserveHistory], async (tx) => { const r = await tx.get(Stores.reserves, reservePub); if (!r) { @@ -589,15 +585,6 @@ async function updateReserve( reconciled.newAddedItems.length + reconciled.newMatchedItems.length != 0 ) { - const reserveUpdate: ReserveUpdatedEventRecord = { - reservePub: r.reservePub, - timestamp: getTimestampNow(), - amountReserveBalance: Amounts.stringify(balance), - amountExpected: Amounts.stringify(updateSummary.awaitedReserveAmount), - newHistoryTransactions, - reserveUpdateId, - }; - await tx.put(Stores.reserveUpdatedEvents, reserveUpdate); logger.trace("setting reserve status to 'withdrawing' after query"); r.reserveStatus = ReserveRecordStatus.WITHDRAWING; r.retryInfo = initRetryInfo(); diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index 248ea2cd1..7b914568f 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -25,8 +25,6 @@ import { import * as Amounts from "../util/amounts"; import { Stores, - initRetryInfo, - updateRetryInfoTimeout, TipPlanchet, CoinRecord, CoinSourceType, @@ -47,6 +45,7 @@ import { URL } from "../util/url"; import { Logger } from "../util/logging"; import { checkDbInvariant } from "../util/invariants"; import { TalerErrorCode } from "../TalerErrorCode"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; const logger = new Logger("operations/tip.ts"); diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 026a91ef3..54d4d5574 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -20,7 +20,6 @@ import { InternalWalletState } from "./state"; import { Stores, - WithdrawalSourceType, WalletRefundItem, RefundState, ReserveRecordStatus, @@ -95,10 +94,7 @@ export async function getTransactions( Stores.reserveHistory, Stores.tips, Stores.withdrawalGroups, - Stores.payEvents, Stores.planchets, - Stores.refundEvents, - Stores.reserveUpdatedEvents, Stores.recoupGroups, ], // Report withdrawals that are currently in progress. diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index eec92ba29..fd472fdfe 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -21,12 +21,9 @@ import { DenominationStatus, CoinStatus, CoinRecord, - initRetryInfo, - updateRetryInfoTimeout, CoinSourceType, DenominationSelectionInfo, PlanchetRecord, - WithdrawalSourceType, DenomSelectionState, } from "../types/dbTypes"; import { @@ -64,6 +61,7 @@ import { readSuccessResponseJsonOrThrow } from "../util/http"; import { URL } from "../util/url"; import { TalerErrorCode } from "../TalerErrorCode"; import { encodeCrock } from "../crypto/talerCrypto"; +import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries"; const logger = new Logger("withdraw.ts"); |