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

Function formatPrice

src/utils/formatNumbers.ts:566–578  ·  view source on GitHub ↗
({
  price,
  type = NumberType.FiatTokenPrice,
  locale = DEFAULT_LOCALE,
  localCurrency = DEFAULT_LOCAL_CURRENCY,
  conversionRate,
}: FormatPriceOptions)

Source from the content-addressed store, hash-verified

564}
565
566function formatPrice({
567 price,
568 type = NumberType.FiatTokenPrice,
569 locale = DEFAULT_LOCALE,
570 localCurrency = DEFAULT_LOCAL_CURRENCY,
571 conversionRate,
572}: FormatPriceOptions): string {
573 if (price === null || price === undefined) {
574 return '-'
575 }
576
577 return formatNumber({ input: parseFloat(price.toSignificant()), type, locale, localCurrency, conversionRate })
578}
579
580interface FormatTickPriceOptions {
581 price?: Price<Token, Token>

Callers 6

TradePriceFunction · 0.85
PositionPreviewFunction · 0.85
formatTickPriceFunction · 0.85
useFormatterFunction · 0.85
AddLiquidityFunction · 0.85
CurrentPriceCardFunction · 0.85

Calls 1

formatNumberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…