MCPcopy Index your code
hub / github.com/Uniswap/interface / handleFallbackCurrency

Function handleFallbackCurrency

src/utils/formatNumbers.ts:697–707  ·  view source on GitHub ↗
(
  selectedCurrency: SupportedLocalCurrency,
  previousSelectedCurrency: SupportedLocalCurrency | undefined,
  previousConversionRate: number | undefined,
  shouldFallbackToUSD: boolean,
  shouldFallbackToPrevious: boolean
)

Source from the content-addressed store, hash-verified

695}
696
697function handleFallbackCurrency(
698 selectedCurrency: SupportedLocalCurrency,
699 previousSelectedCurrency: SupportedLocalCurrency | undefined,
700 previousConversionRate: number | undefined,
701 shouldFallbackToUSD: boolean,
702 shouldFallbackToPrevious: boolean
703) {
704 if (shouldFallbackToUSD) return DEFAULT_LOCAL_CURRENCY
705 if (shouldFallbackToPrevious) return previousConversionRate ? previousSelectedCurrency : DEFAULT_LOCAL_CURRENCY
706 return selectedCurrency
707}
708
709// Constructs an object that injects the correct locale and local currency into each of the above formatter functions.
710export function useFormatter() {

Callers 1

useFormatterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…