gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: return exchange


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: return exchange scope info if we already know the currency
Date: Mon, 08 Jan 2024 22:13:51 +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 de39d4323 wallet-core: return exchange scope info if we already know 
the currency
de39d4323 is described below

commit de39d432374a3ecd1bddd788b1ac1585461af8c1
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 8 22:13:48 2024 +0100

    wallet-core: return exchange scope info if we already know the currency
    
    Fixes bugs.taler.net/n/8034
---
 .../taler-wallet-core/src/operations/common.ts     | 36 +++++++++++++---------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/common.ts 
b/packages/taler-wallet-core/src/operations/common.ts
index abba3f7a7..d8fb82be1 100644
--- a/packages/taler-wallet-core/src/operations/common.ts
+++ b/packages/taler-wallet-core/src/operations/common.ts
@@ -101,9 +101,8 @@ export async function makeCoinsVisible(
   }>,
   transactionId: string,
 ): Promise<void> {
-  const coins = await tx.coins.indexes.bySourceTransactionId.getAll(
-    transactionId,
-  );
+  const coins =
+    await tx.coins.indexes.bySourceTransactionId.getAll(transactionId);
   for (const coinRecord of coins) {
     if (!coinRecord.visible) {
       coinRecord.visible = 1;
@@ -657,6 +656,24 @@ export function getExchangeState(r: ExchangeEntryRecord): 
ExchangeEntryState {
   };
 }
 
+/**
+ * Mock scope info for an exchange by always returning a regional currency 
scope.
+ */
+function mockExchangeScopeInfo(
+  r: ExchangeEntryRecord,
+  exchangeDetails: ExchangeDetailsRecord | undefined,
+): ScopeInfo | undefined {
+  const currency = r.presetCurrencyHint ?? exchangeDetails?.currency;
+  if (currency) {
+    return {
+      currency,
+      type: ScopeType.Exchange,
+      url: r.baseUrl,
+    };
+  }
+  return undefined;
+}
+
 export function makeExchangeListItem(
   r: ExchangeEntryRecord,
   exchangeDetails: ExchangeDetailsRecord | undefined,
@@ -668,16 +685,6 @@ export function makeExchangeListItem(
       }
     : undefined;
 
-  let scopeInfo: ScopeInfo | undefined = undefined;
-  if (exchangeDetails) {
-    // FIXME: Look up actual scope info.
-    scopeInfo = {
-      currency: exchangeDetails.currency,
-      type: ScopeType.Exchange,
-      url: r.baseUrl,
-    };
-  }
-
   return {
     exchangeBaseUrl: r.baseUrl,
     currency: exchangeDetails?.currency ?? r.presetCurrencyHint,
@@ -689,7 +696,8 @@ export function makeExchangeListItem(
       : [],
     paytoUris: exchangeDetails?.wireInfo.accounts.map((x) => x.payto_uri) ?? 
[],
     lastUpdateErrorInfo,
-    scopeInfo,
+    // FIXME: Return real scope info in the future!
+    scopeInfo: mockExchangeScopeInfo(r, exchangeDetails),
   };
 }
 

-- 
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]