aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-06-03 16:46:25 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-06-03 16:46:25 +0530
commit83af702f1cae043902e23e9358c3e036ddca8d33 (patch)
tree3b27fa06fd890406224a0cc4e074d9bd9457230d /src
parent77c61e738181561979da64a480fe21f70f6fe1f4 (diff)
re-indent with latest version of prettier
Diffstat (limited to 'src')
-rw-r--r--src/android/index.ts7
-rw-r--r--src/crypto/workers/cryptoImplementation.ts16
-rw-r--r--src/headless/integrationtest.ts8
-rw-r--r--src/headless/taler-wallet-cli.ts5
-rw-r--r--src/operations/history.ts10
-rw-r--r--src/operations/pay.ts5
-rw-r--r--src/operations/pending.ts14
-rw-r--r--src/operations/reserves.ts6
-rw-r--r--src/operations/tip.ts5
-rw-r--r--src/operations/withdraw.ts14
-rw-r--r--src/types/talerTypes.ts8
-rw-r--r--src/types/transactions.ts2
-rw-r--r--src/types/walletTypes.ts3
-rw-r--r--src/util/amounts.ts2
-rw-r--r--src/util/time.ts1
-rw-r--r--src/webex/pages/popup.tsx10
-rw-r--r--src/webex/pages/welcome.tsx23
-rw-r--r--src/webex/pages/withdraw.tsx23
-rw-r--r--src/webex/permissions.ts2
19 files changed, 96 insertions, 68 deletions
diff --git a/src/android/index.ts b/src/android/index.ts
index 0e8efd840..a10236cee 100644
--- a/src/android/index.ts
+++ b/src/android/index.ts
@@ -33,7 +33,10 @@ import {
} from "../util/http";
import { NodeHttpLib } from "../headless/NodeHttpLib";
import { WalletNotification } from "../types/notifications";
-import { WALLET_EXCHANGE_PROTOCOL_VERSION, WALLET_MERCHANT_PROTOCOL_VERSION } from "../operations/versions";
+import {
+ WALLET_EXCHANGE_PROTOCOL_VERSION,
+ WALLET_MERCHANT_PROTOCOL_VERSION,
+} from "../operations/versions";
// @ts-ignore: special built-in module
//import akono = require("akono");
@@ -159,7 +162,7 @@ class AndroidWalletMessageHandler {
supported_protocol_versions: {
exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
- }
+ },
};
}
case "getTransactions": {
diff --git a/src/crypto/workers/cryptoImplementation.ts b/src/crypto/workers/cryptoImplementation.ts
index dc0452dc1..e0ba24e47 100644
--- a/src/crypto/workers/cryptoImplementation.ts
+++ b/src/crypto/workers/cryptoImplementation.ts
@@ -65,7 +65,11 @@ import {
} from "../talerCrypto";
import { randomBytes } from "../primitives/nacl-fast";
import { kdf } from "../primitives/kdf";
-import { Timestamp, getTimestampNow, timestampTruncateToSecond } from "../../util/time";
+import {
+ Timestamp,
+ getTimestampNow,
+ timestampTruncateToSecond,
+} from "../../util/time";
enum SignaturePurpose {
RESERVE_WITHDRAW = 1200,
@@ -368,7 +372,10 @@ export class CryptoImplementation {
for (const ncd of newCoinDenoms.selectedDenoms) {
const t = Amounts.add(ncd.denom.value, ncd.denom.feeWithdraw).amount;
- valueWithFee = Amounts.add(valueWithFee, Amounts.mult(t, ncd.count).amount).amount;
+ valueWithFee = Amounts.add(
+ valueWithFee,
+ Amounts.mult(t, ncd.count).amount,
+ ).amount;
}
// melt fee
@@ -406,7 +413,10 @@ export class CryptoImplementation {
const coinNumber = planchets.length;
const transferPriv = decodeCrock(transferPrivs[i]);
const oldCoinPub = decodeCrock(meltCoin.coinPub);
- const transferSecret = keyExchangeEcdheEddsa(transferPriv, oldCoinPub);
+ const transferSecret = keyExchangeEcdheEddsa(
+ transferPriv,
+ oldCoinPub,
+ );
const fresh = setupRefreshPlanchet(transferSecret, coinNumber);
const coinPriv = fresh.coinPriv;
const coinPub = fresh.coinPub;
diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts
index 5beb7b793..db96d57c4 100644
--- a/src/headless/integrationtest.ts
+++ b/src/headless/integrationtest.ts
@@ -87,7 +87,9 @@ async function makePayment(
};
}
-export async function runIntegrationTest(args: IntegrationTestArgs): Promise<void> {
+export async function runIntegrationTest(
+ args: IntegrationTestArgs,
+): Promise<void> {
logger.info("running test with arguments", args);
const parsedSpendAmount = Amounts.parseOrThrow(args.amountToSpend);
@@ -191,7 +193,9 @@ export async function runIntegrationTest(args: IntegrationTestArgs): Promise<voi
);
}
-export async function runIntegrationTestBasic(cfg: Configuration): Promise<void> {
+export async function runIntegrationTestBasic(
+ cfg: Configuration,
+): Promise<void> {
const walletDbPath = cfg.getString("integrationtest", "walletdb").required();
const bankBaseUrl = cfg
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 72d00a065..5a792ee00 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -649,7 +649,10 @@ testCli
args.genTipUri.merchant ?? "https://backend.test.taler.net/",
args.genTipUri.merchantApiKey ?? "sandbox",
);
- const tipUri = await merchantBackend.authorizeTip(args.genTipUri.amount, "test");
+ const tipUri = await merchantBackend.authorizeTip(
+ args.genTipUri.amount,
+ "test",
+ );
console.log(tipUri);
});
diff --git a/src/operations/history.ts b/src/operations/history.ts
index 4e43596f0..f04dad113 100644
--- a/src/operations/history.ts
+++ b/src/operations/history.ts
@@ -18,11 +18,7 @@
* Imports.
*/
import { InternalWalletState } from "./state";
-import {
- Stores,
- ProposalStatus,
- ProposalRecord,
-} from "../types/dbTypes";
+import { Stores, ProposalStatus, ProposalRecord } from "../types/dbTypes";
import { Amounts } from "../util/amounts";
import { AmountJson } from "../util/amounts";
import {
@@ -216,7 +212,9 @@ export async function getHistory(
HistoryEventType.Withdrawn,
wsr.withdrawalGroupId,
),
- amountWithdrawnEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
+ amountWithdrawnEffective: Amounts.stringify(
+ wsr.denomsSel.totalCoinValue,
+ ),
amountWithdrawnRaw: Amounts.stringify(wsr.rawWithdrawalAmount),
exchangeBaseUrl: wsr.exchangeBaseUrl,
timestamp: wsr.timestampFinish,
diff --git a/src/operations/pay.ts b/src/operations/pay.ts
index b2627f74d..7faace46e 100644
--- a/src/operations/pay.ts
+++ b/src/operations/pay.ts
@@ -165,7 +165,7 @@ export async function getTotalPaymentCost(
costs.push(refreshCost);
}
return {
- totalCost: Amounts.sum(costs).amount
+ totalCost: Amounts.sum(costs).amount,
};
}
@@ -195,7 +195,8 @@ export function selectPayCoins(
Amounts.cmp(o1.feeDeposit, o2.feeDeposit) ||
strcmp(o1.denomPub, o2.denomPub),
);
- const paymentAmount = Amounts.add(contractTermsAmount, customerWireFees).amount;
+ const paymentAmount = Amounts.add(contractTermsAmount, customerWireFees)
+ .amount;
const currency = paymentAmount.currency;
let amountPayRemaining = paymentAmount;
let amountDepositFeeLimitRemaining = depositFeeLimit;
diff --git a/src/operations/pending.ts b/src/operations/pending.ts
index c793f5f0a..cf9b306d6 100644
--- a/src/operations/pending.ts
+++ b/src/operations/pending.ts
@@ -260,12 +260,14 @@ async function gatherWithdrawalPending(
}
let numCoinsWithdrawn = 0;
let numCoinsTotal = 0;
- await tx.iterIndexed(Stores.planchets.byGroup, wsr.withdrawalGroupId).forEach((x) => {
- numCoinsTotal++;
- if (x.withdrawalDone) {
- numCoinsWithdrawn++;
- }
- });
+ await tx
+ .iterIndexed(Stores.planchets.byGroup, wsr.withdrawalGroupId)
+ .forEach((x) => {
+ numCoinsTotal++;
+ if (x.withdrawalDone) {
+ numCoinsWithdrawn++;
+ }
+ });
resp.pendingOperations.push({
type: PendingOperationType.Withdraw,
givesLifeness: true,
diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 3d45d8d5a..2761dfaf9 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -106,7 +106,11 @@ export async function createReserve(
let bankInfo: ReserveBankInfo | undefined;
if (req.bankWithdrawStatusUrl) {
- const denomSelInfo = await selectWithdrawalDenoms(ws, canonExchange, req.amount);
+ const denomSelInfo = await selectWithdrawalDenoms(
+ ws,
+ canonExchange,
+ req.amount,
+ );
const denomSel = denomSelectionInfoToState(denomSelInfo);
bankInfo = {
statusUrl: req.bankWithdrawStatusUrl,
diff --git a/src/operations/tip.ts b/src/operations/tip.ts
index 15d2339b5..1ae7700a5 100644
--- a/src/operations/tip.ts
+++ b/src/operations/tip.ts
@@ -200,7 +200,10 @@ async function processTipImpl(
const planchets: TipPlanchet[] = [];
for (const sd of denomsForWithdraw.selectedDenoms) {
- const denom = await ws.db.getIndexed(Stores.denominations.denomPubHashIndex, sd.denomPubHash);
+ const denom = await ws.db.getIndexed(
+ Stores.denominations.denomPubHashIndex,
+ sd.denomPubHash,
+ );
if (!denom) {
throw Error("denom does not exist anymore");
}
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index 14071be79..284743415 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -420,17 +420,19 @@ async function processPlanchet(
}
}
-export function denomSelectionInfoToState(dsi: DenominationSelectionInfo): DenomSelectionState {
+export function denomSelectionInfoToState(
+ dsi: DenominationSelectionInfo,
+): DenomSelectionState {
return {
selectedDenoms: dsi.selectedDenoms.map((x) => {
return {
count: x.count,
- denomPubHash: x.denom.denomPubHash
+ denomPubHash: x.denom.denomPubHash,
};
}),
totalCoinValue: dsi.totalCoinValue,
totalWithdrawCost: dsi.totalWithdrawCost,
- }
+ };
}
/**
@@ -617,11 +619,7 @@ export async function getExchangeWithdrawalInfo(
throw Error(`exchange ${exchangeInfo.baseUrl} wire details not available`);
}
- const selectedDenoms = await selectWithdrawalDenoms(
- ws,
- baseUrl,
- amount,
- );
+ const selectedDenoms = await selectWithdrawalDenoms(ws, baseUrl, amount);
const exchangeWireAccounts: string[] = [];
for (const account of exchangeWireInfo.accounts) {
exchangeWireAccounts.push(account.payto_uri);
diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts
index eb10d6e1f..0221d26bb 100644
--- a/src/types/talerTypes.ts
+++ b/src/types/talerTypes.ts
@@ -869,9 +869,8 @@ export const codecForTax = (): Codec<Tax> =>
.property("tax", codecForString)
.build("Tax");
-
export const codecForI18n = (): Codec<{ [lang_tag: string]: string }> =>
- makeCodecForMap(codecForString)
+ makeCodecForMap(codecForString);
export const codecForProduct = (): Codec<Product> =>
makeCodecForObject<Product>()
@@ -908,7 +907,10 @@ export const codecForContractTerms = (): Codec<ContractTerms> =>
.property("merchant", codecForMerchantInfo())
.property("merchant_pub", codecForString)
.property("exchanges", makeCodecForList(codecForExchangeHandle()))
- .property("products", makeCodecOptional(makeCodecForList(codecForProduct())))
+ .property(
+ "products",
+ makeCodecOptional(makeCodecForList(codecForProduct())),
+ )
.property("extra", codecForAny)
.build("ContractTerms");
diff --git a/src/types/transactions.ts b/src/types/transactions.ts
index b1d033c09..6ed9a52d4 100644
--- a/src/types/transactions.ts
+++ b/src/types/transactions.ts
@@ -16,7 +16,7 @@
/**
* Type and schema definitions for the wallet's transaction list.
- *
+ *
* @author Florian Dold
* @author Torsten Grote
*/
diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts
index da87b1c1c..dbfd12b52 100644
--- a/src/types/walletTypes.ts
+++ b/src/types/walletTypes.ts
@@ -476,7 +476,6 @@ export interface DepositInfo {
denomSig: string;
}
-
export interface ExtendedPermissionsResponse {
newValue: boolean;
-} \ No newline at end of file
+}
diff --git a/src/util/amounts.ts b/src/util/amounts.ts
index cdb98b0f2..c0bb03619 100644
--- a/src/util/amounts.ts
+++ b/src/util/amounts.ts
@@ -342,7 +342,7 @@ function mult(a: AmountJson, n: number): Result {
if (n == 0) {
return { amount: getZero(a.currency), saturated: false };
}
- let acc = {... a};
+ let acc = { ...a };
while (n > 1) {
let r: Result;
if (n % 2 == 0) {
diff --git a/src/util/time.ts b/src/util/time.ts
index f296aba12..5c2f49d12 100644
--- a/src/util/time.ts
+++ b/src/util/time.ts
@@ -49,7 +49,6 @@ export function getTimestampNow(): Timestamp {
export function getDurationRemaining(
deadline: Timestamp,
now = getTimestampNow(),
-
): Duration {
if (deadline.t_ms === "never") {
return { d_ms: "forever" };
diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx
index 4d3c65b26..875bbcb5c 100644
--- a/src/webex/pages/popup.tsx
+++ b/src/webex/pages/popup.tsx
@@ -624,10 +624,12 @@ const HistoryComponent = (props: any): JSX.Element => {
class WalletSettings extends React.Component<any, any> {
render(): JSX.Element {
- return <div>
- <h2>Permissions</h2>
- <PermissionsCheckbox />
- </div>;
+ return (
+ <div>
+ <h2>Permissions</h2>
+ <PermissionsCheckbox />
+ </div>
+ );
}
}
diff --git a/src/webex/pages/welcome.tsx b/src/webex/pages/welcome.tsx
index 8d4920cac..a7c24d659 100644
--- a/src/webex/pages/welcome.tsx
+++ b/src/webex/pages/welcome.tsx
@@ -108,19 +108,16 @@ export function PermissionsCheckbox(): JSX.Element {
const granted = await new Promise<boolean>((resolve, reject) => {
// We set permissions here, since apparently FF wants this to be done
// as the result of an input event ...
- getPermissionsApi().request(
- extendedPermissions,
- (granted: boolean) => {
- if (chrome.runtime.lastError) {
- console.error("error requesting permissions");
- console.error(chrome.runtime.lastError);
- reject(chrome.runtime.lastError);
- return;
- }
- console.log("permissions granted:", granted);
- resolve(granted);
- },
- );
+ getPermissionsApi().request(extendedPermissions, (granted: boolean) => {
+ if (chrome.runtime.lastError) {
+ console.error("error requesting permissions");
+ console.error(chrome.runtime.lastError);
+ reject(chrome.runtime.lastError);
+ return;
+ }
+ console.log("permissions granted:", granted);
+ resolve(granted);
+ });
});
const res = await wxApi.setExtendedPermissions(granted);
console.log(res);
diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx
index 5ef4376f7..d8ac3c455 100644
--- a/src/webex/pages/withdraw.tsx
+++ b/src/webex/pages/withdraw.tsx
@@ -28,11 +28,13 @@ import { WithdrawDetails } from "../../types/walletTypes";
import { WithdrawDetailView, renderAmount } from "../renderHtml";
import React, { useState, useEffect } from "react";
-import { getWithdrawDetails, acceptWithdrawal, onUpdateNotification } from "../wxApi";
+import {
+ getWithdrawDetails,
+ acceptWithdrawal,
+ onUpdateNotification,
+} from "../wxApi";
-function WithdrawalDialog(props: {
- talerWithdrawUri: string;
-}): JSX.Element {
+function WithdrawalDialog(props: { talerWithdrawUri: string }): JSX.Element {
const [details, setDetails] = useState<WithdrawDetails | undefined>();
const [selectedExchange, setSelectedExchange] = useState<
string | undefined
@@ -48,8 +50,8 @@ function WithdrawalDialog(props: {
return onUpdateNotification(() => {
setUpdateCounter(updateCounter + 1);
});
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [])
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
useEffect(() => {
const fetchData = async (): Promise<void> => {
@@ -174,11 +176,12 @@ function WithdrawalDialog(props: {
<strong>{renderAmount(details.bankWithdrawDetails.amount)}</strong> from
your bank account into your wallet.
</i18n.Translate>
- { selectedExchange ?
+ {selectedExchange ? (
<p>
- The exchange <strong>{selectedExchange}</strong> will be used as the Taler payment service provider.
- </p> : null
- }
+ The exchange <strong>{selectedExchange}</strong> will be used as the
+ Taler payment service provider.
+ </p>
+ ) : null}
<div>
<button
diff --git a/src/webex/permissions.ts b/src/webex/permissions.ts
index 57ca6dc66..bcd357fd6 100644
--- a/src/webex/permissions.ts
+++ b/src/webex/permissions.ts
@@ -17,4 +17,4 @@
export const extendedPermissions = {
permissions: ["webRequest", "webRequestBlocking"],
origins: ["http://*/*", "https://*/*"],
-}; \ No newline at end of file
+};