aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-11-02 17:02:42 +0100
committerFlorian Dold <florian@dold.me>2022-11-02 17:02:42 +0100
commit14456bb942fa596290c2eb59f287e02c17c37f4c (patch)
treea049d0fcd94521567d9e9d1fa015676b14e54bd8 /packages/taler-wallet-core/src/db.ts
parent91e069c7428e8c160a8d5592514c0d8a6f726353 (diff)
downloadwallet-core-14456bb942fa596290c2eb59f287e02c17c37f4c.tar.xz
wallet-core: address DB FIXMEs
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts73
1 files changed, 41 insertions, 32 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index b380498c4..f7cb6e177 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -46,6 +46,7 @@ import {
TransactionIdStr,
UnblindedSignature,
WireInfo,
+ HashCodeString,
} from "@gnu-taler/taler-util";
import {
describeContents,
@@ -1630,16 +1631,12 @@ export interface TombstoneRecord {
id: string;
}
-export interface BalancePerCurrencyRecord {
- currency: string;
-
- availableNow: AmountString;
-
- availableExpected: AmountString;
-
- pendingIncoming: AmountString;
-
- pendingOutgoing: AmountString;
+export enum PeerPushPaymentInitiationStatus {
+ /**
+ * Initiated, but no purse created yet.
+ */
+ Initiated = 10 /* ACTIVE_START */,
+ PurseCreated = 50 /* DORMANT_START */,
}
/**
@@ -1653,7 +1650,8 @@ export interface PeerPushPaymentInitiationRecord {
amount: AmountString;
- contractTerms: any;
+ contractTermsHash: HashCodeString;
+
/**
* Purse public key. Used as the primary key to look
* up this record.
@@ -1679,12 +1677,12 @@ export interface PeerPushPaymentInitiationRecord {
purseExpiration: TalerProtocolTimestamp;
+ timestampCreated: TalerProtocolTimestamp;
+
/**
- * Did we successfully create the purse with the exchange?
+ * Status of the peer push payment initiation.
*/
- purseCreated: boolean;
-
- timestampCreated: TalerProtocolTimestamp;
+ status: PeerPushPaymentInitiationStatus;
}
export interface PeerPullPaymentInitiationRecord {
@@ -1710,11 +1708,15 @@ export interface PeerPullPaymentInitiationRecord {
pursePriv: string;
/**
- * Contract terms for the other party.
- *
- * FIXME: Put into contract terms store.
+ * Hash of the contract terms. Also
+ * used to look up the contract terms in the DB.
*/
- contractTerms: PeerContractTerms;
+ contractTermsHash: string;
+
+ /**
+ * Status of the peer pull payment initiation.
+ */
+ status: OperationStatus;
}
/**
@@ -1735,9 +1737,22 @@ export interface PeerPushPaymentIncomingRecord {
timestamp: TalerProtocolTimestamp;
- contractTerms: PeerContractTerms;
+ /**
+ * Hash of the contract terms. Also
+ * used to look up the contract terms in the DB.
+ */
+ contractTermsHash: string;
+
+ /**
+ * Status of the peer push payment incoming initiation.
+ */
+ status: OperationStatus;
+}
- // FIXME: add status etc.
+export enum PeerPullPaymentIncomingStatus {
+ Proposed = 30 /* USER_ATTENTION_START */,
+ Accepted = 10 /* ACTIVE_START */,
+ Paid = 50 /* DORMANT_START */,
}
export interface PeerPullPaymentIncomingRecord {
@@ -1751,11 +1766,12 @@ export interface PeerPullPaymentIncomingRecord {
timestampCreated: TalerProtocolTimestamp;
- paid: boolean;
-
- accepted: boolean;
-
contractPriv: string;
+
+ /**
+ * Status of the peer push payment incoming initiation.
+ */
+ status: PeerPullPaymentIncomingStatus;
}
/**
@@ -2061,13 +2077,6 @@ export const WalletStoresV1 = {
}),
{},
),
- balancesPerCurrency: describeStore(
- "balancesPerCurrency",
- describeContents<BalancePerCurrencyRecord>({
- keyPath: "currency",
- }),
- {},
- ),
peerPushPaymentIncoming: describeStore(
"peerPushPaymentIncoming",
describeContents<PeerPushPaymentIncomingRecord>({