summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts12
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts18
2 files changed, 20 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 2549b1404..20b07d44e 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -147,6 +147,7 @@ async function refreshCreateSession(
throw Error("db inconsistent: exchange of coin not found");
}
+
const { availableAmount, availableDenoms } = await ws.db
.mktx((x) => ({
denominations: x.denominations,
@@ -161,6 +162,7 @@ async function refreshCreateSession(
throw Error("db inconsistent: denomination for coin not found");
}
+ // FIXME: use an index here, based on the withdrawal expiration time.
const availableDenoms: DenominationRecord[] = await tx.denominations.indexes.byExchangeBaseUrl
.iter(exchange.baseUrl)
.toArray();
@@ -913,7 +915,15 @@ export async function autoRefresh(
}
}
if (refreshCoins.length > 0) {
- await createRefreshGroup(ws, tx, refreshCoins, RefreshReason.Scheduled);
+ const res = await createRefreshGroup(
+ ws,
+ tx,
+ refreshCoins,
+ RefreshReason.Scheduled,
+ );
+ logger.info(
+ `created refresh group for auto-refresh (${res.refreshGroupId})`,
+ );
}
logger.info(
`current wallet time: ${timestampToIsoString(getTimestampNow())}`,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 44e626110..81c35c17b 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -17,7 +17,6 @@
/**
* Imports.
*/
-import * as LibtoolVersion from "@gnu-taler/taler-util";
import {
AmountJson,
Amounts,
@@ -41,6 +40,7 @@ import {
WithdrawResponse,
URL,
WithdrawUriInfoResponse,
+ VersionMatchResult,
} from "@gnu-taler/taler-util";
import {
CoinRecord,
@@ -143,7 +143,7 @@ interface ExchangeWithdrawDetails {
*
* Older exchanges don't return version information.
*/
- versionMatch: LibtoolVersion.VersionMatchResult | undefined;
+ versionMatch: VersionMatchResult | undefined;
/**
* Libtool-style version string for the exchange or "unknown"
@@ -693,15 +693,15 @@ export async function updateWithdrawalDenoms(
while (current < denominations.length) {
const updatedDenominations: DenominationRecord[] = [];
// Do a batch of batchSize
- for (let batchIdx = 0; batchIdx < batchSize; batchIdx++) {
- current++;
- if (current >= denominations.length) {
- break;
- }
+ for (
+ let batchIdx = 0;
+ batchIdx < batchSize && current < denominations.length;
+ batchIdx++, current++
+ ) {
const denom = denominations[current];
if (denom.status === DenominationStatus.Unverified) {
logger.trace(
- `Validation denomination (${current + 1}/${
+ `Validating denomination (${current + 1}/${
denominations.length
}) signature of ${denom.denomPubHash}`,
);
@@ -939,7 +939,7 @@ export async function getExchangeWithdrawalInfo(
let versionMatch;
if (exchangeDetails.protocolVersion) {
- versionMatch = LibtoolVersion.compare(
+ versionMatch = compare(
WALLET_EXCHANGE_PROTOCOL_VERSION,
exchangeDetails.protocolVersion,
);