diff options
author | Florian Dold <florian@dold.me> | 2022-10-15 11:52:07 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-15 11:53:16 +0200 |
commit | e075134ffc94fda3582b179122bda594d91a962b (patch) | |
tree | 547920b2aa07bdb9f2c87a0c1f8c35dbcd64c8f7 /packages/taler-wallet-core/src/db.ts | |
parent | 4d70391f3db386766a516bdecc3d1d265c5d49a1 (diff) | |
download | wallet-core-e075134ffc94fda3582b179122bda594d91a962b.tar.xz |
wallet-core: simplify coin record
we only track the allocation now, not the remaining amount
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 43 |
1 files changed, 4 insertions, 39 deletions
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", @@ -693,14 +674,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. @@ -1462,17 +1435,10 @@ 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<ExchangeTosRecord>({ keyPath: ["exchangeBaseUrl", "etag"], - autoIncrement: true, }), {}, ), |