From aaf950e2ad5c07d4423f9822e3a0ae9f7b8d2bdf Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 30 Mar 2020 16:09:32 +0530 Subject: re-format with prettier v2, fix HTML --- src/operations/balance.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/operations/balance.ts') diff --git a/src/operations/balance.ts b/src/operations/balance.ts index 03d1b2a9f..8858e8b43 100644 --- a/src/operations/balance.ts +++ b/src/operations/balance.ts @@ -34,8 +34,7 @@ export async function getBalancesInsideTransaction( ws: InternalWalletState, tx: TransactionHandle, ): Promise { - - /** + /** * Add amount to a balance field, both for * the slicing by exchange and currency. */ @@ -74,7 +73,7 @@ export async function getBalancesInsideTransaction( byExchange: {}, }; - await tx.iter(Stores.coins).forEach(c => { + await tx.iter(Stores.coins).forEach((c) => { if (c.suspended) { return; } @@ -82,7 +81,7 @@ export async function getBalancesInsideTransaction( addTo(balanceStore, "available", c.currentAmount, c.exchangeBaseUrl); } }); - await tx.iter(Stores.refreshGroups).forEach(r => { + await tx.iter(Stores.refreshGroups).forEach((r) => { // Don't count finished refreshes, since the refresh already resulted // in coins being added to the wallet. if (r.timestampFinished) { @@ -107,7 +106,7 @@ export async function getBalancesInsideTransaction( } }); - await tx.iter(Stores.withdrawalSession).forEach(wds => { + await tx.iter(Stores.withdrawalSession).forEach((wds) => { let w = wds.totalCoinValue; for (let i = 0; i < wds.planchets.length; i++) { if (wds.withdrawn[i]) { @@ -120,7 +119,7 @@ export async function getBalancesInsideTransaction( addTo(balanceStore, "pendingIncoming", w, wds.exchangeBaseUrl); }); - await tx.iter(Stores.purchases).forEach(t => { + await tx.iter(Stores.purchases).forEach((t) => { if (t.timestampFirstSuccessfulPay) { return; } @@ -145,14 +144,16 @@ export async function getBalances( ): Promise { logger.trace("starting to compute balance"); - return await ws.db.runWithReadTransaction([ - Stores.coins, - Stores.refreshGroups, - Stores.reserves, - Stores.purchases, - Stores.withdrawalSession, - ], - async tx => { - return getBalancesInsideTransaction(ws, tx); - }); + return await ws.db.runWithReadTransaction( + [ + Stores.coins, + Stores.refreshGroups, + Stores.reserves, + Stores.purchases, + Stores.withdrawalSession, + ], + async (tx) => { + return getBalancesInsideTransaction(ws, tx); + }, + ); } -- cgit v1.2.3