From 44bea073af97f8c1aee4a3fc05cbfdb6036da265 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 20 May 2024 17:10:06 -0300 Subject: codespell and pretty --- packages/taler-wallet-core/src/balance.ts | 16 ++++++++++++---- packages/taler-wallet-core/src/db.ts | 2 +- packages/taler-wallet-core/src/dbless.ts | 4 +--- packages/taler-wallet-core/src/pay-merchant.ts | 20 ++++++++++++-------- packages/taler-wallet-core/src/transactions.ts | 12 ++++++------ packages/taler-wallet-core/src/wallet.ts | 12 ++++++------ packages/taler-wallet-core/src/withdraw.ts | 10 +++++----- 7 files changed, 43 insertions(+), 33 deletions(-) (limited to 'packages/taler-wallet-core/src') diff --git a/packages/taler-wallet-core/src/balance.ts b/packages/taler-wallet-core/src/balance.ts index b2ba7b95d..76e604324 100644 --- a/packages/taler-wallet-core/src/balance.ts +++ b/packages/taler-wallet-core/src/balance.ts @@ -375,14 +375,20 @@ export async function getBalancesInsideTransaction( break; case WithdrawalGroupStatus.SuspendedKyc: case WithdrawalGroupStatus.PendingKyc: { - checkDbInvariant(wg.denomsSel !== undefined, "wg in kyc state should have been initialized") + checkDbInvariant( + wg.denomsSel !== undefined, + "wg in kyc state should have been initialized", + ); const currency = Amounts.currencyOf(wg.denomsSel.totalCoinValue); await balanceStore.setFlagIncomingKyc(currency, wg.exchangeBaseUrl); break; } case WithdrawalGroupStatus.PendingAml: case WithdrawalGroupStatus.SuspendedAml: { - checkDbInvariant(wg.denomsSel !== undefined, "wg in aml state should have been initialized") + checkDbInvariant( + wg.denomsSel !== undefined, + "wg in aml state should have been initialized", + ); const currency = Amounts.currencyOf(wg.denomsSel.totalCoinValue); await balanceStore.setFlagIncomingAml(currency, wg.exchangeBaseUrl); break; @@ -398,7 +404,10 @@ export async function getBalancesInsideTransaction( break; } case WithdrawalGroupStatus.PendingWaitConfirmBank: { - checkDbInvariant(wg.denomsSel !== undefined, "wg in confirmed state should have been initialized") + checkDbInvariant( + wg.denomsSel !== undefined, + "wg in confirmed state should have been initialized", + ); const currency = Amounts.currencyOf(wg.denomsSel.totalCoinValue); await balanceStore.setFlagIncomingConfirmation( currency, @@ -418,7 +427,6 @@ export async function getBalancesInsideTransaction( wg.denomsSel.totalCoinValue, ); } - }); await tx.peerPushDebit.indexes.byStatus diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 9d963b269..44c241aed 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -353,7 +353,7 @@ export enum WithdrawalGroupStatus { * Another wallet confirmed the withdrawal * (by POSTing the reserve pub to the bank) * before we had the chance. - * + * * In this situation, we'll let the other wallet continue * and give up ourselves. */ diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts index dfefe6ef5..d3085ecb4 100644 --- a/packages/taler-wallet-core/src/dbless.ts +++ b/packages/taler-wallet-core/src/dbless.ts @@ -113,9 +113,7 @@ export interface TopupReserveWithBankArgs { amount: AmountString; } -export async function topupReserveWithBank( - args: TopupReserveWithBankArgs, -) { +export async function topupReserveWithBank(args: TopupReserveWithBankArgs) { const { http, corebankApiBaseUrl, amount, exchangeInfo, reservePub } = args; const bankClient = new TalerCorebankApiClient(corebankApiBaseUrl); const bankUser = await bankClient.createRandomBankUser(); diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts index 8b6cb5e8d..77ea4c4c1 100644 --- a/packages/taler-wallet-core/src/pay-merchant.ts +++ b/packages/taler-wallet-core/src/pay-merchant.ts @@ -630,7 +630,8 @@ async function processDownloadProposal( if (proposal.purchaseStatus != PurchaseStatus.PendingDownloadingProposal) { logger.error( - `unexpected state ${proposal.purchaseStatus}/${PurchaseStatus[proposal.purchaseStatus] + `unexpected state ${proposal.purchaseStatus}/${ + PurchaseStatus[proposal.purchaseStatus] } for ${ctx.transactionId} in processDownloadProposal`, ); return TaskRunResult.finished(); @@ -889,7 +890,8 @@ async function createOrReusePurchase( oldProposal.claimToken === claimToken ) { logger.info( - `Found old proposal (status=${PurchaseStatus[oldProposal.purchaseStatus] + `Found old proposal (status=${ + PurchaseStatus[oldProposal.purchaseStatus] }) for order ${orderId} at ${merchantBaseUrl}`, ); if (oldProposal.purchaseStatus === PurchaseStatus.DialogShared) { @@ -1618,15 +1620,15 @@ export async function checkPayForTemplate( wex.http, ); - const cfg = await merchantApi.getConfig() + const cfg = await merchantApi.getConfig(); if (cfg.type === "fail") { throw TalerError.fromUncheckedDetail(cfg.detail); } return { ...asd, - supportedCurrencies: Object.keys(cfg.body.currencies) - } + supportedCurrencies: Object.keys(cfg.body.currencies), + }; } export async function preparePayForTemplate( @@ -1646,14 +1648,16 @@ export async function preparePayForTemplate( parsedUri.templateId, ); - const templateParamsAmount = req.templateParams?.amount as AmountString | undefined; + const templateParamsAmount = req.templateParams?.amount as + | AmountString + | undefined; if (templateParamsAmount === null) { const amountFromUri = templateInfo.editable_defaults?.amount; if (amountFromUri != null) { templateDetails.amount = amountFromUri as AmountString; } } else { - templateDetails.amount = templateParamsAmount + templateDetails.amount = templateParamsAmount; } const templateParamsSummary = req.templateParams?.summary; @@ -1663,7 +1667,7 @@ export async function preparePayForTemplate( templateDetails.summary = summaryFromUri; } } else { - templateDetails.summary = templateParamsSummary + templateDetails.summary = templateParamsSummary; } const reqUrl = new URL( diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts index b4809bfed..9a9fb524f 100644 --- a/packages/taler-wallet-core/src/transactions.ts +++ b/packages/taler-wallet-core/src/transactions.ts @@ -592,8 +592,8 @@ function buildTransactionForPeerPullCredit( ); }); const txState = computePeerPullCreditTransactionState(pullCredit); - checkDbInvariant(wsr.instructedAmount !== undefined, "wg unitialized"); - checkDbInvariant(wsr.denomsSel !== undefined, "wg unitialized"); + checkDbInvariant(wsr.instructedAmount !== undefined, "wg uninitialized"); + checkDbInvariant(wsr.denomsSel !== undefined, "wg uninitialized"); return { type: TransactionType.PeerPullCredit, txState, @@ -666,8 +666,8 @@ function buildTransactionForPeerPushCredit( if (wg.wgInfo.withdrawalType !== WithdrawalRecordType.PeerPushCredit) { throw Error("invalid withdrawal group type for push payment credit"); } - checkDbInvariant(wg.instructedAmount !== undefined, "wg unitialized"); - checkDbInvariant(wg.denomsSel !== undefined, "wg unitialized"); + checkDbInvariant(wg.instructedAmount !== undefined, "wg uninitialized"); + checkDbInvariant(wg.denomsSel !== undefined, "wg uninitialized"); const txState = computePeerPushCreditTransactionState(pushInc); return { @@ -783,8 +783,8 @@ function buildTransactionForManualWithdraw( const plainPaytoUris = exchangeDetails.wireInfo?.accounts.map((x) => x.payto_uri) ?? []; - checkDbInvariant(wg.instructedAmount !== undefined, "wg unitialized"); - checkDbInvariant(wg.denomsSel !== undefined, "wg unitialized"); + checkDbInvariant(wg.instructedAmount !== undefined, "wg uninitialized"); + checkDbInvariant(wg.denomsSel !== undefined, "wg uninitialized"); const exchangePaytoUris = augmentPaytoUrisForWithdrawal( plainPaytoUris, wg.reservePub, diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 26fd64eb4..68da15410 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -551,9 +551,9 @@ async function dumpCoins(wex: WalletExecutionContext): Promise { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -1653,7 +1653,7 @@ async function handleCoreApiRequest( wex = getObservedWalletExecutionContext(ws, cts.token, oc); } else { oc = { - observe(evt) { }, + observe(evt) {}, }; wex = getNormalWalletExecutionContext(ws, cts.token, oc); } @@ -1790,7 +1790,7 @@ export class Cache { constructor( private maxCapacity: number, private cacheDuration: Duration, - ) { } + ) {} get(key: string): T | undefined { const r = this.map.get(key); @@ -1826,7 +1826,7 @@ export class Cache { * Implementation of triggers for the wallet DB. */ class WalletDbTriggerSpec implements TriggerSpec { - constructor(public ws: InternalWalletState) { } + constructor(public ws: InternalWalletState) {} afterCommit(info: AfterCommitInfo): void { if (info.mode !== "readwrite") { diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index b95ab8548..4a7c7873c 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -915,7 +915,7 @@ async function processPlanchetGenerate( ): Promise { checkDbInvariant( withdrawalGroup.denomsSel !== undefined, - "can't process unitialized exchange", + "can't process uninitialized exchange", ); const exchangeBaseUrl = withdrawalGroup.exchangeBaseUrl; let planchet = await wex.db.runReadOnlyTx( @@ -1506,11 +1506,11 @@ async function processQueryReserve( } checkDbInvariant( withdrawalGroup.denomsSel !== undefined, - "can't process unitialized exchange", + "can't process uninitialized exchange", ); checkDbInvariant( withdrawalGroup.instructedAmount !== undefined, - "can't process unitialized exchange", + "can't process uninitialized exchange", ); const reservePub = withdrawalGroup.reservePub; @@ -1741,7 +1741,7 @@ async function redenominateWithdrawal( } checkDbInvariant( wg.denomsSel !== undefined, - "can't process unitialized exchange", + "can't process uninitialized exchange", ); const currency = Amounts.currencyOf(wg.denomsSel.totalWithdrawCost); const exchangeBaseUrl = wg.exchangeBaseUrl; @@ -1880,7 +1880,7 @@ async function processWithdrawalGroupPendingReady( checkDbInvariant( withdrawalGroup.denomsSel !== undefined, - "can't process unitialized exchange", + "can't process uninitialized exchange", ); const exchangeBaseUrl = withdrawalGroup.exchangeBaseUrl; await fetchFreshExchange(wex, withdrawalGroup.exchangeBaseUrl); -- cgit v1.2.3