diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-16 16:20:45 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-16 16:20:45 +0100 |
commit | 35a7b76a7d935dc2c749fd39ac80c6af1096b795 (patch) | |
tree | b7f0bb167d3c912a085e7b842e887d5c834208fb /src/types | |
parent | fa4621e70c48500a372504eb8ae9b9481531c555 (diff) | |
download | wallet-core-35a7b76a7d935dc2c749fd39ac80c6af1096b795.tar.xz |
history WIP, DB naming
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/dbTypes.ts | 42 | ||||
-rw-r--r-- | src/types/history.ts | 64 |
2 files changed, 33 insertions, 73 deletions
diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts index 897c35038..a289eeb44 100644 --- a/src/types/dbTypes.ts +++ b/src/types/dbTypes.ts @@ -154,7 +154,7 @@ export interface ReserveRecord { /** * Time when the reserve was created. */ - created: Timestamp; + timestampCreated: Timestamp; /** * Time when the information about this reserve was posted to the bank. @@ -176,23 +176,23 @@ export interface ReserveRecord { * Amount that's still available for withdrawing * from this reserve. */ - withdrawRemainingAmount: AmountJson; + amountWithdrawRemaining: AmountJson; /** * Amount allocated for withdrawing. * The corresponding withdraw operation may or may not * have been completed yet. */ - withdrawAllocatedAmount: AmountJson; + amountWithdrawAllocated: AmountJson; - withdrawCompletedAmount: AmountJson; + amountWithdrawCompleted: AmountJson; /** * Amount requested when the reserve was created. * When a reserve is re-used (rare!) the current_amount can * be higher than the requested_amount */ - initiallyRequestedAmount: AmountJson; + amountInitiallyRequested: AmountJson; /** * We got some payback to this reserve. We'll cease to automatically @@ -469,6 +469,13 @@ export interface ExchangeWireInfo { accounts: ExchangeBankAccount[]; } +/** + * Summary of updates to the exchange. + */ +export interface ExchangeUpdateDiff { + // FIXME: implement! +} + export const enum ExchangeUpdateReason { Initial = "initial", Forced = "forced", @@ -529,9 +536,16 @@ export interface ExchangeRecord { * undefined if no update is in progress. */ updateStarted: Timestamp | undefined; + updateStatus: ExchangeUpdateStatus; + updateReason?: ExchangeUpdateReason; + /** + * Update diff, will be incorporated when the update is finalized. + */ + updateDiff: ExchangeUpdateDiff | undefined; + lastError?: OperationError; } @@ -898,7 +912,7 @@ export interface RefreshGroupRecord { /** * Timestamp when the refresh session finished. */ - finishedTimestamp: Timestamp | undefined; + timestampFinished: Timestamp | undefined; } /** @@ -916,13 +930,13 @@ export interface RefreshSessionRecord { * How much of the coin's value is melted away * with this refresh session? */ - valueWithFee: AmountJson; + amountRefreshInput: AmountJson; /** * Sum of the value of denominations we want * to withdraw in this session, without fees. */ - valueOutput: AmountJson; + amountRefreshOutput: AmountJson; /** * Signature to confirm the melting. @@ -972,7 +986,7 @@ export interface RefreshSessionRecord { /** * When has this refresh session been created? */ - created: Timestamp; + timestampCreated: Timestamp; /** * Base URL for the exchange we're doing the refresh with. @@ -1142,13 +1156,13 @@ export interface PurchaseRecord { * Timestamp of the first time that sending a payment to the merchant * for this purchase was successful. */ - firstSuccessfulPayTimestamp: Timestamp | undefined; + timestampFirstSuccessfulPay: Timestamp | undefined; /** * When was the purchase made? * Refers to the time that the user accepted. */ - acceptTimestamp: Timestamp; + timestampAccept: Timestamp; /** * State of refunds for this proposal. @@ -1159,7 +1173,7 @@ export interface PurchaseRecord { * When was the last refund made? * Set to 0 if no refund was made on the purchase. */ - lastRefundStatusTimestamp: Timestamp | undefined; + timestampLastRefundStatus: Timestamp | undefined; /** * Last session signature that we submitted to /pay (if any). @@ -1302,12 +1316,12 @@ export interface WithdrawalSessionRecord { * When was the withdrawal operation started started? * Timestamp in milliseconds. */ - startTimestamp: Timestamp; + timestampStart: Timestamp; /** * When was the withdrawal operation completed? */ - finishTimestamp?: Timestamp; + timestampFinish?: Timestamp; totalCoinValue: AmountJson; diff --git a/src/types/history.ts b/src/types/history.ts index 210006312..8b46276be 100644 --- a/src/types/history.ts +++ b/src/types/history.ts @@ -1,5 +1,6 @@ import { Timestamp, RefreshReason } from "./walletTypes"; import { ReserveTransaction } from "./ReserveTransaction"; +import { WithdrawalSource } from "./dbTypes"; /* This file is part of GNU Taler @@ -45,8 +46,6 @@ export const enum HistoryEventType { Refreshed = "refreshed", Refund = "refund", ReserveBalanceUpdated = "reserve-balance-updated", - ReserveWithdrawAllocated = "reserve-withdraw-allocated", - ReserveConfirmed = "reserve-confirmed", ReserveCreated = "reserve-created", TipAccepted = "tip-accepted", TipDeclined = "tip-declined", @@ -105,31 +104,6 @@ export interface HistoryReserveCreatedEvent { } /** - * The user (or some application / test case) or the bank has confirmed that the - * reserve will indeed become available after a while, because the - * funds are in the process of being transfered to the exchange. - */ -export interface HistoryReserveConfirmeEvent { - type: HistoryEventType.ReserveConfirmed; - - /** - * Point in time when the reserve was confirmed. - */ - timestamp: Timestamp; - - /** - * Amount that the should appear in the reserve once its status - * is requested from the exchange. - */ - expectedAmount: string; - - /** - * Condensed information about the reserve. - */ - reserveShortInfo: ReserveShortInfo; -} - -/** * This event is emitted every time we ask the exchange for the status * of the reserve, and the status has changed. */ @@ -161,35 +135,6 @@ export interface HistoryReserveBalanceUpdatedEvent { } /** - * This event is emitted every time we ask the exchange for the status - * of the reserve, and the status has changed. - */ -export interface HistoryReserveWithdrawAllocatedEvent { - type: HistoryEventType.ReserveWithdrawAllocated; - - /** - * Point in time when the reserve was confirmed. - */ - timestamp: Timestamp; - - /** - * Unique identifier to query more information about the withdrawal. - */ - withdrawalSessionId: string; - - /** - * Condensed information about the reserve. - */ - reserveShortInfo: ReserveShortInfo; - - /** - * Amount that has been allocated for withdrawal from - * this reserve. - */ - amountWithdrawAllocated: string; -} - -/** * History event to indicate that the user has accepted a tip. */ export interface HistoryTipAcceptedEvent { @@ -549,7 +494,7 @@ export interface HistoryPaymentSent { /** * A refund has been applied. */ -export interface HistoryRefund { +export interface HistoryRefunded { /** * Type tag. */ @@ -635,6 +580,8 @@ export interface HistoryWithdrawnEvent { */ withdrawSessionId: string; + withdrawalSource: WithdrawalSource; + /** * Amount that has been subtracted from the reserve's balance * for this withdrawal. @@ -689,9 +636,8 @@ export type HistoryEvent = HistoryEventBase & | HistoryPaymentAbortedEvent | HistoryPaymentSent | HistoryRefreshedEvent - | HistoryRefund + | HistoryRefunded | HistoryReserveBalanceUpdatedEvent - | HistoryReserveConfirmeEvent | HistoryReserveCreatedEvent | HistoryTipAcceptedEvent | HistoryTipDeclinedEvent |