gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: -include more info in refresh


From: gnunet
Subject: [taler-wallet-core] branch master updated: -include more info in refresh tx
Date: Tue, 14 Feb 2023 13:28:15 +0100

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 12fc0b3f2 -include more info in refresh tx
12fc0b3f2 is described below

commit 12fc0b3f2a12778c3ee439f3d4fc470c4e9c0bfd
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Feb 14 13:28:10 2023 +0100

    -include more info in refresh tx
---
 packages/taler-wallet-core/src/db.ts                      | 1 +
 packages/taler-wallet-core/src/internal-wallet-state.ts   | 8 +++++++-
 packages/taler-wallet-core/src/operations/common.ts       | 3 +++
 packages/taler-wallet-core/src/operations/refresh.ts      | 3 +++
 packages/taler-wallet-core/src/operations/transactions.ts | 7 ++++++-
 5 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 8aff18c6d..8bb8d519f 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -865,6 +865,7 @@ export enum TransactionStatus {
  * Additional information about the reason of a refresh.
  */
 export interface RefreshReasonDetails {
+  originatingTransactionId?: string;
   proposalId?: string;
 }
 
diff --git a/packages/taler-wallet-core/src/internal-wallet-state.ts 
b/packages/taler-wallet-core/src/internal-wallet-state.ts
index 879d18a48..d180861f8 100644
--- a/packages/taler-wallet-core/src/internal-wallet-state.ts
+++ b/packages/taler-wallet-core/src/internal-wallet-state.ts
@@ -43,7 +43,12 @@ import {
 } from "@gnu-taler/taler-util";
 import { CryptoDispatcher } from "./crypto/workers/crypto-dispatcher.js";
 import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
-import { ExchangeDetailsRecord, ExchangeRecord, WalletStoresV1 } from 
"./db.js";
+import {
+  ExchangeDetailsRecord,
+  ExchangeRecord,
+  RefreshReasonDetails,
+  WalletStoresV1,
+} from "./db.js";
 import { PendingOperationsResponse } from "./pending-types.js";
 import { AsyncOpMemoMap, AsyncOpMemoSingle } from "./util/asyncMemo.js";
 import { HttpRequestLibrary } from "./util/http.js";
@@ -89,6 +94,7 @@ export interface RefreshOperations {
     currency: string,
     oldCoinPubs: CoinRefreshRequest[],
     reason: RefreshReason,
+    reasonDetails?: RefreshReasonDetails,
   ): Promise<RefreshGroupId>;
 }
 
diff --git a/packages/taler-wallet-core/src/operations/common.ts 
b/packages/taler-wallet-core/src/operations/common.ts
index 31c1bebb2..3ea02012b 100644
--- a/packages/taler-wallet-core/src/operations/common.ts
+++ b/packages/taler-wallet-core/src/operations/common.ts
@@ -188,6 +188,9 @@ export async function spendCoins(
     Amounts.currencyOf(csi.contributions[0]),
     refreshCoinPubs,
     RefreshReason.PayMerchant,
+    {
+      originatingTransactionId: csi.allocationId,
+    },
   );
 }
 
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts 
b/packages/taler-wallet-core/src/operations/refresh.ts
index 638dec8a6..5b7bf8d83 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -60,6 +60,7 @@ import {
   RefreshCoinStatus,
   RefreshGroupRecord,
   RefreshOperationStatus,
+  RefreshReasonDetails,
   WalletStoresV1,
 } from "../db.js";
 import { TalerError } from "../errors.js";
@@ -853,6 +854,7 @@ export async function createRefreshGroup(
   currency: string,
   oldCoinPubs: CoinRefreshRequest[],
   reason: RefreshReason,
+  reasonDetails?: RefreshReasonDetails,
 ): Promise<RefreshGroupId> {
   const refreshGroupId = encodeCrock(getRandomBytes(32));
 
@@ -940,6 +942,7 @@ export async function createRefreshGroup(
     statusPerCoin: oldCoinPubs.map(() => RefreshCoinStatus.Pending),
     oldCoinPubs: oldCoinPubs.map((x) => x.coinPub),
     lastErrorPerCoin: {},
+    reasonDetails,
     reason,
     refreshGroupId,
     refreshSessionPerCoin: oldCoinPubs.map(() => undefined),
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index 12037fe0e..5b6b5adc3 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -600,7 +600,10 @@ function buildTransactionForRefresh(
     refreshGroupRecord.currency,
     refreshGroupRecord.inputPerCoin,
   ).amount;
-  const outputAmount = Amounts.sumOrZero(refreshGroupRecord.currency, 
refreshGroupRecord.estimatedOutputPerCoin).amount;
+  const outputAmount = Amounts.sumOrZero(
+    refreshGroupRecord.currency,
+    refreshGroupRecord.estimatedOutputPerCoin,
+  ).amount;
   return {
     type: TransactionType.Refresh,
     refreshReason: refreshGroupRecord.reason,
@@ -612,6 +615,8 @@ function buildTransactionForRefresh(
     ),
     refreshInputAmount: Amounts.stringify(inputAmount),
     refreshOutputAmount: Amounts.stringify(outputAmount),
+    originatingTransactionId:
+      refreshGroupRecord.reasonDetails?.originatingTransactionId,
     extendedStatus:
       refreshGroupRecord.operationStatus === RefreshOperationStatus.Finished ||
       refreshGroupRecord.operationStatus ===

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]