aboutsummaryrefslogtreecommitdiff
path: root/src/walletTypes.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-11-20 19:48:43 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-11-20 19:48:43 +0100
commit553da649902f71d5ca34c9a6289ab6b1ef0ba7cb (patch)
tree857c4eb2c39e4a92e71c8a623d3188e6dbbbd1e9 /src/walletTypes.ts
parentfaedf697626dd37f3ac74ad4cac1ec378598bbf3 (diff)
downloadwallet-core-553da649902f71d5ca34c9a6289ab6b1ef0ba7cb.tar.xz
WIP: simplify DB queries and error handling
Diffstat (limited to 'src/walletTypes.ts')
-rw-r--r--src/walletTypes.ts58
1 files changed, 49 insertions, 9 deletions
diff --git a/src/walletTypes.ts b/src/walletTypes.ts
index e632cd38b..b227ca816 100644
--- a/src/walletTypes.ts
+++ b/src/walletTypes.ts
@@ -34,8 +34,7 @@ import {
CoinRecord,
DenominationRecord,
ExchangeRecord,
- ExchangeWireFeesRecord,
- TipRecord,
+ ExchangeWireInfo,
} from "./dbTypes";
import { CoinPaySig, ContractTerms, PayReq } from "./talerTypes";
@@ -98,7 +97,7 @@ export interface ReserveCreationInfo {
/**
* Wire fees from the exchange.
*/
- wireFees: ExchangeWireFeesRecord;
+ wireFees: ExchangeWireInfo;
/**
* Does the wallet know about an auditor for
@@ -475,7 +474,6 @@ export interface PreparePayResultError {
error: string;
}
-
export interface PreparePayResultPaid {
status: "paid";
contractTerms: ContractTerms;
@@ -517,18 +515,40 @@ export interface WalletDiagnostics {
}
export interface PendingWithdrawOperation {
- type: "withdraw"
+ type: "withdraw";
}
export interface PendingRefreshOperation {
- type: "refresh"
+ type: "refresh";
}
export interface PendingPayOperation {
- type: "pay"
+ type: "pay";
+}
+
+export interface OperationError {
+ type: string;
+ message: string;
+ details: any;
+}
+
+export interface PendingExchangeUpdateOperation {
+ type: "exchange-update";
+ stage: string;
+ exchangeBaseUrl: string;
+ lastError?: OperationError;
+}
+
+export interface PendingBugOperation {
+ type: "bug";
+ message: string;
+ details: any;
}
-export type PendingOperationInfo = PendingWithdrawOperation
+export type PendingOperationInfo =
+ | PendingWithdrawOperation
+ | PendingBugOperation
+ | PendingExchangeUpdateOperation;
export interface PendingOperationsResponse {
pendingOperations: PendingOperationInfo[];
@@ -541,4 +561,24 @@ export interface HistoryQuery {
* Level 1: All events.
*/
level: number;
-} \ No newline at end of file
+}
+
+export interface Timestamp {
+ /**
+ * Timestamp in milliseconds.
+ */
+ t_ms: number;
+}
+
+export interface Duration {
+ /**
+ * Duration in milliseconds.
+ */
+ d_ms: number;
+}
+
+export function getTimestampNow(): Timestamp {
+ return {
+ t_ms: new Date().getTime(),
+ };
+}