11import { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
22import { useSelector } from 'react-redux' ;
33import { selectCurrentCurrency } from '../../../../../selectors/currencyRateController' ;
4+ import currencySymbols from '../../../../../util/currency-symbols.json' ;
45import { getCurrencySymbol } from '../../../../../util/number/bigint' ;
56import { MAX_INPUT_LENGTH } from '../../components/TokenInputArea' ;
67import { BridgeToken } from '../../types' ;
@@ -16,6 +17,15 @@ import { useSourceAmountCursor } from '../useSourceAmountCursor';
1617import { useTokenFiatRate } from '../useTokenFiatRate' ;
1718
1819const FIAT_KEYPAD_CURRENCY = 'SWAPS_FIAT_INPUT' ;
20+ type CurrencyCode = keyof typeof currencySymbols ;
21+
22+ const getInputCurrencySymbol = ( currency ?: string ) => {
23+ const currencyCode = ( currency || 'usd' ) . toLowerCase ( ) ;
24+
25+ return currencyCode in currencySymbols
26+ ? getCurrencySymbol ( currencyCode as CurrencyCode )
27+ : currencyCode . toUpperCase ( ) ;
28+ } ;
1929
2030export const useSourceAmountInput = ( {
2131 sourceAmount,
@@ -192,7 +202,7 @@ export const useSourceAmountInput = ({
192202 } , [ canToggle , currentCurrency , isFiatMode , sourceAmount , sourceToken ] ) ;
193203
194204 const inputPrefix = isFiatMode
195- ? getCurrencySymbol ( ( currentCurrency || 'usd' ) . toLowerCase ( ) )
205+ ? getInputCurrencySymbol ( currentCurrency )
196206 : undefined ;
197207
198208 return {
0 commit comments