refactor: re-structure type definitions

This commit is contained in:
Florian Dold 2019-12-12 20:53:15 +01:00
parent cc137c8739
commit 74433c3e05
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
48 changed files with 587 additions and 519 deletions

View File

@ -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";

View File

@ -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";

View File

@ -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);
}

View File

@ -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,

View File

@ -23,7 +23,7 @@
* Imports.
*/
import axios from "axios";
import { CheckPaymentResponse } from "../talerTypes";
import { CheckPaymentResponse } from "../types/talerTypes";
/**
* Connection to the *internal* merchant backend.

View File

@ -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";

View File

@ -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";

View File

@ -1,4 +1,4 @@
import { OperationError } from "../walletTypes";
import { OperationError } from "../types/walletTypes";
/*
This file is part of GNU Taler

View File

@ -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,

View File

@ -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.

View File

@ -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;

View File

@ -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");

View File

@ -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,

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

@ -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(

View File

@ -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");

View File

@ -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,

58
src/types/history.ts Normal file
View File

@ -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;
}

213
src/types/notifications.ts Normal file
View File

@ -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;

161
src/types/pending.ts Normal file
View File

@ -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;
}

View File

@ -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.

View File

@ -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 = (

View File

@ -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,
@ -227,33 +227,6 @@ export interface ConfirmPayResult {
nextUrl: string;
}
/**
* 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 {
/**

View File

@ -21,7 +21,7 @@
/**
* Imports.
*/
import { getTimestampNow, Timestamp } from "../walletTypes";
import { getTimestampNow, Timestamp } from "../types/walletTypes";
/**
* Maximum request per second, per origin.

View File

@ -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.

View File

@ -25,7 +25,7 @@
/**
* Imports.
*/
import * as i18n from "../i18n";
import * as i18n from "../webex/i18n";
/**
* Short summary of the wire information.

View File

@ -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);

View File

@ -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";
} from "./operations/exchanges";
import { processReserve } from "./operations/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";
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

View File

@ -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";

View File

@ -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 };

View File

@ -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";

View File

@ -25,7 +25,7 @@ import {
AuditorRecord,
CurrencyRecord,
ExchangeForCurrencyRecord,
} from "../../dbTypes";
} from "../../types/dbTypes";
import {
getCurrencies,

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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" });

View File

@ -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 }) {

View File

@ -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";

View File

@ -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 }) {

View File

@ -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);

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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,

View File

@ -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",