aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/wallet.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-05-23 10:26:54 -0300
committerSebastian <sebasjm@gmail.com>2024-05-23 10:26:54 -0300
commit527716758f154eb863acb0052f004dd23313f765 (patch)
tree057a9a08222bedcf46e3c567e3d7ac683c9f77c0 /packages/taler-wallet-core/src/wallet.ts
parent8b37f6ef4987cb06b4682d5bd2cfc907fd9f8d2d (diff)
downloadwallet-core-527716758f154eb863acb0052f004dd23313f765.tar.xz
redo commit #aa39162de
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r--packages/taler-wallet-core/src/wallet.ts33
1 files changed, 26 insertions, 7 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 49ffbcfb6..c17a2b467 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -107,6 +107,7 @@ import {
codecForGetExchangeTosRequest,
codecForGetWithdrawalDetailsForAmountRequest,
codecForGetWithdrawalDetailsForUri,
+ codecForHintNetworkAvailabilityRequest,
codecForImportDbRequest,
codecForInitRequest,
codecForInitiatePeerPullPaymentRequest,
@@ -287,6 +288,7 @@ import {
getWithdrawalTransactionByUri,
parseTransactionIdentifier,
resumeTransaction,
+ retryAll,
retryTransaction,
suspendTransaction,
} from "./transactions.js";
@@ -741,7 +743,6 @@ async function dispatchRequestInternal(
innerError: getErrorDetailFromException(e),
});
}
-
wex.ws.initWithConfig(applyRunConfigDefaults(req.config));
if (wex.ws.config.testing.skipDefaults) {
@@ -754,8 +755,11 @@ async function dispatchRequestInternal(
versionInfo: getVersion(wex),
};
- // After initialization, task loop should run.
- await wex.taskScheduler.ensureRunning();
+ if (req.config?.lazyTaskLoop) {
+ logger.trace("lazily starting task loop");
+ } else {
+ await wex.taskScheduler.ensureRunning();
+ }
wex.ws.initCalled = true;
return resp;
@@ -1043,6 +1047,10 @@ async function dispatchRequestInternal(
const req = codecForPrepareWithdrawExchangeRequest().decode(payload);
return handlePrepareWithdrawExchange(wex, req);
}
+ case WalletApiOperation.CheckPayForTemplate: {
+ const req = codecForCheckPayTemplateRequest().decode(payload);
+ return await checkPayForTemplate(wex, req);
+ }
case WalletApiOperation.PreparePayForUri: {
const req = codecForPreparePayRequest().decode(payload);
return await preparePayForUri(wex, req.talerPayUri);
@@ -1231,10 +1239,16 @@ async function dispatchRequestInternal(
await loadBackupRecovery(wex, req);
return {};
}
- // case WalletApiOperation.GetPlanForOperation: {
- // const req = codecForGetPlanForOperationRequest().decode(payload);
- // return await getPlanForOperation(ws, req);
- // }
+ case WalletApiOperation.HintNetworkAvailability: {
+ const req = codecForHintNetworkAvailabilityRequest().decode(payload);
+ if (req.isNetworkAvailable) {
+ await retryAll(wex);
+ } else {
+ // We're not doing anything right now, but we could stop showing
+ // certain errors!
+ }
+ return {};
+ }
case WalletApiOperation.ConvertDepositAmount: {
const req = codecForConvertAmountRequest.decode(payload);
return await convertDepositAmount(wex, req);
@@ -1829,6 +1843,11 @@ class WalletDbTriggerSpec implements TriggerSpec {
if (info.mode !== "readwrite") {
return;
}
+ logger.trace(
+ `in after commit callback for readwrite, modified ${j2s([
+ ...info.modifiedStores,
+ ])}`,
+ );
const modified = info.accessedStores;
if (
modified.has(WalletStoresV1.exchanges.storeName) ||