diff --git a/.github/workflows/create-release-pr-v2.yml b/.github/workflows/create-release-pr-v2.yml index 284fa6752d8..0498d5175c8 100644 --- a/.github/workflows/create-release-pr-v2.yml +++ b/.github/workflows/create-release-pr-v2.yml @@ -20,7 +20,7 @@ jobs: create-release-pr: needs: generate-build-version - uses: MetaMask/github-tools/.github/workflows/create-release-pr.yml@f8467f14f7d09c5b980565f15ebc8003b0272138 + uses: MetaMask/github-tools/.github/workflows/create-release-pr.yml@4f594ca7d90378da66b7efce987eff379934524b with: platform: mobile base-branch: ${{ inputs.base-branch }} diff --git a/app/components/UI/Stake/__mocks__/mockData.ts b/app/components/UI/Stake/__mocks__/mockData.ts index f0fcabbca3d..8cc42489a85 100644 --- a/app/components/UI/Stake/__mocks__/mockData.ts +++ b/app/components/UI/Stake/__mocks__/mockData.ts @@ -130,6 +130,8 @@ export const MOCK_STAKING_API_SERVICE: Partial = { getPooledStakes: jest.fn(), getVaultData: jest.fn(), getPooledStakingEligibility: jest.fn(), + getVaultDailyApys: jest.fn(), + getVaultApyAverages: jest.fn(), baseUrl: 'https://staking.api.com', }; @@ -151,7 +153,6 @@ const MOCK_POOLED_STAKING_CONTRACT_SERVICE = { export const MOCK_POOL_STAKING_SDK: Stake = { stakingContract: MOCK_POOLED_STAKING_CONTRACT_SERVICE, - stakingApiService: MOCK_STAKING_API_SERVICE as StakingApiService, sdkType: StakingType.POOLED, setSdkType: jest.fn(), }; diff --git a/app/components/UI/Stake/components/EarnTokenListItem/__snapshots__/EarnTokenListItem.test.tsx.snap b/app/components/UI/Stake/components/EarnTokenListItem/__snapshots__/EarnTokenListItem.test.tsx.snap index c23dc7fe98c..d9a0bc8a542 100644 --- a/app/components/UI/Stake/components/EarnTokenListItem/__snapshots__/EarnTokenListItem.test.tsx.snap +++ b/app/components/UI/Stake/components/EarnTokenListItem/__snapshots__/EarnTokenListItem.test.tsx.snap @@ -178,7 +178,7 @@ exports[`EarnTokenListItem render matches snapshot 1`] = ` } } > - 3.0% [missing "en.stake.apr" translation] + 3.0% APR - StyleSheet.create({ - container: { - paddingHorizontal: 24, - paddingTop: 24, - }, - imageContainer: { - alignItems: 'center', - paddingBottom: 16, - }, - bannerImage: { - width: '100%', - height: 200, - borderRadius: 12, - }, - textContainer: { - paddingVertical: 8, - }, - buttonContainer: { - flexDirection: 'row', - gap: 16, - paddingHorizontal: 16, - paddingTop: 16, - }, - button: { - flex: 1, - }, - italicText: { - fontStyle: 'italic', - }, - }); - -export default createLearnMoreModalStyles; diff --git a/app/components/UI/Stake/components/LearnMoreModal/LearnMoreModal.test.tsx b/app/components/UI/Stake/components/LearnMoreModal/LearnMoreModal.test.tsx deleted file mode 100644 index e290bea31e5..00000000000 --- a/app/components/UI/Stake/components/LearnMoreModal/LearnMoreModal.test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { fireEvent, screen } from '@testing-library/react-native'; -import LearnMoreModal from '.'; -import { POOLED_STAKING_FAQ_URL } from '../../constants'; -import Routes from '../../../../../constants/navigation/Routes'; -import { renderScreen } from '../../../../../util/test/renderWithProvider'; -import { strings } from '../../../../../../locales/i18n'; - -const renderLearnMoreModal = () => - renderScreen(LearnMoreModal, { name: Routes.STAKING.MODALS.LEARN_MORE }); - -const mockNavigate = jest.fn(); - -jest.mock('@react-navigation/native', () => { - const actualReactNavigation = jest.requireActual('@react-navigation/native'); - return { - ...actualReactNavigation, - useNavigation: () => ({ - navigate: mockNavigate, - }), - }; -}); - -describe('LearnMoreModal', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - it('render matches snapshot', () => { - const { toJSON } = renderLearnMoreModal(); - expect(toJSON()).toMatchSnapshot(); - }); - - it('navigates to FAQ page when "Learn More" button is pressed', () => { - renderLearnMoreModal(); - // Simulate pressing the "Learn More" button - fireEvent.press(screen.getByText(strings('stake.learn_more'))); - - // Assert that navigate is called with the correct parameters - expect(mockNavigate).toHaveBeenCalledWith('Webview', { - screen: 'SimpleWebview', - params: { url: POOLED_STAKING_FAQ_URL }, - }); - }); -}); diff --git a/app/components/UI/Stake/components/LearnMoreModal/__snapshots__/LearnMoreModal.test.tsx.snap b/app/components/UI/Stake/components/LearnMoreModal/__snapshots__/LearnMoreModal.test.tsx.snap deleted file mode 100644 index 283a6ed9dc9..00000000000 --- a/app/components/UI/Stake/components/LearnMoreModal/__snapshots__/LearnMoreModal.test.tsx.snap +++ /dev/null @@ -1,722 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`LearnMoreModal render matches snapshot 1`] = ` - - - - - - - - - - - - - LearnMore - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Stake ETH and earn - - - - - Stake any amount of ETH - - - No minimum required. - - - - - Earn ETH rewards - - - Start earning as soon as you stake. Rewards compound automatically. - - - - - Flexible unstaking - - - Unstake anytime. Typically takes less than 3 days, but can take up to 11 days to process. - - - - - Staking does not guarantee rewards, and involves risks including a loss of funds. - - - - - - - - Learn more - - - - - - - Got it - - - - - - - - - - - - - - - - - -`; diff --git a/app/components/UI/Stake/components/LearnMoreModal/index.tsx b/app/components/UI/Stake/components/LearnMoreModal/index.tsx deleted file mode 100644 index 5d6d4b6677d..00000000000 --- a/app/components/UI/Stake/components/LearnMoreModal/index.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import React, { useRef } from 'react'; -import { View, Image } from 'react-native'; -import BottomSheet, { - type BottomSheetRef, -} from '../../../../../component-library/components/BottomSheets/BottomSheet'; -import Text, { - TextColor, - TextVariant, -} from '../../../../../component-library/components/Texts/Text'; -import LearnMoreImage from '../images/LearnMoreEthBanner.png'; -import Button, { - ButtonSize, - ButtonVariants, - ButtonWidthTypes, -} from '../../../../../component-library/components/Buttons/Button'; -import { useNavigation } from '@react-navigation/native'; -import { strings } from '../../../../../../locales/i18n'; -import { POOLED_STAKING_FAQ_URL } from '../../constants'; -import createLearnMoreModalStyles from './LearnMoreModal.styles'; -import { MetaMetricsEvents } from '../../../../hooks/useMetrics'; -import { withMetaMetrics } from '../../utils/metaMetrics/withMetaMetrics'; -import { EVENT_LOCATIONS, EVENT_PROVIDERS } from '../../constants/events'; - -const styles = createLearnMoreModalStyles(); - -const ModalTextBlock = ({ - heading, - body, - bodyColor = TextColor.Alternative, -}: { - heading: string; - body: string; - bodyColor?: TextColor; -}) => ( - - {heading} - - {body} - - -); - -const LearnMoreModal = () => { - const sheetRef = useRef(null); - - const navigation = useNavigation(); - - const handleClose = () => { - sheetRef.current?.onCloseBottomSheet(); - }; - - const handleLearnMoreBrowserRedirect = () => { - // Take to the faq page - navigation.navigate('Webview', { - screen: 'SimpleWebview', - params: { - url: POOLED_STAKING_FAQ_URL, - }, - }); - }; - - return ( - - - - - - - - - {strings('stake.stake_eth_and_earn')} - - - - - - - - - {strings('stake.disclaimer')} - - - - - -