From f332d61fb68fbc394f31337ddeb7d1fc114772d0 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Dec 2020 16:45:15 +0100 Subject: formatting pass --- packages/taler-wallet-core/src/TalerErrorCode.ts | 3 -- .../src/crypto/talerCrypto-test.ts | 1 - packages/taler-wallet-core/src/db.ts | 5 ++- .../taler-wallet-core/src/headless/NodeHttpLib.ts | 7 ++-- packages/taler-wallet-core/src/headless/helpers.ts | 7 ++-- .../taler-wallet-core/src/operations/backup.ts | 12 ++++--- .../taler-wallet-core/src/operations/errors.ts | 4 ++- .../taler-wallet-core/src/operations/exchanges.ts | 37 +++++++++++----------- packages/taler-wallet-core/src/operations/pay.ts | 16 ++++++---- .../taler-wallet-core/src/operations/recoup.ts | 5 +-- .../taler-wallet-core/src/operations/refund.ts | 10 ++++-- packages/taler-wallet-core/src/operations/tip.ts | 5 ++- .../taler-wallet-core/src/operations/withdraw.ts | 15 +++++---- .../taler-wallet-core/src/types/backupTypes.ts | 13 ++++---- .../taler-wallet-core/src/types/notifications.ts | 2 +- packages/taler-wallet-core/src/types/types-test.ts | 5 ++- .../taler-wallet-core/src/types/walletTypes.ts | 24 +++++++------- .../taler-wallet-core/src/util/RequestThrottler.ts | 6 +++- packages/taler-wallet-core/src/util/helpers.ts | 2 +- packages/taler-wallet-core/src/util/http.ts | 9 ++---- packages/taler-wallet-core/src/util/query.ts | 9 +++--- packages/taler-wallet-core/src/util/retries.ts | 2 +- packages/taler-wallet-core/src/util/taleruri.ts | 2 +- packages/taler-wallet-core/src/wallet.ts | 17 +++++++--- 24 files changed, 120 insertions(+), 98 deletions(-) (limited to 'packages/taler-wallet-core/src') diff --git a/packages/taler-wallet-core/src/TalerErrorCode.ts b/packages/taler-wallet-core/src/TalerErrorCode.ts index a662e2720..a78b04f25 100644 --- a/packages/taler-wallet-core/src/TalerErrorCode.ts +++ b/packages/taler-wallet-core/src/TalerErrorCode.ts @@ -22,8 +22,6 @@ */ export enum TalerErrorCode { - - /** * Special code to indicate success (no error). * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1668,5 +1666,4 @@ export enum TalerErrorCode { * (A value of 0 indicates that the error is generated client-side). */ END = 9999, - } diff --git a/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts b/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts index fb8d2a40f..99a0e12c0 100644 --- a/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts +++ b/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts @@ -187,4 +187,3 @@ test("taler-exchange-tvg eddsa_ecdh #2", (t) => { ); t.deepEqual(encodeCrock(myKm2), key_material); }); - diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 6f5b6b453..b13abac57 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -76,7 +76,10 @@ export function openTalerDatabase( if ((si as any)[indexName] instanceof Index) { const ii: Index = (si as any)[indexName]; const indexVersionAdded = ii.options?.versionAdded ?? 0; - if (indexVersionAdded > oldVersion || storeVersionAdded > oldVersion) { + if ( + indexVersionAdded > oldVersion || + storeVersionAdded > oldVersion + ) { s.createIndex(ii.indexName, ii.keyPath, ii.options); } } diff --git a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts index 5eefb24f9..68a549274 100644 --- a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts +++ b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts @@ -31,7 +31,7 @@ import { OperationFailedError, makeErrorDetails } from "../operations/errors"; import { TalerErrorCode } from "../TalerErrorCode"; import { URL } from "../util/url"; import { Logger } from "../util/logging"; -import { bytesToString } from '../crypto/talerCrypto'; +import { bytesToString } from "../crypto/talerCrypto"; const logger = new Logger("NodeHttpLib.ts"); @@ -92,10 +92,10 @@ export class NodeHttpLib implements HttpRequestLibrary { ); } - const makeText = async(): Promise => { + const makeText = async (): Promise => { const respText = new Uint8Array(resp.data); return bytesToString(respText); - } + }; const makeJson = async (): Promise => { let responseJson; @@ -152,7 +152,6 @@ export class NodeHttpLib implements HttpRequestLibrary { json: makeJson, bytes: makeBytes, }; - } async get(url: string, opt?: HttpRequestOptions): Promise { return this.fetch(url, { diff --git a/packages/taler-wallet-core/src/headless/helpers.ts b/packages/taler-wallet-core/src/headless/helpers.ts index 09f0ca906..30b670032 100644 --- a/packages/taler-wallet-core/src/headless/helpers.ts +++ b/packages/taler-wallet-core/src/headless/helpers.ts @@ -64,8 +64,7 @@ export interface DefaultNodeWalletArgs { */ function makeId(length: number): string { let result = ""; - const characters = - "abcdefghijklmnopqrstuvwxyz0123456789"; + const characters = "abcdefghijklmnopqrstuvwxyz0123456789"; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * characters.length)); } @@ -129,7 +128,9 @@ export async function getDefaultNodeWallet( const myVersionChange = (): Promise => { logger.error("version change requested, should not happen"); - throw Error("BUG: wallet DB version change event can't happen with memory IDB"); + throw Error( + "BUG: wallet DB version change event can't happen with memory IDB", + ); }; shimIndexedDB(myBridgeIdbFactory); diff --git a/packages/taler-wallet-core/src/operations/backup.ts b/packages/taler-wallet-core/src/operations/backup.ts index 6c497b305..f609d4354 100644 --- a/packages/taler-wallet-core/src/operations/backup.ts +++ b/packages/taler-wallet-core/src/operations/backup.ts @@ -120,7 +120,7 @@ async function provideBackupState( key: WALLET_BACKUP_STATE_KEY, value: { deviceId, - clocks: { [deviceId]: 1}, + clocks: { [deviceId]: 1 }, walletRootPub: k.pub, walletRootPriv: k.priv, lastBackupHash: undefined, @@ -152,7 +152,9 @@ export async function exportBackup( const exchanges: BackupExchange[] = []; const coinsByDenom: { [dph: string]: BackupCoin[] } = {}; - const denominationsByExchange: { [url: string]: BackupDenomination[] } = {}; + const denominationsByExchange: { + [url: string]: BackupDenomination[]; + } = {}; const reservesByExchange: { [url: string]: BackupReserve[] } = {}; await tx.iter(Stores.coins).forEach((coin) => { @@ -193,7 +195,9 @@ export async function exportBackup( }); await tx.iter(Stores.denominations).forEach((denom) => { - const backupDenoms = (denominationsByExchange[denom.exchangeBaseUrl] ??= []); + const backupDenoms = (denominationsByExchange[ + denom.exchangeBaseUrl + ] ??= []); backupDenoms.push({ coins: coinsByDenom[denom.denomPubHash] ?? [], denom_pub: denom.denomPub, @@ -401,7 +405,7 @@ export async function runBackupCycle(ws: InternalWalletState): Promise { if (resp.status === HttpResponseStatus.PaymentRequired) { logger.trace("payment required for backup"); - logger.trace(`headers: ${j2s(resp.headers)}`) + logger.trace(`headers: ${j2s(resp.headers)}`); return; } diff --git a/packages/taler-wallet-core/src/operations/errors.ts b/packages/taler-wallet-core/src/operations/errors.ts index 4eeda898b..8ec8468a1 100644 --- a/packages/taler-wallet-core/src/operations/errors.ts +++ b/packages/taler-wallet-core/src/operations/errors.ts @@ -36,7 +36,9 @@ export class OperationFailedAndReportedError extends Error { message: string, details: Record, ): OperationFailedAndReportedError { - return new OperationFailedAndReportedError(makeErrorDetails(ec, message, details)); + return new OperationFailedAndReportedError( + makeErrorDetails(ec, message, details), + ); } constructor(public operationError: TalerErrorDetails) { diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index b82700365..b6865cccc 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -289,24 +289,21 @@ async function updateExchangeFinalize( if (exchange.updateStatus != ExchangeUpdateStatus.FinalizeUpdate) { return; } - await ws.db.runWithWriteTransaction( - [Stores.exchanges], - async (tx) => { - const r = await tx.get(Stores.exchanges, exchangeBaseUrl); - if (!r) { - return; - } - if (r.updateStatus != ExchangeUpdateStatus.FinalizeUpdate) { - return; - } - r.addComplete = true; - r.updateStatus = ExchangeUpdateStatus.Finished; - // Reset time to next auto refresh check, - // as now new denominations might be available. - r.nextRefreshCheck = undefined; - await tx.put(Stores.exchanges, r); - }, - ); + await ws.db.runWithWriteTransaction([Stores.exchanges], async (tx) => { + const r = await tx.get(Stores.exchanges, exchangeBaseUrl); + if (!r) { + return; + } + if (r.updateStatus != ExchangeUpdateStatus.FinalizeUpdate) { + return; + } + r.addComplete = true; + r.updateStatus = ExchangeUpdateStatus.Finished; + // Reset time to next auto refresh check, + // as now new denominations might be available. + r.nextRefreshCheck = undefined; + await tx.put(Stores.exchanges, r); + }); } async function updateExchangeWithTermsOfService( @@ -547,7 +544,9 @@ export async function getExchangeTrust( ); if (currencyRecord) { for (const trustedExchange of currencyRecord.exchanges) { - if (trustedExchange.exchangeMasterPub === exchangeDetails.masterPublicKey) { + if ( + trustedExchange.exchangeMasterPub === exchangeDetails.masterPublicKey + ) { isTrusted = true; break; } diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index ad970129f..52f0c4510 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -435,7 +435,9 @@ async function recordConfirmPay( } else { sessionId = proposal.downloadSessionId; } - logger.trace(`recording payment on ${proposal.orderId} with session ID ${sessionId}`); + logger.trace( + `recording payment on ${proposal.orderId} with session ID ${sessionId}`, + ); const payCostInfo = await getTotalPaymentCost(ws, coinSelection); const t: PurchaseRecord = { abortStatus: AbortStatus.None, @@ -943,7 +945,10 @@ async function submitPay( session_id: purchase.lastSessionId, }; - logger.trace("making pay request ... ", JSON.stringify(reqBody, undefined, 2)); + logger.trace( + "making pay request ... ", + JSON.stringify(reqBody, undefined, 2), + ); const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], () => ws.http.postJson(payUrl, reqBody, { @@ -971,7 +976,7 @@ async function submitPay( lastError: err, }; } - + const merchantResp = await readSuccessResponseJsonOrThrow( resp, codecForMerchantPayResponse(), @@ -1208,10 +1213,7 @@ export async function confirmPay( throw Error("proposal is in invalid state"); } - let purchase = await ws.db.get( - Stores.purchases, - proposalId, - ); + let purchase = await ws.db.get(Stores.purchases, proposalId); if (purchase) { if ( diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts index 585c91a09..7bbac8a99 100644 --- a/packages/taler-wallet-core/src/operations/recoup.ts +++ b/packages/taler-wallet-core/src/operations/recoup.ts @@ -38,10 +38,7 @@ import { import { codecForRecoupConfirmation } from "../types/talerTypes"; import { NotificationType } from "../types/notifications"; -import { - getReserveRequestTimeout, - processReserve, -} from "./reserves"; +import { getReserveRequestTimeout, processReserve } from "./reserves"; import { Amounts } from "../util/amounts"; import { createRefreshGroup, processRefreshGroup } from "./refresh"; diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index e0d060376..36b21b232 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -286,7 +286,10 @@ async function storeFailedRefund( } if (contrib) { coin.currentAmount = Amounts.add(coin.currentAmount, contrib).amount; - coin.currentAmount = Amounts.sub(coin.currentAmount, denom.feeRefund).amount; + coin.currentAmount = Amounts.sub( + coin.currentAmount, + denom.feeRefund, + ).amount; } refreshCoinsMap[coin.coinPub] = { coinPub: coin.coinPub }; await tx.put(Stores.coins, coin); @@ -325,7 +328,8 @@ async function acceptRefunds( const isPermanentFailure = refundStatus.type === "failure" && - refundStatus.exchange_status >= 400 && refundStatus.exchange_status < 500 ; + refundStatus.exchange_status >= 400 && + refundStatus.exchange_status < 500; // Already failed. if (existingRefundInfo?.type === RefundState.Failed) { @@ -536,7 +540,7 @@ export async function applyRefund( fulfillmentMessage: purchase.contractData.fulfillmentMessage, summary_i18n: purchase.contractData.summaryI18n, fulfillmentMessage_i18n: purchase.contractData.fulfillmentMessageI18n, - } + }, }; } diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index bf565b9b2..a57963824 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -40,7 +40,10 @@ import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto"; import { guardOperationException, makeErrorDetails } from "./errors"; import { NotificationType } from "../types/notifications"; import { getTimestampNow } from "../util/time"; -import { getHttpResponseErrorDetails, readSuccessResponseJsonOrThrow } from "../util/http"; +import { + getHttpResponseErrorDetails, + readSuccessResponseJsonOrThrow, +} from "../util/http"; import { URL } from "../util/url"; import { Logger } from "../util/logging"; import { checkDbInvariant } from "../util/invariants"; diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index d09903cbb..a3bb9724c 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -43,7 +43,10 @@ import { InternalWalletState } from "./state"; import { parseWithdrawUri } from "../util/taleruri"; import { Logger } from "../util/logging"; import { updateExchangeFromUrl, getExchangeTrust } from "./exchanges"; -import { WALLET_EXCHANGE_PROTOCOL_VERSION, WALLET_BANK_INTEGRATION_PROTOCOL_VERSION } from "./versions"; +import { + WALLET_EXCHANGE_PROTOCOL_VERSION, + WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, +} from "./versions"; import * as LibtoolVersion from "../util/libtoolVersion"; import { @@ -155,10 +158,7 @@ export async function getBankWithdrawalInfo( throw Error(`can't parse URL ${talerWithdrawUri}`); } - const configReqUrl = new URL( - "config", - uriResult.bankIntegrationApiBaseUrl, - ) + const configReqUrl = new URL("config", uriResult.bankIntegrationApiBaseUrl); const configResp = await ws.http.get(configReqUrl.href); const config = await readSuccessResponseJsonOrThrow( @@ -166,7 +166,10 @@ export async function getBankWithdrawalInfo( codecForTalerConfigResponse(), ); - const versionRes = compare(WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, config.version); + const versionRes = compare( + WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, + config.version, + ); if (versionRes?.compatible != true) { const opErr = makeErrorDetails( TalerErrorCode.WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE, diff --git a/packages/taler-wallet-core/src/types/backupTypes.ts b/packages/taler-wallet-core/src/types/backupTypes.ts index 247a4d398..daf2fbe5a 100644 --- a/packages/taler-wallet-core/src/types/backupTypes.ts +++ b/packages/taler-wallet-core/src/types/backupTypes.ts @@ -23,6 +23,7 @@ * Current limitations: * 1. Exchange/auditor trust isn't exported yet * (see https://bugs.gnunet.org/view.php?id=6448) + * 2. Reports to the auditor (cryptographic proofs and/or diagnostics) aren't exported yet * * General considerations / decisions: * 1. Information about previously occurring errors and @@ -196,7 +197,7 @@ export interface WalletBackupContentV1 { /** * Interning table for forgettable values of contract terms. - * + * * Used to reduce storage space, as many forgettable items (product image, * addresses, etc.) might be shared among many contract terms. */ @@ -205,7 +206,7 @@ export interface WalletBackupContentV1 { /** * Trust declaration for an auditor. - * + * * The trust applies based on the public key of * the auditor, irrespective of what base URL the exchange * is referencing. @@ -223,7 +224,7 @@ export interface BackupTrustAuditor { /** * Clock when the auditor trust has been added. - * + * * Can be undefined if this entry represents a removal delta * from the wallet's defaults. */ @@ -237,7 +238,7 @@ export interface BackupTrustAuditor { /** * Trust declaration for an exchange. - * + * * The trust only applies for the combination of base URL * and public key. If the master public key changes while the base * URL stays the same, the exchange has to be re-added by a wallet update @@ -256,12 +257,12 @@ export interface BackupTrustExchange { /** * Clock when the exchange trust has been added. - * + * * Can be undefined if this entry represents a removal delta * from the wallet's defaults. */ clock_added?: ClockValue; - + /** * Clock for when the exchange trust has been removed. */ diff --git a/packages/taler-wallet-core/src/types/notifications.ts b/packages/taler-wallet-core/src/types/notifications.ts index 7faf730ef..533223cc0 100644 --- a/packages/taler-wallet-core/src/types/notifications.ts +++ b/packages/taler-wallet-core/src/types/notifications.ts @@ -223,7 +223,7 @@ export interface ReserveRegisteredWithBankNotification { /** * Notification sent when a pay (or pay replay) operation succeeded. - * + * * We send this notification because the confirmPay request can return * a "confirmed" response that indicates that the payment has been confirmed * by the user, but we're still waiting for the payment to succeed or fail. diff --git a/packages/taler-wallet-core/src/types/types-test.ts b/packages/taler-wallet-core/src/types/types-test.ts index 183122ef7..19c9b5aa6 100644 --- a/packages/taler-wallet-core/src/types/types-test.ts +++ b/packages/taler-wallet-core/src/types/types-test.ts @@ -54,7 +54,6 @@ test("contract terms validation", (t) => { t.fail(); }); - test("contract terms validation (locations)", (t) => { const c = { nonce: "123123123", @@ -69,7 +68,7 @@ test("contract terms validation (locations)", (t) => { name: "Foo", address: { country: "DE", - } + }, }, order_id: "test_order", pay_deadline: { t_ms: 42 }, @@ -83,7 +82,7 @@ test("contract terms validation (locations)", (t) => { delivery_location: { country: "FR", town: "Rennes", - } + }, }; const r = codecForContractTerms().decode(c); diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index ab7d3b4db..d0e72b289 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -365,13 +365,13 @@ export interface PrepareTipResult { * Amount that the merchant gave. */ tipAmountRaw: AmountString; - + /** * Amount that arrived at the wallet. * Might be lower than the raw amount due to fees. */ tipAmountEffective: AmountString; - + /** * Base URL of the merchant backend giving then tip. */ @@ -382,7 +382,7 @@ export interface PrepareTipResult { * Determined by the merchant, the wallet/user has no choice here. */ exchangeBaseUrl: string; - + /** * Time when the tip will expire. After it expired, it can't be picked * up anymore. @@ -392,13 +392,13 @@ export interface PrepareTipResult { export const codecForPrepareTipResult = (): Codec => buildCodecForObject() - .property("accepted", codecForBoolean()) - .property("tipAmountRaw", codecForAmountString()) - .property("tipAmountEffective", codecForAmountString()) - .property("exchangeBaseUrl", codecForString()) - .property("merchantBaseUrl", codecForString()) - .property("expirationTimestamp", codecForTimestamp) - .property("walletTipId", codecForString()) + .property("accepted", codecForBoolean()) + .property("tipAmountRaw", codecForAmountString()) + .property("tipAmountEffective", codecForAmountString()) + .property("exchangeBaseUrl", codecForString()) + .property("merchantBaseUrl", codecForString()) + .property("expirationTimestamp", codecForTimestamp) + .property("walletTipId", codecForString()) .build("PrepareTipResult"); export interface BenchmarkResult { @@ -974,7 +974,9 @@ export interface AbortPayWithRefundRequest { proposalId: string; } -export const codecForAbortPayWithRefundRequest = (): Codec => +export const codecForAbortPayWithRefundRequest = (): Codec< + AbortPayWithRefundRequest +> => buildCodecForObject() .property("proposalId", codecForString()) .build("AbortPayWithRefundRequest"); diff --git a/packages/taler-wallet-core/src/util/RequestThrottler.ts b/packages/taler-wallet-core/src/util/RequestThrottler.ts index 8c9f304e0..0bdd7cab7 100644 --- a/packages/taler-wallet-core/src/util/RequestThrottler.ts +++ b/packages/taler-wallet-core/src/util/RequestThrottler.ts @@ -21,7 +21,11 @@ /** * Imports. */ -import { getTimestampNow, timestampDifference, timestampCmp } from "../util/time"; +import { + getTimestampNow, + timestampDifference, + timestampCmp, +} from "../util/time"; import { URL } from "./url"; import { Logger } from "./logging"; diff --git a/packages/taler-wallet-core/src/util/helpers.ts b/packages/taler-wallet-core/src/util/helpers.ts index 570df441d..3d8999ed5 100644 --- a/packages/taler-wallet-core/src/util/helpers.ts +++ b/packages/taler-wallet-core/src/util/helpers.ts @@ -149,4 +149,4 @@ export function strcmp(s1: string, s2: string): number { export function j2s(x: any): string { return JSON.stringify(x, undefined, 2); -} \ No newline at end of file +} diff --git a/packages/taler-wallet-core/src/util/http.ts b/packages/taler-wallet-core/src/util/http.ts index 1ec9c2f50..4b0a8e75a 100644 --- a/packages/taler-wallet-core/src/util/http.ts +++ b/packages/taler-wallet-core/src/util/http.ts @@ -17,7 +17,7 @@ /** * Helpers for doing XMLHttpRequest-s that are based on ES6 promises. * Allows for easy mocking for test cases. - * + * * The API is inspired by the HTML5 fetch API. */ @@ -91,7 +91,7 @@ export class Headers { toJSON(): any { const m: Record = {}; - this.headerMap.forEach((v, k) => m[k] = v); + this.headerMap.forEach((v, k) => (m[k] = v)); return m; } } @@ -120,10 +120,7 @@ export interface HttpRequestLibrary { /** * Make an HTTP POST request with a JSON body. */ - fetch( - url: string, - opt?: HttpRequestOptions, - ): Promise; + fetch(url: string, opt?: HttpRequestOptions): Promise; } type TalerErrorResponse = { diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts index beb14cad0..e1a23b168 100644 --- a/packages/taler-wallet-core/src/util/query.ts +++ b/packages/taler-wallet-core/src/util/query.ts @@ -25,7 +25,6 @@ */ import { openPromise } from "./promiseUtils"; import { - IDBObjectStoreParameters, IDBRequest, IDBTransaction, IDBValidKey, @@ -574,7 +573,7 @@ export class Database { async get( store: Store, - key: any, + key: IDBValidKey, ): Promise { const tx = this.db.transaction([store.name], "readonly"); const req = tx.objectStore(store.name).get(key); @@ -585,7 +584,7 @@ export class Database { async getIndexed>( index: InferIndex, - key: any, + key: IDBValidKey, ): Promise | undefined> { const tx = this.db.transaction([index.storeName], "readonly"); const req = tx.objectStore(index.storeName).index(index.indexName).get(key); @@ -597,7 +596,7 @@ export class Database { async put>( store: St, value: StoreContent, - key?: any, + key?: IDBValidKey, ): Promise { const tx = this.db.transaction([store.name], "readwrite"); const req = tx.objectStore(store.name).put(value, key); @@ -608,7 +607,7 @@ export class Database { async mutate( store: Store, - key: any, + key: IDBValidKey, f: (x: T) => T | undefined, ): Promise { const tx = this.db.transaction([store.name], "readwrite"); diff --git a/packages/taler-wallet-core/src/util/retries.ts b/packages/taler-wallet-core/src/util/retries.ts index f3a5e7d80..8be78cfc8 100644 --- a/packages/taler-wallet-core/src/util/retries.ts +++ b/packages/taler-wallet-core/src/util/retries.ts @@ -89,4 +89,4 @@ export function initRetryInfo( }; updateRetryInfoTimeout(info, p); return info; -} \ No newline at end of file +} diff --git a/packages/taler-wallet-core/src/util/taleruri.ts b/packages/taler-wallet-core/src/util/taleruri.ts index ee055a32f..d8366fd0f 100644 --- a/packages/taler-wallet-core/src/util/taleruri.ts +++ b/packages/taler-wallet-core/src/util/taleruri.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ -import { canonicalizeBaseUrl } from './helpers'; +import { canonicalizeBaseUrl } from "./helpers"; import { URLSearchParams } from "./url"; export interface PayUriResult { diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 4491a167b..07af32bb8 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -132,7 +132,11 @@ import { PendingOperationType, } from "./types/pending"; import { WalletNotification, NotificationType } from "./types/notifications"; -import { processPurchaseQueryRefund, applyRefund, abortFailedPayWithRefund } from "./operations/refund"; +import { + processPurchaseQueryRefund, + applyRefund, + abortFailedPayWithRefund, +} from "./operations/refund"; import { durationMin, Duration } from "./util/time"; import { processRecoupGroup } from "./operations/recoup"; import { @@ -152,7 +156,12 @@ import { testPay, } from "./operations/testing"; import { TalerErrorCode } from "."; -import { addBackupProvider, codecForAddBackupProviderRequest, runBackupCycle, exportBackup } from './operations/backup'; +import { + addBackupProvider, + codecForAddBackupProviderRequest, + runBackupCycle, + exportBackup, +} from "./operations/backup"; const builtinCurrencies: CurrencyRecord[] = [ { @@ -721,9 +730,7 @@ export class Wallet { * Accept a refund, return the contract hash for the contract * that was involved in the refund. */ - async applyRefund( - talerRefundUri: string, - ): Promise { + async applyRefund(talerRefundUri: string): Promise { return applyRefund(this.ws, talerRefundUri); } -- cgit v1.2.3