diff options
Diffstat (limited to 'packages/taler-wallet-core/src/util')
-rw-r--r-- | packages/taler-wallet-core/src/util/denominations.ts | 9 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/util/instructedAmountConversion.ts | 17 |
2 files changed, 15 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/util/denominations.ts b/packages/taler-wallet-core/src/util/denominations.ts index 76716cf7a..db6e69956 100644 --- a/packages/taler-wallet-core/src/util/denominations.ts +++ b/packages/taler-wallet-core/src/util/denominations.ts @@ -26,10 +26,9 @@ import { FeeDescriptionPair, TalerProtocolTimestamp, TimePoint, - WireFee, } from "@gnu-taler/taler-util"; import { DenominationRecord } from "../db.js"; -import { WalletConfig } from "../index.js"; +import { timestampProtocolFromDb } from "../index.js"; /** * Given a list of denominations with the same value and same period of time: @@ -457,9 +456,11 @@ export function isWithdrawableDenom( denomselAllowLate?: boolean, ): boolean { const now = AbsoluteTime.now(); - const start = AbsoluteTime.fromProtocolTimestamp(d.stampStart); + const start = AbsoluteTime.fromProtocolTimestamp( + timestampProtocolFromDb(d.stampStart), + ); const withdrawExpire = AbsoluteTime.fromProtocolTimestamp( - d.stampExpireWithdraw, + timestampProtocolFromDb(d.stampExpireWithdraw), ); const started = AbsoluteTime.cmp(now, start) >= 0; let lastPossibleWithdraw: AbsoluteTime; diff --git a/packages/taler-wallet-core/src/util/instructedAmountConversion.ts b/packages/taler-wallet-core/src/util/instructedAmountConversion.ts index 54c08eee4..a0394a687 100644 --- a/packages/taler-wallet-core/src/util/instructedAmountConversion.ts +++ b/packages/taler-wallet-core/src/util/instructedAmountConversion.ts @@ -14,6 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +import { GlobalIDB } from "@gnu-taler/idb-bridge"; import { AbsoluteTime, AgeRestriction, @@ -29,14 +30,14 @@ import { parsePaytoUri, strcmp, } from "@gnu-taler/taler-util"; -import { checkDbInvariant } from "./invariants.js"; import { DenominationRecord, InternalWalletState, getExchangeDetails, + timestampProtocolFromDb, } from "../index.js"; import { CoinInfo } from "./coinSelection.js"; -import { GlobalIDB } from "@gnu-taler/idb-bridge"; +import { checkDbInvariant } from "./invariants.js"; /** * If the operation going to be plan subtracts @@ -224,10 +225,10 @@ async function getAvailableDenoms( ); for (const denom of ds) { const expiresWithdraw = AbsoluteTime.fromProtocolTimestamp( - denom.stampExpireWithdraw, + timestampProtocolFromDb(denom.stampExpireWithdraw), ); const expiresDeposit = AbsoluteTime.fromProtocolTimestamp( - denom.stampExpireDeposit, + timestampProtocolFromDb(denom.stampExpireDeposit), ); creditDeadline = AbsoluteTime.min(deadline, expiresWithdraw); debitDeadline = AbsoluteTime.min(deadline, expiresDeposit); @@ -270,10 +271,10 @@ async function getAvailableDenoms( continue; } const expiresWithdraw = AbsoluteTime.fromProtocolTimestamp( - denom.stampExpireWithdraw, + timestampProtocolFromDb(denom.stampExpireWithdraw), ); const expiresDeposit = AbsoluteTime.fromProtocolTimestamp( - denom.stampExpireDeposit, + timestampProtocolFromDb(denom.stampExpireDeposit), ); creditDeadline = AbsoluteTime.min(deadline, expiresWithdraw); debitDeadline = AbsoluteTime.min(deadline, expiresDeposit); @@ -318,7 +319,9 @@ function buildCoinInfoFromDenom( exchangeBaseUrl: denom.exchangeBaseUrl, duration: AbsoluteTime.difference( AbsoluteTime.now(), - AbsoluteTime.fromProtocolTimestamp(denom.stampExpireDeposit), + AbsoluteTime.fromProtocolTimestamp( + timestampProtocolFromDb(denom.stampExpireDeposit), + ), ), totalAvailable: total, value: Amounts.parseOrThrow(denom.value), |