diff options
author | Florian Dold <florian@dold.me> | 2023-09-08 11:45:31 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-08 11:45:31 +0200 |
commit | 132ece8e53d2c7d69c943a2898ed07411c63f12f (patch) | |
tree | dbe97c498c5853efd844aab4502ae97d8dec7b4a /packages/taler-wallet-core/src/db.ts | |
parent | c660db82c12e08020661828f1d8383baa7ef0e02 (diff) | |
download | wallet-core-132ece8e53d2c7d69c943a2898ed07411c63f12f.tar.xz |
wallet-core: store contract terms in separate object store only
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 9aedb888b..679ca2842 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -102,6 +102,14 @@ import { RetryInfo, TaskIdentifiers } from "./operations/common.js"; */ /** + FIXMEs: + - Contract terms can be quite large. We currently tend to read the + full contract terms from the DB quite often. + Instead, we should probably extract what we need into a separate object + store. + */ + +/** * Name of the Taler database. This is effectively the major * version of the DB schema. Whenever it changes, custom import logic * for all previous versions must be written, which should be @@ -166,47 +174,47 @@ export enum WithdrawalGroupStatus { /** * Reserve must be registered with the bank. */ - PendingRegisteringBank = 0x0100_0000, - SuspendedRegisteringBank = 0x0110_0000, + PendingRegisteringBank = 0x0100_0001, + SuspendedRegisteringBank = 0x0110_0001, /** * We've registered reserve's information with the bank * and are now waiting for the user to confirm the withdraw * with the bank (typically 2nd factor auth). */ - PendingWaitConfirmBank = 0x0100_0001, - SuspendedWaitConfirmBank = 0x0110_0001, + PendingWaitConfirmBank = 0x0100_0002, + SuspendedWaitConfirmBank = 0x0110_0002, /** * Querying reserve status with the exchange. */ - PendingQueryingStatus = 0x0100_0002, - SuspendedQueryingStatus = 0x0110_0002, + PendingQueryingStatus = 0x0100_0003, + SuspendedQueryingStatus = 0x0110_0003, /** * Ready for withdrawal. */ - PendingReady = 0x0100_0003, - SuspendedReady = 0x0110_0003, + PendingReady = 0x0100_0004, + SuspendedReady = 0x0110_0004, /** * We are telling the bank that we don't want to complete * the withdrawal! */ - AbortingBank = 0x0103_0000, - SuspendedAbortingBank = 0x0113_0000, + AbortingBank = 0x0103_0001, + SuspendedAbortingBank = 0x0113_0001, /** * Exchange wants KYC info from the user. */ - PendingKyc = 0x0100_0004, - SuspendedKyc = 0x0110_004, + PendingKyc = 0x0100_0005, + SuspendedKyc = 0x0110_005, /** * Exchange is doing AML checks. */ - PendingAml = 0x0100_0005, - SuspendedAml = 0x0100_0005, + PendingAml = 0x0100_0006, + SuspendedAml = 0x0100_0006, /** * The corresponding withdraw record has been created. @@ -218,9 +226,9 @@ export enum WithdrawalGroupStatus { /** * The bank aborted the withdrawal. */ - FailedBankAborted = 0x0501_0000, + FailedBankAborted = 0x0501_0001, - FailedAbortingBank = 0x0501_0001, + FailedAbortingBank = 0x0501_0002, /** * Aborted in a state where we were supposed to @@ -272,9 +280,9 @@ export interface ReserveBankInfo { */ export enum DenominationVerificationStatus { /** - * Verification was delayed. + * Verification was delayed (pending). */ - Unverified = 0x0500_0000, + Unverified = 0x0100_0000, /** * Verified as valid. @@ -532,6 +540,7 @@ export enum ExchangeEntryDbRecordStatus { Used = 3, } +// FIXME: Use status ranges for this as well? export enum ExchangeEntryDbUpdateStatus { Initial = 1, InitialUpdate = 2, @@ -612,9 +621,9 @@ export interface ExchangeEntryRecord { } export enum PlanchetStatus { - Pending = 10 /* ACTIVE_START */, - KycRequired = 11 /* ACTIVE_START + 1 */, - WithdrawalDone = 50 /* DORMANT_START */, + Pending = 0x0100_0000, + KycRequired = 0x0100_0001, + WithdrawalDone = 0x0500_000, } /** @@ -1358,7 +1367,8 @@ export interface WgInfoBankManual { export interface WgInfoBankPeerPull { withdrawalType: WithdrawalRecordType.PeerPullCredit; - contractTerms: any; + // FIXME: include a transaction ID here? + /** * Needed to quickly construct the taler:// URI for the counterparty * without a join. @@ -1369,7 +1379,7 @@ export interface WgInfoBankPeerPull { export interface WgInfoBankPeerPush { withdrawalType: WithdrawalRecordType.PeerPushCredit; - contractTerms: any; + // FIXME: include a transaction ID here? } export interface WgInfoBankRecoup { @@ -1829,11 +1839,6 @@ export interface PeerPushDebitRecord { */ contractEncNonce: string; - /** - * FIXME: Put those in a different object store! - */ - contractTerms: PeerContractTerms; - purseExpiration: TalerProtocolTimestamp; timestampCreated: TalerPreciseTimestamp; @@ -1861,7 +1866,7 @@ export enum PeerPullPaymentCreditStatus { SuspendedCreatePurse = 0x0110_0000, SuspendedReady = 0x0110_0001, SuspendedMergeKycRequired = 0x0110_0002, - SuspendedWithdrawing = 0x0113_0000, + SuspendedWithdrawing = 0x0110_0000, SuspendedAbortingDeletePurse = 0x0113_0000, @@ -1878,6 +1883,7 @@ export interface PeerPullCreditRecord { /** * Amount requested. + * FIXME: What type of instructed amount is i? */ amount: AmountString; @@ -1908,11 +1914,6 @@ export interface PeerPullCreditRecord { contractEncNonce: string; - /** - * FIXME: Put in separate object store! - */ - contractTerms: PeerContractTerms; - mergeTimestamp: TalerPreciseTimestamp; mergeReserveRowId: number; @@ -2529,8 +2530,7 @@ export const WalletStoresV1 = { byWithdrawalGroupId: describeIndex( "byWithdrawalGroupId", "withdrawalGroupId", - { - }, + {}, ), }, ), @@ -2571,8 +2571,7 @@ export const WalletStoresV1 = { }), { byProposalId: describeIndex("byProposalId", "proposalId"), - byStatus: describeIndex("byStatus", "status", { - }), + byStatus: describeIndex("byStatus", "status", {}), }, ), refundItems: describeStore( |