MCPcopy
hub / github.com/Uniswap/interface / formatReviewSwapCurrencyAmount

Function formatReviewSwapCurrencyAmount

src/utils/formatNumbers.ts:665–674  ·  view source on GitHub ↗
(
  amount: CurrencyAmount<Currency>,
  locale: SupportedLocale = DEFAULT_LOCALE
)

Source from the content-addressed store, hash-verified

663const MAX_AMOUNT_STR_LENGTH = 9
664
665function formatReviewSwapCurrencyAmount(
666 amount: CurrencyAmount<Currency>,
667 locale: SupportedLocale = DEFAULT_LOCALE
668): string {
669 let formattedAmount = formatCurrencyAmount({ amount, type: NumberType.TokenTx, locale })
670 if (formattedAmount.length > MAX_AMOUNT_STR_LENGTH) {
671 formattedAmount = formatCurrencyAmount({ amount, type: NumberType.SwapTradeAmount, locale })
672 }
673 return formattedAmount
674}
675
676export function useFormatterLocales(): {
677 formatterLocale: SupportedLocale

Callers 4

SwapModalHeaderAmountFunction · 0.85
TradeSummaryFunction · 0.85
useFormatterFunction · 0.85

Calls 1

formatCurrencyAmountFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…