diff --git a/apps/ledger-live-desktop/src/renderer/modals/NoFundsStake/index.tsx b/apps/ledger-live-desktop/src/renderer/modals/NoFundsStake/index.tsx index 66a2e81a9587..8aca0ed9e00f 100644 --- a/apps/ledger-live-desktop/src/renderer/modals/NoFundsStake/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/modals/NoFundsStake/index.tsx @@ -49,7 +49,7 @@ const NoFundsStakeModal = ({ account, parentAccount, entryPoint }: NoFundsStakeM const { isCurrencyAvailable } = useRampCatalog(); - const availableOnBuy = !!(currency && isCurrencyAvailable(currency.id, "onRamp")); + const availableOnBuy = !!currency && isCurrencyAvailable(currency.id, "onRamp"); const availableOnSwap = useMemo(() => { return currency && currenciesAll.includes(currency.id); diff --git a/apps/ledger-live-desktop/src/renderer/screens/market/MarketCoinScreen/index.tsx b/apps/ledger-live-desktop/src/renderer/screens/market/MarketCoinScreen/index.tsx index 886b5cab7b2a..1523da9740ed 100644 --- a/apps/ledger-live-desktop/src/renderer/screens/market/MarketCoinScreen/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/screens/market/MarketCoinScreen/index.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import React, { useCallback } from "react"; import { Flex, Text, Icon } from "@ledgerhq/react-ui"; import { useSelector, useDispatch } from "react-redux"; import { useHistory, useParams } from "react-router-dom"; diff --git a/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/helpers.ts b/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/helpers.ts index e0d6275b290d..035bd65913ab 100644 --- a/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/helpers.ts +++ b/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/helpers.ts @@ -16,7 +16,7 @@ export function isCurrencyInCatalog( status: "onRamp" | "offRamp", ) { if (!catalog || isEmpty(catalog[status])) { - return null; + return false; } const currencies = getCryptoCurrencyIds(catalog[status]); diff --git a/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/useRampCatalog.ts b/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/useRampCatalog.ts index 62d0d81f6a24..f4b004a41f8d 100644 --- a/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/useRampCatalog.ts +++ b/libs/ledger-live-common/src/platform/providers/RampCatalogProvider/useRampCatalog.ts @@ -1,4 +1,4 @@ -import { useCallback, useEffect } from "react"; +import { useCallback } from "react"; import { getCryptoCurrencyIds, isCurrencyInCatalog } from "./helpers"; import { useRampCatalogContext } from "./index"; import type { CryptoCurrency } from "@ledgerhq/wallet-api-core/lib/currencies/types"; @@ -8,15 +8,13 @@ type UseRampCatalog = { isCurrencyAvailable: ( currencyId: CryptoCurrency["id"] | string, mode: "onRamp" | "offRamp", - ) => boolean | null; + ) => boolean; getSupportedCryptoCurrencyIds: (mode: "onRamp" | "offRamp") => CryptoCurrency["id"][] | null; }; export function useRampCatalog(): UseRampCatalog { const state = useRampCatalogContext(); - useEffect(() => {}, [state.value]); - /** @param mode "onRamp" for can buy, "offRamp" for can sell. */ const getSupportedCryptoCurrencyIds = useCallback( (mode: "onRamp" | "offRamp") => { @@ -37,7 +35,7 @@ export function useRampCatalog(): UseRampCatalog { mode: "onRamp" | "offRamp", ) => { if (!state.value) { - return null; + return false; } return isCurrencyInCatalog(currencyId, state.value, mode); },