From 031d9d5a7de5902a5eae01ed53a0e06f5e80641f Mon Sep 17 00:00:00 2001 From: finned-palmer Date: Sat, 10 Jul 2021 07:21:52 -0500 Subject: [PATCH 1/2] Fix destructured param in checkTicket --- pkg/btc-wallet/src/js/components/lib/walletModal.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/btc-wallet/src/js/components/lib/walletModal.js b/pkg/btc-wallet/src/js/components/lib/walletModal.js index be0bc6ef07..f8687441d5 100644 --- a/pkg/btc-wallet/src/js/components/lib/walletModal.js +++ b/pkg/btc-wallet/src/js/components/lib/walletModal.js @@ -24,11 +24,7 @@ const WalletModal = () => { const [confirmingMasterTicket, setConfirmingMasterTicket] = useState(false); const [error, setError] = useState(false); - const checkTicket = ({ - event: { - target: { value }, - }, - }) => { + const checkTicket = ({ target: { value } }) => { // TODO: port over bridge ticket validation logic if (confirmingMasterTicket) { setConfirmedMasterTicket(value); From 6bc8d247bd65f13c693c6bfd4b1ca0b5c9bf5f2e Mon Sep 17 00:00:00 2001 From: finned-palmer Date: Sat, 10 Jul 2021 08:27:49 -0500 Subject: [PATCH 2/2] Map dollar sign to USD --- pkg/btc-wallet/src/js/hooks/useSettings.js | 3 ++- pkg/btc-wallet/src/js/lib/util.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/btc-wallet/src/js/hooks/useSettings.js b/pkg/btc-wallet/src/js/hooks/useSettings.js index 55e7038e48..c6e4917536 100644 --- a/pkg/btc-wallet/src/js/hooks/useSettings.js +++ b/pkg/btc-wallet/src/js/hooks/useSettings.js @@ -1,7 +1,7 @@ import React, { createContext, useContext, useEffect, useState } from 'react'; import _ from 'lodash'; import { api } from '../api'; -import { reduceHistory } from '../lib/util'; +import { mapDenominationToSymbol, reduceHistory } from '../lib/util'; export const SettingsContext = createContext({ network: 'bitcoin', @@ -120,6 +120,7 @@ export const SettingsProvider = ({ channel, children }) => { const newCurrencyRates = currencyRates; for (let c in n) { newCurrencyRates[c] = n[c]; + newCurrencyRates[c].symbol = mapDenominationToSymbol(c); } setCurrencyRates(newCurrencyRates); setTimeout(() => initializeCurrencyPoll(), 1000 * 60 * 15); diff --git a/pkg/btc-wallet/src/js/lib/util.js b/pkg/btc-wallet/src/js/lib/util.js index 131ec4012c..2c133559a6 100644 --- a/pkg/btc-wallet/src/js/lib/util.js +++ b/pkg/btc-wallet/src/js/lib/util.js @@ -118,3 +118,12 @@ export function reduceHistory(history) { return hest2.recvd - hest1.recvd; }); } + +export function mapDenominationToSymbol(denomination) { + switch (denomination) { + case 'USD': + return '$'; + default: + return denomination; + } +}