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

Function formatCurrencyAmount

src/utils/formatNumbers.ts:518–534  ·  view source on GitHub ↗
({
  amount,
  type = NumberType.TokenNonTx,
  placeholder,
  locale = DEFAULT_LOCALE,
  localCurrency = DEFAULT_LOCAL_CURRENCY,
  conversionRate,
}: FormatCurrencyAmountOptions)

Source from the content-addressed store, hash-verified

516}
517
518function formatCurrencyAmount({
519 amount,
520 type = NumberType.TokenNonTx,
521 placeholder,
522 locale = DEFAULT_LOCALE,
523 localCurrency = DEFAULT_LOCAL_CURRENCY,
524 conversionRate,
525}: FormatCurrencyAmountOptions): string {
526 return formatNumber({
527 input: amount ? parseFloat(amount.toSignificant()) : undefined,
528 type,
529 placeholder,
530 locale,
531 localCurrency,
532 conversionRate,
533 })
534}
535
536function formatPercent(percent: Percent | undefined, locale: SupportedLocale = DEFAULT_LOCALE) {
537 if (!percent) return '-'

Callers 15

useFormatterFunction · 0.70
CurrencyAmountRowFunction · 0.50
BalanceSummaryFunction · 0.50
PositionPreviewFunction · 0.50
CurrencyInputPanelFunction · 0.50
modalHeaderFunction · 0.50
RemoveFunction · 0.50
modalHeaderFunction · 0.50

Calls 1

formatNumberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…