summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts53
1 files changed, 43 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 997d9c90a..1d5ff4e7a 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1,6 +1,6 @@
/*
This file is part of GNU Taler
- (C) 2021-2022 Taler Systems S.A.
+ (C) 2021-2024 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -53,6 +53,7 @@ import {
TalerPreciseTimestamp,
TalerProtocolDuration,
TalerProtocolTimestamp,
+ Transaction,
TransactionIdStr,
UnblindedSignature,
WireInfo,
@@ -148,7 +149,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 6;
+export const WALLET_DB_MINOR_VERSION = 7;
declare const symDbProtocolTimestamp: unique symbol;
@@ -2328,10 +2329,42 @@ export interface GlobalCurrencyExchangeRecord {
}
/**
+ * Primary key: transactionItem.transactionId
+ */
+export interface TransactionRecord {
+ /**
+ * Transaction item returned to the client.
+ */
+ transactionItem: Transaction;
+
+ /**
+ * Exchanges involved in the transaction.
+ */
+ exchanges: string[];
+
+ currency: string;
+}
+
+/**
* Schema definition for the IndexedDB
* wallet database.
*/
export const WalletStoresV1 = {
+ transactions: describeStoreV2({
+ recordCodec: passthroughCodec<TransactionRecord>(),
+ storeName: "transactions",
+ keyPath: "transactionItem.transactionId",
+ versionAdded: 7,
+ indexes: {
+ byCurrency: describeIndex("byCurrency", "currency", {
+ versionAdded: 7,
+ }),
+ byExchange: describeIndex("byExchange", "exchanges", {
+ versionAdded: 7,
+ multiEntry: true,
+ }),
+ },
+ }),
globalCurrencyAuditors: describeStoreV2({
recordCodec: passthroughCodec<GlobalCurrencyAuditorRecord>(),
storeName: "globalCurrencyAuditors",
@@ -2721,22 +2754,22 @@ export const WalletStoresV1 = {
),
};
-export type WalletDbReadWriteTransaction<
- StoresArr extends Array<StoreNames<typeof WalletStoresV1>>,
-> = DbReadWriteTransaction<typeof WalletStoresV1, StoresArr>;
+export type WalletDbStoresArr = Array<StoreNames<typeof WalletStoresV1>>;
+
+export type WalletDbReadWriteTransaction<StoresArr extends WalletDbStoresArr> =
+ DbReadWriteTransaction<typeof WalletStoresV1, StoresArr>;
-export type WalletDbReadOnlyTransaction<
- StoresArr extends Array<StoreNames<typeof WalletStoresV1>>,
-> = DbReadOnlyTransaction<typeof WalletStoresV1, StoresArr>;
+export type WalletDbReadOnlyTransaction<StoresArr extends WalletDbStoresArr> =
+ DbReadOnlyTransaction<typeof WalletStoresV1, StoresArr>;
export type WalletDbAllStoresReadOnlyTransaction<> = DbReadOnlyTransaction<
typeof WalletStoresV1,
- Array<StoreNames<typeof WalletStoresV1>>
+ WalletDbStoresArr
>;
export type WalletDbAllStoresReadWriteTransaction<> = DbReadWriteTransaction<
typeof WalletStoresV1,
- Array<StoreNames<typeof WalletStoresV1>>
+ WalletDbStoresArr
>;
/**