Closed rin-st closed 4 months ago
Lol initally I was bit hesitant to have this hook in hooks/scaffold-eth since seem too specific to SE-2 internal use but then realised that we have hooks like useAnimateConfig etc too in their, not sure what the best place to keep this internal hooks but I think its fine for now !
I agree that the hooks folder is a little bit mess. Maybe in future create two folders like core (main hooks from docs) and internal/helpers/utils(all other hooks)?
Niceee tysm @rin-st !!
Maybe in future create two folders like core (main hooks from docs) and internal/helpers/utils(all other hooks)?
Yup makes sense !
Description
Adds
useDisplayUsdMode
hook which helps to work with nativeCurrency/USD values.Hook takes as parameter
defaultUsdMode
which sets an initial value, and returns{ displayUsdMode, toggleDisplayUsdMode }
.toggleDisplayUsdMode
allows to change innerdisplayUsdMode
, anddisplayUsdMode
basically returns current USD mode.defaultUsdMode
anddisplayUsdMode
variables are booleans.true
meansUSD
,false
means Native Currency.See discussion here
Note:
undefined
since with it we need additional conditions likeif (typeof nativeCurrencyPrice !== "undefined" && nativeCurrencyPrice > 0)
etc.isFetching
value for price totrue
, so it's clear that if!isFetching && price === 0
then fetch failed.Additional Information