From 5d6192b0cd356f7e56fa8d6193a2e74233a52f4b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 11 May 2020 18:03:25 +0530 Subject: make planchet management during withdrawal O(n) instead of O(n^2) --- src/webex/renderHtml.tsx | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'src/webex/renderHtml.tsx') diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx index a56af37fc..39ff470a2 100644 --- a/src/webex/renderHtml.tsx +++ b/src/webex/renderHtml.tsx @@ -25,7 +25,6 @@ */ import { AmountJson } from "../util/amounts"; import * as Amounts from "../util/amounts"; -import { DenominationRecord } from "../types/dbTypes"; import { ExchangeWithdrawDetails } from "../types/walletTypes"; import * as i18n from "./i18n"; import React from "react"; @@ -208,31 +207,6 @@ function FeeDetailsView(props: { } const denoms = rci.selectedDenoms; - - const countByPub: { [s: string]: number } = {}; - const uniq: DenominationRecord[] = []; - - denoms.forEach((x: DenominationRecord) => { - let c = countByPub[x.denomPub] || 0; - if (c === 0) { - uniq.push(x); - } - c += 1; - countByPub[x.denomPub] = c; - }); - - function row(denom: DenominationRecord): JSX.Element { - return ( - - {countByPub[denom.denomPub] + "x"} - {renderAmount(denom.value)} - {renderAmount(denom.feeWithdraw)} - {renderAmount(denom.feeRefresh)} - {renderAmount(denom.feeDeposit)} - - ); - } - const withdrawFee = renderAmount(rci.withdrawFee); const overhead = renderAmount(rci.overhead); @@ -266,7 +240,19 @@ function FeeDetailsView(props: { {i18n.str`Deposit Fee`} - {uniq.map(row)} + + {denoms.selectedDenoms.map((ds) => { + return ( + + {ds.count + "x"} + {renderAmount(ds.denom.value)} + {renderAmount(ds.denom.feeWithdraw)} + {renderAmount(ds.denom.feeRefresh)} + {renderAmount(ds.denom.feeDeposit)} + + ); + })} +

Wire Fees

-- cgit v1.2.3