From 0ffea74ad52113aa9036453ff3ea8d4dff61b3d8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 2 Sep 2020 11:21:42 +0530 Subject: [PATCH] no more const enum, remove unused field --- .../src/types/ReserveTransaction.ts | 2 +- .../taler-wallet-core/src/types/dbTypes.ts | 34 ++++++------------- .../src/types/notifications.ts | 2 +- .../taler-wallet-core/src/types/pending.ts | 6 ++-- .../src/types/transactions.ts | 6 ++-- .../src/types/walletTypes.ts | 6 ++-- .../taler-wallet-core/src/util/taleruri.ts | 2 +- 7 files changed, 23 insertions(+), 35 deletions(-) diff --git a/packages/taler-wallet-core/src/types/ReserveTransaction.ts b/packages/taler-wallet-core/src/types/ReserveTransaction.ts index 0d946518f..aa98473a4 100644 --- a/packages/taler-wallet-core/src/types/ReserveTransaction.ts +++ b/packages/taler-wallet-core/src/types/ReserveTransaction.ts @@ -37,7 +37,7 @@ import { } from "./talerTypes"; import { Timestamp, codecForTimestamp } from "../util/time"; -export const enum ReserveTransactionType { +export enum ReserveTransactionType { Withdraw = "WITHDRAW", Credit = "CREDIT", Recoup = "RECOUP", diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts index 9ba07a0fd..1c3613ced 100644 --- a/packages/taler-wallet-core/src/types/dbTypes.ts +++ b/packages/taler-wallet-core/src/types/dbTypes.ts @@ -151,7 +151,7 @@ export function initRetryInfo( return info; } -export const enum WalletReserveHistoryItemType { +export enum WalletReserveHistoryItemType { Credit = "credit", Withdraw = "withdraw", Closing = "closing", @@ -541,7 +541,7 @@ export interface ExchangeDetails { lastUpdateTime: Timestamp; } -export const enum ExchangeUpdateStatus { +export enum ExchangeUpdateStatus { FetchKeys = "fetch-keys", FetchWire = "fetch-wire", FetchTerms = "fetch-terms", @@ -558,15 +558,7 @@ export interface ExchangeWireInfo { accounts: ExchangeBankAccount[]; } -/** - * Summary of updates to the exchange. - */ -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ExchangeUpdateDiff { - // FIXME: implement! -} - -export const enum ExchangeUpdateReason { +export enum ExchangeUpdateReason { Initial = "initial", Forced = "forced", Scheduled = "scheduled", @@ -644,14 +636,10 @@ export interface ExchangeRecord { updateReason?: ExchangeUpdateReason; - /** - * Update diff, will be incorporated when the update is finalized. - */ - updateDiff: ExchangeUpdateDiff | undefined; - lastError?: TalerErrorDetails; } + /** * A coin that isn't yet signed by an exchange. */ @@ -721,7 +709,7 @@ export interface RefreshPlanchetRecord { /** * Status of a coin. */ -export const enum CoinStatus { +export enum CoinStatus { /** * Withdrawn and never shown to anybody. */ @@ -732,7 +720,7 @@ export const enum CoinStatus { Dormant = "dormant", } -export const enum CoinSourceType { +export enum CoinSourceType { Withdraw = "withdraw", Refresh = "refresh", Tip = "tip", @@ -827,7 +815,7 @@ export interface CoinRecord { status: CoinStatus; } -export const enum ProposalStatus { +export enum ProposalStatus { /** * Not downloaded yet. */ @@ -1170,7 +1158,7 @@ export interface RefundEventRecord { proposalId: string; } -export const enum RefundState { +export enum RefundState { Failed = "failed", Applied = "applied", Pending = "pending", @@ -1222,7 +1210,7 @@ export interface WalletRefundAppliedItem extends WalletRefundItemCommon { type: RefundState.Applied; } -export const enum RefundReason { +export enum RefundReason { /** * Normal refund given by the merchant. */ @@ -1464,7 +1452,7 @@ export interface CoinsReturnRecord { wire: any; } -export const enum WithdrawalSourceType { +export enum WithdrawalSourceType { Tip = "tip", Reserve = "reserve", } @@ -1613,7 +1601,7 @@ export interface RecoupGroupRecord { lastError: TalerErrorDetails | undefined; } -export const enum ImportPayloadType { +export enum ImportPayloadType { CoreSchema = "core-schema", } diff --git a/packages/taler-wallet-core/src/types/notifications.ts b/packages/taler-wallet-core/src/types/notifications.ts index 0196cebf1..7d3795a6d 100644 --- a/packages/taler-wallet-core/src/types/notifications.ts +++ b/packages/taler-wallet-core/src/types/notifications.ts @@ -25,7 +25,7 @@ import { TalerErrorDetails } from "./walletTypes"; import { WithdrawalSource } from "./dbTypes"; -export const enum NotificationType { +export enum NotificationType { CoinWithdrawn = "coin-withdrawn", ProposalAccepted = "proposal-accepted", ProposalDownloaded = "proposal-downloaded", diff --git a/packages/taler-wallet-core/src/types/pending.ts b/packages/taler-wallet-core/src/types/pending.ts index 23c736a57..69613becb 100644 --- a/packages/taler-wallet-core/src/types/pending.ts +++ b/packages/taler-wallet-core/src/types/pending.ts @@ -25,7 +25,7 @@ import { TalerErrorDetails, BalancesResponse } from "./walletTypes"; import { WithdrawalSource, RetryInfo, ReserveRecordStatus } from "./dbTypes"; import { Timestamp, Duration } from "../util/time"; -export const enum PendingOperationType { +export enum PendingOperationType { Bug = "bug", ExchangeUpdate = "exchange-update", Pay = "pay", @@ -84,13 +84,13 @@ export interface PendingBugOperation { /** * Current state of an exchange update operation. */ -export const enum ExchangeUpdateOperationStage { +export enum ExchangeUpdateOperationStage { FetchKeys = "fetch-keys", FetchWire = "fetch-wire", FinalizeUpdate = "finalize-update", } -export const enum ReserveType { +export enum ReserveType { /** * Manually created. */ diff --git a/packages/taler-wallet-core/src/types/transactions.ts b/packages/taler-wallet-core/src/types/transactions.ts index dce480830..1d1eb6490 100644 --- a/packages/taler-wallet-core/src/types/transactions.ts +++ b/packages/taler-wallet-core/src/types/transactions.ts @@ -96,7 +96,7 @@ export type Transaction = | TransactionTip | TransactionRefresh; -export const enum TransactionType { +export enum TransactionType { Withdrawal = "withdrawal", Payment = "payment", Refund = "refund", @@ -104,7 +104,7 @@ export const enum TransactionType { Tip = "tip", } -export const enum WithdrawalType { +export enum WithdrawalType { TalerBankIntegrationApi = "taler-bank-integration-api", ManualTransfer = "manual-transfer", } @@ -164,7 +164,7 @@ interface TransactionWithdrawal extends TransactionCommon { withdrawalDetails: WithdrawalDetails; } -export const enum PaymentStatus { +export enum PaymentStatus { /** * Explicitly aborted after timeout / failure */ diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index dbaefae3b..01fd95e05 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -202,7 +202,7 @@ export function mkAmount( return { value, fraction, currency }; } -export const enum ConfirmPayResultType { +export enum ConfirmPayResultType { Done = "done", Pending = "pending", } @@ -370,7 +370,7 @@ export interface BenchmarkResult { repetitions: number; } -export const enum PreparePayResultType { +export enum PreparePayResultType { PaymentPossible = "payment-possible", InsufficientBalance = "insufficient-balance", AlreadyConfirmed = "already-confirmed", @@ -529,7 +529,7 @@ export interface PlanchetCreationRequest { /** * Reasons for why a coin is being refreshed. */ -export const enum RefreshReason { +export enum RefreshReason { Manual = "manual", Pay = "pay", Refund = "refund", diff --git a/packages/taler-wallet-core/src/util/taleruri.ts b/packages/taler-wallet-core/src/util/taleruri.ts index 56b46c0ff..5b2c5aba7 100644 --- a/packages/taler-wallet-core/src/util/taleruri.ts +++ b/packages/taler-wallet-core/src/util/taleruri.ts @@ -64,7 +64,7 @@ export function parseWithdrawUri(s: string): WithdrawUriResult | undefined { }; } -export const enum TalerUriType { +export enum TalerUriType { TalerPay = "taler-pay", TalerWithdraw = "taler-withdraw", TalerTip = "taler-tip",