[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: implement hintNe
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: implement hintNetworkAvailability request |
Date: |
Thu, 16 May 2024 00:30:54 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new aa39162de wallet-core: implement hintNetworkAvailability request
aa39162de is described below
commit aa39162de0bba9b7673db5214012efee1ea61f15
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu May 16 00:30:51 2024 +0200
wallet-core: implement hintNetworkAvailability request
---
packages/taler-util/src/wallet-types.ts | 10 ++++++++++
packages/taler-wallet-core/src/transactions.ts | 7 +++++++
packages/taler-wallet-core/src/wallet-api-types.ts | 9 +++++++++
packages/taler-wallet-core/src/wallet.ts | 16 ++++++++++++----
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/packages/taler-util/src/wallet-types.ts
b/packages/taler-util/src/wallet-types.ts
index 5f3dfcb6e..4f971319a 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -3304,3 +3304,13 @@ export const codecForSyncTermsOfServiceResponse =
.property("annual_fee", codecForAmountString())
.property("version", codecForString())
.build("SyncTermsOfServiceResponse");
+
+export interface HintNetworkAvailabilityRequest {
+ isNetworkAvailable: boolean;
+}
+
+export const codecForHintNetworkAvailabilityRequest =
+ (): Codec<HintNetworkAvailabilityRequest> =>
+ buildCodecForObject<HintNetworkAvailabilityRequest>()
+ .property("isNetworkAvailable", codecForBoolean())
+ .build("HintNetworkAvailabilityRequest");
diff --git a/packages/taler-wallet-core/src/transactions.ts
b/packages/taler-wallet-core/src/transactions.ts
index dc555c12a..12a4a31b5 100644
--- a/packages/taler-wallet-core/src/transactions.ts
+++ b/packages/taler-wallet-core/src/transactions.ts
@@ -1736,6 +1736,13 @@ export async function retryTransaction(
}
}
+export async function retryAll(wex: WalletExecutionContext): Promise<void> {
+ const tasks = wex.taskScheduler.getActiveTasks();
+ for (const task of tasks) {
+ await wex.taskScheduler.resetTaskRetries(task);
+ }
+}
+
async function getContextForTransaction(
wex: WalletExecutionContext,
transactionId: string,
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts
b/packages/taler-wallet-core/src/wallet-api-types.ts
index 9a8ea8470..6fe2422bc 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -79,6 +79,7 @@ import {
GetPlanForOperationResponse,
GetWithdrawalDetailsForAmountRequest,
GetWithdrawalDetailsForUriRequest,
+ HintNetworkAvailabilityRequest,
ImportDbRequest,
InitRequest,
InitResponse,
@@ -260,6 +261,7 @@ export enum WalletApiOperation {
RemoveGlobalCurrencyAuditor = "removeGlobalCurrencyAuditor",
ListAssociatedRefreshes = "listAssociatedRefreshes",
Shutdown = "shutdown",
+ HintNetworkAvailability = "hintNetworkAvailability",
CanonicalizeBaseUrl = "canonicalizeBaseUrl",
TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
TestingWaitRefreshesFinal = "testingWaitRefreshesFinal",
@@ -311,6 +313,12 @@ export type GetVersionOp = {
response: WalletCoreVersion;
};
+export type HintNetworkAvailabilityOp = {
+ op: WalletApiOperation.HintNetworkAvailability;
+ request: HintNetworkAvailabilityRequest;
+ response: EmptyObject;
+};
+
// group: Basic Wallet Information
/**
@@ -1337,6 +1345,7 @@ export type WalletOperations = {
[WalletApiOperation.ConfirmWithdrawal]: ConfirmWithdrawalOp;
[WalletApiOperation.CanonicalizeBaseUrl]: CanonicalizeBaseUrlOp;
[WalletApiOperation.TestingGetReserveHistory]: TestingGetReserveHistoryOp;
+ [WalletApiOperation.HintNetworkAvailability]: HintNetworkAvailabilityOp;
};
export type WalletCoreRequestType<
diff --git a/packages/taler-wallet-core/src/wallet.ts
b/packages/taler-wallet-core/src/wallet.ts
index b232080e9..b4a22c398 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -106,6 +106,7 @@ import {
codecForGetExchangeTosRequest,
codecForGetWithdrawalDetailsForAmountRequest,
codecForGetWithdrawalDetailsForUri,
+ codecForHintNetworkAvailabilityRequest,
codecForImportDbRequest,
codecForInitRequest,
codecForInitiatePeerPullPaymentRequest,
@@ -285,6 +286,7 @@ import {
getWithdrawalTransactionByUri,
parseTransactionIdentifier,
resumeTransaction,
+ retryAll,
retryTransaction,
suspendTransaction,
} from "./transactions.js";
@@ -1234,10 +1236,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);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: implement hintNetworkAvailability request,
gnunet <=