gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: fixes #8228


From: gnunet
Subject: [taler-wallet-core] branch master updated: fixes #8228
Date: Mon, 12 Feb 2024 20:58:37 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new c166f98ae fixes #8228
c166f98ae is described below

commit c166f98aeb744a31cb0ae8d6d7d294fc2eae0b1f
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Feb 12 16:58:30 2024 -0300

    fixes #8228
---
 .../src/components/BalanceTable.tsx                |  5 +++-
 .../src/popup/BalancePage.tsx                      |  5 +++-
 .../src/wallet/DeveloperPage.tsx                   | 29 ++++++++++++++++++++++
 .../src/wallet/History.tsx                         | 23 +++++++++--------
 4 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/components/BalanceTable.tsx 
b/packages/taler-wallet-webextension/src/components/BalanceTable.tsx
index d3733e6cc..b8bcaa391 100644
--- a/packages/taler-wallet-webextension/src/components/BalanceTable.tsx
+++ b/packages/taler-wallet-webextension/src/components/BalanceTable.tsx
@@ -14,7 +14,7 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import { Amounts, WalletBalance } from "@gnu-taler/taler-util";
+import { Amounts, ScopeType, WalletBalance } from "@gnu-taler/taler-util";
 import { VNode, h } from "preact";
 import { TableWithRoundRows as TableWithRoundedRows } from "./styled/index.js";
 
@@ -45,6 +45,9 @@ export function BalanceTable({
               }}
             >
               {Amounts.stringifyValue(av, 2)}
+              <div style={{ fontSize: "small", color: "grey" }}>
+                {entry.scopeInfo.type === ScopeType.Exchange || 
entry.scopeInfo.type === ScopeType.Auditor ? entry.scopeInfo.url : undefined}
+              </div>
             </td>
           </tr>
         );
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx 
b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index 23614e290..513b37642 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -153,7 +153,10 @@ export function BalanceView(state: State.Balances): VNode {
   const { i18n } = useTranslationContext();
   const currencyWithNonZeroAmount = state.balances
     .filter((b) => !Amounts.isZero(b.available))
-    .map((b) => b.available.split(":")[0]);
+    .map((b) => {
+      b.flags
+      return b.available.split(":")[0]
+    });
 
   if (state.balances.length === 0) {
     return (
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index d12ae864b..5230d830f 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -170,6 +170,7 @@ export function View({ operations, coins, 
onDownloadDatabase }: Props): VNode {
   );
 
   const [tagName, setTagName] = useState("");
+  const [exchangeURL, setExchangeURL] = useState("");
   const [logLevel, setLogLevel] = useState("info");
   return (
     <div>
@@ -397,6 +398,34 @@ export function View({ operations, coins, 
onDownloadDatabase }: Props): VNode {
           Set log level
         </Button>
       </Paper>
+      <Paper style={{ padding: 10, margin: 10 }}>
+        <h3>Exchange</h3>
+        <div>
+          <TextField
+            label="Exchange URL"
+            placeholder="exchange.demo.taler.net"
+            variant="filled"
+            // error={subject.error}
+            required
+            value={exchangeURL}
+            onChange={setExchangeURL}
+          />
+        </div>
+        <Button
+          variant="contained"
+          onClick={async () => {
+            const resp = await fetch(new URL("/keys", exchangeURL).href)
+            const j = await resp.json()
+            api.wallet.call(WalletApiOperation.AddGlobalCurrencyExchange, {
+              currency: j.currency,
+              exchangeBaseUrl: j.base_url,
+              exchangeMasterPub: j.master_public_key,
+            });
+          }}
+        >
+          Set exchange as Global
+        </Button>
+      </Paper>
       {
         downloadedDatabase && (
           <div>
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx 
b/packages/taler-wallet-webextension/src/wallet/History.tsx
index dcc3c43e3..41b03424c 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.tsx
@@ -18,6 +18,7 @@ import {
   AbsoluteTime,
   Amounts,
   NotificationType,
+  ScopeType,
   Transaction,
   WalletBalance,
 } from "@gnu-taler/taler-util";
@@ -132,11 +133,10 @@ export function HistoryView({
         (transactionByCurrency[av.currency] &&
           transactionByCurrency[av.currency].length > 0)
       );
-    })
-    .map((b) => b.available.split(":")[0]);
+    });
 
   const defaultCurrencyIndex = currencies.findIndex(
-    (c) => c === defaultCurrency,
+    (c) => c.scopeInfo.currency === defaultCurrency,
   );
   const [currencyIndex, setCurrencyIndex] = useState(
     defaultCurrencyIndex === -1 ? 0 : defaultCurrencyIndex,
@@ -151,7 +151,7 @@ export function HistoryView({
   const ts =
     selectedCurrency === undefined
       ? []
-      : transactionByCurrency[selectedCurrency] ?? [];
+      : transactionByCurrency[selectedCurrency.scopeInfo.currency] ?? [];
 
   const datesWithTransaction: string[] = [];
   const byDate = ts.reduce((rv, x) => {
@@ -199,7 +199,7 @@ export function HistoryView({
                 {selectedCurrency}
               </CenteredText>
             ) : (
-              <NiceSelect>
+              <NiceSelect style={{ flexDirection: "column" }}>
                 <select
                   style={{
                     fontSize: "x-large",
@@ -209,14 +209,17 @@ export function HistoryView({
                     setCurrencyIndex(Number(e.currentTarget.value));
                   }}
                 >
-                  {currencies.map((currency, index) => {
+                  {currencies.map((entry, index) => {
                     return (
-                      <option value={index} key={currency}>
-                        {currency}
+                      <option value={index} key={entry.scopeInfo.currency}>
+                        {entry.scopeInfo.currency}
                       </option>
                     );
                   })}
                 </select>
+                <div style={{ fontSize: "small", color: "grey" }}>
+                  {selectedCurrency.scopeInfo.type === ScopeType.Exchange || 
selectedCurrency.scopeInfo.type === ScopeType.Auditor ? 
selectedCurrency.scopeInfo.url : undefined}
+                </div>
               </NiceSelect>
             )}
             {currencyAmount && (
@@ -236,7 +239,7 @@ export function HistoryView({
               tooltip="Transfer money to the wallet"
               startIcon={DownloadIcon}
               variant="contained"
-              onClick={() => goToWalletManualWithdraw(selectedCurrency)}
+              onClick={() => 
goToWalletManualWithdraw(selectedCurrency.scopeInfo.currency)}
             >
               <i18n.Translate>Add</i18n.Translate>
             </Button>
@@ -246,7 +249,7 @@ export function HistoryView({
                 startIcon={UploadIcon}
                 variant="outlined"
                 color="primary"
-                onClick={() => goToWalletDeposit(selectedCurrency)}
+                onClick={() => 
goToWalletDeposit(selectedCurrency.scopeInfo.currency)}
               >
                 <i18n.Translate>Send</i18n.Translate>
               </Button>

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