From 553da649902f71d5ca34c9a6289ab6b1ef0ba7cb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 20 Nov 2019 19:48:43 +0100 Subject: WIP: simplify DB queries and error handling --- src/walletTypes.ts | 58 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 9 deletions(-) (limited to 'src/walletTypes.ts') 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(), + }; +} -- cgit v1.2.3