gnunet-svn
[Top][All Lists]
Advanced

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

[taler-typescript-core] branch master updated: fix #9537


From: Admin
Subject: [taler-typescript-core] branch master updated: fix #9537
Date: Fri, 14 Feb 2025 18:24:19 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository taler-typescript-core.

The following commit(s) were added to refs/heads/master by this push:
     new 75209143a fix #9537
75209143a is described below

commit 75209143aace1fb78caedee35bcabf7eee8814c8
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Feb 14 14:23:34 2025 -0300

    fix #9537
---
 .../src/cta/Withdraw/state.ts                      | 77 ++++------------------
 1 file changed, 11 insertions(+), 66 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
index 232bfe9e2..930f55493 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
@@ -21,6 +21,7 @@ import {
   ExchangeFullDetails,
   ExchangeListItem,
   NotificationType,
+  ScopeType,
   TransactionMajorState,
   TransactionMinorState,
   parseWithdrawExchangeUri,
@@ -54,17 +55,21 @@ export function useComponentStateFromParams({
     const uri = maybeTalerUri
       ? parseWithdrawExchangeUri(maybeTalerUri)
       : undefined;
-    const exchangeByTalerUri = updatedExchangeByUser ?? uri?.exchangeBaseUrl;
+
+    const exchangeUrlByScope =
+      scope?.type === ScopeType.Exchange ? scope.url : undefined;
+    const exchangeByScopeOrTalerUri =
+      updatedExchangeByUser ?? exchangeUrlByScope ?? uri?.exchangeBaseUrl;
 
     let ex: ExchangeFullDetails | undefined;
-    if (exchangeByTalerUri) {
+    if (exchangeByScopeOrTalerUri) {
       await api.wallet.call(WalletApiOperation.AddExchange, {
-        exchangeBaseUrl: exchangeByTalerUri,
+        exchangeBaseUrl: exchangeByScopeOrTalerUri,
       });
       const info = await api.wallet.call(
         WalletApiOperation.GetExchangeDetailedInfo,
         {
-          exchangeBaseUrl: exchangeByTalerUri,
+          exchangeBaseUrl: exchangeByScopeOrTalerUri,
         },
       );
 
@@ -92,9 +97,8 @@ export function useComponentStateFromParams({
     };
   }
 
-
   const currency = uriInfoHook.response.exchange?.currency ?? scope?.currency;
-  const exchangeByTalerUri = uriInfoHook.response.exchange?.exchangeBaseUrl;
+  const exchangeByUrl = uriInfoHook.response.exchange?.exchangeBaseUrl;
   const exchangeList = uriInfoHook.response.exchanges.exchanges;
 
   const maybeAmount = uriInfoHook.response.amount ?? paramsAmount;
@@ -109,65 +113,6 @@ export function useComponentStateFromParams({
     };
   }
 
-  // if (!maybeAmount) {
-  //   const exchangeBaseUrl =
-  //     uriInfoHook.response.exchange?.exchangeBaseUrl ??
-  //     (exchangeList.length > 0 ? exchangeList[0].exchangeBaseUrl : 
undefined);
-  //   const currency =
-  //     uriInfoHook.response.exchange?.currency ??
-  //     (exchangeList.length > 0 ? exchangeList[0].currency : undefined);
-
-  //   if (!exchangeBaseUrl) {
-  //     return {
-  //       status: "error",
-  //       error: {
-  //         message: i18n.str`Can't withdraw from exchange`,
-  //         description: i18n.str`Missing base URL`,
-  //         cause: undefined,
-  //         context: {},
-  //         type: "error",
-  //       },
-  //     };
-  //   }
-  //   if (!currency) {
-  //     return {
-  //       status: "error",
-  //       error: {
-  //         message: i18n.str`Can't withdraw from exchange`,
-  //         description: i18n.str`Missing unknown currency`,
-  //         cause: undefined,
-  //         context: {},
-  //         type: "error",
-  //       },
-  //     };
-  //   }
-  //   return () => {
-  //     const { pushAlertOnError } = useAlertContext();
-  //     const [amount, setAmount] = useState<AmountJson>(
-  //       Amounts.zeroOfCurrency(currency),
-  //     );
-  //     const isValid = Amounts.isNonZero(amount);
-  //     return {
-  //       status: "select-amount",
-  //       currency,
-  //       exchangeBaseUrl,
-  //       error: undefined,
-  //       confirm: {
-  //         onClick: isValid
-  //           ? pushAlertOnError(async () => {
-  //               onAmountChanged(Amounts.stringify(amount));
-  //             })
-  //           : undefined,
-  //       },
-  //       amount: {
-  //         value: amount,
-  //         onInput: pushAlertOnError(async (e) => {
-  //           setAmount(e);
-  //         }),
-  //       },
-  //     };
-  //   };
-  // }
   const chosenAmount = maybeAmount ?? Amounts.zeroOfCurrency(currency);
 
   async function doManualWithdraw(
@@ -205,7 +150,7 @@ export function useComponentStateFromParams({
         bankFee: Amounts.zeroOfCurrency(chosenAmount.currency),
         editableAmount: true,
         editableExchange: true,
-        exchange: exchangeByTalerUri,
+        exchange: exchangeByUrl,
         exchangeList: exchangeList,
       },
       setUpdatedExchangeByUser,

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