From e075134ffc94fda3582b179122bda594d91a962b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 15 Oct 2022 11:52:07 +0200 Subject: wallet-core: simplify coin record we only track the allocation now, not the remaining amount --- packages/taler-wallet-core/src/db.ts | 43 ++++-------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'packages/taler-wallet-core/src/db.ts') diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index c301ee457..b785efed8 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -49,6 +49,8 @@ import { ExchangeGlobalFees, DenomSelectionState, TransactionIdStr, + CoinRefreshRequest, + CoinStatus, } from "@gnu-taler/taler-util"; import { RetryInfo, RetryTags } from "./util/retries.js"; import { Event, IDBDatabase } from "@gnu-taler/idb-bridge"; @@ -603,27 +605,6 @@ export interface PlanchetRecord { ageCommitmentProof?: AgeCommitmentProof; } -/** - * Status of a coin. - */ -export enum CoinStatus { - /** - * Withdrawn and never shown to anybody. - */ - Fresh = "fresh", - - /** - * Fresh, but currently marked as "suspended", thus won't be used - * for spending. Used for testing. - */ - FreshSuspended = "fresh-suspended", - - /** - * A coin that has been spent and refreshed. - */ - Dormant = "dormant", -} - export enum CoinSourceType { Withdraw = "withdraw", Refresh = "refresh", @@ -692,14 +673,6 @@ export interface CoinRecord { */ denomSig: UnblindedSignature; - /** - * Amount that's left on the coin. - * - * FIXME: This is pretty redundant with "allocation" and "status". - * Do we really need this? - */ - currentAmount: AmountJson; - /** * Base URL that identifies the exchange from which we got the * coin. @@ -732,7 +705,7 @@ export interface CoinRecord { * - Diagnostics * - Idempotency of applying a coin selection (e.g. after re-selection) */ - allocation: CoinAllocation | undefined; + spendAllocation: CoinAllocation | undefined; /** * Maximum age of purchases that can be made with this coin. @@ -1461,18 +1434,11 @@ export interface RecoupGroupRecord { */ recoupFinishedPerCoin: boolean[]; - /** - * We store old amount (i.e. before recoup) of recouped coins here, - * as the balance of a recouped coin is set to zero when the - * recoup group is created. - */ - oldAmountPerCoin: AmountJson[]; - /** * Public keys of coins that should be scheduled for refreshing * after all individual recoups are done. */ - scheduleRefreshCoins: string[]; + scheduleRefreshCoins: CoinRefreshRequest[]; } export enum BackupProviderStateTag { @@ -1875,7 +1841,6 @@ export const WalletStoresV1 = { "exchangeTos", describeContents({ keyPath: ["exchangeBaseUrl", "etag"], - autoIncrement: true, }), {}, ), -- cgit v1.2.3