diff --git a/app/components/UI/Bridge/routes.tsx b/app/components/UI/Bridge/routes.tsx index 63231e842843..362bdc93dae5 100644 --- a/app/components/UI/Bridge/routes.tsx +++ b/app/components/UI/Bridge/routes.tsx @@ -32,11 +32,15 @@ import { BatchSellFinalReviewModal } from './components/BatchSellFinalReviewModa import { BatchSellNetworkFeeInfoModal } from './components/BatchSellNetworkFeeInfoModal'; import { BatchSellMinimumReceivedInfoModal } from './components/BatchSellMinimumReceivedInfoModal'; import { BatchSellPriceImpactInfoModal } from './components/BatchSellPriceImpactInfoModal'; +import type { + BridgeModalsNavigationParamList, + BridgeScreensStackParamList, +} from './types/navigation'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type ScreenComponent = React.ComponentType; -const Stack = createNativeStackNavigator(); +const Stack = createNativeStackNavigator(); export const BridgeScreenStack = () => ( @@ -71,7 +75,8 @@ export const BridgeScreenStack = () => ( ); -const ModalStack = createNativeStackNavigator(); +const ModalStack = + createNativeStackNavigator(); export const BridgeModalStack = () => ( | undefined; + BridgeModals: + | NavigatorScreenParams + | undefined; + }; diff --git a/app/core/NavigationService/types.ts b/app/core/NavigationService/types.ts index 926cffc8f2ed..834989f5663a 100644 --- a/app/core/NavigationService/types.ts +++ b/app/core/NavigationService/types.ts @@ -20,28 +20,11 @@ import type { BrowserParams } from '../../components/Views/Browser/Browser.types import type { ActivityDetailsParams } from '../../components/Views/ActivityDetails/ActivityDetails.types'; // Bridge params -import type { BatchSellTokenSelectRouteParams } from '../../components/UI/Bridge/Views/BatchSellTokenSelect/types'; -import type { BridgeRouteParams } from '../../components/UI/Bridge/hooks/useSwapBridgeNavigation'; -import type { BridgeTokenSelectorRouteParams } from '../../components/UI/Bridge/components/BridgeTokenSelector/BridgeTokenSelector'; -import type { HardwareWalletsSwapsRouteParams } from '../../components/UI/HardwareWallet/Swaps/flowStrategy'; -import type { HwQrScannerRouteParams } from '../../components/UI/HardwareWallet/Swaps/HwQrScanner'; -import type { PriceImpactModalRouterParams } from '../../components/UI/Bridge/components/PriceImpactModal/types'; -import type { MissingPriceModalParams } from '../../components/UI/Bridge/components/MissingPriceModal'; -import type { TokenWarningModalParams } from '../../components/UI/Bridge/components/TokenWarningModal'; -import type { HighRateAlertModalParams } from '../../components/UI/Bridge/components/HighRateAlertModal'; -import type { PostTradeBottomSheetParams } from '../../components/UI/Bridge/components/PostTradeBottomSheet/PostTradeBottomSheet.types'; -import type { BatchSellPriceImpactInfoModalParams } from '../../components/UI/Bridge/components/BatchSellPriceImpactInfoModal/BatchSellPriceImpactInfoModal.types'; -import type { BatchSellNetworkFeeInfoModalParams } from '../../components/UI/Bridge/components/BatchSellNetworkFeeInfoModal/BatchSellNetworkFeeInfoModal.types'; -import type { BatchSellMinimumReceivedInfoModalParams } from '../../components/UI/Bridge/components/BatchSellMinimumReceivedInfoModal/BatchSellMinimumReceivedInfoModal.types'; import type { - BatchSellSlippageModalParams, - SwapSlippageModalParams, -} from '../../components/UI/Bridge/components/SlippageModal/types'; -import type { - TransactionDetailsBlockExplorerParams, - BlockaidModalParams, - BridgeTransactionDetailsParams, -} from '../../components/UI/Bridge/Bridge.types'; + BridgeModalsNavigationParamList, + BridgeScreensStackParamList, +} from '../../components/UI/Bridge/types/navigation'; +import type { BridgeTransactionDetailsParams } from '../../components/UI/Bridge/Bridge.types'; import type { SetPayTokenRequest } from '../../components/Views/confirmations/hooks/pay/useAutomaticTransactionPayToken'; // Manual backup params @@ -729,43 +712,40 @@ export type RootStackParamList = { EditNetwork: EditNetworkParams | undefined; // Bridge routes - Bridge: BridgeRouteParams | undefined; - BridgeView: BridgeRouteParams | undefined; - BridgeTokenSelector: BridgeTokenSelectorRouteParams | undefined; - BatchSellTokenSelect: BatchSellTokenSelectRouteParams | undefined; - BatchSellReview: undefined; - QuoteSelectorView: undefined; - HwQrScanner: HwQrScannerRouteParams | undefined; - BridgeModals: undefined; - MarketClosedModal: undefined; - NetworkListModal: undefined; - PriceImpactModal: PriceImpactModalRouterParams; - MissingPriceModal: MissingPriceModalParams; - TokenWarningModal: TokenWarningModalParams; - HighRateAlertModal: HighRateAlertModalParams; - PostTradeModal: PostTradeBottomSheetParams; - BatchSellPriceImpactInfoModal: BatchSellPriceImpactInfoModalParams; - SwapDefaultSlippageModal: SwapSlippageModalParams | undefined; - SwapCustomSlippageModal: SwapSlippageModalParams | undefined; - BatchSellDefaultSlippageModal: BatchSellSlippageModalParams | undefined; - BatchSellCustomSlippageModal: BatchSellSlippageModalParams | undefined; - TransactionDetailsBlockExplorer: - | TransactionDetailsBlockExplorerParams - | undefined; - BlockaidModal: BlockaidModalParams; - RecipientSelectorModal: undefined; - BatchSellDestinationTokenSelectorModal: undefined; - BatchSellQuoteDetailsModal: undefined; - BatchSellFinalReviewModal: undefined; - BatchSellNetworkFeeInfoModal: BatchSellNetworkFeeInfoModalParams | undefined; - BatchSellMinimumReceivedInfoModal: - | BatchSellMinimumReceivedInfoModalParams + Bridge: NavigatorScreenParams | undefined; + BridgeView: BridgeScreensStackParamList['BridgeView']; + BridgeTokenSelector: BridgeScreensStackParamList['BridgeTokenSelector']; + BatchSellTokenSelect: BridgeScreensStackParamList['BatchSellTokenSelect']; + BatchSellReview: BridgeScreensStackParamList['BatchSellReview']; + QuoteSelectorView: BridgeScreensStackParamList['QuoteSelectorView']; + HwQrScanner: BridgeScreensStackParamList['HwQrScanner']; + HardwareWalletsSwaps: BridgeScreensStackParamList['HardwareWalletsSwaps']; + BridgeModals: + | NavigatorScreenParams | undefined; + MarketClosedModal: BridgeModalsNavigationParamList['MarketClosedModal']; + NetworkListModal: BridgeModalsNavigationParamList['NetworkListModal']; + PriceImpactModal: BridgeModalsNavigationParamList['PriceImpactModal']; + MissingPriceModal: BridgeModalsNavigationParamList['MissingPriceModal']; + TokenWarningModal: BridgeModalsNavigationParamList['TokenWarningModal']; + HighRateAlertModal: BridgeModalsNavigationParamList['HighRateAlertModal']; + PostTradeModal: BridgeModalsNavigationParamList['PostTradeModal']; + BatchSellPriceImpactInfoModal: BridgeModalsNavigationParamList['BatchSellPriceImpactInfoModal']; + SwapDefaultSlippageModal: BridgeModalsNavigationParamList['SwapDefaultSlippageModal']; + SwapCustomSlippageModal: BridgeModalsNavigationParamList['SwapCustomSlippageModal']; + BatchSellDefaultSlippageModal: BridgeModalsNavigationParamList['BatchSellDefaultSlippageModal']; + BatchSellCustomSlippageModal: BridgeModalsNavigationParamList['BatchSellCustomSlippageModal']; + TransactionDetailsBlockExplorer: BridgeModalsNavigationParamList['TransactionDetailsBlockExplorer']; + BlockaidModal: BridgeModalsNavigationParamList['BlockaidModal']; + RecipientSelectorModal: BridgeModalsNavigationParamList['RecipientSelectorModal']; + BatchSellDestinationTokenSelectorModal: BridgeModalsNavigationParamList['BatchSellDestinationTokenSelectorModal']; + BatchSellQuoteDetailsModal: BridgeModalsNavigationParamList['BatchSellQuoteDetailsModal']; + BatchSellFinalReviewModal: BridgeModalsNavigationParamList['BatchSellFinalReviewModal']; + BatchSellNetworkFeeInfoModal: BridgeModalsNavigationParamList['BatchSellNetworkFeeInfoModal']; + BatchSellMinimumReceivedInfoModal: BridgeModalsNavigationParamList['BatchSellMinimumReceivedInfoModal']; BridgeTransactionDetails: | BridgeTransactionDetailsParams - | TransactionDetailsBlockExplorerParams - | undefined; - HardwareWalletsSwaps: HardwareWalletsSwapsRouteParams | undefined; + | BridgeModalsNavigationParamList['TransactionDetailsBlockExplorer']; // Perps routes - use PerpsNavigationParamList for type-safe perps navigation. // The `Perps` root is a nested stack navigator, so it also accepts the