Skip to content

Commit

Permalink
refactor: pr review lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beths-ledger committed Sep 27, 2023
1 parent c5a6a51 commit edd13c6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function isCurrencyInCatalog(
status: "onRamp" | "offRamp",
) {
if (!catalog || isEmpty(catalog[status])) {
return null;
return false;
}
const currencies = getCryptoCurrencyIds(catalog[status]);

Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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") => {
Expand All @@ -37,7 +35,7 @@ export function useRampCatalog(): UseRampCatalog {
mode: "onRamp" | "offRamp",
) => {
if (!state.value) {
return null;
return false;
}
return isCurrencyInCatalog(currencyId, state.value, mode);
},
Expand Down

0 comments on commit edd13c6

Please sign in to comment.