diff options
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 6 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/internal-wallet-state.ts | 10 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/exchanges.ts | 4 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/refresh.ts | 13 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 8 |
5 files changed, 16 insertions, 25 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index fdb9b668e..4fac0f9aa 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -44,10 +44,10 @@ import { PeerContractTerms, Location, WireInfo, + DenominationInfo, } from "@gnu-taler/taler-util"; import { RetryInfo, RetryTags } from "./util/retries.js"; import { Event, IDBDatabase } from "@gnu-taler/idb-bridge"; -import { DenomInfo } from "./internal-wallet-state.js"; /** * Name of the Taler database. This is effectively the major @@ -330,7 +330,7 @@ export namespace DenominationRecord { }; } - export function toDenomInfo(d: DenominationRecord): DenomInfo { + export function toDenomInfo(d: DenominationRecord): DenominationInfo { return { denomPub: d.denomPub, denomPubHash: d.denomPubHash, @@ -1719,7 +1719,7 @@ export interface OperationRetryRecord { /** * Unique identifier for the operation. Typically of * the format `${opType}-${opUniqueKey}` - * + * * @see {@link RetryTags} */ id: string; diff --git a/packages/taler-wallet-core/src/internal-wallet-state.ts b/packages/taler-wallet-core/src/internal-wallet-state.ts index 575e7553c..ad6afe3c3 100644 --- a/packages/taler-wallet-core/src/internal-wallet-state.ts +++ b/packages/taler-wallet-core/src/internal-wallet-state.ts @@ -125,14 +125,6 @@ export interface RecoupOperations { ): Promise<void>; } -export type DenomInfo = DenominationInfo & { - /** - * The denomination public key. - */ - denomPub: DenominationPubKey; -} - - export type NotificationListener = (n: WalletNotification) => void; /** @@ -184,7 +176,7 @@ export interface InternalWalletState { }>, exchangeBaseUrl: string, denomPubHash: string, - ): Promise<DenomInfo | undefined>; + ): Promise<DenominationInfo | undefined>; db: DbAccess<typeof WalletStoresV1>; http: HttpRequestLibrary; diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index ca85ff465..9165ed050 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -53,8 +53,6 @@ import { DenominationVerificationStatus, ExchangeDetailsRecord, ExchangeRecord, - OperationAttemptResult, - OperationAttemptResultType, WalletStoresV1, } from "../db.js"; import { TalerError } from "../errors.js"; @@ -66,7 +64,7 @@ import { readSuccessResponseTextOrThrow, } from "../util/http.js"; import { DbAccess, GetReadOnlyAccess } from "../util/query.js"; -import { RetryInfo, runOperationHandlerForResult } from "../util/retries.js"; +import { OperationAttemptResult, OperationAttemptResultType, RetryInfo, runOperationHandlerForResult } from "../util/retries.js"; import { WALLET_EXCHANGE_PROTOCOL_VERSION } from "../versions.js"; import { guardOperationException } from "./common.js"; diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 048ab15b3..eeb492499 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -25,6 +25,7 @@ import { codecForExchangeRevealResponse, CoinPublicKey, CoinPublicKeyString, + DenominationInfo, DenomKeyType, Duration, durationFromSpec, @@ -42,7 +43,6 @@ import { NotificationType, RefreshGroupId, RefreshReason, - TalerErrorDetail, TalerProtocolTimestamp, URL, } from "@gnu-taler/taler-util"; @@ -64,7 +64,6 @@ import { } from "../db.js"; import { TalerError } from "../errors.js"; import { - DenomInfo, EXCHANGE_COINS_LOCK, InternalWalletState, } from "../internal-wallet-state.js"; @@ -74,9 +73,11 @@ import { } from "../util/http.js"; import { checkDbInvariant } from "../util/invariants.js"; import { GetReadWriteAccess } from "../util/query.js"; -import { OperationAttemptResult, OperationAttemptResultType, RetryInfo, runOperationHandlerForResult } from "../util/retries.js"; -import { makeCoinAvailable, Wallet } from "../wallet.js"; -import { guardOperationException } from "./common.js"; +import { + OperationAttemptResult, + OperationAttemptResultType, +} from "../util/retries.js"; +import { makeCoinAvailable } from "../wallet.js"; import { updateExchangeFromUrl } from "./exchanges.js"; import { isWithdrawableDenom, @@ -98,7 +99,7 @@ const logger = new Logger("refresh.ts"); */ export function getTotalRefreshCost( denoms: DenominationRecord[], - refreshedDenom: DenomInfo, + refreshedDenom: DenominationInfo, amountLeft: AmountJson, ): AmountJson { const withdrawAmount = Amounts.sub( diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index f89d0330c..c993155d8 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -92,6 +92,7 @@ import { FeeDescription, TalerErrorDetail, codecForTransactionByIdRequest, + DenominationInfo, } from "@gnu-taler/taler-util"; import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js"; import { @@ -115,7 +116,6 @@ import { } from "./errors.js"; import { createDenominationTimeline } from "./index.browser.js"; import { - DenomInfo, ExchangeOperations, InternalWalletState, MerchantInfo, @@ -746,7 +746,7 @@ async function getExchangeDetailedInfo( return; } - const denominations: DenomInfo[] = denominationRecords.map((x) => + const denominations: DenominationInfo[] = denominationRecords.map((x) => DenominationRecord.toDenomInfo(x), ); @@ -1572,7 +1572,7 @@ class InternalWalletStateImpl implements InternalWalletState { }; // FIXME: Use an LRU cache here. - private denomCache: Record<string, DenomInfo> = {}; + private denomCache: Record<string, DenominationInfo> = {}; /** * Promises that are waiting for a particular resource. @@ -1606,7 +1606,7 @@ class InternalWalletStateImpl implements InternalWalletState { }>, exchangeBaseUrl: string, denomPubHash: string, - ): Promise<DenomInfo | undefined> { + ): Promise<DenominationInfo | undefined> { const key = `${exchangeBaseUrl}:${denomPubHash}`; const cached = this.denomCache[key]; if (cached) { |