summaryrefslogtreecommitdiff
path: root/src/types/pending.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-15 16:59:00 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-15 16:59:00 +0100
commit4966376839365536923cd6cfbb86d15071432e1a (patch)
tree6658b4a84df5ba6a0189e6d79e37fb0cc7fb597a /src/types/pending.ts
parentf4043a0f8114b1b8612e01a5cdf65b8d6ffc6f00 (diff)
downloadwallet-core-4966376839365536923cd6cfbb86d15071432e1a.tar.gz
wallet-core-4966376839365536923cd6cfbb86d15071432e1a.tar.bz2
wallet-core-4966376839365536923cd6cfbb86d15071432e1a.zip
group refresh sessions into groups for nicer history
Diffstat (limited to 'src/types/pending.ts')
-rw-r--r--src/types/pending.ts87
1 files changed, 42 insertions, 45 deletions
diff --git a/src/types/pending.ts b/src/types/pending.ts
index 5e381d09a..d08d2c54e 100644
--- a/src/types/pending.ts
+++ b/src/types/pending.ts
@@ -24,27 +24,41 @@
import { OperationError, Timestamp, Duration } from "./walletTypes";
import { WithdrawalSource, RetryInfo } from "./dbTypes";
+export const enum PendingOperationType {
+ Bug = "bug",
+ ExchangeUpdate = "exchange-update",
+ Pay = "pay",
+ ProposalChoice = "proposal-choice",
+ ProposalDownload = "proposal-download",
+ Refresh = "refresh",
+ Reserve = "reserve",
+ RefundApply = "refund-apply",
+ RefundQuery = "refund-query",
+ TipChoice = "tip-choice",
+ TipPickup = "tip-pickup",
+ Withdraw = "withdraw",
+}
+
/**
* Information about a pending operation.
*/
export type PendingOperationInfo = PendingOperationInfoCommon &
(
- | PendingWithdrawOperation
- | PendingReserveOperation
| PendingBugOperation
- | PendingDirtyCoinOperation
| PendingExchangeUpdateOperation
- | PendingRefreshOperation
- | PendingTipOperation
- | PendingProposalDownloadOperation
- | PendingProposalChoiceOperation
| PendingPayOperation
- | PendingRefundQueryOperation
+ | PendingProposalChoiceOperation
+ | PendingProposalDownloadOperation
+ | PendingRefreshOperation
| PendingRefundApplyOperation
+ | PendingRefundQueryOperation
+ | PendingReserveOperation
+ | PendingTipPickupOperation
+ | PendingWithdrawOperation
);
export interface PendingExchangeUpdateOperation {
- type: "exchange-update";
+ type: PendingOperationType.ExchangeUpdate;
stage: string;
reason: string;
exchangeBaseUrl: string;
@@ -52,13 +66,13 @@ export interface PendingExchangeUpdateOperation {
}
export interface PendingBugOperation {
- type: "bug";
+ type: PendingOperationType.Bug;
message: string;
details: any;
}
export interface PendingReserveOperation {
- type: "reserve";
+ type: PendingOperationType.Reserve;
retryInfo: RetryInfo | undefined;
stage: string;
timestampCreated: Timestamp;
@@ -68,21 +82,13 @@ export interface PendingReserveOperation {
}
export interface PendingRefreshOperation {
- type: "refresh";
+ type: PendingOperationType.Refresh;
lastError?: OperationError;
- refreshSessionId: string;
- oldCoinPub: string;
- refreshStatus: string;
- refreshOutputSize: number;
-}
-
-export interface PendingDirtyCoinOperation {
- type: "dirty-coin";
- coinPub: string;
+ refreshGroupId: string;
}
export interface PendingProposalDownloadOperation {
- type: "proposal-download";
+ type: PendingOperationType.ProposalDownload;
merchantBaseUrl: string;
proposalTimestamp: Timestamp;
proposalId: string;
@@ -96,66 +102,57 @@ export interface PendingProposalDownloadOperation {
* proposed contract terms.
*/
export interface PendingProposalChoiceOperation {
- type: "proposal-choice";
+ type: PendingOperationType.ProposalChoice;
merchantBaseUrl: string;
proposalTimestamp: Timestamp;
proposalId: string;
}
-export interface PendingTipOperation {
- type: "tip";
+export interface PendingTipPickupOperation {
+ type: PendingOperationType.TipPickup;
tipId: string;
merchantBaseUrl: string;
merchantTipId: string;
}
export interface PendingPayOperation {
- type: "pay";
+ type: PendingOperationType.Pay;
proposalId: string;
isReplay: boolean;
- retryInfo: RetryInfo,
+ retryInfo: RetryInfo;
lastError: OperationError | undefined;
}
export interface PendingRefundQueryOperation {
- type: "refund-query";
+ type: PendingOperationType.RefundQuery;
proposalId: string;
- retryInfo: RetryInfo,
+ retryInfo: RetryInfo;
lastError: OperationError | undefined;
}
export interface PendingRefundApplyOperation {
- type: "refund-apply";
+ type: PendingOperationType.RefundApply;
proposalId: string;
- retryInfo: RetryInfo,
+ retryInfo: RetryInfo;
lastError: OperationError | undefined;
numRefundsPending: number;
numRefundsDone: number;
}
-export interface PendingOperationInfoCommon {
- type: string;
- givesLifeness: boolean;
-}
-
-
export interface PendingWithdrawOperation {
- type: "withdraw";
+ type: PendingOperationType.Withdraw;
source: WithdrawalSource;
withdrawSessionId: string;
numCoinsWithdrawn: number;
numCoinsTotal: number;
}
-export interface PendingRefreshOperation {
- type: "refresh";
-}
-
-export interface PendingPayOperation {
- type: "pay";
+export interface PendingOperationInfoCommon {
+ type: PendingOperationType;
+ givesLifeness: boolean;
}
export interface PendingOperationsResponse {
pendingOperations: PendingOperationInfo[];
nextRetryDelay: Duration;
-} \ No newline at end of file
+}