From bd88dcebbcf90414c790a86ee13740eaf20e3334 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian@dold.me>
Date: Sat, 15 Oct 2022 12:59:26 +0200
Subject: wallet-core: simplify exchanges list response

---
 .../src/wallet/DeveloperPage.tsx                        | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index c6f016e00..c0e35b17b 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -17,6 +17,7 @@
 import {
   Amounts,
   CoinDumpJson,
+  CoinStatus,
   ExchangeListItem,
   NotificationType,
 } from "@gnu-taler/taler-util";
@@ -86,7 +87,7 @@ type CoinsInfo = CoinDumpJson["coins"];
 type CalculatedCoinfInfo = {
   ageKeysCount: number | undefined;
   denom_value: number;
-  remain_value: number;
+  //remain_value: number;
   status: string;
   from_refresh: boolean;
   id: string;
@@ -143,10 +144,10 @@ export function View({
       prev[cur.exchange_base_url].push({
         ageKeysCount: cur.ageCommitmentProof?.proof.privateKeys.length,
         denom_value: parseFloat(Amounts.stringifyValue(denom)),
-        remain_value: parseFloat(
-          Amounts.stringifyValue(Amounts.parseOrThrow(cur.remaining_value)),
-        ),
-        status: cur.coin_suspended ? "suspended" : "ok",
+        // remain_value: parseFloat(
+        //   Amounts.stringifyValue(Amounts.parseOrThrow(cur.remaining_value)),
+        // ),
+        status: cur.coin_status,
         from_refresh: cur.refresh_parent_coin_pub !== undefined,
         id: cur.coin_pub,
       });
@@ -254,8 +255,8 @@ export function View({
 
         const coins = allcoins.reduce(
           (prev, cur) => {
-            if (cur.remain_value > 0) prev.usable.push(cur);
-            if (cur.remain_value === 0) prev.spent.push(cur);
+            if (cur.status === CoinStatus.Fresh) prev.usable.push(cur);
+            if (cur.status === CoinStatus.Dormant) prev.spent.push(cur);
             return prev;
           },
           {
@@ -356,7 +357,6 @@ function ShowAllCoins({
               <tr key={idx}>
                 <td>{c.id.substring(0, 5)}</td>
                 <td>{c.denom_value}</td>
-                <td>{c.remain_value}</td>
                 <td>{c.status}</td>
                 <td>{c.from_refresh ? "true" : "false"}</td>
                 <td>{String(c.ageKeysCount)}</td>
@@ -396,7 +396,6 @@ function ShowAllCoins({
               <tr key={idx}>
                 <td>{c.id.substring(0, 5)}</td>
                 <td>{c.denom_value}</td>
-                <td>{c.remain_value}</td>
                 <td>{c.status}</td>
                 <td>{c.from_refresh ? "true" : "false"}</td>
               </tr>
-- 
cgit v1.2.3

