summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-31 16:50:34 +0200
committerFlorian Dold <florian@dold.me>2024-03-31 16:50:34 +0200
commitf45340eb11435f47a3a561c724cd356e5b4ba885 (patch)
tree3c2a079d78202908f0007fe065f7225ba016e415 /packages/taler-wallet-core/src/db.ts
parent2d61180dce798ab260d47f94b382fd4f843a55bf (diff)
downloadwallet-core-f45340eb11435f47a3a561c724cd356e5b4ba885.tar.gz
wallet-core-f45340eb11435f47a3a561c724cd356e5b4ba885.tar.bz2
wallet-core-f45340eb11435f47a3a561c724cd356e5b4ba885.zip
wallet-core: implement denom-loss transaction
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts38
1 files changed, 37 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 98390805b..4ead3cf5c 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -39,6 +39,7 @@ import {
CoinPublicKeyString,
CoinRefreshRequest,
CoinStatus,
+ DenomLossEventType,
DenomSelectionState,
DenominationInfo,
DenominationPubKey,
@@ -149,7 +150,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 8;
+export const WALLET_DB_MINOR_VERSION = 9;
declare const symDbProtocolTimestamp: unique symbol;
@@ -2355,11 +2356,46 @@ export interface TransactionRecord {
currency: string;
}
+export enum DenomLossStatus {
+ /**
+ * Done indicates that the loss happened.
+ */
+ Done = 0x0500_0000,
+
+ /**
+ * Aborted in the sense that the loss was reversed.
+ */
+ Aborted = 0x0503_0001,
+}
+
+export interface DenomLossEventRecord {
+ denomLossEventId: string;
+ currency: string;
+ denomPubHashes: string[];
+ status: DenomLossStatus;
+ timestampCreated: DbPreciseTimestamp;
+ amount: string;
+ eventType: DenomLossEventType;
+ exchangeBaseUrl: string;
+}
+
/**
* Schema definition for the IndexedDB
* wallet database.
*/
export const WalletStoresV1 = {
+ denomLossEvents: describeStoreV2({
+ recordCodec: passthroughCodec<DenomLossEventRecord>(),
+ storeName: "denomLossEvents",
+ keyPath: "denomLossEventId",
+ versionAdded: 9,
+ indexes: {
+ byCurrency: describeIndex("byCurrency", "currency", {
+ versionAdded: 9,
+ }),
+ byStatus: describeIndex("byStatus", "status"),
+ },
+ }),
transactions: describeStoreV2({
recordCodec: passthroughCodec<TransactionRecord>(),
storeName: "transactions",