aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crypto/workers/cryptoApi.ts6
-rw-r--r--src/crypto/workers/cryptoImplementation.ts6
-rw-r--r--src/db.ts10
-rw-r--r--src/headless/helpers.ts6
-rw-r--r--src/headless/merchant.ts2
-rw-r--r--src/headless/taler-wallet-cli.ts2
-rw-r--r--src/operations/balance.ts (renamed from src/wallet-impl/balance.ts)4
-rw-r--r--src/operations/errors.ts (renamed from src/wallet-impl/errors.ts)2
-rw-r--r--src/operations/exchanges.ts (renamed from src/wallet-impl/exchanges.ts)6
-rw-r--r--src/operations/history.ts (renamed from src/wallet-impl/history.ts)4
-rw-r--r--src/operations/pay.ts (renamed from src/wallet-impl/pay.ts)8
-rw-r--r--src/operations/payback.ts (renamed from src/wallet-impl/payback.ts)6
-rw-r--r--src/operations/pending.ts (renamed from src/wallet-impl/pending.ts)6
-rw-r--r--src/operations/refresh.ts (renamed from src/wallet-impl/refresh.ts)6
-rw-r--r--src/operations/reserves.ts (renamed from src/wallet-impl/reserves.ts)8
-rw-r--r--src/operations/return.ts (renamed from src/wallet-impl/return.ts)12
-rw-r--r--src/operations/state.ts (renamed from src/wallet-impl/state.ts)6
-rw-r--r--src/operations/tip.ts (renamed from src/wallet-impl/tip.ts)7
-rw-r--r--src/operations/withdraw.ts (renamed from src/wallet-impl/withdraw.ts)8
-rw-r--r--src/types/dbTypes.ts (renamed from src/dbTypes.ts)6
-rw-r--r--src/types/history.ts58
-rw-r--r--src/types/notifications.ts213
-rw-r--r--src/types/pending.ts161
-rw-r--r--src/types/talerTypes.ts (renamed from src/talerTypes.ts)18
-rw-r--r--src/types/types-test.ts (renamed from src/types-test.ts)2
-rw-r--r--src/types/walletTypes.ts (renamed from src/walletTypes.ts)367
-rw-r--r--src/util/RequestThrottler.ts2
-rw-r--r--src/util/helpers.ts2
-rw-r--r--src/util/wire.ts2
-rw-r--r--src/wallet-test.ts6
-rw-r--r--src/wallet.ts46
-rw-r--r--src/webex/i18n.tsx (renamed from src/i18n.tsx)2
-rw-r--r--src/webex/messages.ts9
-rw-r--r--src/webex/pages/add-auditor.tsx2
-rw-r--r--src/webex/pages/auditors.tsx2
-rw-r--r--src/webex/pages/benchmark.tsx4
-rw-r--r--src/webex/pages/pay.tsx4
-rw-r--r--src/webex/pages/payback.tsx2
-rw-r--r--src/webex/pages/popup.tsx6
-rw-r--r--src/webex/pages/refund.tsx2
-rw-r--r--src/webex/pages/return-coins.tsx4
-rw-r--r--src/webex/pages/tip.tsx4
-rw-r--r--src/webex/pages/welcome.tsx2
-rw-r--r--src/webex/pages/withdraw.tsx4
-rw-r--r--src/webex/renderHtml.tsx6
-rw-r--r--src/webex/wxApi.ts4
-rw-r--r--src/webex/wxBackend.ts14
-rw-r--r--tsconfig.json39
48 files changed, 588 insertions, 520 deletions
diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts
index aa1ff2c42..3c6758670 100644
--- a/src/crypto/workers/cryptoApi.ts
+++ b/src/crypto/workers/cryptoApi.ts
@@ -30,11 +30,11 @@ import {
RefreshSessionRecord,
TipPlanchet,
WireFee,
-} from "../../dbTypes";
+} from "../../types/dbTypes";
import { CryptoWorker } from "./cryptoWorker";
-import { ContractTerms, PaybackRequest } from "../../talerTypes";
+import { ContractTerms, PaybackRequest } from "../../types/talerTypes";
import {
BenchmarkResult,
@@ -42,7 +42,7 @@ import {
PayCoinInfo,
PlanchetCreationResult,
PlanchetCreationRequest,
-} from "../../walletTypes";
+} from "../../types/walletTypes";
import * as timer from "../../util/timer";
diff --git a/src/crypto/workers/cryptoImplementation.ts b/src/crypto/workers/cryptoImplementation.ts
index fa5a30d68..04d15fb4b 100644
--- a/src/crypto/workers/cryptoImplementation.ts
+++ b/src/crypto/workers/cryptoImplementation.ts
@@ -33,9 +33,9 @@ import {
TipPlanchet,
WireFee,
initRetryInfo,
-} from "../../dbTypes";
+} from "../../types/dbTypes";
-import { CoinPaySig, ContractTerms, PaybackRequest } from "../../talerTypes";
+import { CoinPaySig, ContractTerms, PaybackRequest } from "../../types/talerTypes";
import {
BenchmarkResult,
CoinWithDenom,
@@ -44,7 +44,7 @@ import {
PlanchetCreationResult,
PlanchetCreationRequest,
getTimestampNow,
-} from "../../walletTypes";
+} from "../../types/walletTypes";
import { canonicalJson, getTalerStampSec } from "../../util/helpers";
import { AmountJson } from "../../util/amounts";
import * as Amounts from "../../util/amounts";
diff --git a/src/db.ts b/src/db.ts
index ddf3771b7..70338122e 100644
--- a/src/db.ts
+++ b/src/db.ts
@@ -1,4 +1,4 @@
-import { Stores, WALLET_DB_VERSION } from "./dbTypes";
+import { Stores, WALLET_DB_VERSION } from "./types/dbTypes";
import { Store, Index } from "./util/query";
const DB_NAME = "taler";
@@ -7,7 +7,7 @@ const DB_NAME = "taler";
* Return a promise that resolves
* to the taler wallet db.
*/
-export function openTalerDb(
+export function openDatabase(
idbFactory: IDBFactory,
onVersionChange: () => void,
onUpgradeUnsupported: (oldVersion: number, newVersion: number) => void,
@@ -59,7 +59,7 @@ export function openTalerDb(
});
}
-export function exportDb(db: IDBDatabase): Promise<any> {
+export function exportDatabase(db: IDBDatabase): Promise<any> {
const dump = {
name: db.name,
stores: {} as { [s: string]: any },
@@ -89,7 +89,7 @@ export function exportDb(db: IDBDatabase): Promise<any> {
});
}
-export function importDb(db: IDBDatabase, dump: any): Promise<void> {
+export function importDatabase(db: IDBDatabase, dump: any): Promise<void> {
console.log("importing db", dump);
return new Promise<void>((resolve, reject) => {
const tx = db.transaction(Array.from(db.objectStoreNames), "readwrite");
@@ -113,6 +113,6 @@ export function importDb(db: IDBDatabase, dump: any): Promise<void> {
});
}
-export function deleteDb(idbFactory: IDBFactory) {
+export function deleteDatabase(idbFactory: IDBFactory) {
idbFactory.deleteDatabase(DB_NAME);
}
diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index 791bd6ab5..2c0824a7d 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -23,7 +23,7 @@
*/
import { Wallet } from "../wallet";
import { MemoryBackend, BridgeIDBFactory, shimIndexedDB } from "idb-bridge";
-import { openTalerDb } from "../db";
+import { openDatabase } from "../db";
import Axios, { AxiosPromise, AxiosResponse } from "axios";
import {
HttpRequestLibrary,
@@ -36,9 +36,9 @@ import { Bank } from "./bank";
import fs = require("fs");
import { Logger } from "../util/logging";
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
-import { NotificationType, WalletNotification } from "../walletTypes";
import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
import { RequestThrottler } from "../util/RequestThrottler";
+import { WalletNotification, NotificationType } from "../types/notifications";
const logger = new Logger("helpers.ts");
@@ -191,7 +191,7 @@ export async function getDefaultNodeWallet(
shimIndexedDB(myBridgeIdbFactory);
- const myDb = await openTalerDb(
+ const myDb = await openDatabase(
myIdbFactory,
myVersionChange,
myUnsupportedUpgrade,
diff --git a/src/headless/merchant.ts b/src/headless/merchant.ts
index 5ce50cb53..6a2d0ad2e 100644
--- a/src/headless/merchant.ts
+++ b/src/headless/merchant.ts
@@ -23,7 +23,7 @@
* Imports.
*/
import axios from "axios";
-import { CheckPaymentResponse } from "../talerTypes";
+import { CheckPaymentResponse } from "../types/talerTypes";
/**
* Connection to the *internal* merchant backend.
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index d2ace124d..2e2ded52c 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -26,7 +26,7 @@ import { BridgeIDBFactory, MemoryBackend } from "idb-bridge";
import { Logger } from "../util/logging";
import * as Amounts from "../util/amounts";
import { decodeCrock } from "../crypto/talerCrypto";
-import { OperationFailedAndReportedError } from "../wallet-impl/errors";
+import { OperationFailedAndReportedError } from "../operations/errors";
import { Bank } from "./bank";
import { classifyTalerUri, TalerUriType } from "../util/taleruri";
diff --git a/src/wallet-impl/balance.ts b/src/operations/balance.ts
index 8ce91a173..8c8a2a9cf 100644
--- a/src/wallet-impl/balance.ts
+++ b/src/operations/balance.ts
@@ -17,10 +17,10 @@
/**
* Imports.
*/
-import { WalletBalance, WalletBalanceEntry } from "../walletTypes";
+import { WalletBalance, WalletBalanceEntry } from "../types/walletTypes";
import { runWithReadTransaction } from "../util/query";
import { InternalWalletState } from "./state";
-import { Stores, TipRecord, CoinStatus } from "../dbTypes";
+import { Stores, TipRecord, CoinStatus } from "../types/dbTypes";
import * as Amounts from "../util/amounts";
import { AmountJson } from "../util/amounts";
import { Logger } from "../util/logging";
diff --git a/src/wallet-impl/errors.ts b/src/operations/errors.ts
index 803497e66..7e97fdb3c 100644
--- a/src/wallet-impl/errors.ts
+++ b/src/operations/errors.ts
@@ -1,4 +1,4 @@
-import { OperationError } from "../walletTypes";
+import { OperationError } from "../types/walletTypes";
/*
This file is part of GNU Taler
diff --git a/src/wallet-impl/exchanges.ts b/src/operations/exchanges.ts
index 1e5f86b4f..836bce6e4 100644
--- a/src/wallet-impl/exchanges.ts
+++ b/src/operations/exchanges.ts
@@ -16,8 +16,8 @@
import { InternalWalletState } from "./state";
import { WALLET_CACHE_BREAKER_CLIENT_VERSION } from "../wallet";
-import { KeysJson, Denomination, ExchangeWireJson } from "../talerTypes";
-import { getTimestampNow, OperationError } from "../walletTypes";
+import { KeysJson, Denomination, ExchangeWireJson } from "../types/talerTypes";
+import { getTimestampNow, OperationError } from "../types/walletTypes";
import {
ExchangeRecord,
ExchangeUpdateStatus,
@@ -25,7 +25,7 @@ import {
DenominationRecord,
DenominationStatus,
WireFee,
-} from "../dbTypes";
+} from "../types/dbTypes";
import {
canonicalizeBaseUrl,
extractTalerStamp,
diff --git a/src/wallet-impl/history.ts b/src/operations/history.ts
index 99e51c8de..9c4bb6a90 100644
--- a/src/wallet-impl/history.ts
+++ b/src/operations/history.ts
@@ -17,12 +17,12 @@
/**
* Imports.
*/
-import { HistoryQuery, HistoryEvent } from "../walletTypes";
import { oneShotIter, runWithReadTransaction } from "../util/query";
import { InternalWalletState } from "./state";
-import { Stores, TipRecord } from "../dbTypes";
+import { Stores, TipRecord } from "../types/dbTypes";
import * as Amounts from "../util/amounts";
import { AmountJson } from "../util/amounts";
+import { HistoryQuery, HistoryEvent } from "../types/history";
/**
* Retrive the full event history for this wallet.
diff --git a/src/wallet-impl/pay.ts b/src/operations/pay.ts
index af9d44066..08d227927 100644
--- a/src/wallet-impl/pay.ts
+++ b/src/operations/pay.ts
@@ -24,7 +24,7 @@ import {
ContractTerms,
MerchantRefundPermission,
RefundRequest,
-} from "../talerTypes";
+} from "../types/talerTypes";
import {
Timestamp,
CoinSelectionResult,
@@ -34,8 +34,7 @@ import {
PreparePayResult,
ConfirmPayResult,
OperationError,
- NotificationType,
-} from "../walletTypes";
+} from "../types/walletTypes";
import {
oneShotIter,
oneShotIterIndex,
@@ -55,7 +54,7 @@ import {
ProposalStatus,
initRetryInfo,
updateRetryInfoTimeout,
-} from "../dbTypes";
+} from "../types/dbTypes";
import * as Amounts from "../util/amounts";
import {
amountToPretty,
@@ -76,6 +75,7 @@ import { getTotalRefreshCost, refresh } from "./refresh";
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
import { guardOperationException } from "./errors";
import { assertUnreachable } from "../util/assertUnreachable";
+import { NotificationType } from "../types/notifications";
export interface SpeculativePayData {
payCoinInfo: PayCoinInfo;
diff --git a/src/wallet-impl/payback.ts b/src/operations/payback.ts
index 8cdfbf7ed..2d8a72839 100644
--- a/src/wallet-impl/payback.ts
+++ b/src/operations/payback.ts
@@ -24,12 +24,12 @@ import {
oneShotPut,
} from "../util/query";
import { InternalWalletState } from "./state";
-import { Stores, TipRecord, CoinStatus } from "../dbTypes";
+import { Stores, TipRecord, CoinStatus } from "../types/dbTypes";
import { Logger } from "../util/logging";
-import { PaybackConfirmation } from "../talerTypes";
+import { PaybackConfirmation } from "../types/talerTypes";
import { updateExchangeFromUrl } from "./exchanges";
-import { NotificationType } from "../walletTypes";
+import { NotificationType } from "../types/notifications";
const logger = new Logger("payback.ts");
diff --git a/src/wallet-impl/pending.ts b/src/operations/pending.ts
index 7079fa5ff..b9fc1d203 100644
--- a/src/wallet-impl/pending.ts
+++ b/src/operations/pending.ts
@@ -18,11 +18,10 @@
* Imports.
*/
import {
- PendingOperationsResponse,
getTimestampNow,
Timestamp,
Duration,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { runWithReadTransaction, TransactionHandle } from "../util/query";
import { InternalWalletState } from "./state";
import {
@@ -31,7 +30,8 @@ import {
ReserveRecordStatus,
CoinStatus,
ProposalStatus,
-} from "../dbTypes";
+} from "../types/dbTypes";
+import { PendingOperationsResponse } from "../types/pending";
function updateRetryDelay(
oldDelay: Duration,
diff --git a/src/wallet-impl/refresh.ts b/src/operations/refresh.ts
index a33511c34..4e4449d96 100644
--- a/src/wallet-impl/refresh.ts
+++ b/src/operations/refresh.ts
@@ -25,7 +25,7 @@ import {
RefreshSessionRecord,
initRetryInfo,
updateRetryInfoTimeout,
-} from "../dbTypes";
+} from "../types/dbTypes";
import { amountToPretty } from "../util/helpers";
import {
oneShotGet,
@@ -41,9 +41,9 @@ import { updateExchangeFromUrl } from "./exchanges";
import {
getTimestampNow,
OperationError,
- NotificationType,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { guardOperationException } from "./errors";
+import { NotificationType } from "../types/notifications";
const logger = new Logger("refresh.ts");
diff --git a/src/wallet-impl/reserves.ts b/src/operations/reserves.ts
index 504cf10f0..5ad13a67a 100644
--- a/src/wallet-impl/reserves.ts
+++ b/src/operations/reserves.ts
@@ -20,8 +20,7 @@ import {
getTimestampNow,
ConfirmReserveRequest,
OperationError,
- NotificationType,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { canonicalizeBaseUrl } from "../util/helpers";
import { InternalWalletState } from "./state";
import {
@@ -32,7 +31,7 @@ import {
WithdrawalSessionRecord,
initRetryInfo,
updateRetryInfoTimeout,
-} from "../dbTypes";
+} from "../types/dbTypes";
import {
oneShotMutate,
oneShotPut,
@@ -43,7 +42,7 @@ import {
import { Logger } from "../util/logging";
import * as Amounts from "../util/amounts";
import { updateExchangeFromUrl, getExchangeTrust } from "./exchanges";
-import { WithdrawOperationStatusResponse, ReserveStatus } from "../talerTypes";
+import { WithdrawOperationStatusResponse, ReserveStatus } from "../types/talerTypes";
import { assertUnreachable } from "../util/assertUnreachable";
import { encodeCrock } from "../crypto/talerCrypto";
import { randomBytes } from "../crypto/primitives/nacl-fast";
@@ -52,6 +51,7 @@ import {
processWithdrawSession,
} from "./withdraw";
import { guardOperationException, OperationFailedAndReportedError } from "./errors";
+import { NotificationType } from "../types/notifications";
const logger = new Logger("reserves.ts");
diff --git a/src/wallet-impl/return.ts b/src/operations/return.ts
index 0c142f9a6..74885a735 100644
--- a/src/wallet-impl/return.ts
+++ b/src/operations/return.ts
@@ -18,21 +18,17 @@
* Imports.
*/
import {
- HistoryQuery,
- HistoryEvent,
- WalletBalance,
- WalletBalanceEntry,
ReturnCoinsRequest,
CoinWithDenom,
-} from "../walletTypes";
-import { oneShotIter, runWithWriteTransaction, oneShotGet, oneShotIterIndex, oneShotPut } from "../util/query";
+} from "../types/walletTypes";
+import { runWithWriteTransaction, oneShotGet, oneShotIterIndex, oneShotPut } from "../util/query";
import { InternalWalletState } from "./state";
-import { Stores, TipRecord, CoinStatus, CoinsReturnRecord, CoinRecord } from "../dbTypes";
+import { Stores, TipRecord, CoinStatus, CoinsReturnRecord, CoinRecord } from "../types/dbTypes";
import * as Amounts from "../util/amounts";
import { AmountJson } from "../util/amounts";
import { Logger } from "../util/logging";
import { canonicalJson } from "../util/helpers";
-import { ContractTerms } from "../talerTypes";
+import { ContractTerms } from "../types/talerTypes";
import { selectPayCoins } from "./pay";
const logger = new Logger("return.ts");
diff --git a/src/wallet-impl/state.ts b/src/operations/state.ts
index 18df861f1..47bf40de3 100644
--- a/src/wallet-impl/state.ts
+++ b/src/operations/state.ts
@@ -18,13 +18,13 @@ import { HttpRequestLibrary } from "../util/http";
import {
NextUrlResult,
WalletBalance,
- PendingOperationsResponse,
- WalletNotification,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { SpeculativePayData } from "./pay";
import { CryptoApi, CryptoWorkerFactory } from "../crypto/workers/cryptoApi";
import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo";
import { Logger } from "../util/logging";
+import { PendingOperationsResponse } from "../types/pending";
+import { WalletNotification } from "../types/notifications";
type NotificationListener = (n: WalletNotification) => void;
diff --git a/src/wallet-impl/tip.ts b/src/operations/tip.ts
index 22ec37793..0a710f67e 100644
--- a/src/wallet-impl/tip.ts
+++ b/src/operations/tip.ts
@@ -18,15 +18,16 @@
import { oneShotGet, oneShotPut, oneShotMutate, runWithWriteTransaction } from "../util/query";
import { InternalWalletState } from "./state";
import { parseTipUri } from "../util/taleruri";
-import { TipStatus, getTimestampNow, OperationError, NotificationType } from "../walletTypes";
-import { TipPickupGetResponse, TipPlanchetDetail, TipResponse } from "../talerTypes";
+import { TipStatus, getTimestampNow, OperationError } from "../types/walletTypes";
+import { TipPickupGetResponse, TipPlanchetDetail, TipResponse } from "../types/talerTypes";
import * as Amounts from "../util/amounts";
-import { Stores, PlanchetRecord, WithdrawalSessionRecord, initRetryInfo, updateRetryInfoTimeout } from "../dbTypes";
+import { Stores, PlanchetRecord, WithdrawalSessionRecord, initRetryInfo, updateRetryInfoTimeout } from "../types/dbTypes";
import { getExchangeWithdrawalInfo, getVerifiedWithdrawDenomList, processWithdrawSession } from "./withdraw";
import { getTalerStampSec, extractTalerStampOrThrow } from "../util/helpers";
import { updateExchangeFromUrl } from "./exchanges";
import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto";
import { guardOperationException } from "./errors";
+import { NotificationType } from "../types/notifications";
export async function getTipStatus(
diff --git a/src/wallet-impl/withdraw.ts b/src/operations/withdraw.ts
index d8b2b599c..4ecc321f8 100644
--- a/src/wallet-impl/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -24,7 +24,7 @@ import {
PlanchetRecord,
initRetryInfo,
updateRetryInfoTimeout,
-} from "../dbTypes";
+} from "../types/dbTypes";
import * as Amounts from "../util/amounts";
import {
getTimestampNow,
@@ -33,9 +33,8 @@ import {
ExchangeWithdrawDetails,
WithdrawDetails,
OperationError,
- NotificationType,
-} from "../walletTypes";
-import { WithdrawOperationStatusResponse } from "../talerTypes";
+} from "../types/walletTypes";
+import { WithdrawOperationStatusResponse } from "../types/talerTypes";
import { InternalWalletState } from "./state";
import { parseWithdrawUri } from "../util/taleruri";
import { Logger } from "../util/logging";
@@ -57,6 +56,7 @@ import { WALLET_PROTOCOL_VERSION } from "../wallet";
import * as LibtoolVersion from "../util/libtoolVersion";
import { guardOperationException } from "./errors";
+import { NotificationType } from "../types/notifications";
const logger = new Logger("withdraw.ts");
diff --git a/src/dbTypes.ts b/src/types/dbTypes.ts
index 28c1ee2e3..ce2bb4109 100644
--- a/src/dbTypes.ts
+++ b/src/types/dbTypes.ts
@@ -23,8 +23,8 @@
/**
* Imports.
*/
-import { AmountJson } from "./util/amounts";
-import { Checkable } from "./util/checkable";
+import { AmountJson } from "../util/amounts";
+import { Checkable } from "../util/checkable";
import {
Auditor,
CoinPaySig,
@@ -35,7 +35,7 @@ import {
TipResponse,
} from "./talerTypes";
-import { Index, Store } from "./util/query";
+import { Index, Store } from "../util/query";
import {
Timestamp,
OperationError,
diff --git a/src/types/history.ts b/src/types/history.ts
new file mode 100644
index 000000000..e925b0ffe
--- /dev/null
+++ b/src/types/history.ts
@@ -0,0 +1,58 @@
+import { Timestamp } from "./walletTypes";
+
+/*
+ This file is part of GNU Taler
+ (C) 2019 GNUnet e.V.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Type and schema definitions for the wallet's history.
+ */
+
+/**
+ * Activity history record.
+ */
+export interface HistoryEvent {
+ /**
+ * Type of the history event.
+ */
+ type: string;
+
+ /**
+ * Time when the activity was recorded.
+ */
+ timestamp: Timestamp;
+
+ /**
+ * Details used when rendering the history record.
+ */
+ detail: any;
+
+ /**
+ * Set to 'true' if the event has been explicitly created,
+ * and set to 'false' if the event has been derived from the
+ * state of the database.
+ */
+ explicit: boolean;
+}
+
+
+export interface HistoryQuery {
+ /**
+ * Verbosity of history events.
+ * Level 0: Only withdraw, pay, tip and refund events.
+ * Level 1: All events.
+ */
+ level: number;
+} \ No newline at end of file
diff --git a/src/types/notifications.ts b/src/types/notifications.ts
new file mode 100644
index 000000000..c64d33bfb
--- /dev/null
+++ b/src/types/notifications.ts
@@ -0,0 +1,213 @@
+/*
+ This file is part of GNU Taler
+ (C) 2019 GNUnet e.V.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Type and schema definitions for notifications from the wallet to clients
+ * of the wallet.
+ */
+
+export const enum NotificationType {
+ CoinWithdrawn = "coin-withdrawn",
+ ProposalAccepted = "proposal-accepted",
+ ProposalDownloaded = "proposal-downloaded",
+ RefundsSubmitted = "refunds-submitted",
+ PaybackStarted = "payback-started",
+ PaybackFinished = "payback-finished",
+ RefreshRevealed = "refresh-revealed",
+ RefreshMelted = "refresh-melted",
+ RefreshStarted = "refresh-started",
+ RefreshRefused = "refresh-refused",
+ ReserveUpdated = "reserve-updated",
+ ReserveConfirmed = "reserve-confirmed",
+ ReserveDepleted = "reserve-depleted",
+ ReserveCreated = "reserve-created",
+ WithdrawSessionCreated = "withdraw-session-created",
+ WithdrawSessionFinished = "withdraw-session-finished",
+ WaitingForRetry = "waiting-for-retry",
+ RefundStarted = "refund-started",
+ RefundQueried = "refund-queried",
+ RefundFinished = "refund-finished",
+ ExchangeOperationError = "exchange-operation-error",
+ RefreshOperationError = "refresh-operation-error",
+ RefundApplyOperationError = "refund-apply-error",
+ RefundStatusOperationError = "refund-status-error",
+ ProposalOperationError = "proposal-error",
+ TipOperationError = "tip-error",
+ PayOperationError = "pay-error",
+ WithdrawOperationError = "withdraw-error",
+ ReserveOperationError = "reserve-error",
+ Wildcard = "wildcard",
+}
+
+export interface ProposalAcceptedNotification {
+ type: NotificationType.ProposalAccepted;
+ proposalId: string;
+}
+
+export interface CoinWithdrawnNotification {
+ type: NotificationType.CoinWithdrawn;
+}
+
+export interface RefundStartedNotification {
+ type: NotificationType.RefundStarted;
+}
+
+export interface RefundQueriedNotification {
+ type: NotificationType.RefundQueried;
+}
+
+export interface ProposalDownloadedNotification {
+ type: NotificationType.ProposalDownloaded;
+ proposalId: string;
+}
+
+export interface RefundsSubmittedNotification {
+ type: NotificationType.RefundsSubmitted;
+ proposalId: string;
+}
+
+export interface PaybackStartedNotification {
+ type: NotificationType.PaybackStarted;
+}
+
+export interface PaybackFinishedNotification {
+ type: NotificationType.PaybackFinished;
+}
+
+export interface RefreshMeltedNotification {
+ type: NotificationType.RefreshMelted;
+}
+
+export interface RefreshRevealedNotification {
+ type: NotificationType.RefreshRevealed;
+}
+
+export interface RefreshStartedNotification {
+ type: NotificationType.RefreshStarted;
+}
+
+export interface RefreshRefusedNotification {
+ type: NotificationType.RefreshRefused;
+}
+
+export interface ReserveUpdatedNotification {
+ type: NotificationType.ReserveUpdated;
+}
+
+export interface ReserveConfirmedNotification {
+ type: NotificationType.ReserveConfirmed;
+}
+
+export interface WithdrawSessionCreatedNotification {
+ type: NotificationType.WithdrawSessionCreated;
+ withdrawSessionId: string;
+}
+
+export interface WithdrawSessionFinishedNotification {
+ type: NotificationType.WithdrawSessionFinished;
+ withdrawSessionId: string;
+}
+
+export interface ReserveDepletedNotification {
+ type: NotificationType.ReserveDepleted;
+ reservePub: string;
+}
+
+export interface WaitingForRetryNotification {
+ type: NotificationType.WaitingForRetry;
+ numPending: number;
+ numGivingLiveness: number;
+}
+
+export interface RefundFinishedNotification {
+ type: NotificationType.RefundFinished;
+}
+
+export interface ExchangeOperationErrorNotification {
+ type: NotificationType.ExchangeOperationError;
+}
+
+export interface RefreshOperationErrorNotification {
+ type: NotificationType.RefreshOperationError;
+}
+
+export interface RefundStatusOperationErrorNotification {
+ type: NotificationType.RefundStatusOperationError;
+}
+
+export interface RefundApplyOperationErrorNotification {
+ type: NotificationType.RefundApplyOperationError;
+}
+
+export interface PayOperationErrorNotification {
+ type: NotificationType.PayOperationError;
+}
+
+export interface ProposalOperationErrorNotification {
+ type: NotificationType.ProposalOperationError;
+}
+
+export interface TipOperationErrorNotification {
+ type: NotificationType.TipOperationError;
+}
+
+export interface WithdrawOperationErrorNotification {
+ type: NotificationType.WithdrawOperationError;
+}
+
+export interface ReserveOperationErrorNotification {
+ type: NotificationType.ReserveOperationError;
+}
+
+export interface ReserveCreatedNotification {
+ type: NotificationType.ReserveCreated;
+}
+
+export interface WildcardNotification {
+ type: NotificationType.Wildcard;
+}
+
+export type WalletNotification =
+ | WithdrawOperationErrorNotification
+ | ReserveOperationErrorNotification
+ | ExchangeOperationErrorNotification
+ | RefreshOperationErrorNotification
+ | RefundStatusOperationErrorNotification
+ | RefundApplyOperationErrorNotification
+ | ProposalOperationErrorNotification
+ | PayOperationErrorNotification
+ | TipOperationErrorNotification
+ | ProposalAcceptedNotification
+ | ProposalDownloadedNotification
+ | RefundsSubmittedNotification
+ | PaybackStartedNotification
+ | PaybackFinishedNotification
+ | RefreshMeltedNotification
+ | RefreshRevealedNotification
+ | RefreshStartedNotification
+ | RefreshRefusedNotification
+ | ReserveUpdatedNotification
+ | ReserveCreatedNotification
+ | ReserveConfirmedNotification
+ | WithdrawSessionFinishedNotification
+ | ReserveDepletedNotification
+ | WaitingForRetryNotification
+ | RefundStartedNotification
+ | RefundFinishedNotification
+ | RefundQueriedNotification
+ | WithdrawSessionCreatedNotification
+ | CoinWithdrawnNotification
+ | WildcardNotification;
diff --git a/src/types/pending.ts b/src/types/pending.ts
new file mode 100644
index 000000000..5e381d09a
--- /dev/null
+++ b/src/types/pending.ts
@@ -0,0 +1,161 @@
+/*
+ This file is part of GNU Taler
+ (C) 2019 GNUnet e.V.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Type and schema definitions for pending operations in the wallet.
+ */
+
+/**
+ * Imports.
+ */
+import { OperationError, Timestamp, Duration } from "./walletTypes";
+import { WithdrawalSource, RetryInfo } from "./dbTypes";
+
+/**
+ * Information about a pending operation.
+ */
+export type PendingOperationInfo = PendingOperationInfoCommon &
+ (
+ | PendingWithdrawOperation
+ | PendingReserveOperation
+ | PendingBugOperation
+ | PendingDirtyCoinOperation
+ | PendingExchangeUpdateOperation
+ | PendingRefreshOperation
+ | PendingTipOperation
+ | PendingProposalDownloadOperation
+ | PendingProposalChoiceOperation
+ | PendingPayOperation
+ | PendingRefundQueryOperation
+ | PendingRefundApplyOperation
+ );
+
+export interface PendingExchangeUpdateOperation {
+ type: "exchange-update";
+ stage: string;
+ reason: string;
+ exchangeBaseUrl: string;
+ lastError: OperationError | undefined;
+}
+
+export interface PendingBugOperation {
+ type: "bug";
+ message: string;
+ details: any;
+}
+
+export interface PendingReserveOperation {
+ type: "reserve";
+ retryInfo: RetryInfo | undefined;
+ stage: string;
+ timestampCreated: Timestamp;
+ reserveType: string;
+ reservePub: string;
+ bankWithdrawConfirmUrl?: string;
+}
+
+export interface PendingRefreshOperation {
+ type: "refresh";
+ lastError?: OperationError;
+ refreshSessionId: string;
+ oldCoinPub: string;
+ refreshStatus: string;
+ refreshOutputSize: number;
+}
+
+export interface PendingDirtyCoinOperation {
+ type: "dirty-coin";
+ coinPub: string;
+}
+
+export interface PendingProposalDownloadOperation {
+ type: "proposal-download";
+ merchantBaseUrl: string;
+ proposalTimestamp: Timestamp;
+ proposalId: string;
+ orderId: string;
+ lastError?: OperationError;
+ retryInfo: RetryInfo;
+}
+
+/**
+ * User must choose whether to accept or reject the merchant's
+ * proposed contract terms.
+ */
+export interface PendingProposalChoiceOperation {
+ type: "proposal-choice";
+ merchantBaseUrl: string;
+ proposalTimestamp: Timestamp;
+ proposalId: string;
+}
+
+export interface PendingTipOperation {
+ type: "tip";
+ tipId: string;
+ merchantBaseUrl: string;
+ merchantTipId: string;
+}
+
+export interface PendingPayOperation {
+ type: "pay";
+ proposalId: string;
+ isReplay: boolean;
+ retryInfo: RetryInfo,
+ lastError: OperationError | undefined;
+}
+
+export interface PendingRefundQueryOperation {
+ type: "refund-query";
+ proposalId: string;
+ retryInfo: RetryInfo,
+ lastError: OperationError | undefined;
+}
+
+export interface PendingRefundApplyOperation {
+ type: "refund-apply";
+ proposalId: string;
+ retryInfo: RetryInfo,
+ lastError: OperationError | undefined;
+ numRefundsPending: number;
+ numRefundsDone: number;
+}
+
+export interface PendingOperationInfoCommon {
+ type: string;
+ givesLifeness: boolean;
+}
+
+
+export interface PendingWithdrawOperation {
+ type: "withdraw";
+ source: WithdrawalSource;
+ withdrawSessionId: string;
+ numCoinsWithdrawn: number;
+ numCoinsTotal: number;
+}
+
+export interface PendingRefreshOperation {
+ type: "refresh";
+}
+
+export interface PendingPayOperation {
+ type: "pay";
+}
+
+export interface PendingOperationsResponse {
+ pendingOperations: PendingOperationInfo[];
+ nextRetryDelay: Duration;
+} \ No newline at end of file
diff --git a/src/talerTypes.ts b/src/types/talerTypes.ts
index 840321db7..df89b9979 100644
--- a/src/talerTypes.ts
+++ b/src/types/talerTypes.ts
@@ -1,21 +1,21 @@
/*
- This file is part of TALER
- (C) 2018 GNUnet e.V. and INRIA
+ This file is part of GNU Taler
+ (C) 2019 GNUnet e.V.
- TALER is free software; you can redistribute it and/or modify it under the
+ GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * Type and schema definitions for the base taler protocol.
+ * Type and schema definitions and helpers for the core GNU Taler protocol.
*
* All types here should be "@Checkable".
*
@@ -26,11 +26,11 @@
/**
* Imports.
*/
-import { Checkable } from "./util/checkable";
+import { Checkable } from "../util/checkable";
-import * as Amounts from "./util/amounts";
+import * as Amounts from "../util/amounts";
-import { timestampCheck } from "./util/helpers";
+import { timestampCheck } from "../util/helpers";
/**
* Denomination as found in the /keys response from the exchange.
diff --git a/src/types-test.ts b/src/types/types-test.ts
index 38cb9260a..a686fbe38 100644
--- a/src/types-test.ts
+++ b/src/types/types-test.ts
@@ -15,7 +15,7 @@
*/
import test from "ava";
-import * as Amounts from "./util/amounts";
+import * as Amounts from "../util/amounts";
import { ContractTerms } from "./talerTypes";
const amt = (
diff --git a/src/walletTypes.ts b/src/types/walletTypes.ts
index e136b4e01..a9bf2061f 100644
--- a/src/walletTypes.ts
+++ b/src/types/walletTypes.ts
@@ -25,10 +25,10 @@
/**
* Imports.
*/
-import { Checkable } from "./util/checkable";
-import * as LibtoolVersion from "./util/libtoolVersion";
+import { Checkable } from "../util/checkable";
+import * as LibtoolVersion from "../util/libtoolVersion";
-import { AmountJson } from "./util/amounts";
+import { AmountJson } from "../util/amounts";
import {
CoinRecord,
@@ -228,33 +228,6 @@ export interface ConfirmPayResult {
}
/**
- * Activity history record.
- */
-export interface HistoryEvent {
- /**
- * Type of the history event.
- */
- type: string;
-
- /**
- * Time when the activity was recorded.
- */
- timestamp: Timestamp;
-
- /**
- * Details used when rendering the history record.
- */
- detail: any;
-
- /**
- * Set to 'true' if the event has been explicitly created,
- * and set to 'false' if the event has been derived from the
- * state of the database.
- */
- explicit: boolean;
-}
-
-/**
* Information about all sender wire details known to the wallet,
* as well as exchanges that accept these wire types.
*/
@@ -488,346 +461,12 @@ export interface WalletDiagnostics {
dbOutdated: boolean;
}
-export interface PendingWithdrawOperation {
- type: "withdraw";
- source: WithdrawalSource;
- withdrawSessionId: string;
- numCoinsWithdrawn: number;
- numCoinsTotal: number;
-}
-
-export interface PendingRefreshOperation {
- type: "refresh";
-}
-
-export interface PendingPayOperation {
- type: "pay";
-}
-
-export const enum NotificationType {
- CoinWithdrawn = "coin-withdrawn",
- ProposalAccepted = "proposal-accepted",
- ProposalDownloaded = "proposal-downloaded",
- RefundsSubmitted = "refunds-submitted",
- PaybackStarted = "payback-started",
- PaybackFinished = "payback-finished",
- RefreshRevealed = "refresh-revealed",
- RefreshMelted = "refresh-melted",
- RefreshStarted = "refresh-started",
- RefreshRefused = "refresh-refused",
- ReserveUpdated = "reserve-updated",
- ReserveConfirmed = "reserve-confirmed",
- ReserveDepleted = "reserve-depleted",
- ReserveCreated = "reserve-created",
- WithdrawSessionCreated = "withdraw-session-created",
- WithdrawSessionFinished = "withdraw-session-finished",
- WaitingForRetry = "waiting-for-retry",
- RefundStarted = "refund-started",
- RefundQueried = "refund-queried",
- RefundFinished = "refund-finished",
- ExchangeOperationError = "exchange-operation-error",
- RefreshOperationError = "refresh-operation-error",
- RefundApplyOperationError = "refund-apply-error",
- RefundStatusOperationError = "refund-status-error",
- ProposalOperationError = "proposal-error",
- TipOperationError = "tip-error",
- PayOperationError = "pay-error",
- WithdrawOperationError = "withdraw-error",
- ReserveOperationError = "reserve-error",
- Wildcard = "wildcard",
-}
-
-export interface ProposalAcceptedNotification {
- type: NotificationType.ProposalAccepted;
- proposalId: string;
-}
-
-export interface CoinWithdrawnNotification {
- type: NotificationType.CoinWithdrawn;
-}
-
-export interface RefundStartedNotification {
- type: NotificationType.RefundStarted;
-}
-
-export interface RefundQueriedNotification {
- type: NotificationType.RefundQueried;
-}
-
-export interface ProposalDownloadedNotification {
- type: NotificationType.ProposalDownloaded;
- proposalId: string;
-}
-
-export interface RefundsSubmittedNotification {
- type: NotificationType.RefundsSubmitted;
- proposalId: string;
-}
-
-export interface PaybackStartedNotification {
- type: NotificationType.PaybackStarted;
-}
-
-export interface PaybackFinishedNotification {
- type: NotificationType.PaybackFinished;
-}
-
-export interface RefreshMeltedNotification {
- type: NotificationType.RefreshMelted;
-}
-
-export interface RefreshRevealedNotification {
- type: NotificationType.RefreshRevealed;
-}
-
-export interface RefreshStartedNotification {
- type: NotificationType.RefreshStarted;
-}
-
-export interface RefreshRefusedNotification {
- type: NotificationType.RefreshRefused;
-}
-
-export interface ReserveUpdatedNotification {
- type: NotificationType.ReserveUpdated;
-}
-
-export interface ReserveConfirmedNotification {
- type: NotificationType.ReserveConfirmed;
-}
-
-export interface WithdrawSessionCreatedNotification {
- type: NotificationType.WithdrawSessionCreated;
- withdrawSessionId: string;
-}
-
-export interface WithdrawSessionFinishedNotification {
- type: NotificationType.WithdrawSessionFinished;
- withdrawSessionId: string;
-}
-
-export interface ReserveDepletedNotification {
- type: NotificationType.ReserveDepleted;
- reservePub: string;
-}
-
-export interface WaitingForRetryNotification {
- type: NotificationType.WaitingForRetry;
- numPending: number;
- numGivingLiveness: number;
-}
-
-export interface RefundFinishedNotification {
- type: NotificationType.RefundFinished;
-}
-
-export interface ExchangeOperationErrorNotification {
- type: NotificationType.ExchangeOperationError;
-}
-
-export interface RefreshOperationErrorNotification {
- type: NotificationType.RefreshOperationError;
-}
-
-export interface RefundStatusOperationErrorNotification {
- type: NotificationType.RefundStatusOperationError;
-}
-
-export interface RefundApplyOperationErrorNotification {
- type: NotificationType.RefundApplyOperationError;
-}
-
-export interface PayOperationErrorNotification {
- type: NotificationType.PayOperationError;
-}
-
-export interface ProposalOperationErrorNotification {
- type: NotificationType.ProposalOperationError;
-}
-
-export interface TipOperationErrorNotification {
- type: NotificationType.TipOperationError;
-}
-
-export interface WithdrawOperationErrorNotification {
- type: NotificationType.WithdrawOperationError;
-}
-
-export interface ReserveOperationErrorNotification {
- type: NotificationType.ReserveOperationError;
-}
-
-export interface ReserveCreatedNotification {
- type: NotificationType.ReserveCreated;
-}
-
-export interface WildcardNotification {
- type: NotificationType.Wildcard;
-}
-
-export type WalletNotification =
- | WithdrawOperationErrorNotification
- | ReserveOperationErrorNotification
- | ExchangeOperationErrorNotification
- | RefreshOperationErrorNotification
- | RefundStatusOperationErrorNotification
- | RefundApplyOperationErrorNotification
- | ProposalOperationErrorNotification
- | PayOperationErrorNotification
- | TipOperationErrorNotification
- | ProposalAcceptedNotification
- | ProposalDownloadedNotification
- | RefundsSubmittedNotification
- | PaybackStartedNotification
- | PaybackFinishedNotification
- | RefreshMeltedNotification
- | RefreshRevealedNotification
- | RefreshStartedNotification
- | RefreshRefusedNotification
- | ReserveUpdatedNotification
- | ReserveCreatedNotification
- | ReserveConfirmedNotification
- | WithdrawSessionFinishedNotification
- | ReserveDepletedNotification
- | WaitingForRetryNotification
- | RefundStartedNotification
- | RefundFinishedNotification
- | RefundQueriedNotification
- | WithdrawSessionCreatedNotification
- | CoinWithdrawnNotification
- | WildcardNotification;
-
export interface OperationError {
type: string;
message: string;
details: any;
}
-export interface PendingExchangeUpdateOperation {
- type: "exchange-update";
- stage: string;
- reason: string;
- exchangeBaseUrl: string;
- lastError: OperationError | undefined;
-}
-
-export interface PendingBugOperation {
- type: "bug";
- message: string;
- details: any;
-}
-
-export interface PendingReserveOperation {
- type: "reserve";
- retryInfo: RetryInfo | undefined;
- stage: string;
- timestampCreated: Timestamp;
- reserveType: string;
- reservePub: string;
- bankWithdrawConfirmUrl?: string;
-}
-
-export interface PendingRefreshOperation {
- type: "refresh";
- lastError?: OperationError;
- refreshSessionId: string;
- oldCoinPub: string;
- refreshStatus: string;
- refreshOutputSize: number;
-}
-
-export interface PendingDirtyCoinOperation {
- type: "dirty-coin";
- coinPub: string;
-}
-
-export interface PendingProposalDownloadOperation {
- type: "proposal-download";
- merchantBaseUrl: string;
- proposalTimestamp: Timestamp;
- proposalId: string;
- orderId: string;
- lastError?: OperationError;
- retryInfo: RetryInfo;
-}
-
-/**
- * User must choose whether to accept or reject the merchant's
- * proposed contract terms.
- */
-export interface PendingProposalChoiceOperation {
- type: "proposal-choice";
- merchantBaseUrl: string;
- proposalTimestamp: Timestamp;
- proposalId: string;
-}
-
-export interface PendingTipOperation {
- type: "tip";
- tipId: string;
- merchantBaseUrl: string;
- merchantTipId: string;
-}
-
-export interface PendingPayOperation {
- type: "pay";
- proposalId: string;
- isReplay: boolean;
- retryInfo: RetryInfo,
- lastError: OperationError | undefined;
-}
-
-export interface PendingRefundQueryOperation {
- type: "refund-query";
- proposalId: string;
- retryInfo: RetryInfo,
- lastError: OperationError | undefined;
-}
-
-export interface PendingRefundApplyOperation {
- type: "refund-apply";
- proposalId: string;
- retryInfo: RetryInfo,
- lastError: OperationError | undefined;
- numRefundsPending: number;
- numRefundsDone: number;
-}
-
-export interface PendingOperationInfoCommon {
- type: string;
- givesLifeness: boolean;
-}
-
-export type PendingOperationInfo = PendingOperationInfoCommon &
- (
- | PendingWithdrawOperation
- | PendingReserveOperation
- | PendingBugOperation
- | PendingDirtyCoinOperation
- | PendingExchangeUpdateOperation
- | PendingRefreshOperation
- | PendingTipOperation
- | PendingProposalDownloadOperation
- | PendingProposalChoiceOperation
- | PendingPayOperation
- | PendingRefundQueryOperation
- | PendingRefundApplyOperation
- );
-
-export interface PendingOperationsResponse {
- pendingOperations: PendingOperationInfo[];
- nextRetryDelay: Duration;
-}
-
-export interface HistoryQuery {
- /**
- * Verbosity of history events.
- * Level 0: Only withdraw, pay, tip and refund events.
- * Level 1: All events.
- */
- level: number;
-}
-
@Checkable.Class()
export class Timestamp {
/**
diff --git a/src/util/RequestThrottler.ts b/src/util/RequestThrottler.ts
index d44109bee..c144cb152 100644
--- a/src/util/RequestThrottler.ts
+++ b/src/util/RequestThrottler.ts
@@ -21,7 +21,7 @@
/**
* Imports.
*/
-import { getTimestampNow, Timestamp } from "../walletTypes";
+import { getTimestampNow, Timestamp } from "../types/walletTypes";
/**
* Maximum request per second, per origin.
diff --git a/src/util/helpers.ts b/src/util/helpers.ts
index 3831e84af..99d046f04 100644
--- a/src/util/helpers.ts
+++ b/src/util/helpers.ts
@@ -24,7 +24,7 @@
import { AmountJson } from "./amounts";
import * as Amounts from "./amounts";
-import { Timestamp, Duration } from "../walletTypes";
+import { Timestamp, Duration } from "../types/walletTypes";
/**
* Show an amount in a form suitable for the user.
diff --git a/src/util/wire.ts b/src/util/wire.ts
index 63b73d864..757ba9266 100644
--- a/src/util/wire.ts
+++ b/src/util/wire.ts
@@ -25,7 +25,7 @@
/**
* Imports.
*/
-import * as i18n from "../i18n";
+import * as i18n from "../webex/i18n";
/**
* Short summary of the wire information.
diff --git a/src/wallet-test.ts b/src/wallet-test.ts
index cc8532f07..c937de3f5 100644
--- a/src/wallet-test.ts
+++ b/src/wallet-test.ts
@@ -16,14 +16,14 @@
import test from "ava";
-import * as dbTypes from "./dbTypes";
-import * as types from "./walletTypes";
+import * as dbTypes from "./types/dbTypes";
+import * as types from "./types/walletTypes";
import * as wallet from "./wallet";
import { AmountJson } from "./util/amounts";
import * as Amounts from "./util/amounts";
-import { selectPayCoins } from "./wallet-impl/pay";
+import { selectPayCoins } from "./operations/pay";
function a(x: string): AmountJson {
const amt = Amounts.parse(x);
diff --git a/src/wallet.ts b/src/wallet.ts
index edfc0b09d..1db458b38 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -39,7 +39,7 @@ import {
acceptWithdrawal,
getWithdrawDetailsForUri,
getExchangeWithdrawalInfo,
-} from "./wallet-impl/withdraw";
+} from "./operations/withdraw";
import {
abortFailedPayment,
@@ -51,7 +51,7 @@ import {
processPurchasePay,
processPurchaseQueryRefund,
processPurchaseApplyRefund,
-} from "./wallet-impl/pay";
+} from "./operations/pay";
import {
CoinRecord,
@@ -64,31 +64,24 @@ import {
ReserveRecord,
Stores,
ReserveRecordStatus,
-} from "./dbTypes";
-import { MerchantRefundPermission } from "./talerTypes";
+} from "./types/dbTypes";
+import { MerchantRefundPermission } from "./types/talerTypes";
import {
BenchmarkResult,
ConfirmPayResult,
ConfirmReserveRequest,
CreateReserveRequest,
CreateReserveResponse,
- HistoryEvent,
ReturnCoinsRequest,
SenderWireInfos,
TipStatus,
WalletBalance,
PreparePayResult,
- BankWithdrawDetails,
WithdrawDetails,
AcceptWithdrawalResponse,
PurchaseDetails,
- PendingOperationInfo,
- PendingOperationsResponse,
- HistoryQuery,
- WalletNotification,
- NotificationType,
ExchangeWithdrawDetails,
-} from "./walletTypes";
+} from "./types/walletTypes";
import { Logger } from "./util/logging";
import { assertUnreachable } from "./util/assertUnreachable";
@@ -98,22 +91,25 @@ import {
getExchangeTrust,
getExchangePaytoUri,
acceptExchangeTermsOfService,
-} from "./wallet-impl/exchanges";
-import { processReserve } from "./wallet-impl/reserves";
-
-import { InternalWalletState } from "./wallet-impl/state";
-import { createReserve, confirmReserve } from "./wallet-impl/reserves";
-import { processRefreshSession, refresh } from "./wallet-impl/refresh";
-import { processWithdrawSession } from "./wallet-impl/withdraw";
-import { getHistory } from "./wallet-impl/history";
-import { getPendingOperations } from "./wallet-impl/pending";
-import { getBalances } from "./wallet-impl/balance";
-import { acceptTip, getTipStatus, processTip } from "./wallet-impl/tip";
-import { returnCoins } from "./wallet-impl/return";
-import { payback } from "./wallet-impl/payback";
+} from "./operations/exchanges";
+import { processReserve } from "./operations/reserves";
+
+import { InternalWalletState } from "./operations/state";
+import { createReserve, confirmReserve } from "./operations/reserves";
+import { processRefreshSession, refresh } from "./operations/refresh";
+import { processWithdrawSession } from "./operations/withdraw";
+import { getHistory } from "./operations/history";
+import { getPendingOperations } from "./operations/pending";
+import { getBalances } from "./operations/balance";
+import { acceptTip, getTipStatus, processTip } from "./operations/tip";
+import { returnCoins } from "./operations/return";
+import { payback } from "./operations/payback";
import { TimerGroup } from "./util/timer";
import { AsyncCondition } from "./util/promiseUtils";
import { AsyncOpMemoSingle } from "./util/asyncMemo";
+import { PendingOperationInfo, PendingOperationsResponse } from "./types/pending";
+import { WalletNotification, NotificationType } from "./types/notifications";
+import { HistoryQuery, HistoryEvent } from "./types/history";
/**
* Wallet protocol version spoken with the exchange
diff --git a/src/i18n.tsx b/src/webex/i18n.tsx
index 67df6c516..3923654e7 100644
--- a/src/i18n.tsx
+++ b/src/webex/i18n.tsx
@@ -21,7 +21,7 @@
/**
* Imports.
*/
-import {strings} from "./i18n/strings";
+import {strings} from "../i18n/strings";
// @ts-ignore: no type decl for this library
import * as jedLib from "jed";
diff --git a/src/webex/messages.ts b/src/webex/messages.ts
index 4aaf75b2b..579dd4347 100644
--- a/src/webex/messages.ts
+++ b/src/webex/messages.ts
@@ -22,11 +22,12 @@
/* tslint:disable:completed-docs */
import { AmountJson } from "../util/amounts";
-import * as dbTypes from "../dbTypes";
-import * as talerTypes from "../talerTypes";
-import * as walletTypes from "../walletTypes";
+import * as dbTypes from "../types/dbTypes";
+import * as talerTypes from "../types/talerTypes";
+import * as walletTypes from "../types/walletTypes";
import { UpgradeResponse } from "./wxApi";
+import { HistoryEvent } from "../types/history";
/**
* Message type information.
@@ -79,7 +80,7 @@ export interface MessageMap {
};
"get-history": {
request: {};
- response: walletTypes.HistoryEvent[];
+ response: HistoryEvent[];
};
"get-coins": {
request: { exchangeBaseUrl: string };
diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx
index 766db9c5d..0f681aae4 100644
--- a/src/webex/pages/add-auditor.tsx
+++ b/src/webex/pages/add-auditor.tsx
@@ -20,7 +20,7 @@
* @author Florian Dold
*/
-import { CurrencyRecord } from "../../dbTypes";
+import { CurrencyRecord } from "../../types/dbTypes";
import { getCurrencies, updateCurrency } from "../wxApi";
import React, { useState } from "react";
import { registerMountPage } from "../renderHtml";
diff --git a/src/webex/pages/auditors.tsx b/src/webex/pages/auditors.tsx
index 276a7e8e1..876cf326b 100644
--- a/src/webex/pages/auditors.tsx
+++ b/src/webex/pages/auditors.tsx
@@ -25,7 +25,7 @@ import {
AuditorRecord,
CurrencyRecord,
ExchangeForCurrencyRecord,
-} from "../../dbTypes";
+} from "../../types/dbTypes";
import {
getCurrencies,
diff --git a/src/webex/pages/benchmark.tsx b/src/webex/pages/benchmark.tsx
index b250bc20a..fe874f2b7 100644
--- a/src/webex/pages/benchmark.tsx
+++ b/src/webex/pages/benchmark.tsx
@@ -21,9 +21,9 @@
* @author Florian Dold
*/
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
-import { BenchmarkResult } from "../../walletTypes";
+import { BenchmarkResult } from "../../types/walletTypes";
import * as wxApi from "../wxApi";
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index cff2f9461..eca115e78 100644
--- a/src/webex/pages/pay.tsx
+++ b/src/webex/pages/pay.tsx
@@ -22,9 +22,9 @@
/**
* Imports.
*/
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
-import { PreparePayResult } from "../../walletTypes";
+import { PreparePayResult } from "../../types/walletTypes";
import { renderAmount, ProgressButton, registerMountPage } from "../renderHtml";
import * as wxApi from "../wxApi";
diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx
index 806bef17c..a25b5c6b2 100644
--- a/src/webex/pages/payback.tsx
+++ b/src/webex/pages/payback.tsx
@@ -23,7 +23,7 @@
/**
* Imports.
*/
-import { ReserveRecord } from "../../dbTypes";
+import { ReserveRecord } from "../../types/dbTypes";
import { renderAmount, registerMountPage } from "../renderHtml";
import { getPaybackReserves, withdrawPaybackReserve } from "../wxApi";
import * as React from "react";
diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx
index 27d5dddba..3a2856d64 100644
--- a/src/webex/pages/popup.tsx
+++ b/src/webex/pages/popup.tsx
@@ -24,16 +24,15 @@
/**
* Imports.
*/
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
import { AmountJson } from "../../util/amounts";
import * as Amounts from "../../util/amounts";
import {
- HistoryEvent,
WalletBalance,
WalletBalanceEntry,
-} from "../../walletTypes";
+} from "../../types/walletTypes";
import {
abbrev,
@@ -44,6 +43,7 @@ import {
import * as wxApi from "../wxApi";
import * as React from "react";
+import { HistoryEvent } from "../../types/history";
function onUpdateNotification(f: () => void): () => void {
const port = chrome.runtime.connect({ name: "notifications" });
diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx
index 5196c9ea6..2a3f65d21 100644
--- a/src/webex/pages/refund.tsx
+++ b/src/webex/pages/refund.tsx
@@ -24,7 +24,7 @@ import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";
import * as wxApi from "../wxApi";
-import { PurchaseDetails } from "../../walletTypes";
+import { PurchaseDetails } from "../../types/walletTypes";
import { AmountView } from "../renderHtml";
function RefundStatusView(props: { talerRefundUri: string }) {
diff --git a/src/webex/pages/return-coins.tsx b/src/webex/pages/return-coins.tsx
index be65b4121..7c835da0a 100644
--- a/src/webex/pages/return-coins.tsx
+++ b/src/webex/pages/return-coins.tsx
@@ -31,9 +31,9 @@ import * as Amounts from "../../util/amounts";
import {
SenderWireInfos,
WalletBalance,
-} from "../../walletTypes";
+} from "../../types/walletTypes";
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
import * as wire from "../../util/wire";
diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx
index ac904cf0d..c44b343a4 100644
--- a/src/webex/pages/tip.tsx
+++ b/src/webex/pages/tip.tsx
@@ -24,7 +24,7 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
import { acceptTip, getReserveCreationInfo, getTipStatus } from "../wxApi";
@@ -32,7 +32,7 @@ import { WithdrawDetailView, renderAmount, ProgressButton } from "../renderHtml"
import * as Amounts from "../../util/amounts";
import { useState, useEffect } from "react";
-import { TipStatus } from "../../walletTypes";
+import { TipStatus } from "../../types/walletTypes";
function TipDisplay(props: { talerTipUri: string }) {
diff --git a/src/webex/pages/welcome.tsx b/src/webex/pages/welcome.tsx
index 1026e6e6e..e8f7028ed 100644
--- a/src/webex/pages/welcome.tsx
+++ b/src/webex/pages/welcome.tsx
@@ -23,7 +23,7 @@
import React, { useState, useEffect } from "react";
import { getDiagnostics } from "../wxApi";
import { registerMountPage, PageLink } from "../renderHtml";
-import { WalletDiagnostics } from "../../walletTypes";
+import { WalletDiagnostics } from "../../types/walletTypes";
function Diagnostics() {
const [timedOut, setTimedOut] = useState(false);
diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx
index 3ee0f768a..9d84ff3a6 100644
--- a/src/webex/pages/withdraw.tsx
+++ b/src/webex/pages/withdraw.tsx
@@ -22,11 +22,11 @@
*/
-import * as i18n from "../../i18n";
+import * as i18n from "../i18n";
import {
WithdrawDetails,
-} from "../../walletTypes";
+} from "../../types/walletTypes";
import { WithdrawDetailView, renderAmount } from "../renderHtml";
diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx
index bf9cdc76f..767058ebf 100644
--- a/src/webex/renderHtml.tsx
+++ b/src/webex/renderHtml.tsx
@@ -25,10 +25,10 @@
*/
import { AmountJson } from "../util/amounts";
import * as Amounts from "../util/amounts";
-import { DenominationRecord } from "../dbTypes";
-import { ExchangeWithdrawDetails } from "../walletTypes";
+import { DenominationRecord } from "../types/dbTypes";
+import { ExchangeWithdrawDetails } from "../types/walletTypes";
import * as moment from "moment";
-import * as i18n from "../i18n";
+import * as i18n from "./i18n";
import React from "react";
import ReactDOM from "react-dom";
diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts
index b0af7ac29..1383ffbc3 100644
--- a/src/webex/wxApi.ts
+++ b/src/webex/wxApi.ts
@@ -30,7 +30,7 @@ import {
ExchangeRecord,
PlanchetRecord,
ReserveRecord,
-} from "../dbTypes";
+} from "../types/dbTypes";
import {
BenchmarkResult,
ConfirmPayResult,
@@ -40,7 +40,7 @@ import {
WalletBalance,
PurchaseDetails,
WalletDiagnostics,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { MessageMap, MessageType } from "./messages";
diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts
index 27141247e..f3f4d80eb 100644
--- a/src/webex/wxBackend.ts
+++ b/src/webex/wxBackend.ts
@@ -30,11 +30,11 @@ import {
CreateReserveRequest,
ReturnCoinsRequest,
WalletDiagnostics,
-} from "../walletTypes";
+} from "../types/walletTypes";
import { Wallet } from "../wallet";
import { isFirefox } from "./compat";
-import { WALLET_DB_VERSION } from "../dbTypes";
-import { openTalerDb, exportDb, importDb, deleteDb } from "../db";
+import { WALLET_DB_VERSION } from "../types/dbTypes";
+import { openDatabase, exportDatabase, importDatabase, deleteDatabase } from "../db";
import { ChromeBadge } from "./chromeBadge";
import { MessageType } from "./messages";
import * as wxApi from "./wxApi";
@@ -73,11 +73,11 @@ async function handleMessage(
}
case "dump-db": {
const db = needsWallet().db;
- return exportDb(db);
+ return exportDatabase(db);
}
case "import-db": {
const db = needsWallet().db;
- return importDb(db, detail.dump);
+ return importDatabase(db, detail.dump);
}
case "ping": {
return Promise.resolve();
@@ -91,7 +91,7 @@ async function handleMessage(
tx.objectStore(db.objectStoreNames[i]).clear();
}
}
- deleteDb(indexedDB);
+ deleteDatabase(indexedDB);
setBadgeText({ text: "" });
console.log("reset done");
if (!currentWallet) {
@@ -423,7 +423,7 @@ async function reinitWallet() {
setBadgeText({ text: "" });
const badge = new ChromeBadge();
try {
- currentDatabase = await openTalerDb(
+ currentDatabase = await openDatabase(
indexedDB,
reinitWallet,
handleUpgradeUnsupported,
diff --git a/tsconfig.json b/tsconfig.json
index 2af0ca65b..8d696591c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -36,18 +36,34 @@
"src/crypto/workers/nodeThreadWorker.ts",
"src/crypto/workers/synchronousWorker.ts",
"src/db.ts",
- "src/dbTypes.ts",
"src/headless/bank.ts",
"src/headless/clk.ts",
"src/headless/helpers.ts",
"src/headless/integrationtest.ts",
"src/headless/merchant.ts",
"src/headless/taler-wallet-cli.ts",
- "src/i18n.tsx",
"src/i18n/strings.ts",
"src/index.ts",
- "src/talerTypes.ts",
- "src/types-test.ts",
+ "src/operations/balance.ts",
+ "src/operations/errors.ts",
+ "src/operations/exchanges.ts",
+ "src/operations/history.ts",
+ "src/operations/pay.ts",
+ "src/operations/payback.ts",
+ "src/operations/pending.ts",
+ "src/operations/refresh.ts",
+ "src/operations/reserves.ts",
+ "src/operations/return.ts",
+ "src/operations/state.ts",
+ "src/operations/tip.ts",
+ "src/operations/withdraw.ts",
+ "src/types/dbTypes.ts",
+ "src/types/history.ts",
+ "src/types/notifications.ts",
+ "src/types/pending.ts",
+ "src/types/talerTypes.ts",
+ "src/types/types-test.ts",
+ "src/types/walletTypes.ts",
"src/util/RequestThrottler.ts",
"src/util/amounts.ts",
"src/util/assertUnreachable.ts",
@@ -67,25 +83,12 @@
"src/util/taleruri.ts",
"src/util/timer.ts",
"src/util/wire.ts",
- "src/wallet-impl/balance.ts",
- "src/wallet-impl/errors.ts",
- "src/wallet-impl/exchanges.ts",
- "src/wallet-impl/history.ts",
- "src/wallet-impl/pay.ts",
- "src/wallet-impl/payback.ts",
- "src/wallet-impl/pending.ts",
- "src/wallet-impl/refresh.ts",
- "src/wallet-impl/reserves.ts",
- "src/wallet-impl/return.ts",
- "src/wallet-impl/state.ts",
- "src/wallet-impl/tip.ts",
- "src/wallet-impl/withdraw.ts",
"src/wallet-test.ts",
"src/wallet.ts",
- "src/walletTypes.ts",
"src/webex/background.ts",
"src/webex/chromeBadge.ts",
"src/webex/compat.ts",
+ "src/webex/i18n.tsx",
"src/webex/messages.ts",
"src/webex/notify.ts",
"src/webex/pages/add-auditor.tsx",