Skip to content

Commit

Permalink
fix: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kallen-ledger committed Feb 13, 2025
1 parent de49aa6 commit 3d42671
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { Strategy } from "@ledgerhq/coin-evm/lib/types/index";
import { Transaction } from "@ledgerhq/live-common/generated/types";
import { Account, AccountLike } from "@ledgerhq/types-live";
import BigNumber from "bignumber.js";
import { ScreenName } from "~/const";
import { FeeData } from "~/screens/Swap/LiveApp/customHandlers/getFee";

export type FeesNavigatorParamsList = {
[ScreenName.FeeHomePage]: {
account: AccountLike;
feePayingAccount: Account;
feesStrategy: Strategy;
fromAmount: BigNumber | undefined;
customFeeConfig: object,
onSelect(
feesStrategy: Strategy,
customFeeConfig: object,
): Promise<void>;
transaction: any;
customFeeConfig: object;
onSelect(feesStrategy: Strategy, customFeeConfig: object): Promise<void>;
transaction: Transaction;
};
[ScreenName.FeeCustomFeePage]: undefined;
};
5 changes: 2 additions & 3 deletions apps/ledger-live-mobile/src/screens/Fees/FeeContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getDefaultFeeUnit } from "@ledgerhq/coin-evm/lib/logic";
import { FeeData, Strategy } from "@ledgerhq/coin-evm/lib/types/index";
import { Strategy } from "@ledgerhq/coin-evm/lib/types/index";
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/formatCurrencyUnit";
import { Flex, Text } from "@ledgerhq/native-ui";
import { Account } from "@ledgerhq/types-live";
import BigNumber from "bignumber.js";
Expand All @@ -8,7 +8,6 @@ import { useTranslation } from "react-i18next";
import { TouchableOpacity } from "react-native";
import { useTheme } from "styled-components/native";
import { StrategyIcon } from "./StrategyIcon";
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/lib/currencies/formatCurrencyUnit";

type Props = {
strategy: Strategy;
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/src/screens/Fees/StrategyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Strategy } from "@ledgerhq/coin-evm/lib/types/index";
import { SpeedFast, SpeedLow, SpeedMedium } from "@ledgerhq/icons-ui/native";
import { useMemo } from "react";
import React, { useMemo } from "react";
import { useTheme } from "styled-components/native";

type Props = {
Expand Down
18 changes: 13 additions & 5 deletions apps/ledger-live-mobile/src/screens/Fees/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getTypedTransaction } from "@ledgerhq/coin-evm/lib/transaction";
import { getEstimatedFees } from "@ledgerhq/coin-evm/logic";
import { useGasOptions } from "@ledgerhq/live-common/lib/families/evm/react";
import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
import { useGasOptions } from "@ledgerhq/live-common/families/evm/react";
import { Flex } from "@ledgerhq/native-ui";
import React from "react";
import { SafeAreaView } from "react-native";
import { FeesNavigatorParamsList } from "~/components/RootNavigator/types/FeesNavigator";
import { RootComposite, StackNavigatorProps } from "~/components/RootNavigator/types/helpers";
Expand All @@ -15,7 +17,7 @@ export type Props = RootComposite<
export function FeesScreen({ route: { params } }: Props) {
const [gasOptions] = useGasOptions({
currency: params.feePayingAccount.currency,
transaction: params.transaction,
transaction: params.transaction as EvmTransaction,
});

return (
Expand All @@ -30,7 +32,9 @@ export function FeesScreen({ route: { params } }: Props) {
}}
gasOption={
gasOptions?.slow
? getEstimatedFees(getTypedTransaction(params.transaction, gasOptions?.slow))
? getEstimatedFees(
getTypedTransaction(params.transaction as EvmTransaction, gasOptions?.slow),
)
: undefined
}
/>
Expand All @@ -41,7 +45,9 @@ export function FeesScreen({ route: { params } }: Props) {
onSelect={() => params.onSelect("medium", gasOptions?.medium ?? {})}
gasOption={
gasOptions?.medium
? getEstimatedFees(getTypedTransaction(params.transaction, gasOptions?.medium))
? getEstimatedFees(
getTypedTransaction(params.transaction as EvmTransaction, gasOptions?.medium),
)
: undefined
}
/>
Expand All @@ -52,7 +58,9 @@ export function FeesScreen({ route: { params } }: Props) {
onSelect={() => params.onSelect("fast", gasOptions?.fast ?? {})}
gasOption={
gasOptions?.fast
? getEstimatedFees(getTypedTransaction(params.transaction, gasOptions?.fast))
? getEstimatedFees(
getTypedTransaction(params.transaction as EvmTransaction, gasOptions?.fast),
)
: undefined
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ interface GenerateFeeDataParams {
feesStrategy: Strategy;
fromAmount: BigNumber | undefined;
customFeeConfig: object;
bridge: AccountBridge<any>;
baseTransaction: any;
bridge: AccountBridge<Transaction>;
baseTransaction: Transaction;
}

const getRecipientAddress = (
Expand Down Expand Up @@ -68,7 +68,7 @@ const generateFeeData = async ({
const gasOptions = await gasTracker?.getGasOptions({ currency: feePayingAccount.currency });
const gasOption = gasOptions ? gasOptions[feesStrategy] : undefined;

const config = baseTransaction.family === 'evm' ? gasOption : customFeeConfig;
const config = baseTransaction.family === "evm" ? gasOption : customFeeConfig;

const recipient = getRecipientAddress(baseTransaction.family, feePayingAccount.currency.id);
const transactionConfig: Transaction = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { NavigationProp, NavigationState } from "@react-navigation/native";
import { NavigatorName, ScreenName } from "~/const";

export const swapRedirectToHistory = (
navigation: Omit<NavigationProp<ReactNavigation.RootParamList>, "getState"> & {
getState(): NavigationState | undefined;
},
_: Omit<NavigationProp<ReactNavigation.RootParamList>, "getState"> & {
getState(): NavigationState | undefined;
},
) => {
return async () => {
return Promise.resolve(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const trackSwapError = (error: Error, properties: Record<string, unknown>
}
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type TransformableObject = Record<string, any>;

/**
Expand Down

0 comments on commit 3d42671

Please sign in to comment.