From f36bb7a04eabe0330cb166bf9ce5021c92f38dc8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 6 Apr 2020 21:15:41 +0530 Subject: linter --- src/operations/exchanges.ts | 8 ++++---- src/operations/history.ts | 2 +- src/operations/pay.ts | 10 +++++----- src/operations/pending.ts | 16 ++++++++-------- src/operations/recoup.ts | 6 +++--- src/operations/refresh.ts | 4 ++-- src/operations/refund.ts | 6 +++--- src/operations/reserves.ts | 8 ++++---- src/operations/tip.ts | 4 ++-- src/operations/withdraw.ts | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/operations') diff --git a/src/operations/exchanges.ts b/src/operations/exchanges.ts index b9806bb62..53b250a8e 100644 --- a/src/operations/exchanges.ts +++ b/src/operations/exchanges.ts @@ -198,7 +198,7 @@ async function updateExchangeWithKeys( ), ); - let recoupGroupId: string | undefined = undefined; + const recoupGroupId: string | undefined = undefined; await ws.db.runWithWriteTransaction( [Stores.exchanges, Stores.denominations, Stores.recoupGroups, Stores.coins], @@ -459,7 +459,7 @@ async function updateExchangeWithWireInfo( export async function updateExchangeFromUrl( ws: InternalWalletState, baseUrl: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => setExchangeError(ws, baseUrl, e); return await guardOperationException( @@ -476,7 +476,7 @@ export async function updateExchangeFromUrl( async function updateExchangeFromUrlImpl( ws: InternalWalletState, baseUrl: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const now = getTimestampNow(); baseUrl = canonicalizeBaseUrl(baseUrl); @@ -583,7 +583,7 @@ export async function getExchangePaytoUri( if (!exchangeWireInfo) { throw Error(`Exchange wire info for '${exchangeBaseUrl}' not found.`); } - for (let account of exchangeWireInfo.accounts) { + for (const account of exchangeWireInfo.accounts) { const res = parsePaytoUri(account.payto_uri); if (!res) { continue; diff --git a/src/operations/history.ts b/src/operations/history.ts index edb4d9f27..b043e4a90 100644 --- a/src/operations/history.ts +++ b/src/operations/history.ts @@ -333,7 +333,7 @@ export async function getHistory( amountsRaw.push(c.currentAmount); } } - let amountRefreshedRaw = Amounts.sum(amountsRaw).amount; + const amountRefreshedRaw = Amounts.sum(amountsRaw).amount; let amountRefreshedEffective: AmountJson; if (amountsEffective.length == 0) { amountRefreshedEffective = Amounts.getZero( diff --git a/src/operations/pay.ts b/src/operations/pay.ts index 9b9d2fa9f..3a629e9c2 100644 --- a/src/operations/pay.ts +++ b/src/operations/pay.ts @@ -198,8 +198,8 @@ export function selectPayCoins( let totalFees = Amounts.getZero(currency); let amountPayRemaining = paymentAmount; let amountDepositFeeLimitRemaining = depositFeeLimit; - let customerWireFees = Amounts.getZero(currency); - let customerDepositFees = Amounts.getZero(currency); + const customerWireFees = Amounts.getZero(currency); + const customerDepositFees = Amounts.getZero(currency); for (const aci of acis) { // Don't use this coin if depositing it is more expensive than // the amount it would give the merchant. @@ -283,7 +283,7 @@ async function getCoinsForPayment( const exchanges = await ws.db.iter(Stores.exchanges).toArray(); for (const exchange of exchanges) { - let isOkay: boolean = false; + let isOkay = false; const exchangeDetails = exchange.details; if (!exchangeDetails) { continue; @@ -618,7 +618,7 @@ async function incrementPurchasePayRetry( export async function processDownloadProposal( ws: InternalWalletState, proposalId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (err: OperationError) => incrementProposalRetry(ws, proposalId, err); @@ -1106,7 +1106,7 @@ export async function confirmPay( export async function processPurchasePay( ws: InternalWalletState, proposalId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => incrementPurchasePayRetry(ws, proposalId, e); diff --git a/src/operations/pending.ts b/src/operations/pending.ts index 106e5053c..cee929aa2 100644 --- a/src/operations/pending.ts +++ b/src/operations/pending.ts @@ -54,7 +54,7 @@ async function gatherExchangePending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { if (onlyDue) { // FIXME: exchanges should also be updated regularly @@ -146,7 +146,7 @@ async function gatherReservePending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { // FIXME: this should be optimized by using an index for "onlyDue==true". await tx.iter(Stores.reserves).forEach((reserve) => { @@ -215,7 +215,7 @@ async function gatherRefreshPending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.refreshGroups).forEach((r) => { if (r.timestampFinished) { @@ -244,7 +244,7 @@ async function gatherWithdrawalPending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.withdrawalGroups).forEach((wsr) => { if (wsr.timestampFinish) { @@ -279,7 +279,7 @@ async function gatherProposalPending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.proposals).forEach((proposal) => { if (proposal.proposalStatus == ProposalStatus.PROPOSED) { @@ -320,7 +320,7 @@ async function gatherTipPending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.tips).forEach((tip) => { if (tip.pickedUp) { @@ -350,7 +350,7 @@ async function gatherPurchasePending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.purchases).forEach((pr) => { if (pr.paymentSubmitPending) { @@ -413,7 +413,7 @@ async function gatherRecoupPending( tx: TransactionHandle, now: Timestamp, resp: PendingOperationsResponse, - onlyDue: boolean = false, + onlyDue = false, ): Promise { await tx.iter(Stores.recoupGroups).forEach((rg) => { if (rg.timestampFinished) { diff --git a/src/operations/recoup.ts b/src/operations/recoup.ts index e13ae3c1f..97bc39564 100644 --- a/src/operations/recoup.ts +++ b/src/operations/recoup.ts @@ -291,7 +291,7 @@ async function resetRecoupGroupRetry( export async function processRecoupGroup( ws: InternalWalletState, recoupGroupId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { await ws.memoProcessRecoup.memo(recoupGroupId, async () => { const onOpErr = (e: OperationError) => @@ -306,7 +306,7 @@ export async function processRecoupGroup( async function processRecoupGroupImpl( ws: InternalWalletState, recoupGroupId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { if (forceNow) { await resetRecoupGroupRetry(ws, recoupGroupId); @@ -386,7 +386,7 @@ async function processRecoup( const coinPub = recoupGroup.coinPubs[coinIdx]; - let coin = await ws.db.get(Stores.coins, coinPub); + const coin = await ws.db.get(Stores.coins, coinPub); if (!coin) { throw Error(`Coin ${coinPub} not found, can't request payback`); } diff --git a/src/operations/refresh.ts b/src/operations/refresh.ts index be4f5c5af..23d192e0a 100644 --- a/src/operations/refresh.ts +++ b/src/operations/refresh.ts @@ -446,7 +446,7 @@ async function refreshReveal( rg.timestampFinished = getTimestampNow(); rg.retryInfo = initRetryInfo(false); } - for (let coin of coins) { + for (const coin of coins) { await tx.put(Stores.coins, coin); } await tx.put(Stores.refreshGroups, rg); @@ -482,7 +482,7 @@ async function incrementRefreshRetry( export async function processRefreshGroup( ws: InternalWalletState, refreshGroupId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { await ws.memoProcessRefresh.memo(refreshGroupId, async () => { const onOpErr = (e: OperationError) => diff --git a/src/operations/refund.ts b/src/operations/refund.ts index f0fec4065..74d4b848e 100644 --- a/src/operations/refund.ts +++ b/src/operations/refund.ts @@ -300,7 +300,7 @@ export async function applyRefund( export async function processPurchaseQueryRefund( ws: InternalWalletState, proposalId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => incrementPurchaseQueryRefundRetry(ws, proposalId, e); @@ -366,7 +366,7 @@ async function processPurchaseQueryRefundImpl( export async function processPurchaseApplyRefund( ws: InternalWalletState, proposalId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => incrementPurchaseApplyRefundRetry(ws, proposalId, e); @@ -460,7 +460,7 @@ async function processPurchaseApplyRefundImpl( } // Groups that failed/succeeded - let groups: { [refundGroupId: string]: boolean } = {}; + const groups: { [refundGroupId: string]: boolean } = {}; // Avoid duplicates const refreshCoinsMap: { [coinPub: string]: CoinPublicKey } = {}; diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts index 5c299d112..2ee1b358f 100644 --- a/src/operations/reserves.ts +++ b/src/operations/reserves.ts @@ -248,7 +248,7 @@ export async function forceQueryReserve( export async function processReserve( ws: InternalWalletState, reservePub: string, - forceNow: boolean = false, + forceNow = false, ): Promise { return ws.memoProcessReserve.memo(reservePub, async () => { const onOpError = (err: OperationError) => @@ -264,7 +264,7 @@ async function registerReserveWithBank( ws: InternalWalletState, reservePub: string, ): Promise { - let reserve = await ws.db.get(Stores.reserves, reservePub); + const reserve = await ws.db.get(Stores.reserves, reservePub); switch (reserve?.reserveStatus) { case ReserveRecordStatus.WAIT_CONFIRM_BANK: case ReserveRecordStatus.REGISTERING_BANK: @@ -317,7 +317,7 @@ async function processReserveBankStatusImpl( ws: InternalWalletState, reservePub: string, ): Promise { - let reserve = await ws.db.get(Stores.reserves, reservePub); + const reserve = await ws.db.get(Stores.reserves, reservePub); switch (reserve?.reserveStatus) { case ReserveRecordStatus.WAIT_CONFIRM_BANK: case ReserveRecordStatus.REGISTERING_BANK: @@ -534,7 +534,7 @@ async function updateReserve( async function processReserveImpl( ws: InternalWalletState, reservePub: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const reserve = await ws.db.get(Stores.reserves, reservePub); if (!reserve) { diff --git a/src/operations/tip.ts b/src/operations/tip.ts index 7bfbddb6a..1a88dbca3 100644 --- a/src/operations/tip.ts +++ b/src/operations/tip.ts @@ -66,7 +66,7 @@ export async function getTipStatus( console.log("status", tipPickupStatus); - let amount = Amounts.parseOrThrow(tipPickupStatus.amount); + const amount = Amounts.parseOrThrow(tipPickupStatus.amount); let tipRecord = await ws.db.get(Stores.tips, [ res.merchantTipId, @@ -147,7 +147,7 @@ async function incrementTipRetry( export async function processTip( ws: InternalWalletState, tipId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => incrementTipRetry(ws, tipId, e); await guardOperationException( diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts index fcd9d70c9..70ecf9aed 100644 --- a/src/operations/withdraw.ts +++ b/src/operations/withdraw.ts @@ -394,7 +394,7 @@ async function incrementWithdrawalRetry( export async function processWithdrawGroup( ws: InternalWalletState, withdrawalGroupId: string, - forceNow: boolean = false, + forceNow = false, ): Promise { const onOpErr = (e: OperationError) => incrementWithdrawalRetry(ws, withdrawalGroupId, e); @@ -470,7 +470,7 @@ export async function getExchangeWithdrawalInfo( .reduce((a, b) => Amounts.add(a, b).amount); const exchangeWireAccounts: string[] = []; - for (let account of exchangeWireInfo.accounts) { + for (const account of exchangeWireInfo.accounts) { exchangeWireAccounts.push(account.payto_uri); } -- cgit v1.2.3