From 7de5ceaa74a2d0d99bf3699b0818c470d1202dc7 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 13 Jan 2021 00:51:30 +0100 Subject: [PATCH] auto format --- .../src/integrationtests/harness.ts | 4 ++- .../src/integrationtests/test-claim-loop.ts | 5 +--- .../test-payment-transient.ts | 2 +- .../test-timetravel-withdraw.ts | 4 +-- .../src/integrationtests/test-tipping.ts | 6 +--- .../src/operations/backup.ts | 29 ++++++++++++------- .../src/operations/refresh.ts | 5 +++- .../src/operations/refund.ts | 16 ++++++---- .../taler-wallet-core/src/operations/state.ts | 2 +- .../taler-wallet-core/src/operations/tip.ts | 2 +- .../src/operations/transactions.ts | 4 +-- .../src/operations/withdraw.ts | 2 -- .../taler-wallet-core/src/types/dbTypes.ts | 9 +++--- .../src/types/notifications.ts | 1 - packages/taler-wallet-core/src/wallet.ts | 2 +- 15 files changed, 49 insertions(+), 44 deletions(-) diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts index 4985c5fc1..6d1d4e16e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/harness.ts +++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts @@ -1457,7 +1457,9 @@ export async function runTestWithState( const handleSignal = (s: string) => { gc.shutdownSync(); - console.warn("**** received fatal proces event, shutting down test harness"); + console.warn( + "**** received fatal proces event, shutting down test harness", + ); status = "fail"; p.reject(Error("caught signal")); }; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-claim-loop.ts b/packages/taler-wallet-cli/src/integrationtests/test-claim-loop.ts index 5a0540e90..4a4cd555b 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-claim-loop.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-claim-loop.ts @@ -17,10 +17,7 @@ /** * Imports. */ -import { - GlobalTestState, - MerchantPrivateApi, -} from "./harness"; +import { GlobalTestState, MerchantPrivateApi } from "./harness"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; import { URL } from "url"; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts index 73973bdc0..67038989a 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts @@ -169,4 +169,4 @@ export async function runPaymentTransientTest(t: GlobalTestState) { `expected status 202 (after paying), but got ${publicOrderStatusResp.status}`, ); } -} \ No newline at end of file +} diff --git a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts index b4de50b95..e74a49c95 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts @@ -28,7 +28,7 @@ import { Duration, TransactionType } from "taler-wallet-core"; /** * Basic time travel test. */ -export async function runTimetravelWithdrawTest(t: GlobalTestState){ +export async function runTimetravelWithdrawTest(t: GlobalTestState) { // Set up test environment const { @@ -87,4 +87,4 @@ export async function runTimetravelWithdrawTest(t: GlobalTestState){ // This doesn't work yet, see https://bugs.taler.net/n/6585 // await wallet.runUntilDone({ maxRetries: 5 }); -} \ No newline at end of file +} diff --git a/packages/taler-wallet-cli/src/integrationtests/test-tipping.ts b/packages/taler-wallet-cli/src/integrationtests/test-tipping.ts index 01ec6c1bb..21422c42c 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-tipping.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-tipping.ts @@ -17,11 +17,7 @@ /** * Imports. */ -import { - GlobalTestState, - MerchantPrivateApi, - BankApi, -} from "./harness"; +import { GlobalTestState, MerchantPrivateApi, BankApi } from "./harness"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; /** diff --git a/packages/taler-wallet-core/src/operations/backup.ts b/packages/taler-wallet-core/src/operations/backup.ts index a9f1fc43f..8bc82ce6c 100644 --- a/packages/taler-wallet-core/src/operations/backup.ts +++ b/packages/taler-wallet-core/src/operations/backup.ts @@ -1274,7 +1274,9 @@ export async function importBackup( break; default: logger.warn( - `got backup purchase abort_status ${j2s(backupPurchase.abort_status)}`, + `got backup purchase abort_status ${j2s( + backupPurchase.abort_status, + )}`, ); throw Error("not reachable"); } @@ -1338,8 +1340,7 @@ export async function importBackup( timestampAccept: backupPurchase.timestamp_accept, timestampFirstSuccessfulPay: backupPurchase.timestamp_first_successful_pay, - timestampLastRefundStatus: - undefined, + timestampLastRefundStatus: undefined, merchantPaySig: backupPurchase.merchant_pay_sig, lastSessionId: undefined, abortStatus, @@ -1567,14 +1568,20 @@ export async function runBackupCycle(ws: InternalWalletState): Promise { continue; } const p = proposalId; - await ws.db.runWithWriteTransaction([Stores.backupProviders], async (tx) => { - const provRec = await tx.get(Stores.backupProviders, provider.baseUrl); - checkDbInvariant(!!provRec); - const ids = new Set(provRec.paymentProposalIds) - ids.add(p); - provRec.paymentProposalIds = Array.from(ids); - await tx.put(Stores.backupProviders, provRec); - }); + await ws.db.runWithWriteTransaction( + [Stores.backupProviders], + async (tx) => { + const provRec = await tx.get( + Stores.backupProviders, + provider.baseUrl, + ); + checkDbInvariant(!!provRec); + const ids = new Set(provRec.paymentProposalIds); + ids.add(p); + provRec.paymentProposalIds = Array.from(ids); + await tx.put(Stores.backupProviders, provRec); + }, + ); const confirmRes = await confirmPay(ws, proposalId); switch (confirmRes.type) { case ConfirmPayResultType.Pending: diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 2d80f0a50..a6c311f45 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -150,7 +150,10 @@ async function refreshCreateSession( oldDenom.feeRefresh, ).amount; - const newCoinDenoms = selectWithdrawalDenominations(availableAmount, availableDenoms); + const newCoinDenoms = selectWithdrawalDenominations( + availableAmount, + availableDenoms, + ); if (newCoinDenoms.selectedDenoms.length === 0) { logger.trace( diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index 7ffcdb6d9..13df438e4 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -503,7 +503,9 @@ export async function applyRefund( let amountRefundGranted = Amounts.getZero( purchase.download.contractData.amount.currency, ); - let amountRefundGone = Amounts.getZero(purchase.download.contractData.amount.currency); + let amountRefundGone = Amounts.getZero( + purchase.download.contractData.amount.currency, + ); let pendingAtExchange = false; @@ -545,7 +547,8 @@ export async function applyRefund( summary: purchase.download.contractData.summary, fulfillmentMessage: purchase.download.contractData.fulfillmentMessage, summary_i18n: purchase.download.contractData.summaryI18n, - fulfillmentMessage_i18n: purchase.download.contractData.fulfillmentMessageI18n, + fulfillmentMessage_i18n: + purchase.download.contractData.fulfillmentMessageI18n, }, }; } @@ -669,9 +672,12 @@ async function processPurchaseQueryRefundImpl( purchase.payCoinSelection.coinContributions[i], ), rtransaction_id: 0, - execution_time: timestampAddDuration(purchase.download.contractData.timestamp, { - d_ms: 1000, - }), + execution_time: timestampAddDuration( + purchase.download.contractData.timestamp, + { + d_ms: 1000, + }, + ), }); } await acceptRefunds(ws, proposalId, refunds, RefundReason.AbortRefund); diff --git a/packages/taler-wallet-core/src/operations/state.ts b/packages/taler-wallet-core/src/operations/state.ts index 60aee4c3f..645ad8ad3 100644 --- a/packages/taler-wallet-core/src/operations/state.ts +++ b/packages/taler-wallet-core/src/operations/state.ts @@ -57,7 +57,7 @@ export class InternalWalletState { constructor( // FIXME: Make this a getter and make - // the actual value nullable. + // the actual value nullable. // Check if we are in a DB migration / garbage collection // and throw an error in that case. public db: Database, diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index 68b5a2ad0..328fe2cfa 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -227,7 +227,7 @@ async function processTipImpl( planchetIndex: planchets.length, secretSeed: tipRecord.secretSeed, }; - logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`) + logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`); const p = await ws.cryptoApi.createTipPlanchet(deriveReq); logger.trace(`derive result: ${j2s(p)}`); denomForPlanchet[planchets.length] = denom; diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index a862d24ef..c7e6a9c53 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -269,9 +269,7 @@ export async function getTransactions( ); let r0: WalletRefundItem | undefined; let amountRaw = Amounts.getZero(contractData.amount.currency); - let amountEffective = Amounts.getZero( - contractData.amount.currency, - ); + let amountEffective = Amounts.getZero(contractData.amount.currency); for (const rk of Object.keys(pr.refunds)) { const refund = pr.refunds[rk]; const myGroupKey = `${refund.executionTime.t_ms}`; diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index c2dfcd1c4..d28bea1e1 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -86,7 +86,6 @@ export function isWithdrawableDenom(d: DenominationRecord): boolean { return started && stillOkay && !d.isRevoked; } - /** * Get a list of denominations (with repetitions possible) * whose total value is as close as possible to the available @@ -562,7 +561,6 @@ export async function updateWithdrawalDenoms( } } - async function incrementWithdrawalRetry( ws: InternalWalletState, withdrawalGroupId: string, diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts index 0cfc8801b..60752fd68 100644 --- a/packages/taler-wallet-core/src/types/dbTypes.ts +++ b/packages/taler-wallet-core/src/types/dbTypes.ts @@ -1587,11 +1587,10 @@ class TipsStore extends Store<"tips", TipRecord> { "tipsByMerchantTipIdAndOriginIndex", [string, string], TipRecord - >( - this, - "tipsByMerchantTipIdAndOriginIndex", - ["merchantTipId", "merchantBaseUrl"], - ); + >(this, "tipsByMerchantTipIdAndOriginIndex", [ + "merchantTipId", + "merchantBaseUrl", + ]); } class WithdrawalGroupsStore extends Store< diff --git a/packages/taler-wallet-core/src/types/notifications.ts b/packages/taler-wallet-core/src/types/notifications.ts index 9ddcf4fa2..8601c65b3 100644 --- a/packages/taler-wallet-core/src/types/notifications.ts +++ b/packages/taler-wallet-core/src/types/notifications.ts @@ -124,7 +124,6 @@ export interface RefreshRefusedNotification { type: NotificationType.RefreshUnwarranted; } - export interface ReserveConfirmedNotification { type: NotificationType.ReserveConfirmed; } diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 631ac9509..65b816cc3 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -979,7 +979,7 @@ export class Wallet { async getBackupStatus(): Promise { return getBackupInfo(this.ws); } - + /** * Implementation of the "wallet-core" API. */