diff --git a/app/actions/transaction/index.js b/app/actions/transaction/index.js index b1b98a692606..0d327b73458a 100644 --- a/app/actions/transaction/index.js +++ b/app/actions/transaction/index.js @@ -25,8 +25,8 @@ export function newAssetTransaction(selectedAsset) { assetType: selectedAsset.isETH ? ETH : selectedAsset.tokenId - ? ERC721 - : ERC20, + ? ERC721 + : ERC20, }; } @@ -68,8 +68,8 @@ export function setSelectedAsset(selectedAsset) { assetType: selectedAsset.isETH ? ETH : selectedAsset.tokenId - ? ERC721 - : ERC20, + ? ERC721 + : ERC20, }; } diff --git a/app/component-library/components-temp/MultichainAccounts/MultichainAccountSelectorList/MultichainAccountSelectorList.stories.tsx b/app/component-library/components-temp/MultichainAccounts/MultichainAccountSelectorList/MultichainAccountSelectorList.stories.tsx index fca782102969..0ef7b2e9ca15 100644 --- a/app/component-library/components-temp/MultichainAccounts/MultichainAccountSelectorList/MultichainAccountSelectorList.stories.tsx +++ b/app/component-library/components-temp/MultichainAccounts/MultichainAccountSelectorList/MultichainAccountSelectorList.stories.tsx @@ -21,7 +21,7 @@ const createMockAccountGroup = ( hidden: false, }, accounts: accounts as [string], - }) as AccountGroupObject; + } as AccountGroupObject); const mockAccountGroup1 = createMockAccountGroup( 'wallet-1/group-1', diff --git a/app/component-library/components-temp/MultichainAccounts/test-utils.ts b/app/component-library/components-temp/MultichainAccounts/test-utils.ts index e342f98bffec..12728ba54ce0 100644 --- a/app/component-library/components-temp/MultichainAccounts/test-utils.ts +++ b/app/component-library/components-temp/MultichainAccounts/test-utils.ts @@ -94,13 +94,10 @@ export const createMockWallet = ( type: ExtendedKeyringTypes.simple, }, }, - groups: groups.reduce( - (acc, group) => { - acc[group.id] = group; - return acc; - }, - {} as Record, - ), + groups: groups.reduce((acc, group) => { + acc[group.id] = group; + return acc; + }, {} as Record), }; return wallet as unknown as AccountWalletObject; @@ -123,13 +120,10 @@ export const createMockEntropyWallet = ( id: 'test-entropy-id', }, }, - groups: groups.reduce( - (acc, group) => { - acc[group.id] = group; - return acc; - }, - {} as Record, - ), + groups: groups.reduce((acc, group) => { + acc[group.id] = group; + return acc; + }, {} as Record), }; return wallet as unknown as AccountWalletObject; @@ -142,18 +136,15 @@ export const createMockState = ( wallets: AccountWalletObject[], internalAccounts: Record, ): RootState => { - const walletMap = wallets.reduce( - (acc, wallet) => { - const prefixedKey = `${wallet.type}:${wallet.id}`; + const walletMap = wallets.reduce((acc, wallet) => { + const prefixedKey = `${wallet.type}:${wallet.id}`; - // Store with both prefixed key (for selectors) and plain key (for AccountListFooter) - acc[prefixedKey] = wallet; - acc[wallet.id] = wallet; + // Store with both prefixed key (for selectors) and plain key (for AccountListFooter) + acc[prefixedKey] = wallet; + acc[wallet.id] = wallet; - return acc; - }, - {} as Record, - ); + return acc; + }, {} as Record); const firstWallet = wallets[0]; const firstGroupId = Object.keys(firstWallet?.groups ?? [])[0]; diff --git a/app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains.tsx b/app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains.tsx index 73a32cea1977..9a839918e94e 100644 --- a/app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains.tsx +++ b/app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains.tsx @@ -26,7 +26,7 @@ export const getCalculatedTokenAmount1dAgo = ( ) => tokenPricePercentChange1dAgo !== undefined && tokenFiatBalance ? tokenFiatBalance / (1 + tokenPricePercentChange1dAgo / 100) - : (tokenFiatBalance ?? 0); + : tokenFiatBalance ?? 0; const isValidAmount = (amount: number | null | undefined): boolean => amount !== null && amount !== undefined && !Number.isNaN(amount); diff --git a/app/component-library/components-temp/Tabs/Tab/Tab.tsx b/app/component-library/components-temp/Tabs/Tab/Tab.tsx index 2a798c32ccf3..3a22d8b44b4a 100644 --- a/app/component-library/components-temp/Tabs/Tab/Tab.tsx +++ b/app/component-library/components-temp/Tabs/Tab/Tab.tsx @@ -70,8 +70,8 @@ const Tab: React.FC = ({ isDisabled ? 'text-muted' : isActive - ? 'text-default' - : 'text-alternative' + ? 'text-default' + : 'text-alternative' } numberOfLines={1} style={tw.style('absolute inset-0 flex items-center justify-center')} diff --git a/app/component-library/components/BottomSheets/BottomSheet/foundation/BottomSheetOverlay/README.md b/app/component-library/components/BottomSheets/BottomSheet/foundation/BottomSheetOverlay/README.md index 04b7d2cdb137..829b99c23902 100644 --- a/app/component-library/components/BottomSheets/BottomSheet/foundation/BottomSheetOverlay/README.md +++ b/app/component-library/components/BottomSheets/BottomSheet/foundation/BottomSheetOverlay/README.md @@ -12,7 +12,7 @@ Optional prop to configure the color of the BottomSheetOverlay. | TYPE | REQUIRED | | :-------------------------------------------------- | :------------------------------------------------------ | -| ColorValue | No | +| ColorValue | No | ### `onPress` @@ -20,10 +20,10 @@ Function to trigger when pressing the BottomSheetOverlay. | TYPE | REQUIRED | | :-------------------------------------------------- | :------------------------------------------------------ | -| Function | No | +| Function | No | ## Usage ```javascript - {}}/>; + {}} /> ``` diff --git a/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.tsx b/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.tsx index 3b0a4455014d..34838cd53670 100644 --- a/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.tsx +++ b/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.tsx @@ -61,8 +61,8 @@ const ButtonLink: React.FC = ({ ? DEFAULT_BUTTONLINK_LABEL_COLOR_ERROR_PRESSED : DEFAULT_BUTTONLINK_LABEL_COLOR_ERROR : pressed - ? DEFAULT_BUTTONLINK_LABEL_COLOR_PRESSED - : DEFAULT_BUTTONLINK_LABEL_COLOR; + ? DEFAULT_BUTTONLINK_LABEL_COLOR_PRESSED + : DEFAULT_BUTTONLINK_LABEL_COLOR; const renderLabel = () => typeof label === 'string' ? ( diff --git a/app/component-library/components/Checkbox/Checkbox.styles.ts b/app/component-library/components/Checkbox/Checkbox.styles.ts index 57ad74072c1b..64f6eeb4c3d6 100644 --- a/app/component-library/components/Checkbox/Checkbox.styles.ts +++ b/app/component-library/components/Checkbox/Checkbox.styles.ts @@ -30,20 +30,20 @@ const styleSheet = (params: { theme: Theme; vars: CheckboxStyleSheetVars }) => { const backgroundColor = isReadOnly ? theme.colors.background.alternative : isDanger - ? isChecked || isIndeterminate - ? theme.colors.error.default - : theme.colors.background.default - : isChecked || isIndeterminate - ? theme.colors.primary.default - : theme.colors.background.default; + ? isChecked || isIndeterminate + ? theme.colors.error.default + : theme.colors.background.default + : isChecked || isIndeterminate + ? theme.colors.primary.default + : theme.colors.background.default; const borderColor = isReadOnly ? theme.colors.background.alternative : isDanger - ? theme.colors.error.default - : isChecked || isIndeterminate - ? theme.colors.primary.default - : theme.colors.icon.default; + ? theme.colors.error.default + : isChecked || isIndeterminate + ? theme.colors.primary.default + : theme.colors.icon.default; return StyleSheet.create({ base: Object.assign( diff --git a/app/component-library/components/Navigation/TradeTabBarItem/TradeTabBarItem.tsx b/app/component-library/components/Navigation/TradeTabBarItem/TradeTabBarItem.tsx index fdfa17d5824a..7bf7e98f6423 100644 --- a/app/component-library/components/Navigation/TradeTabBarItem/TradeTabBarItem.tsx +++ b/app/component-library/components/Navigation/TradeTabBarItem/TradeTabBarItem.tsx @@ -81,8 +81,8 @@ function TradeTabBarItem({ label, ...props }: TradeTabBarItemProps) { themeAppearance === 'light' ? IconColor.Inverse : isActive - ? IconColor.Inverse - : IconColor.Default; + ? IconColor.Inverse + : IconColor.Default; return ( ( component={ReturnToAppNotification} initialParams={{ ...props.route.params }} /> + ); diff --git a/app/components/Nav/Main/index.js b/app/components/Nav/Main/index.js index 3001049f2f44..5a2e4c408065 100644 --- a/app/components/Nav/Main/index.js +++ b/app/components/Nav/Main/index.js @@ -137,8 +137,9 @@ const Main = (props) => { if (isSeedlessPasswordOutdated) { // Check for latest seedless password outdated state // isSeedlessPasswordOutdated is true when navigate to wallet main screen after login with password sync - const isOutdated = - await Authentication.checkIsSeedlessPasswordOutdated(false); + const isOutdated = await Authentication.checkIsSeedlessPasswordOutdated( + false, + ); if (!isOutdated) { return; } diff --git a/app/components/Snaps/SnapUIRenderer/components/asset-selector.test.ts b/app/components/Snaps/SnapUIRenderer/components/asset-selector.test.ts index be14de13ccc8..2fcf5d9f71aa 100644 --- a/app/components/Snaps/SnapUIRenderer/components/asset-selector.test.ts +++ b/app/components/Snaps/SnapUIRenderer/components/asset-selector.test.ts @@ -204,8 +204,9 @@ describe('SnapUIAssetSelector', () => { const usdcNameOnButton = await within(selectorButton).findByText('USDC'); expect(usdcNameOnButton).toBeTruthy(); - const solanaNetworkOnButton = - await within(selectorButton).findByText('Solana'); + const solanaNetworkOnButton = await within(selectorButton).findByText( + 'Solana', + ); expect(solanaNetworkOnButton).toBeTruthy(); const solSymbolOnButton = queryByText('SOL'); diff --git a/app/components/UI/AccountInfoCard/index.js b/app/components/UI/AccountInfoCard/index.js index f3e22eab2e96..2ff835f04e8d 100644 --- a/app/components/UI/AccountInfoCard/index.js +++ b/app/components/UI/AccountInfoCard/index.js @@ -179,14 +179,12 @@ class AccountInfoCard extends PureComponent { const originatorInfo = currentConnection?.originatorInfo; const sdkDappMetadata = { - url: isOriginUrl - ? origin - : (originatorInfo?.url ?? strings('sdk.unknown')), + url: isOriginUrl ? origin : originatorInfo?.url ?? strings('sdk.unknown'), icon: originatorInfo?.icon, }; const actualOriginUrl = isOriginUrl ? origin - : (originatorInfo?.url ?? strings('sdk.unknown')); + : originatorInfo?.url ?? strings('sdk.unknown'); return operation === 'signing' && transaction !== undefined ? ( 0 ? colors.success.default : priceDiff < 0 - ? colors.error.default - : colors.text.alternative, + ? colors.error.default + : colors.text.alternative, } as TextStyle, priceDiffIcon: { marginTop: 10, diff --git a/app/components/UI/AssetOverview/Price/Price.tsx b/app/components/UI/AssetOverview/Price/Price.tsx index 3d9f13916f18..c8385877dfe7 100644 --- a/app/components/UI/AssetOverview/Price/Price.tsx +++ b/app/components/UI/AssetOverview/Price/Price.tsx @@ -143,8 +143,8 @@ const Price = ({ diff > 0 ? 'trending-up' : diff < 0 - ? 'trending-down' - : 'minus' + ? 'trending-down' + : 'minus' } size={16} style={styles.priceDiffIcon} diff --git a/app/components/UI/AssetOverview/PriceChart/PriceChart.tsx b/app/components/UI/AssetOverview/PriceChart/PriceChart.tsx index 7f1a2288e27d..7965cb5182c1 100644 --- a/app/components/UI/AssetOverview/PriceChart/PriceChart.tsx +++ b/app/components/UI/AssetOverview/PriceChart/PriceChart.tsx @@ -72,8 +72,8 @@ const PriceChart = ({ priceDiff > 0 ? theme.colors.primary.default : priceDiff < 0 - ? theme.colors.primary.default - : theme.colors.text.alternative; + ? theme.colors.primary.default + : theme.colors.text.alternative; const apx = (size = 0) => { const width = Dimensions.get('window').width; diff --git a/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx b/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx index 2b39384fce1a..a5c352acacee 100644 --- a/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx +++ b/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx @@ -126,9 +126,7 @@ const BasicFunctionalityModal = ({ route }: Props) => { {strings('default_settings.sheet.description_off2')}{' '} - {strings( - 'default_settings.sheet.description_off2_related_features1', - )}{' '} + {strings('default_settings.sheet.description_off2_related_features1')}{' '} {strings( diff --git a/app/components/UI/Bridge/Views/BridgeView/BridgeView.blockaid.test.tsx b/app/components/UI/Bridge/Views/BridgeView/BridgeView.blockaid.test.tsx index 72c2d3cf391a..b052b66d0d09 100644 --- a/app/components/UI/Bridge/Views/BridgeView/BridgeView.blockaid.test.tsx +++ b/app/components/UI/Bridge/Views/BridgeView/BridgeView.blockaid.test.tsx @@ -94,7 +94,7 @@ describe('Blockaid Validation Logic', () => { trade: {} as QuoteResponse['trade'], estimatedProcessingTimeInSeconds: 60, // Add other required properties as needed - }) as unknown as QuoteResponse & QuoteMetadata; + } as unknown as QuoteResponse & QuoteMetadata); it('should navigate to blockaid modal with validation error', async () => { const mockQuote = createMockQuote('test-quote'); diff --git a/app/components/UI/Bridge/Views/BridgeView/index.tsx b/app/components/UI/Bridge/Views/BridgeView/index.tsx index 2cf3d679286b..1ab767ab678f 100644 --- a/app/components/UI/Bridge/Views/BridgeView/index.tsx +++ b/app/components/UI/Bridge/Views/BridgeView/index.tsx @@ -449,10 +449,10 @@ const BridgeView = () => { feePercentage, }) : !hasFee && isNoFeeDestinationAsset - ? strings('bridge.no_mm_fee_disclaimer', { - destTokenSymbol: destToken?.symbol, - }) - : ''} + ? strings('bridge.no_mm_fee_disclaimer', { + destTokenSymbol: destToken?.symbol, + }) + : ''} {approval ? ` ${strings('bridge.approval_needed', approval)}` : ''}{' '} diff --git a/app/components/UI/Bridge/components/QuoteDetailsCard/QuoteDetailsCard.tsx b/app/components/UI/Bridge/components/QuoteDetailsCard/QuoteDetailsCard.tsx index 4d010587c241..a54c2a442163 100644 --- a/app/components/UI/Bridge/components/QuoteDetailsCard/QuoteDetailsCard.tsx +++ b/app/components/UI/Bridge/components/QuoteDetailsCard/QuoteDetailsCard.tsx @@ -298,8 +298,8 @@ const QuoteDetailsCard: React.FC = () => { isRewardsLoading ? RewardAnimationState.Loading : hasRewardsError - ? RewardAnimationState.ErrorState - : RewardAnimationState.Idle + ? RewardAnimationState.ErrorState + : RewardAnimationState.Idle } /> diff --git a/app/components/UI/Bridge/components/TokenInsightsSheet/TokenInsightsSheet.tsx b/app/components/UI/Bridge/components/TokenInsightsSheet/TokenInsightsSheet.tsx index 3c14992005ee..11bf04a35365 100644 --- a/app/components/UI/Bridge/components/TokenInsightsSheet/TokenInsightsSheet.tsx +++ b/app/components/UI/Bridge/components/TokenInsightsSheet/TokenInsightsSheet.tsx @@ -409,8 +409,8 @@ const TokenInsightsSheet: React.FC = () => { priceChange24h > 0 ? TextColor.Success : priceChange24h < 0 - ? TextColor.Error - : TextColor.Alternative + ? TextColor.Error + : TextColor.Alternative } > {formatPercentChange(priceChange24h)} diff --git a/app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx b/app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx index 9ce509f0a0ba..f4a6a9ba6746 100644 --- a/app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx +++ b/app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx @@ -316,9 +316,7 @@ export const BridgeTransactionDetails = ( estimatedCompletionString && ( - {strings( - 'bridge_transaction_details.estimated_completion', - )}{' '} + {strings('bridge_transaction_details.estimated_completion')}{' '} { testID={CardHomeSelectors.BALANCE_SKELETON} /> ) : ( - (balanceAmount ?? '0') + balanceAmount ?? '0' )} = ({ {item.allowanceState === AllowanceState.Enabled ? strings('card.asset_selection.enabled') : item.allowanceState === AllowanceState.Limited - ? strings('card.asset_selection.limited') - : strings('card.asset_selection.not_enabled')} + ? strings('card.asset_selection.limited') + : strings('card.asset_selection.not_enabled')} {item.walletAddress && ( { }) .build(), ); - const { contactVerificationId } = - await sendEmailVerification(debouncedEmail); + const { contactVerificationId } = await sendEmailVerification( + debouncedEmail, + ); dispatch(setContactVerificationId(contactVerificationId)); diff --git a/app/components/UI/Card/hooks/useAssetsList.ts b/app/components/UI/Card/hooks/useAssetsList.ts index d1a261ac9475..765b0c534e44 100644 --- a/app/components/UI/Card/hooks/useAssetsList.ts +++ b/app/components/UI/Card/hooks/useAssetsList.ts @@ -91,7 +91,7 @@ export const useAssetsList = ( const assetAddress = token.caipChainId && isSolanaChainId(token.caipChainId) ? `${token.caipChainId}/token:${token.address}` - : (token.address?.toLowerCase() ?? ''); + : token.address?.toLowerCase() ?? ''; const iconUrl = buildTokenIconUrl( token.caipChainId, token.address ?? '', diff --git a/app/components/UI/Card/hooks/useEmailVerificationVerify.test.ts b/app/components/UI/Card/hooks/useEmailVerificationVerify.test.ts index 986c0a7bf69c..81e322d01784 100644 --- a/app/components/UI/Card/hooks/useEmailVerificationVerify.test.ts +++ b/app/components/UI/Card/hooks/useEmailVerificationVerify.test.ts @@ -98,8 +98,9 @@ describe('useEmailVerificationVerify', () => { let response: EmailVerificationVerifyResponse | undefined; await act(async () => { - response = - await result.current.verifyEmailVerification(mockVerifyRequest); + response = await result.current.verifyEmailVerification( + mockVerifyRequest, + ); }); expect(mockEmailVerificationVerify).toHaveBeenCalledWith({ diff --git a/app/components/UI/Card/hooks/useGetCardExternalWalletDetails.ts b/app/components/UI/Card/hooks/useGetCardExternalWalletDetails.ts index ed0bc1e160bd..511e080403b4 100644 --- a/app/components/UI/Card/hooks/useGetCardExternalWalletDetails.ts +++ b/app/components/UI/Card/hooks/useGetCardExternalWalletDetails.ts @@ -39,8 +39,8 @@ export const mapCardExternalWalletDetailToCardTokenAllowance = ( allowanceFloat === 0 ? AllowanceState.NotEnabled : allowanceFloat < ARBITRARY_ALLOWANCE - ? AllowanceState.Limited - : AllowanceState.Enabled; + ? AllowanceState.Limited + : AllowanceState.Enabled; const availableBalance = Math.min(balanceFloat, allowanceFloat); // Find totalAllowance by matching the token address diff --git a/app/components/UI/Card/hooks/useGetPriorityCardToken.tsx b/app/components/UI/Card/hooks/useGetPriorityCardToken.tsx index 06d04e8a5efe..634bad1316a0 100644 --- a/app/components/UI/Card/hooks/useGetPriorityCardToken.tsx +++ b/app/components/UI/Card/hooks/useGetPriorityCardToken.tsx @@ -61,8 +61,9 @@ const fetchAllowances = async ( name: TraceName.Card, op: TraceOperation.CardGetSupportedTokensAllowances, }); - const supportedTokensAllowances = - await sdk.getSupportedTokensAllowances(selectedAddress); + const supportedTokensAllowances = await sdk.getSupportedTokensAllowances( + selectedAddress, + ); const supportedTokens = sdk.getSupportedTokensByChainId(sdk.lineaChainId); diff --git a/app/components/UI/Card/hooks/usePhoneVerificationSend.ts b/app/components/UI/Card/hooks/usePhoneVerificationSend.ts index 2f0bb0b2e398..a779a6c0c7cc 100644 --- a/app/components/UI/Card/hooks/usePhoneVerificationSend.ts +++ b/app/components/UI/Card/hooks/usePhoneVerificationSend.ts @@ -53,8 +53,9 @@ const usePhoneVerificationSend = (): { setIsSuccess(false); setError(null); - const phoneVerificationSendResponse = - await sdk.phoneVerificationSend(request); + const phoneVerificationSendResponse = await sdk.phoneVerificationSend( + request, + ); setIsSuccess(true); diff --git a/app/components/UI/Card/hooks/usePhoneVerificationVerify.test.ts b/app/components/UI/Card/hooks/usePhoneVerificationVerify.test.ts index 7684693051fc..28d1e02962e6 100644 --- a/app/components/UI/Card/hooks/usePhoneVerificationVerify.test.ts +++ b/app/components/UI/Card/hooks/usePhoneVerificationVerify.test.ts @@ -95,8 +95,9 @@ describe('usePhoneVerificationVerify', () => { let response: RegisterUserResponse | undefined; await act(async () => { - response = - await result.current.verifyPhoneVerification(mockVerifyRequest); + response = await result.current.verifyPhoneVerification( + mockVerifyRequest, + ); }); expect(mockPhoneVerificationVerify).toHaveBeenCalledWith({ diff --git a/app/components/UI/Card/hooks/useRegisterMailingAddress.ts b/app/components/UI/Card/hooks/useRegisterMailingAddress.ts index 98900d990cb2..c741e926fdfd 100644 --- a/app/components/UI/Card/hooks/useRegisterMailingAddress.ts +++ b/app/components/UI/Card/hooks/useRegisterMailingAddress.ts @@ -59,8 +59,9 @@ const useRegisterMailingAddress = (): { ? { ...request, location } : request; - const registerAddressResponse = - await sdk.registerMailingAddress(requestWithLocation); + const registerAddressResponse = await sdk.registerMailingAddress( + requestWithLocation, + ); setIsSuccess(true); diff --git a/app/components/UI/Card/hooks/useRegisterPhysicalAddress.ts b/app/components/UI/Card/hooks/useRegisterPhysicalAddress.ts index efe8a4d3babb..bda44b3c82f8 100644 --- a/app/components/UI/Card/hooks/useRegisterPhysicalAddress.ts +++ b/app/components/UI/Card/hooks/useRegisterPhysicalAddress.ts @@ -53,8 +53,9 @@ const useRegisterPhysicalAddress = (): { setIsSuccess(false); setError(null); - const registerAddressResponse = - await sdk.registerPhysicalAddress(request); + const registerAddressResponse = await sdk.registerPhysicalAddress( + request, + ); setIsSuccess(true); diff --git a/app/components/UI/Card/sdk/CardSDK.test.ts b/app/components/UI/Card/sdk/CardSDK.test.ts index 1b62c090f31b..f37ab3f73dc4 100644 --- a/app/components/UI/Card/sdk/CardSDK.test.ts +++ b/app/components/UI/Card/sdk/CardSDK.test.ts @@ -730,8 +730,9 @@ describe('CardSDK', () => { cardFeatureFlag: emptyTokensCardFeatureFlag, }); - const result = - await emptyTokensCardSDK.getSupportedTokensAllowances(testAddress); + const result = await emptyTokensCardSDK.getSupportedTokensAllowances( + testAddress, + ); expect(result).toEqual([]); }); @@ -961,8 +962,9 @@ describe('CardSDK', () => { json: jest.fn().mockResolvedValue(mockResponse), }); - const result = - await cardSDK.initiateCardProviderAuthentication(mockQueryParams); + const result = await cardSDK.initiateCardProviderAuthentication( + mockQueryParams, + ); expect(result).toEqual(mockResponse); expect(global.fetch).toHaveBeenCalledWith( diff --git a/app/components/UI/Card/sdk/index.tsx b/app/components/UI/Card/sdk/index.tsx index 243a0a7fe025..6e560f6b3c18 100644 --- a/app/components/UI/Card/sdk/index.tsx +++ b/app/components/UI/Card/sdk/index.tsx @@ -148,11 +148,12 @@ export const useCardSDK = () => { * Higher-order component that wraps a component with CardSDKProvider. */ export const withCardSDK = - (Component: React.ComponentType) => (props: Record) => ( - - - - ); + (Component: React.ComponentType) => (props: Record) => + ( + + + + ); /** * Component that performs cardholder verification. diff --git a/app/components/UI/Carousel/index.test.tsx b/app/components/UI/Carousel/index.test.tsx index ede360145c16..7b23a91601f2 100644 --- a/app/components/UI/Carousel/index.test.tsx +++ b/app/components/UI/Carousel/index.test.tsx @@ -41,7 +41,7 @@ const makeMockState = () => }, settings: { showFiatOnTestnets: false }, banners: { dismissedBanners: [] }, - }) as unknown as RootState; + } as unknown as RootState); // Mocks jest.mock('react-redux', () => ({ diff --git a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx index 1a696bf5f10f..67012240e2d6 100644 --- a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx +++ b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx @@ -60,7 +60,7 @@ const RenderBalance = (asset: { {balanceFiat === TOKEN_BALANCE_LOADING ? ( ) : ( - (balanceFiat ?? '') + balanceFiat ?? '' )} diff --git a/app/components/UI/Earn/Views/EarnInputView/EarnInputView.tsx b/app/components/UI/Earn/Views/EarnInputView/EarnInputView.tsx index dd7addac10f4..7d44427c9f45 100644 --- a/app/components/UI/Earn/Views/EarnInputView/EarnInputView.tsx +++ b/app/components/UI/Earn/Views/EarnInputView/EarnInputView.tsx @@ -119,7 +119,7 @@ const EarnInputView = () => { // otherwise, use the contract exchange rate or 0 if undefined const exchangeRate = token.isETH ? 1 - : (contractExchangeRates?.[token.address as Hex]?.price ?? 0); + : contractExchangeRates?.[token.address as Hex]?.price ?? 0; // other hooks const { styles, theme } = useStyles(styleSheet, {}); diff --git a/app/components/UI/Earn/Views/EarnWithdrawInputView/EarnWithdrawInputView.tsx b/app/components/UI/Earn/Views/EarnWithdrawInputView/EarnWithdrawInputView.tsx index 566402c75461..7486026f43ef 100644 --- a/app/components/UI/Earn/Views/EarnWithdrawInputView/EarnWithdrawInputView.tsx +++ b/app/components/UI/Earn/Views/EarnWithdrawInputView/EarnWithdrawInputView.tsx @@ -706,7 +706,7 @@ const EarnWithdrawInputView = () => { style={styles.keypad} // TODO: this should be the underlying token symbol/ticker if not ETH // once this data is available in the state we can use that - currency={token.isETH ? 'ETH' : (token.ticker ?? token.symbol)} + currency={token.isETH ? 'ETH' : token.ticker ?? token.symbol} decimals={isFiat ? 2 : 5} /> diff --git a/app/components/UI/EditGasFee1559/index.js b/app/components/UI/EditGasFee1559/index.js index dace7a839c79..c0e6353aae6c 100644 --- a/app/components/UI/EditGasFee1559/index.js +++ b/app/components/UI/EditGasFee1559/index.js @@ -739,12 +739,12 @@ const EditGasFee1559 = ({ showInfoModal === 'gas_limit' ? strings('edit_gas_fee_eip1559.gas_limit') : showInfoModal === 'max_priority_fee' - ? strings('edit_gas_fee_eip1559.max_priority_fee') - : showInfoModal === 'max_fee' - ? strings('edit_gas_fee_eip1559.max_fee') - : showInfoModal === 'new_gas_fee' - ? strings('edit_gas_fee_eip1559.new_gas_fee') - : null + ? strings('edit_gas_fee_eip1559.max_priority_fee') + : showInfoModal === 'max_fee' + ? strings('edit_gas_fee_eip1559.max_fee') + : showInfoModal === 'new_gas_fee' + ? strings('edit_gas_fee_eip1559.new_gas_fee') + : null } toggleModal={() => setShowInfoModal(null)} body={ diff --git a/app/components/UI/EditGasFeeLegacy/index.js b/app/components/UI/EditGasFeeLegacy/index.js index b26d0a25e308..6bb27c4c45fe 100644 --- a/app/components/UI/EditGasFeeLegacy/index.js +++ b/app/components/UI/EditGasFeeLegacy/index.js @@ -489,8 +489,8 @@ const EditGasFeeLegacy = ({ showRangeInfoModal === 'gas_limit' ? strings('edit_gas_fee_eip1559.gas_limit') : showRangeInfoModal === 'gas_price' - ? strings('edit_gas_fee_eip1559.gas_price') - : null + ? strings('edit_gas_fee_eip1559.gas_price') + : null } toggleModal={() => setShowRangeInfoModal(null)} body={ diff --git a/app/components/UI/Navbar/index.js b/app/components/UI/Navbar/index.js index 9904e414231c..62db57195574 100644 --- a/app/components/UI/Navbar/index.js +++ b/app/components/UI/Navbar/index.js @@ -2021,16 +2021,16 @@ export function getDepositNavbarOptions( /> ) : showConfiguration - ? () => ( - - ) - : null, + ? () => ( + + ) + : null, headerRight: showClose ? () => ( { ticker, }) : type !== RPC - ? strings('network_information.first_description', { ticker }) - : [ - ticker === undefined - ? strings('network_information.private_network') - : strings('network_information.first_description', { - ticker, - }), - ] + ? strings('network_information.first_description', { ticker }) + : [ + ticker === undefined + ? strings('network_information.private_network') + : strings('network_information.first_description', { + ticker, + }), + ] } number={1} clickableText={undefined} diff --git a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx index 8f56107c12bf..e33e37932bbc 100644 --- a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx +++ b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx @@ -640,10 +640,10 @@ const PermissionsSummary = ({ {isNonDappNetworkSwitch ? strings('permissions.title_add_network_permission') : !isAlreadyConnected || isNetworkSwitch - ? hostname - : strings('permissions.title_dapp_url_has_approval_to', { - dappUrl: hostname, - })} + ? hostname + : strings('permissions.title_dapp_url_has_approval_to', { + dappUrl: hostname, + })} {strings('account_dapp_connections.account_summary_header')} diff --git a/app/components/UI/Perps/Views/PerpsClosePositionView/PerpsClosePositionView.tsx b/app/components/UI/Perps/Views/PerpsClosePositionView/PerpsClosePositionView.tsx index 68fc2bad750c..33ea2b69f9df 100644 --- a/app/components/UI/Perps/Views/PerpsClosePositionView/PerpsClosePositionView.tsx +++ b/app/components/UI/Perps/Views/PerpsClosePositionView/PerpsClosePositionView.tsx @@ -599,8 +599,8 @@ const PerpsClosePositionView: React.FC = () => { rewardsState.isLoading ? RewardAnimationState.Loading : rewardsState.hasError - ? RewardAnimationState.ErrorState - : RewardAnimationState.Idle + ? RewardAnimationState.ErrorState + : RewardAnimationState.Idle } /> diff --git a/app/components/UI/Perps/Views/PerpsMarketDetailsView/PerpsMarketDetailsView.tsx b/app/components/UI/Perps/Views/PerpsMarketDetailsView/PerpsMarketDetailsView.tsx index 0710c836c8a1..e25116abd990 100644 --- a/app/components/UI/Perps/Views/PerpsMarketDetailsView/PerpsMarketDetailsView.tsx +++ b/app/components/UI/Perps/Views/PerpsMarketDetailsView/PerpsMarketDetailsView.tsx @@ -630,12 +630,12 @@ const PerpsMarketDetailsView: React.FC = () => { existingPosition.liquidationPrice || undefined, } : selectedOrderTPSL.takeProfitPrice || - selectedOrderTPSL.stopLossPrice - ? { - takeProfitPrice: selectedOrderTPSL.takeProfitPrice, - stopLossPrice: selectedOrderTPSL.stopLossPrice, - } - : undefined + selectedOrderTPSL.stopLossPrice + ? { + takeProfitPrice: selectedOrderTPSL.takeProfitPrice, + stopLossPrice: selectedOrderTPSL.stopLossPrice, + } + : undefined } testID={`${PerpsMarketDetailsViewSelectorsIDs.CONTAINER}-tradingview-chart`} /> diff --git a/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx b/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx index eb7b8cdc73e8..74e6f107c294 100644 --- a/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx +++ b/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx @@ -63,17 +63,14 @@ const PerpsTransactionsView: React.FC = () => { // Helper function to group transactions by date const groupTransactionsByDate = useCallback( (transactions: PerpsTransaction[]): TransactionSection[] => { - const grouped = transactions.reduce( - (acc, transaction) => { - const dateKey = formatDateSection(transaction.timestamp); - if (!acc[dateKey]) { - acc[dateKey] = []; - } - acc[dateKey].push(transaction); - return acc; - }, - {} as Record, - ); + const grouped = transactions.reduce((acc, transaction) => { + const dateKey = formatDateSection(transaction.timestamp); + if (!acc[dateKey]) { + acc[dateKey] = []; + } + acc[dateKey].push(transaction); + return acc; + }, {} as Record); return Object.entries(grouped).map(([title, data]) => ({ title, data })); }, diff --git a/app/components/UI/Perps/__mocks__/providerMocks.ts b/app/components/UI/Perps/__mocks__/providerMocks.ts index 8f70abd81043..838925948487 100644 --- a/app/components/UI/Perps/__mocks__/providerMocks.ts +++ b/app/components/UI/Perps/__mocks__/providerMocks.ts @@ -50,7 +50,7 @@ export const createMockHyperLiquidProvider = subscribeToOrders: jest.fn(), subscribeToAccount: jest.fn(), setUserFeeDiscount: jest.fn(), - }) as unknown as jest.Mocked; + } as unknown as jest.Mocked); export const createMockOrderResult = () => ({ success: true, diff --git a/app/components/UI/Perps/components/PerpsAmountDisplay/PerpsAmountDisplay.tsx b/app/components/UI/Perps/components/PerpsAmountDisplay/PerpsAmountDisplay.tsx index 1ef4f53f9c37..abe51b54b623 100644 --- a/app/components/UI/Perps/components/PerpsAmountDisplay/PerpsAmountDisplay.tsx +++ b/app/components/UI/Perps/components/PerpsAmountDisplay/PerpsAmountDisplay.tsx @@ -97,8 +97,8 @@ const PerpsAmountDisplay: React.FC = ({ {showTokenAmount && tokenAmount && tokenSymbol ? `${formatPositionSize(tokenAmount)} ${tokenSymbol}` : amount - ? formatPerpsFiat(amount, { ranges: PRICE_RANGES_MINIMAL_VIEW }) - : '$0'} + ? formatPerpsFiat(amount, { ranges: PRICE_RANGES_MINIMAL_VIEW }) + : '$0'} {isActive && ( )} diff --git a/app/components/UI/Perps/components/PerpsTokenLogo/PerpsTokenLogo.tsx b/app/components/UI/Perps/components/PerpsTokenLogo/PerpsTokenLogo.tsx index c413da0e8bb2..9ff40272d8ad 100644 --- a/app/components/UI/Perps/components/PerpsTokenLogo/PerpsTokenLogo.tsx +++ b/app/components/UI/Perps/components/PerpsTokenLogo/PerpsTokenLogo.tsx @@ -119,8 +119,8 @@ const PerpsTokenLogo: React.FC = ({ size === 32 ? AvatarSize.Md : size === 40 - ? AvatarSize.Lg - : AvatarSize.Md + ? AvatarSize.Lg + : AvatarSize.Md } style={style} testID={testID} diff --git a/app/components/UI/Perps/controllers/PerpsController.test.ts b/app/components/UI/Perps/controllers/PerpsController.test.ts index cbeddf6eb7ce..e00e7c7a9dec 100644 --- a/app/components/UI/Perps/controllers/PerpsController.test.ts +++ b/app/components/UI/Perps/controllers/PerpsController.test.ts @@ -1167,8 +1167,9 @@ describe('PerpsController', () => { mockLiquidationPrice, ); - const result = - await controller.calculateLiquidationPrice(liquidationParams); + const result = await controller.calculateLiquidationPrice( + liquidationParams, + ); expect(result).toBe(mockLiquidationPrice); expect(mockProvider.calculateLiquidationPrice).toHaveBeenCalledWith( diff --git a/app/components/UI/Perps/controllers/PerpsController.ts b/app/components/UI/Perps/controllers/PerpsController.ts index a88f1afc3f38..b28dd00fedee 100644 --- a/app/components/UI/Perps/controllers/PerpsController.ts +++ b/app/components/UI/Perps/controllers/PerpsController.ts @@ -877,8 +877,9 @@ export class PerpsController extends BaseController< } const orderExecutionFeeDiscountStartTime = performance.now(); - const discountBips = - await RewardsController.getPerpsDiscountForAccount(caipAccountId); + const discountBips = await RewardsController.getPerpsDiscountForAccount( + caipAccountId, + ); const orderExecutionFeeDiscountDuration = performance.now() - orderExecutionFeeDiscountStartTime; diff --git a/app/components/UI/Perps/hooks/usePerpsClosePosition.test.ts b/app/components/UI/Perps/hooks/usePerpsClosePosition.test.ts index 36612c1661b2..fe3904566a27 100644 --- a/app/components/UI/Perps/hooks/usePerpsClosePosition.test.ts +++ b/app/components/UI/Perps/hooks/usePerpsClosePosition.test.ts @@ -106,8 +106,9 @@ describe('usePerpsClosePosition', () => { const { result } = renderHook(() => usePerpsClosePosition({ onSuccess })); await act(async () => { - const closeResult = - await result.current.handleClosePosition(mockPosition); + const closeResult = await result.current.handleClosePosition( + mockPosition, + ); expect(closeResult).toEqual(successResult); }); @@ -362,8 +363,9 @@ describe('usePerpsClosePosition', () => { const { result } = renderHook(() => usePerpsClosePosition()); await act(async () => { - const closeResult = - await result.current.handleClosePosition(positionWithTPSL); + const closeResult = await result.current.handleClosePosition( + positionWithTPSL, + ); expect(closeResult).toEqual(successResult); }); diff --git a/app/components/UI/Perps/hooks/usePerpsOrderFees.ts b/app/components/UI/Perps/hooks/usePerpsOrderFees.ts index edf73ff7ef00..4ad442c66015 100644 --- a/app/components/UI/Perps/hooks/usePerpsOrderFees.ts +++ b/app/components/UI/Perps/hooks/usePerpsOrderFees.ts @@ -244,8 +244,9 @@ export function usePerpsOrderFees({ const { RewardsController } = Engine.context; const feeDiscountStartTime = performance.now(); - const discountBips = - await RewardsController.getPerpsDiscountForAccount(caipAccountId); + const discountBips = await RewardsController.getPerpsDiscountForAccount( + caipAccountId, + ); const feeDiscountDuration = performance.now() - feeDiscountStartTime; // Measure fee discount API call performance @@ -336,8 +337,9 @@ export function usePerpsOrderFees({ const { RewardsController } = Engine.context; const pointsEstimationStartTime = performance.now(); - const result = - await RewardsController.estimatePoints(estimatePointsDto); + const result = await RewardsController.estimatePoints( + estimatePointsDto, + ); const pointsEstimationDuration = performance.now() - pointsEstimationStartTime; diff --git a/app/components/UI/Perps/selectors/perpsController/index.test.ts b/app/components/UI/Perps/selectors/perpsController/index.test.ts index 7634e7ddcd5e..8cd292e2f044 100644 --- a/app/components/UI/Perps/selectors/perpsController/index.test.ts +++ b/app/components/UI/Perps/selectors/perpsController/index.test.ts @@ -22,7 +22,7 @@ describe('PerpsController Selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('selectPerpsProvider', () => { it('returns the active provider from PerpsController state', () => { diff --git a/app/components/UI/Perps/services/HyperLiquidSubscriptionService.ts b/app/components/UI/Perps/services/HyperLiquidSubscriptionService.ts index 03d6e654b8e9..ab1ef540b004 100644 --- a/app/components/UI/Perps/services/HyperLiquidSubscriptionService.ts +++ b/app/components/UI/Perps/services/HyperLiquidSubscriptionService.ts @@ -673,8 +673,9 @@ export class HyperLiquidSubscriptionService { accountId?: CaipAccountId, ): Promise { const enabledDexs = this.getEnabledDexs(); - const userAddress = - await this.walletService.getUserAddressWithDefault(accountId); + const userAddress = await this.walletService.getUserAddressWithDefault( + accountId, + ); // Establish webData2 subscription for main DEX (if not exists) if (!this.webData2Subscriptions.has('')) { @@ -733,8 +734,9 @@ export class HyperLiquidSubscriptionService { throw new Error('Subscription client not initialized'); } - const userAddress = - await this.walletService.getUserAddressWithDefault(accountId); + const userAddress = await this.walletService.getUserAddressWithDefault( + accountId, + ); // Only subscribe to main DEX (webData2 doesn't support dex parameter) const dexName = ''; // Main DEX diff --git a/app/components/UI/Perps/utils/arbitrumWithdrawalDetection.ts b/app/components/UI/Perps/utils/arbitrumWithdrawalDetection.ts index c2bc5b0f7b89..d391d08a5d2f 100644 --- a/app/components/UI/Perps/utils/arbitrumWithdrawalDetection.ts +++ b/app/components/UI/Perps/utils/arbitrumWithdrawalDetection.ts @@ -199,8 +199,8 @@ export const detectHyperLiquidWithdrawal = ( tx.status === 'confirmed' ? 'completed' : tx.status === 'failed' - ? 'failed' - : 'pending', + ? 'failed' + : 'pending', blockNumber: tx.blockNumber, }; } catch (error) { diff --git a/app/components/UI/Perps/utils/arbitrumWithdrawalTransforms.ts b/app/components/UI/Perps/utils/arbitrumWithdrawalTransforms.ts index 42f694bc812b..e661bc4e36d0 100644 --- a/app/components/UI/Perps/utils/arbitrumWithdrawalTransforms.ts +++ b/app/components/UI/Perps/utils/arbitrumWithdrawalTransforms.ts @@ -30,8 +30,8 @@ export const transformArbitrumWithdrawalToHistoryItem = ( withdrawal.status === 'completed' ? 'completed' : withdrawal.status === 'failed' - ? 'failed' - : 'pending', + ? 'failed' + : 'pending', details: { source: 'arbitrum_blockchain', bridgeContract: withdrawal.from, diff --git a/app/components/UI/Perps/utils/sortMarkets.test.ts b/app/components/UI/Perps/utils/sortMarkets.test.ts index 438bff83ecd5..9fa80aea318d 100644 --- a/app/components/UI/Perps/utils/sortMarkets.test.ts +++ b/app/components/UI/Perps/utils/sortMarkets.test.ts @@ -21,7 +21,7 @@ describe('sortMarkets', () => { openInterest: '$500K', price: '$50000', ...overrides, - }) as PerpsMarketData; + } as PerpsMarketData); beforeEach(() => { jest.clearAllMocks(); diff --git a/app/components/UI/Predict/components/PredictActivityDetail/PredictActivityDetail.tsx b/app/components/UI/Predict/components/PredictActivityDetail/PredictActivityDetail.tsx index ec2d07585d71..c98b8bce8302 100644 --- a/app/components/UI/Predict/components/PredictActivityDetail/PredictActivityDetail.tsx +++ b/app/components/UI/Predict/components/PredictActivityDetail/PredictActivityDetail.tsx @@ -246,7 +246,7 @@ const PredictActivityDetails: React.FC = () => { const netPnlRows: DetailRow[] = []; const netPnlNumeric = isSell - ? (activity.netPnlUsd ?? entryAmount) + ? activity.netPnlUsd ?? entryAmount : activity.netPnlUsd; const netPnlValue = formatCurrencyValue(netPnlNumeric, { showSign: true }); if (netPnlValue && isSell) { diff --git a/app/components/UI/Predict/components/PredictPositionsHeader/PredictPositionsHeader.test.tsx b/app/components/UI/Predict/components/PredictPositionsHeader/PredictPositionsHeader.test.tsx index 569b9c09b139..ba91516b051d 100644 --- a/app/components/UI/Predict/components/PredictPositionsHeader/PredictPositionsHeader.test.tsx +++ b/app/components/UI/Predict/components/PredictPositionsHeader/PredictPositionsHeader.test.tsx @@ -326,20 +326,20 @@ function setupMarketsWonCardTest( claimablePositionsOverrides.positions !== undefined ? (claimablePositionsOverrides.positions as unknown as PredictPosition[]) : props.totalClaimableAmount - ? ([ - { - id: 'position-1', - status: PredictPositionStatus.WON, - cashPnl: props.totalClaimableAmount, - marketId: 'market-1', - tokenId: 'token-1', - outcome: 'Yes', - shares: '100', - avgPrice: 0.5, - currentValue: props.totalClaimableAmount, - }, - ] as unknown as PredictPosition[]) - : []; + ? ([ + { + id: 'position-1', + status: PredictPositionStatus.WON, + cashPnl: props.totalClaimableAmount, + marketId: 'market-1', + tokenId: 'token-1', + outcome: 'Yes', + shares: '100', + avgPrice: 0.5, + currentValue: props.totalClaimableAmount, + }, + ] as unknown as PredictPosition[]) + : []; // Create Redux state const state = { diff --git a/app/components/UI/Predict/providers/polymarket/utils.ts b/app/components/UI/Predict/providers/polymarket/utils.ts index a8fb9828e833..a0ff79ecaa0e 100644 --- a/app/components/UI/Predict/providers/polymarket/utils.ts +++ b/app/components/UI/Predict/providers/polymarket/utils.ts @@ -455,8 +455,8 @@ export const parsePolymarketActivity = ( ? activity.side === 'BUY' ? 'buy' : activity.side === 'SELL' - ? 'sell' - : 'claimWinnings' + ? 'sell' + : 'claimWinnings' : 'claimWinnings'; const id = diff --git a/app/components/UI/Predict/views/PredictMarketDetails/PredictMarketDetails.tsx b/app/components/UI/Predict/views/PredictMarketDetails/PredictMarketDetails.tsx index 9437e868fb4e..375f7c5cff0c 100644 --- a/app/components/UI/Predict/views/PredictMarketDetails/PredictMarketDetails.tsx +++ b/app/components/UI/Predict/views/PredictMarketDetails/PredictMarketDetails.tsx @@ -238,7 +238,7 @@ const PredictMarketDetails: React.FC = () => { color: loadedOutcomeTokenIds.length === 1 ? colors.success.default - : (palette[index] ?? colors.success.default), + : palette[index] ?? colors.success.default, data: (priceHistories[index] ?? []).map((point) => ({ timestamp: point.timestamp, value: Number((point.price * 100).toFixed(2)), @@ -254,7 +254,7 @@ const PredictMarketDetails: React.FC = () => { ]); const chartEmptyLabel = hasAnyOutcomeToken - ? (errors.find(Boolean) ?? undefined) + ? errors.find(Boolean) ?? undefined : ''; const handleTimeframeChange = (timeframe: string) => { diff --git a/app/components/UI/ProfilerManager/ProfilerManager.tsx b/app/components/UI/ProfilerManager/ProfilerManager.tsx index 9121767649cc..077d0a536e66 100644 --- a/app/components/UI/ProfilerManager/ProfilerManager.tsx +++ b/app/components/UI/ProfilerManager/ProfilerManager.tsx @@ -160,8 +160,8 @@ const ProfilerManager: React.FC = ({ isRecording || !lastProfilePath ? 'bg-muted' : pressed - ? 'bg-pressed' - : 'bg-primary-default', + ? 'bg-pressed' + : 'bg-primary-default', ) } onPress={exportTrace} diff --git a/app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.tsx b/app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.tsx index ecb107e435f5..911958587d39 100644 --- a/app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.tsx +++ b/app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.tsx @@ -104,8 +104,8 @@ function OrdersList() { item.provider === FIAT_ORDER_PROVIDERS.AGGREGATOR ? () => handleNavigateToAggregatorTxDetails(item.id) : item.provider === FIAT_ORDER_PROVIDERS.DEPOSIT - ? () => handleNavigateToDepositTxDetails(item.id) - : undefined + ? () => handleNavigateToDepositTxDetails(item.id) + : undefined } underlayColor={colors.background.alternative} activeOpacity={1} diff --git a/app/components/UI/Ramp/Aggregator/Views/Quotes/Quotes.tsx b/app/components/UI/Ramp/Aggregator/Views/Quotes/Quotes.tsx index 093de07f0d88..5b70edb3951b 100644 --- a/app/components/UI/Ramp/Aggregator/Views/Quotes/Quotes.tsx +++ b/app/components/UI/Ramp/Aggregator/Views/Quotes/Quotes.tsx @@ -352,8 +352,9 @@ function Quotes() { ); if (buyAction.browser === ProviderBuyFeatureBrowserEnum.AppBrowser) { - const { url, orderId: customOrderId } = - await buyAction.createWidget(callbackBaseUrl); + const { url, orderId: customOrderId } = await buyAction.createWidget( + callbackBaseUrl, + ); navigation.navigate( ...createCheckoutNavDetails({ @@ -471,8 +472,9 @@ function Quotes() { } else if ( buyAction.browser === ProviderBuyFeatureBrowserEnum.AppBrowser ) { - const { url, orderId: customOrderId } = - await buyAction.createWidget(callbackBaseUrl); + const { url, orderId: customOrderId } = await buyAction.createWidget( + callbackBaseUrl, + ); navigation.navigate( ...createCheckoutNavDetails({ provider: quote.provider, diff --git a/app/components/UI/Ramp/Aggregator/Views/SendTransaction/SendTransaction.tsx b/app/components/UI/Ramp/Aggregator/Views/SendTransaction/SendTransaction.tsx index fb74e1aa383a..e62a6aee60bb 100644 --- a/app/components/UI/Ramp/Aggregator/Views/SendTransaction/SendTransaction.tsx +++ b/app/components/UI/Ramp/Aggregator/Views/SendTransaction/SendTransaction.tsx @@ -257,9 +257,7 @@ function SendTransaction() { - {strings( - 'fiat_on_ramp_aggregator.send_transaction.send', - )}{' '} + {strings('fiat_on_ramp_aggregator.send_transaction.send')}{' '} {fromTokenMinimalUnitString( diff --git a/app/components/UI/Ramp/Aggregator/components/Account.tsx b/app/components/UI/Ramp/Aggregator/components/Account.tsx index eeac3899ed0f..1e962c19eeec 100644 --- a/app/components/UI/Ramp/Aggregator/components/Account.tsx +++ b/app/components/UI/Ramp/Aggregator/components/Account.tsx @@ -62,10 +62,10 @@ const Account = ({ areAddressesEqual(account.address, address), ) : selectedAddress - ? internalAccounts.find((account) => - areAddressesEqual(account.address, selectedAddress), - ) - : undefined; + ? internalAccounts.find((account) => + areAddressesEqual(account.address, selectedAddress), + ) + : undefined; const accountName = selectedInternalAccount?.metadata?.name || ''; return ( diff --git a/app/components/UI/Ramp/Aggregator/hooks/useInAppBrowser.ts b/app/components/UI/Ramp/Aggregator/hooks/useInAppBrowser.ts index adfa576446d4..168426416ddb 100644 --- a/app/components/UI/Ramp/Aggregator/hooks/useInAppBrowser.ts +++ b/app/components/UI/Ramp/Aggregator/hooks/useInAppBrowser.ts @@ -48,8 +48,9 @@ export default function useInAppBrowser() { } const deeplinkRedirectUrl = `${callbackBaseDeeplink}on-ramp${provider.id}`; - const { url, orderId: customOrderId } = - await buyAction.createWidget(deeplinkRedirectUrl); + const { url, orderId: customOrderId } = await buyAction.createWidget( + deeplinkRedirectUrl, + ); let customIdData; diff --git a/app/components/UI/Ramp/Aggregator/hooks/useIntentAmount.ts b/app/components/UI/Ramp/Aggregator/hooks/useIntentAmount.ts index 59ad0463c5a2..50959911ffc1 100644 --- a/app/components/UI/Ramp/Aggregator/hooks/useIntentAmount.ts +++ b/app/components/UI/Ramp/Aggregator/hooks/useIntentAmount.ts @@ -32,8 +32,8 @@ export default function useIntentAmount( const parsedAmount = parseAmount( intent.amount, isBuy - ? (currentFiatCurrency.decimals ?? 0) - : (selectedAsset.decimals ?? 0), + ? currentFiatCurrency.decimals ?? 0 + : selectedAsset.decimals ?? 0, ); if (parsedAmount) { diff --git a/app/components/UI/Ramp/Aggregator/hooks/useSDKMethod.ts b/app/components/UI/Ramp/Aggregator/hooks/useSDKMethod.ts index b7d3117b4259..54d34d721436 100644 --- a/app/components/UI/Ramp/Aggregator/hooks/useSDKMethod.ts +++ b/app/components/UI/Ramp/Aggregator/hooks/useSDKMethod.ts @@ -90,7 +90,7 @@ export default function useSDKMethod( Promise | ReturnType, ] { const method = typeof config === 'string' ? config : config.method; - const onMount = typeof config === 'string' ? true : (config.onMount ?? true); + const onMount = typeof config === 'string' ? true : config.onMount ?? true; const { sdk } = useRampSDK(); const [data, setData] = useState { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); expect(await processCustomOrderId(dummmyCustomOrderIdData)).toEqual([ @@ -125,7 +125,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); expect(await processCustomOrderId(dummmyCustomOrderIdData)).toEqual([ @@ -143,7 +143,7 @@ describe('CustomOrderId processor', () => { .mockResolvedValue({ status: OrderStatusEnum.Pending }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); jest.spyOn(Date, 'now').mockImplementation(() => 1000); @@ -173,7 +173,7 @@ describe('CustomOrderId processor', () => { .mockResolvedValue({ status: OrderStatusEnum.Precreated }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); jest.spyOn(Date, 'now').mockImplementation(() => 12345689); @@ -203,7 +203,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); jest.spyOn(Date, 'now').mockImplementation(() => 1000); @@ -233,7 +233,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; @@ -268,7 +268,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; @@ -303,7 +303,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const errorCount = MAX_ERROR_COUNT; @@ -340,7 +340,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const errorCount = MAX_ERROR_COUNT; @@ -377,7 +377,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; @@ -412,7 +412,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; @@ -447,7 +447,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; @@ -483,7 +483,7 @@ describe('CustomOrderId processor', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); const now = 123123123; diff --git a/app/components/UI/Ramp/Aggregator/sdk/index.tsx b/app/components/UI/Ramp/Aggregator/sdk/index.tsx index 8973b85873db..e6b04ae56c29 100644 --- a/app/components/UI/Ramp/Aggregator/sdk/index.tsx +++ b/app/components/UI/Ramp/Aggregator/sdk/index.tsx @@ -316,10 +316,11 @@ export const useRampSDK = () => { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any -export const withRampSDK = (Component: React.FC) => (props: any) => ( - - - -); +export const withRampSDK = (Component: React.FC) => (props: any) => + ( + + + + ); export default SDKContext; diff --git a/app/components/UI/Ramp/Aggregator/utils/index.test.ts b/app/components/UI/Ramp/Aggregator/utils/index.test.ts index b36ad3a1e34f..c66a5cdb6073 100644 --- a/app/components/UI/Ramp/Aggregator/utils/index.test.ts +++ b/app/components/UI/Ramp/Aggregator/utils/index.test.ts @@ -69,7 +69,7 @@ describe('formatAmount', () => { format: jest.fn().mockImplementation(() => '123,123'), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); expect(formatAmount(123123)).toBe('123,123'); jest.spyOn(Intl, 'NumberFormat').mockClear(); @@ -84,7 +84,7 @@ describe('formatAmount', () => { }), // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); expect(formatAmount(123123)).toBe('123123'); jest.spyOn(Intl, 'NumberFormat').mockClear(); diff --git a/app/components/UI/Ramp/Deposit/Views/Modals/PaymentMethodSelectorModal/PaymentMethodSelectorModal.tsx b/app/components/UI/Ramp/Deposit/Views/Modals/PaymentMethodSelectorModal/PaymentMethodSelectorModal.tsx index 0e89d1167391..0f7d56e49bfe 100644 --- a/app/components/UI/Ramp/Deposit/Views/Modals/PaymentMethodSelectorModal/PaymentMethodSelectorModal.tsx +++ b/app/components/UI/Ramp/Deposit/Views/Modals/PaymentMethodSelectorModal/PaymentMethodSelectorModal.tsx @@ -97,7 +97,7 @@ function PaymentMethodSelectorModal() { color={ typeof paymentMethod.iconColor === 'object' ? paymentMethod.iconColor[themeAppearance] - : (paymentMethod.iconColor ?? IconColor.Primary) + : paymentMethod.iconColor ?? IconColor.Primary } /> diff --git a/app/components/UI/Ramp/Deposit/Views/OrderProcessing/OrderProcessing.tsx b/app/components/UI/Ramp/Deposit/Views/OrderProcessing/OrderProcessing.tsx index 829819a87bd2..ac6f063054e6 100644 --- a/app/components/UI/Ramp/Deposit/Views/OrderProcessing/OrderProcessing.tsx +++ b/app/components/UI/Ramp/Deposit/Views/OrderProcessing/OrderProcessing.tsx @@ -59,9 +59,9 @@ const OrderProcessing = () => { order?.state === FIAT_ORDER_STATES.COMPLETED ? strings('deposit.order_processing.success_title') : order?.state === FIAT_ORDER_STATES.CANCELLED || - order?.state === FIAT_ORDER_STATES.FAILED - ? strings('deposit.order_processing.error_title') - : strings('deposit.order_processing.title'); + order?.state === FIAT_ORDER_STATES.FAILED + ? strings('deposit.order_processing.error_title') + : strings('deposit.order_processing.title'); navigation.setOptions( getDepositNavbarOptions(navigation, { title }, theme), diff --git a/app/components/UI/Ramp/Deposit/hooks/useDepositSdkMethod.ts b/app/components/UI/Ramp/Deposit/hooks/useDepositSdkMethod.ts index a49247409021..b4fcee953fce 100644 --- a/app/components/UI/Ramp/Deposit/hooks/useDepositSdkMethod.ts +++ b/app/components/UI/Ramp/Deposit/hooks/useDepositSdkMethod.ts @@ -103,8 +103,8 @@ export function useDepositSdkMethod( ...params: PartialParameters ): DepositSdkMethodResult { const method = typeof config === 'string' ? config : config.method; - const onMount = typeof config === 'string' ? true : (config.onMount ?? true); - const throws = typeof config === 'string' ? false : (config.throws ?? false); + const onMount = typeof config === 'string' ? true : config.onMount ?? true; + const throws = typeof config === 'string' ? false : config.throws ?? false; const { sdk } = useDepositSDK(); const [data, setData] = useState assetId === token?.assetId); - const rate = currentToken ? (rates[currentToken.assetId] ?? null) : null; + const rate = currentToken ? rates[currentToken.assetId] ?? null : null; let tokenAmount = '0'; diff --git a/app/components/UI/Ramp/Deposit/sdk/index.tsx b/app/components/UI/Ramp/Deposit/sdk/index.tsx index dccfa250d7b0..047ece29d8a9 100644 --- a/app/components/UI/Ramp/Deposit/sdk/index.tsx +++ b/app/components/UI/Ramp/Deposit/sdk/index.tsx @@ -286,8 +286,9 @@ export const useDepositSDK = () => { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any -export const withDepositSDK = (Component: React.FC) => (props: any) => ( - - - -); +export const withDepositSDK = (Component: React.FC) => (props: any) => + ( + + + + ); diff --git a/app/components/UI/Ramp/index.tsx b/app/components/UI/Ramp/index.tsx index 5a9c5e831411..0863a49b3e26 100644 --- a/app/components/UI/Ramp/index.tsx +++ b/app/components/UI/Ramp/index.tsx @@ -82,8 +82,9 @@ async function processCustomOrderId( dispatchThunk: (thunk: ThunkAction) => void; }, ) { - const [customOrderId, fiatOrderResponse] = - await processCustomOrderIdData(customOrderIdData); + const [customOrderId, fiatOrderResponse] = await processCustomOrderIdData( + customOrderIdData, + ); if (fiatOrderResponse) { const fiatOrder = aggregatorOrderToFiatOrder(fiatOrderResponse); diff --git a/app/components/UI/Rewards/components/Onboarding/__tests__/OnboardingIntroStep.test.tsx b/app/components/UI/Rewards/components/Onboarding/__tests__/OnboardingIntroStep.test.tsx index 5eab52e89814..a59515281b7d 100644 --- a/app/components/UI/Rewards/components/Onboarding/__tests__/OnboardingIntroStep.test.tsx +++ b/app/components/UI/Rewards/components/Onboarding/__tests__/OnboardingIntroStep.test.tsx @@ -6,7 +6,7 @@ jest.mock('@metamask/design-system-twrnc-preset', () => { return { useTailwind: () => ({ // Return a minimal style function used in components - style: (..._args: unknown[]) => ({}) as Record, + style: (..._args: unknown[]) => ({} as Record), }), ThemeProvider: ({ children }: { children: React.ReactNode }) => ReactActual.createElement(ReactActual.Fragment, null, children), diff --git a/app/components/UI/Rewards/hooks/useRewardOptinSummary.ts b/app/components/UI/Rewards/hooks/useRewardOptinSummary.ts index 8d28d463acb4..863d1a2d3ee6 100644 --- a/app/components/UI/Rewards/hooks/useRewardOptinSummary.ts +++ b/app/components/UI/Rewards/hooks/useRewardOptinSummary.ts @@ -368,8 +368,8 @@ export const useRewardOptinSummary = (): useRewardOptinSummaryResult => { optedInCount === totalCount ? 'fullyOptedIn' : optedInCount > 0 - ? 'partiallyOptedIn' - : 'notOptedIn', + ? 'partiallyOptedIn' + : 'notOptedIn', ); // Check if all accounts in the selected group are supported diff --git a/app/components/UI/Rewards/utils.ts b/app/components/UI/Rewards/utils.ts index e9ef3353f0d1..a771556ff0da 100644 --- a/app/components/UI/Rewards/utils.ts +++ b/app/components/UI/Rewards/utils.ts @@ -91,8 +91,8 @@ export const deriveAccountMetricProps = (account?: InternalAccount) => { const scope = isEvmAccountType(account.type) ? 'evm' : isSolanaAccount(account) - ? 'solana' - : account.type; // Fallback to account.type for other types + ? 'solana' + : account.type; // Fallback to account.type for other types let type = account.metadata?.keyring?.type; try { diff --git a/app/components/UI/SimulationDetails/sortBalanceChanges.test.ts b/app/components/UI/SimulationDetails/sortBalanceChanges.test.ts index 6bb354d9ada0..2c1d68b07d17 100644 --- a/app/components/UI/SimulationDetails/sortBalanceChanges.test.ts +++ b/app/components/UI/SimulationDetails/sortBalanceChanges.test.ts @@ -4,7 +4,7 @@ import { AssetType, BalanceChange } from './types'; describe('sortBalanceChanges', () => { // Create a mock balance change object. const bc = (type: AssetType): BalanceChange => - ({ asset: { type } }) as BalanceChange; + ({ asset: { type } } as BalanceChange); it.each([ { diff --git a/app/components/UI/SimulationDetails/useBalanceChanges.ts b/app/components/UI/SimulationDetails/useBalanceChanges.ts index b2e18f751321..7341f358e11b 100644 --- a/app/components/UI/SimulationDetails/useBalanceChanges.ts +++ b/app/components/UI/SimulationDetails/useBalanceChanges.ts @@ -189,7 +189,7 @@ function getTokenBalanceChanges( const decimals = asset.type === AssetType.ERC20 - ? (erc20Decimals[asset.address] ?? ERC20_DEFAULT_DECIMALS) + ? erc20Decimals[asset.address] ?? ERC20_DEFAULT_DECIMALS : 0; const balance = getAssetAmount( { @@ -270,7 +270,7 @@ export default function useBalanceChanges({ const erc20UsdRates = useAsyncResultOrThrow( async () => fiatCurrency === CURRENCY_USD - ? (erc20FiatRates.value ?? {}) + ? erc20FiatRates.value ?? {} : fetchTokenFiatRates(CURRENCY_USD, erc20TokenAddresses, chainId), [ JSON.stringify(erc20TokenAddresses), diff --git a/app/components/UI/Swaps/QuotesView.js b/app/components/UI/Swaps/QuotesView.js index e15e204bbfdc..9f298ed18f90 100644 --- a/app/components/UI/Swaps/QuotesView.js +++ b/app/components/UI/Swaps/QuotesView.js @@ -1221,8 +1221,9 @@ function SwapsQuotesView({ } } else { if (approvalTransaction) { - approvalTransactionMetaId = - await handleApprovalTransaction(isHardwareAddress); + approvalTransactionMetaId = await handleApprovalTransaction( + isHardwareAddress, + ); if (isHardwareAddress) { setIsHandlingSwap(false); diff --git a/app/components/UI/Swaps/components/GasEditModal.js b/app/components/UI/Swaps/components/GasEditModal.js index 2e0a48aaf951..b72eb180920f 100644 --- a/app/components/UI/Swaps/components/GasEditModal.js +++ b/app/components/UI/Swaps/components/GasEditModal.js @@ -70,10 +70,10 @@ function GasEditModal({ }) { const [gasSelected, setGasSelected] = useState( customGasFee - ? (customGasFee.selected ?? null) + ? customGasFee.selected ?? null : gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET - ? defaultGasFeeOptionFeeMarket - : defaultGasFeeOptionLegacy, + ? defaultGasFeeOptionFeeMarket + : defaultGasFeeOptionLegacy, ); const [stopUpdateGas, setStopUpdateGas] = useState(false); const [hasEnoughEthBalance, setHasEnoughEthBalance] = useState(true); @@ -309,10 +309,10 @@ function GasEditModal({ const cancelGasEdition = useCallback(() => { setGasSelected( customGasFee - ? (customGasFee.selected ?? null) + ? customGasFee.selected ?? null : gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET - ? GAS_OPTIONS.HIGH - : GAS_OPTIONS.MEDIUM, + ? GAS_OPTIONS.HIGH + : GAS_OPTIONS.MEDIUM, ); dismiss(); }, [customGasFee, dismiss, gasEstimateType]); diff --git a/app/components/UI/TimeEstimateInfoModal/index.js b/app/components/UI/TimeEstimateInfoModal/index.js index 08fe89800d36..35101282cb1c 100644 --- a/app/components/UI/TimeEstimateInfoModal/index.js +++ b/app/components/UI/TimeEstimateInfoModal/index.js @@ -14,10 +14,10 @@ const TimeEstimateInfoModal = ({ timeEstimateId, isVisible, onHideModal }) => ( timeEstimateId === AppConstants.GAS_TIMES.MAYBE ? strings('times_eip1559.warning_low_title') : timeEstimateId === AppConstants.GAS_TIMES.UNKNOWN - ? strings('times_eip1559.warning_unknown_title') - : timeEstimateId === AppConstants.GAS_TIMES.VERY_LIKELY - ? strings('times_eip1559.warning_very_likely_title') - : null + ? strings('times_eip1559.warning_unknown_title') + : timeEstimateId === AppConstants.GAS_TIMES.VERY_LIKELY + ? strings('times_eip1559.warning_very_likely_title') + : null } body={ diff --git a/app/components/UI/Tokens/util/goToAddEvmToken.test.ts b/app/components/UI/Tokens/util/goToAddEvmToken.test.ts index 71d87934bb9e..a71c0725107d 100644 --- a/app/components/UI/Tokens/util/goToAddEvmToken.test.ts +++ b/app/components/UI/Tokens/util/goToAddEvmToken.test.ts @@ -24,7 +24,7 @@ describe('goToAddEvmToken', () => { ({ addProperties: jest.fn().mockReturnThis(), build: jest.fn().mockReturnValue('mockEvent'), - }) as unknown as MetricsEventBuilder, + } as unknown as MetricsEventBuilder), ); const mockProps = { diff --git a/app/components/UI/Tokens/util/removeEvmToken.test.ts b/app/components/UI/Tokens/util/removeEvmToken.test.ts index 11434a24e8a8..8607d898af4f 100644 --- a/app/components/UI/Tokens/util/removeEvmToken.test.ts +++ b/app/components/UI/Tokens/util/removeEvmToken.test.ts @@ -37,7 +37,7 @@ describe('removeEvmToken', () => { ({ addProperties: jest.fn().mockReturnThis(), build: jest.fn().mockReturnValue('mockEvent'), - }) as unknown as MetricsEventBuilder, + } as unknown as MetricsEventBuilder), ); const mockProps = { diff --git a/app/components/UI/TransactionElement/TransactionDetails/index.js b/app/components/UI/TransactionElement/TransactionDetails/index.js index 6629b2246a90..d944b2fa84dc 100644 --- a/app/components/UI/TransactionElement/TransactionDetails/index.js +++ b/app/components/UI/TransactionElement/TransactionDetails/index.js @@ -254,8 +254,9 @@ class TransactionDetails extends PureComponent { return; } try { - let { l1Fee: multiLayerL1FeeTotal } = - await this.fetchTxReceipt(transactionHash); + let { l1Fee: multiLayerL1FeeTotal } = await this.fetchTxReceipt( + transactionHash, + ); if (!multiLayerL1FeeTotal) { multiLayerL1FeeTotal = '0x0'; // Sets it to 0 if it's not available in a txReceipt yet. } diff --git a/app/components/UI/TransactionElement/utils.js b/app/components/UI/TransactionElement/utils.js index 9d60ddc5f840..71628e5a380a 100644 --- a/app/components/UI/TransactionElement/utils.js +++ b/app/components/UI/TransactionElement/utils.js @@ -721,8 +721,8 @@ function decodeLegacySwapsTx(args) { sourceToken.symbol === 'ETH' ? totalAmountForEthSourceTokenFormatted : decimalSourceAmount - ? `${decimalSourceAmount} ${sourceToken.symbol} + ${totalEthGas} ${ticker}` - : `${totalEthGas} ${ticker}`; + ? `${decimalSourceAmount} ${sourceToken.symbol} + ${totalEthGas} ${ticker}` + : `${totalEthGas} ${ticker}`; const isSwap = swapTransaction.action === 'swap'; let notificationKey, actionKey, value, fiatValue; diff --git a/app/components/UI/TransactionElement/utils.test.js b/app/components/UI/TransactionElement/utils.test.js index f3ecaa3e6c1d..7d43490b282f 100644 --- a/app/components/UI/TransactionElement/utils.test.js +++ b/app/components/UI/TransactionElement/utils.test.js @@ -217,8 +217,9 @@ describe('Transaction Element Utils', () => { }; // Act - const [transactionElement, transactionDetails] = - await decodeTransaction(args); + const [transactionElement, transactionDetails] = await decodeTransaction( + args, + ); // Assert expect(transactionElement).toEqual({ @@ -275,8 +276,9 @@ describe('Transaction Element Utils', () => { }; // Act - const [transactionElement, transactionDetails] = - await decodeTransaction(args); + const [transactionElement, transactionDetails] = await decodeTransaction( + args, + ); // Assert expect(transactionElement).toEqual({ @@ -335,8 +337,9 @@ describe('Transaction Element Utils', () => { }, }; - const [transactionElement, transactionDetails] = - await decodeTransaction(args); + const [transactionElement, transactionDetails] = await decodeTransaction( + args, + ); expect(transactionElement).toEqual({ actionKey: 'Sent USDC', diff --git a/app/components/UI/TransactionHeader/index.js b/app/components/UI/TransactionHeader/index.js index ff3d32b1ca2c..0ac46e3899a5 100644 --- a/app/components/UI/TransactionHeader/index.js +++ b/app/components/UI/TransactionHeader/index.js @@ -136,8 +136,8 @@ const TransactionHeader = (props) => { originIsWalletConnect ? origin.split(WALLET_CONNECT_ORIGIN)[1] : originIsMMSDKRemoteConn - ? origin.split(AppConstants.MM_SDK.SDK_REMOTE_ORIGIN)[1] - : url, + ? origin.split(AppConstants.MM_SDK.SDK_REMOTE_ORIGIN)[1] + : url, ).protocol === 'https:' ? 'lock' : 'warning'; diff --git a/app/components/UI/Transactions/utils.test.ts b/app/components/UI/Transactions/utils.test.ts index f17548829195..3b8cbe49b831 100644 --- a/app/components/UI/Transactions/utils.test.ts +++ b/app/components/UI/Transactions/utils.test.ts @@ -25,7 +25,7 @@ const createTransaction = ( type, hash, txParams: value ? { value } : undefined, - }) as unknown as TransactionMeta; + } as unknown as TransactionMeta); describe('filterDuplicateOutgoingTransactions', () => { describe('Edge Cases', () => { diff --git a/app/components/UI/UrlAutocomplete/index.tsx b/app/components/UI/UrlAutocomplete/index.tsx index d2c41963eee2..d49668fc912d 100644 --- a/app/components/UI/UrlAutocomplete/index.tsx +++ b/app/components/UI/UrlAutocomplete/index.tsx @@ -53,7 +53,7 @@ import { export * from './types'; const dappsWithType: FuseSearchResult[] = dappUrlList.map( - (i) => ({ ...i, category: UrlAutocompleteCategory.Sites }) as const, + (i) => ({ ...i, category: UrlAutocompleteCategory.Sites } as const), ); const TOKEN_SEARCH_LIMIT = 10; diff --git a/app/components/UI/WebsiteIcon/index.test.tsx b/app/components/UI/WebsiteIcon/index.test.tsx index 43b810f862ce..fddbf64c388e 100644 --- a/app/components/UI/WebsiteIcon/index.test.tsx +++ b/app/components/UI/WebsiteIcon/index.test.tsx @@ -19,9 +19,8 @@ jest.mock('../../hooks/useFavicon/withFaviconAwareness', () => ({ __esModule: true, default: (Component: React.ComponentType) => - (props: WebsiteIconProps) => ( - - ), + (props: WebsiteIconProps) => + , })); describe('WebsiteIcon', () => { diff --git a/app/components/UI/shared/BaseControlBar/BaseControlBar.tsx b/app/components/UI/shared/BaseControlBar/BaseControlBar.tsx index 17f2eb25f776..ee4b9ae3d130 100644 --- a/app/components/UI/shared/BaseControlBar/BaseControlBar.tsx +++ b/app/components/UI/shared/BaseControlBar/BaseControlBar.tsx @@ -207,7 +207,7 @@ const BaseControlBar: React.FC = ({ > {displayAllNetworks ? strings('wallet.popular_networks') - : (currentNetworkName ?? strings('wallet.current_network'))} + : currentNetworkName ?? strings('wallet.current_network')} ) : ( @@ -218,7 +218,7 @@ const BaseControlBar: React.FC = ({ > {isAllNetworks && isAllPopularEVMNetworks && isEvmSelected ? strings('wallet.popular_networks') - : (networkName ?? strings('wallet.current_network'))} + : networkName ?? strings('wallet.current_network')} )} diff --git a/app/components/Views/AccountActions/AccountActions.test.tsx b/app/components/Views/AccountActions/AccountActions.test.tsx index 2ca426abf36b..3581e36ba50e 100644 --- a/app/components/Views/AccountActions/AccountActions.test.tsx +++ b/app/components/Views/AccountActions/AccountActions.test.tsx @@ -110,7 +110,7 @@ const generateInitialStateWithSelectedAccount = (account: InternalAccount) => }, }, }, - }) as unknown as RootState; + } as unknown as RootState); jest.mock('../../../core/Engine', () => ({ context: { diff --git a/app/components/Views/AccountPermissions/AccountPermissions.test.tsx b/app/components/Views/AccountPermissions/AccountPermissions.test.tsx index 6b1691e099c3..b26a9ad37435 100644 --- a/app/components/Views/AccountPermissions/AccountPermissions.test.tsx +++ b/app/components/Views/AccountPermissions/AccountPermissions.test.tsx @@ -286,19 +286,16 @@ const mockInitialState = ( }, AccountsController: { internalAccounts: { - accounts: accounts.reduce( - (acc, account, index) => { - const mockAccount = MOCK_INTERNAL_ACCOUNTS[index]; - if (mockAccount) { - acc[mockAccount.id] = { - ...mockAccount, - address: account, - }; - } - return acc; - }, - {} as Record, - ), + accounts: accounts.reduce((acc, account, index) => { + const mockAccount = MOCK_INTERNAL_ACCOUNTS[index]; + if (mockAccount) { + acc[mockAccount.id] = { + ...mockAccount, + address: account, + }; + } + return acc; + }, {} as Record), selectedAccount: 'mock-id-1', }, }, diff --git a/app/components/Views/ActivityView/index.js b/app/components/Views/ActivityView/index.js index abc278e7939d..80f571047847 100644 --- a/app/components/Views/ActivityView/index.js +++ b/app/components/Views/ActivityView/index.js @@ -291,8 +291,8 @@ const ActivityView = () => { > {enabledNetworks.length > 1 ? strings('wallet.popular_networks') - : (currentNetworkName ?? - strings('wallet.current_network'))} + : currentNetworkName ?? + strings('wallet.current_network')} ) : ( @@ -303,7 +303,7 @@ const ActivityView = () => { > {isAllNetworks && isAllPopularEVMNetworks && isEvmSelected ? strings('wallet.popular_networks') - : (networkName ?? strings('wallet.current_network'))} + : networkName ?? strings('wallet.current_network')} )} diff --git a/app/components/Views/AddAsset/AddAsset.test.tsx b/app/components/Views/AddAsset/AddAsset.test.tsx index 9e0150b15449..c23432b5050e 100644 --- a/app/components/Views/AddAsset/AddAsset.test.tsx +++ b/app/components/Views/AddAsset/AddAsset.test.tsx @@ -54,7 +54,8 @@ jest.mock('../../../util/navigation/navUtils', () => ({ jest.mock( '@tommasini/react-native-scrollable-tab-view', () => - ({ children }: { children: React.ReactNode }) => <>{children}, + ({ children }: { children: React.ReactNode }) => + <>{children}, ); const initialState = { diff --git a/app/components/Views/BrowserTab/sendActiveAccount.test.tsx b/app/components/Views/BrowserTab/sendActiveAccount.test.tsx index f80a14db9bf0..ba4e53a9f3ff 100644 --- a/app/components/Views/BrowserTab/sendActiveAccount.test.tsx +++ b/app/components/Views/BrowserTab/sendActiveAccount.test.tsx @@ -83,7 +83,7 @@ describe('sendActiveAccount function', () => { (url: string) => ({ hostname: new URL(url).hostname, - }) as URLParse>, + } as URLParse>), ); }); @@ -162,7 +162,7 @@ describe('sendActiveAccount function', () => { () => ({ hostname: expectedHostname, - }) as MockURLParse, + } as MockURLParse), ); mockGetPermittedEvmAddressesByHostname.mockReturnValue([]); @@ -187,7 +187,7 @@ describe('sendActiveAccount function', () => { () => ({ hostname: expectedHostname, - }) as MockURLParse, + } as MockURLParse), ); mockGetPermittedEvmAddressesByHostname.mockReturnValue([]); @@ -291,7 +291,7 @@ describe('sendActiveAccount function', () => { (url) => ({ hostname: new URL(url).hostname, - }) as MockURLParse, + } as MockURLParse), ); mockGetPermittedEvmAddressesByHostname.mockImplementation( @@ -328,9 +328,8 @@ describe('sendActiveAccount function', () => { resolvedUrlRef.current = authorizedUrl; // Previous site - mockGetPermittedEvmAddressesByHostname.mockImplementation( - (_, hostname) => - hostname === 'authorized.com' ? authorizedAccounts : [], + mockGetPermittedEvmAddressesByHostname.mockImplementation((_, hostname) => + hostname === 'authorized.com' ? authorizedAccounts : [], ); await sendActiveAccount(unauthorizedUrl); @@ -352,8 +351,8 @@ describe('sendActiveAccount function', () => { // resolvedUrlRef still points to previous site (before onLoadEnd updates it) resolvedUrlRef.current = previousSiteUrl; - mockGetPermittedEvmAddressesByHostname.mockImplementation( - (_, hostname) => (hostname === 'victim-dapp.com' ? victimAccounts : []), + mockGetPermittedEvmAddressesByHostname.mockImplementation((_, hostname) => + hostname === 'victim-dapp.com' ? victimAccounts : [], ); await sendActiveAccount(newSiteUrl); diff --git a/app/components/Views/CardNotification/CardNotification.test.tsx b/app/components/Views/CardNotification/CardNotification.test.tsx new file mode 100644 index 000000000000..aa9951de0c99 --- /dev/null +++ b/app/components/Views/CardNotification/CardNotification.test.tsx @@ -0,0 +1,118 @@ +import React from 'react'; +import { render, waitFor } from '@testing-library/react-native'; +import CardNotification from './CardNotification'; +import { ToastContext } from '../../../component-library/components/Toast'; +import { ToastVariants } from '../../../component-library/components/Toast/Toast.types'; +import { IconName } from '../../../component-library/components/Icons/Icon'; + +jest.mock('../../../../locales/i18n', () => ({ + strings: jest.fn((key: string) => key), +})); + +const mockGoBack = jest.fn(); +jest.mock('@react-navigation/native', () => { + const actual = jest.requireActual('@react-navigation/native'); + return { + ...actual, + useNavigation: () => ({ + goBack: mockGoBack, + }), + }; +}); + +describe('CardNotification', () => { + const createToastRef = () => ({ + current: { showToast: jest.fn(), closeToast: jest.fn() }, + }); + + const renderWithProviders = (toastRef = createToastRef()) => { + const ui = ( + + + + ); + + const utils = render(ui); + return { ...utils, toastRef }; + }; + + beforeEach(() => { + jest.clearAllMocks(); + mockGoBack.mockClear(); + }); + + it('renders without crashing', () => { + const { toastRef } = renderWithProviders(); + + expect(toastRef.current).toBeDefined(); + }); + + it('displays toast with correct configuration when toastRef is available', async () => { + const { toastRef } = renderWithProviders(); + + await waitFor(() => { + expect(toastRef.current.showToast).toHaveBeenCalledWith({ + variant: ToastVariants.Icon, + labelOptions: [{ label: 'card.card_home.card_button_enabled_toast' }], + hasNoTimeout: false, + iconName: IconName.Info, + }); + }); + }); + + it('calls navigation goBack after showing toast', async () => { + renderWithProviders(); + + await waitFor(() => { + expect(mockGoBack).toHaveBeenCalledTimes(1); + }); + }); + + it('does not show toast when toastRef is null', () => { + const nullToastRef = { + current: null, + } as unknown as { + current: { showToast: jest.Mock; closeToast: jest.Mock }; + }; + const { toastRef } = renderWithProviders(nullToastRef); + + expect(toastRef.current).toBeNull(); + expect(mockGoBack).not.toHaveBeenCalled(); + }); + + it('shows toast only once on multiple renders', async () => { + const { toastRef, rerender } = renderWithProviders(); + + await waitFor(() => { + expect(toastRef.current.showToast).toHaveBeenCalledTimes(1); + }); + + rerender( + + + , + ); + + await waitFor(() => { + expect(toastRef.current.showToast).toHaveBeenCalledTimes(1); + }); + }); + + it('translates toast label using i18n strings', async () => { + const mockStrings = jest.requireMock('../../../../locales/i18n').strings; + const { toastRef } = renderWithProviders(); + + await waitFor(() => { + expect(mockStrings).toHaveBeenCalledWith( + 'card.card_home.card_button_enabled_toast', + ); + expect(toastRef.current.showToast).toHaveBeenCalled(); + }); + }); + + it('renders empty fragment as component output', () => { + const { toJSON } = renderWithProviders(); + + expect(toJSON()).toBeNull(); + }); +}); diff --git a/app/components/Views/CardNotification/CardNotification.tsx b/app/components/Views/CardNotification/CardNotification.tsx new file mode 100644 index 000000000000..9bc081f5f55c --- /dev/null +++ b/app/components/Views/CardNotification/CardNotification.tsx @@ -0,0 +1,41 @@ +import React, { useContext, useEffect, useRef } from 'react'; +import { ToastContext } from '../../../component-library/components/Toast'; +import { ToastVariants } from '../../../component-library/components/Toast/Toast.types'; +import { useNavigation } from '@react-navigation/native'; +import { IconName } from '../../../component-library/components/Icons/Icon'; +import { strings } from '../../../../locales/i18n'; + +/** + * Fake modal that displays a toast for card-related deeplinks. + * Similar to ReturnToAppNotification but for card feature. + * + * This component is used to trigger toasts from non-React contexts (like deeplink handlers) + * by navigating to this route with toast parameters, then immediately going back. + */ +const CardNotification = () => { + const navigation = useNavigation(); + const { toastRef } = useContext(ToastContext); + const hasExecuted = useRef(false); + + useEffect(() => { + if (toastRef && toastRef.current !== null && !hasExecuted.current) { + hasExecuted.current = true; + + toastRef.current.showToast({ + variant: ToastVariants.Icon, + labelOptions: [ + { label: strings('card.card_home.card_button_enabled_toast') }, + ], + hasNoTimeout: false, + iconName: IconName.Info, + }); + + // Hide the fake modal + navigation?.goBack(); + } + }, [toastRef, navigation]); + + return <>; +}; + +export default CardNotification; diff --git a/app/components/Views/CardNotification/index.tsx b/app/components/Views/CardNotification/index.tsx new file mode 100644 index 000000000000..087cdbec8112 --- /dev/null +++ b/app/components/Views/CardNotification/index.tsx @@ -0,0 +1 @@ +export { default } from './CardNotification'; diff --git a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx b/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx index b9c146ed7b7d..abced2cc0c76 100644 --- a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx +++ b/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx @@ -19,7 +19,8 @@ jest.mock('react-redux', () => ({ jest.mock( '../../../component-library/components/BottomSheets/BottomSheet', () => - ({ children }: { children: React.ReactElement }) => <>{children}, + ({ children }: { children: React.ReactElement }) => + <>{children}, ); const NAVIGATION_PARAMS_MOCK = { diff --git a/app/components/Views/ChoosePassword/index.js b/app/components/Views/ChoosePassword/index.js index f422f5b3c328..5c08532f1ba9 100644 --- a/app/components/Views/ChoosePassword/index.js +++ b/app/components/Views/ChoosePassword/index.js @@ -304,8 +304,9 @@ class ChoosePassword extends PureComponent { const previouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if (authData.currentAuthType === AUTHENTICATION_TYPE.PASSCODE) { this.setState({ biometryType: passcodeType(authData.currentAuthType), @@ -383,8 +384,9 @@ class ChoosePassword extends PureComponent { tryExportSeedPhrase = async (password) => { const { KeyringController } = Engine.context; - const uint8ArrayMnemonic = - await KeyringController.exportSeedPhrase(password); + const uint8ArrayMnemonic = await KeyringController.exportSeedPhrase( + password, + ); return uint8ArrayToMnemonic(uint8ArrayMnemonic, wordlist).split(' '); }; diff --git a/app/components/Views/ErrorBoundary/index.js b/app/components/Views/ErrorBoundary/index.js index 9e8317ddbff9..79f765963905 100644 --- a/app/components/Views/ErrorBoundary/index.js +++ b/app/components/Views/ErrorBoundary/index.js @@ -503,18 +503,18 @@ class ErrorBoundary extends Component { />, ) : this.state.error - ? this.renderWithSafeArea( - , - ) - : this.props.children; + ? this.renderWithSafeArea( + , + ) + : this.props.children; } } diff --git a/app/components/Views/FeatureFlagOverride/FeatureFlagOverride.tsx b/app/components/Views/FeatureFlagOverride/FeatureFlagOverride.tsx index aa272c62bca1..db6e359ad22a 100644 --- a/app/components/Views/FeatureFlagOverride/FeatureFlagOverride.tsx +++ b/app/components/Views/FeatureFlagOverride/FeatureFlagOverride.tsx @@ -432,10 +432,10 @@ const FeatureFlagOverride: React.FC = () => { {searchQuery && typeFilter !== 'all' ? `No ${typeFilter} feature flags match your search.` : searchQuery - ? 'No feature flags match your search.' - : typeFilter !== 'all' - ? `No ${typeFilter} feature flags available.` - : 'No feature flags available.'} + ? 'No feature flags match your search.' + : typeFilter !== 'all' + ? `No ${typeFilter} feature flags available.` + : 'No feature flags available.'} ) : ( diff --git a/app/components/Views/GasEducationCarousel/index.js b/app/components/Views/GasEducationCarousel/index.js index a08feaba671b..a4d8727fc46c 100644 --- a/app/components/Views/GasEducationCarousel/index.js +++ b/app/components/Views/GasEducationCarousel/index.js @@ -304,9 +304,7 @@ const GasEducationCarousel = ({ {strings('fiat_on_ramp.gas_education_carousel.step_3.subtitle_1')} - {strings( - 'fiat_on_ramp.gas_education_carousel.step_3.subtitle_2', - )}{' '} + {strings('fiat_on_ramp.gas_education_carousel.step_3.subtitle_2')}{' '} {strings('fiat_on_ramp.gas_education_carousel.step_3.subtitle_3')}{' '} diff --git a/app/components/Views/ImportNewSecretRecoveryPhrase/index.test.tsx b/app/components/Views/ImportNewSecretRecoveryPhrase/index.test.tsx index c50bcdd82f4e..948ab1da8f09 100644 --- a/app/components/Views/ImportNewSecretRecoveryPhrase/index.test.tsx +++ b/app/components/Views/ImportNewSecretRecoveryPhrase/index.test.tsx @@ -246,8 +246,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { }); it('imports valid pasted 12-word SRP', async () => { - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); await act(() => { for (const [index, word] of valid24WordMnemonic.split(' ').entries()) { @@ -270,8 +271,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { }); it('imports valid pasted 24-word SRP', async () => { - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); await act(() => { for (const [index, word] of valid24WordMnemonic.split(' ').entries()) { @@ -293,8 +295,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { ); }); it('imports valid SRP', async () => { - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); const importButton = getByTestId(ImportSRPIDs.IMPORT_BUTTON); await fireEvent.press(importButton); @@ -308,8 +311,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { }); it('tracks IMPORT_SECRET_RECOVERY_PHRASE_COMPLETED event on successful import', async () => { - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); const importButton = getByTestId(ImportSRPIDs.IMPORT_BUTTON); await fireEvent.press(importButton); @@ -327,8 +331,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { it('(state 2) - tracks IMPORT_SECRET_RECOVERY_PHRASE_COMPLETED event on successful import', async () => { mockIsMultichainAccountsState2Enabled.mockReturnValue(true); - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); const importButton = getByTestId(ImportSRPIDs.IMPORT_BUTTON); await fireEvent.press(importButton); @@ -354,8 +359,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { }); it('displays success toast after successful SRP import', async () => { - const { getByTestId } = - await renderSRPImportComponentAndPasteSRP(valid24WordMnemonic); + const { getByTestId } = await renderSRPImportComponentAndPasteSRP( + valid24WordMnemonic, + ); const importButton = getByTestId(ImportSRPIDs.IMPORT_BUTTON); @@ -381,8 +387,9 @@ describe('ImportNewSecretRecoveryPhrase', () => { describe('errors', () => { it('displays single incorrect word', async () => { - const { getByText } = - await renderSRPImportComponentAndPasteSRP(invalidMnemonic); + const { getByText } = await renderSRPImportComponentAndPasteSRP( + invalidMnemonic, + ); expect( getByText( diff --git a/app/components/Views/Login/index.test.tsx b/app/components/Views/Login/index.test.tsx index 85bedc964f59..c5d4c5e37628 100644 --- a/app/components/Views/Login/index.test.tsx +++ b/app/components/Views/Login/index.test.tsx @@ -160,15 +160,16 @@ jest.mock('../../hooks/useMetrics', () => ({ isEnabled: jest.fn(() => true), })), withMetricsAwareness: jest.fn( - (Component) => (props: Record) => ( - - ), + (Component) => (props: Record) => + ( + + ), ), MetaMetricsEvents: { ERROR_SCREEN_VIEWED: 'Error Screen Viewed', diff --git a/app/components/Views/Login/index.tsx b/app/components/Views/Login/index.tsx index 344d8677aafa..3c26c436a2af 100644 --- a/app/components/Views/Login/index.tsx +++ b/app/components/Views/Login/index.tsx @@ -250,8 +250,9 @@ const Login: React.FC = ({ saveOnboardingEvent }) => { const previouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if (authData.currentAuthType === AUTHENTICATION_TYPE.PASSCODE) { setBiometryType(passcodeType(authData.currentAuthType)); diff --git a/app/components/Views/ManualBackupStep1/index.js b/app/components/Views/ManualBackupStep1/index.js index f4cb86033e51..d38fa16884aa 100644 --- a/app/components/Views/ManualBackupStep1/index.js +++ b/app/components/Views/ManualBackupStep1/index.js @@ -126,8 +126,9 @@ const ManualBackupStep1 = ({ const tryExportSeedPhrase = async (password) => { const { KeyringController } = Engine.context; - const uint8ArrayMnemonic = - await KeyringController.exportSeedPhrase(password); + const uint8ArrayMnemonic = await KeyringController.exportSeedPhrase( + password, + ); return uint8ArrayToMnemonic(uint8ArrayMnemonic, wordlist).split(' '); }; diff --git a/app/components/Views/ManualBackupStep3/index.js b/app/components/Views/ManualBackupStep3/index.js index 5005f0cb2588..06cb345a316e 100644 --- a/app/components/Views/ManualBackupStep3/index.js +++ b/app/components/Views/ManualBackupStep3/index.js @@ -112,8 +112,9 @@ class ManualBackupStep3 extends PureComponent { componentDidMount = async () => { this.updateNavBar(); - const currentSeedphraseHints = - await StorageWrapper.getItem(SEED_PHRASE_HINTS); + const currentSeedphraseHints = await StorageWrapper.getItem( + SEED_PHRASE_HINTS, + ); const parsedHints = currentSeedphraseHints && JSON.parse(currentSeedphraseHints); const manualBackup = parsedHints?.manualBackup; @@ -157,8 +158,9 @@ class ManualBackupStep3 extends PureComponent { return; } this.toggleHint(); - const currentSeedphraseHints = - await StorageWrapper.getItem(SEED_PHRASE_HINTS); + const currentSeedphraseHints = await StorageWrapper.getItem( + SEED_PHRASE_HINTS, + ); const parsedHints = JSON.parse(currentSeedphraseHints); await StorageWrapper.setItem( SEED_PHRASE_HINTS, diff --git a/app/components/Views/MultichainAccounts/MultichainPermissionsSummary/MultichainPermissionsSummary.tsx b/app/components/Views/MultichainAccounts/MultichainPermissionsSummary/MultichainPermissionsSummary.tsx index b2eaa7e2f290..4f2bfce8b53d 100644 --- a/app/components/Views/MultichainAccounts/MultichainPermissionsSummary/MultichainPermissionsSummary.tsx +++ b/app/components/Views/MultichainAccounts/MultichainPermissionsSummary/MultichainPermissionsSummary.tsx @@ -582,10 +582,10 @@ const MultichainPermissionsSummary = ({ {isNonDappNetworkSwitch ? strings('permissions.title_add_network_permission') : !isAlreadyConnected || isNetworkSwitch - ? hostname - : strings('permissions.title_dapp_url_has_approval_to', { - dappUrl: hostname, - })} + ? hostname + : strings('permissions.title_dapp_url_has_approval_to', { + dappUrl: hostname, + })} {strings('account_dapp_connections.account_summary_header')} diff --git a/app/components/Views/MultichainAccounts/WalletDetails/hooks/useWalletBalances.ts b/app/components/Views/MultichainAccounts/WalletDetails/hooks/useWalletBalances.ts index e759760ad28d..e94c0626e0d8 100644 --- a/app/components/Views/MultichainAccounts/WalletDetails/hooks/useWalletBalances.ts +++ b/app/components/Views/MultichainAccounts/WalletDetails/hooks/useWalletBalances.ts @@ -33,21 +33,18 @@ export const useWalletBalances = (walletId: string): UseWalletBalancesHook => { const multichainBalancesForAllAccounts = useMemo( () => - Object.values(walletBalance.groups).reduce( - (acc, group) => { - acc[group.groupId] = formatWithThreshold( - group.totalBalanceInUserCurrency ?? 0, - 0.01, - I18n.locale, - { - style: 'currency', - currency: displayCurrency.toUpperCase(), - }, - ); - return acc; - }, - {} as Record, - ), + Object.values(walletBalance.groups).reduce((acc, group) => { + acc[group.groupId] = formatWithThreshold( + group.totalBalanceInUserCurrency ?? 0, + 0.01, + I18n.locale, + { + style: 'currency', + currency: displayCurrency.toUpperCase(), + }, + ); + return acc; + }, {} as Record), [walletBalance.groups, displayCurrency], ); diff --git a/app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.tsx b/app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.tsx index ca89a1f3c528..826c32d573d9 100644 --- a/app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.tsx +++ b/app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.tsx @@ -46,15 +46,15 @@ function NetworkSearchTextInput({ const inputStylesWhichAreFeatureFlagged = !isNetworkUiRedesignEnabled() ? styles.input : isSearchFieldFocused - ? styles.input - : styles.unfocusedInput; + ? styles.input + : styles.unfocusedInput; const containerInputStylesWhichAreFeatureFlagged = !isNetworkUiRedesignEnabled() ? styles.inputWrapper : isSearchFieldFocused - ? styles.focusedInputWrapper - : styles.inputWrapper; + ? styles.focusedInputWrapper + : styles.inputWrapper; return ( diff --git a/app/components/Views/NetworkSelector/NetworkSelector.styles.ts b/app/components/Views/NetworkSelector/NetworkSelector.styles.ts index 2e7188cb95e9..9a6ffb2c5aa5 100644 --- a/app/components/Views/NetworkSelector/NetworkSelector.styles.ts +++ b/app/components/Views/NetworkSelector/NetworkSelector.styles.ts @@ -16,8 +16,8 @@ const createStyles = (colors: Colors) => marginBottom: Device.isAndroid() ? 16 : isNetworkUiRedesignEnabled() - ? 12 - : 0, + ? 12 + : 0, }, networkMenu: { alignItems: 'center', diff --git a/app/components/Views/Onboarding/index.test.tsx b/app/components/Views/Onboarding/index.test.tsx index f3978f8a40e5..9a66f4af105e 100644 --- a/app/components/Views/Onboarding/index.test.tsx +++ b/app/components/Views/Onboarding/index.test.tsx @@ -155,18 +155,19 @@ jest.mock( '../../hooks/useMetrics/withMetricsAwareness', () =>

(Component: React.ComponentType

) => - (props: P) => ( - - ), + (props: P) => + ( + + ), ); const mockSeedlessOnboardingEnabled = jest.fn(); diff --git a/app/components/Views/OriginSpamModal/OriginSpamModal.test.tsx b/app/components/Views/OriginSpamModal/OriginSpamModal.test.tsx index ff731dd97591..016c8d2225bd 100644 --- a/app/components/Views/OriginSpamModal/OriginSpamModal.test.tsx +++ b/app/components/Views/OriginSpamModal/OriginSpamModal.test.tsx @@ -25,7 +25,8 @@ jest.mock('../../../core/redux/slices/originThrottling', () => ({ jest.mock( '../../../component-library/components/BottomSheets/BottomSheet', () => - ({ children }: { children: React.ReactElement }) => <>{children}, + ({ children }: { children: React.ReactElement }) => + <>{children}, ); const SCAM_ORIGIN_MOCK = 'scam.origin'; diff --git a/app/components/Views/ResetPassword/index.js b/app/components/Views/ResetPassword/index.js index 4861199216e6..86bccb4d9859 100644 --- a/app/components/Views/ResetPassword/index.js +++ b/app/components/Views/ResetPassword/index.js @@ -417,8 +417,9 @@ class ResetPassword extends PureComponent { const previouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if (authData.currentAuthType === AUTHENTICATION_TYPE.PASSCODE) this.setState({ biometryType: passcodeType(authData.currentAuthType), diff --git a/app/components/Views/SDK/SDKSessionsManager/getSharedStyles.ts b/app/components/Views/SDK/SDKSessionsManager/getSharedStyles.ts index 4954997465ad..f567facbab72 100644 --- a/app/components/Views/SDK/SDKSessionsManager/getSharedStyles.ts +++ b/app/components/Views/SDK/SDKSessionsManager/getSharedStyles.ts @@ -43,6 +43,6 @@ const getSharedStyles = ( fontFamily: getFontFamily(TextVariant.BodyMD), color: colors.error.default, } as TextStyle, - }) as const; + } as const); export default getSharedStyles; diff --git a/app/components/Views/Settings/AdvancedSettings/FiatOnTestnetsFriction/FiatOnTestnetsFriction.tsx b/app/components/Views/Settings/AdvancedSettings/FiatOnTestnetsFriction/FiatOnTestnetsFriction.tsx index da75af6b14b3..2875244e3d66 100644 --- a/app/components/Views/Settings/AdvancedSettings/FiatOnTestnetsFriction/FiatOnTestnetsFriction.tsx +++ b/app/components/Views/Settings/AdvancedSettings/FiatOnTestnetsFriction/FiatOnTestnetsFriction.tsx @@ -43,9 +43,7 @@ const FiatOnTestnetsFriction = () => { - {strings( - 'app_settings.show_fiat_on_testnets_modal_description', - )}{' '} + {strings('app_settings.show_fiat_on_testnets_modal_description')}{' '} { }); it('toggles token detection on', () => { - initialState.engine.backgroundState.PreferencesController.useTokenDetection = false; + initialState.engine.backgroundState.PreferencesController.useTokenDetection = + false; const { getByTestId } = renderWithProvider(, { state: initialState, }); diff --git a/app/components/Views/Settings/DisplayNFTMediaSettings/index.test.tsx b/app/components/Views/Settings/DisplayNFTMediaSettings/index.test.tsx index 9510d60832fa..9b8841dc853e 100644 --- a/app/components/Views/Settings/DisplayNFTMediaSettings/index.test.tsx +++ b/app/components/Views/Settings/DisplayNFTMediaSettings/index.test.tsx @@ -95,7 +95,8 @@ describe('DisplayNFTMediaSettings', () => { }); it('toggles display NFT media OFF', () => { - initialState.engine.backgroundState.PreferencesController.displayNftMedia = true; + initialState.engine.backgroundState.PreferencesController.displayNftMedia = + true; const { getByTestId } = renderWithProvider(, { state: initialState, diff --git a/app/components/Views/Settings/NetworksSettings/NetworkSettings/index.js b/app/components/Views/Settings/NetworksSettings/NetworkSettings/index.js index d3a472517e1f..546618ac419d 100644 --- a/app/components/Views/Settings/NetworksSettings/NetworkSettings/index.js +++ b/app/components/Views/Settings/NetworksSettings/NetworkSettings/index.js @@ -597,8 +597,8 @@ export class NetworkSettings extends PureComponent { isCustomMainnet ? navigation.navigate('OptinMetrics') : shouldNetworkSwitchPopToWallet - ? navigation.navigate('WalletView') - : navigation.goBack(); + ? navigation.navigate('WalletView') + : navigation.goBack(); }; /** @@ -902,8 +902,8 @@ export class NetworkSettings extends PureComponent { const symbol = networkConfigurationSymbol ? networkConfigurationSymbol : chainToMatch - ? (chainToMatch?.nativeCurrency?.symbol ?? null) - : (networkList?.nativeCurrency?.symbol ?? null); + ? chainToMatch?.nativeCurrency?.symbol ?? null + : networkList?.nativeCurrency?.symbol ?? null; const symbolToUse = symbol?.toLowerCase() === ticker?.toLowerCase() ? undefined : symbol; diff --git a/app/components/Views/Settings/SecuritySettings/Sections/LoginOptionsSettings.tsx b/app/components/Views/Settings/SecuritySettings/Sections/LoginOptionsSettings.tsx index a78fc9d76c4e..085cf54160f2 100644 --- a/app/components/Views/Settings/SecuritySettings/Sections/LoginOptionsSettings.tsx +++ b/app/components/Views/Settings/SecuritySettings/Sections/LoginOptionsSettings.tsx @@ -40,8 +40,9 @@ const LoginOptionsSettings = ({ const previouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if ( authType.currentAuthType === AUTHENTICATION_TYPE.BIOMETRIC || authType.currentAuthType === AUTHENTICATION_TYPE.PASSCODE diff --git a/app/components/Views/Settings/SecuritySettings/SecuritySettings.tsx b/app/components/Views/Settings/SecuritySettings/SecuritySettings.tsx index 6179152a25f9..d4042da513b1 100644 --- a/app/components/Views/Settings/SecuritySettings/SecuritySettings.tsx +++ b/app/components/Views/Settings/SecuritySettings/SecuritySettings.tsx @@ -174,8 +174,9 @@ const Settings: React.FC = () => { }, [colors, navigation]); const handleHintText = useCallback(async () => { - const currentSeedphraseHints = - await StorageWrapper.getItem(SEED_PHRASE_HINTS); + const currentSeedphraseHints = await StorageWrapper.getItem( + SEED_PHRASE_HINTS, + ); const parsedHints = currentSeedphraseHints && JSON.parse(currentSeedphraseHints); const manualBackup = parsedHints?.manualBackup; @@ -242,8 +243,9 @@ const Settings: React.FC = () => { const saveHint = async () => { if (!hintText) return; toggleHint(); - const currentSeedphraseHints = - await StorageWrapper.getItem(SEED_PHRASE_HINTS); + const currentSeedphraseHints = await StorageWrapper.getItem( + SEED_PHRASE_HINTS, + ); if (currentSeedphraseHints) { const parsedHints = JSON.parse(currentSeedphraseHints); await StorageWrapper.setItem( diff --git a/app/components/Views/Wallet/index.test.tsx b/app/components/Views/Wallet/index.test.tsx index ba06f836a6ba..8f1159e1c584 100644 --- a/app/components/Views/Wallet/index.test.tsx +++ b/app/components/Views/Wallet/index.test.tsx @@ -984,13 +984,10 @@ describe('Wallet', () => { ...mockInitialState.engine.backgroundState .NetworkEnablementController, enabledNetworkMap: { - eip155: enabledNetworks.reduce( - (acc, network) => { - acc[network] = true; - return acc; - }, - {} as Record, - ), + eip155: enabledNetworks.reduce((acc, network) => { + acc[network] = true; + return acc; + }, {} as Record), }, }, }, diff --git a/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.test.tsx b/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.test.tsx index 9482b484bad0..428702a2a802 100644 --- a/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.test.tsx +++ b/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.test.tsx @@ -105,9 +105,7 @@ describe('ApproveAndPermit2', () => { tokenStandard: TokenStandard.ERC20, rawAmount: undefined, spender: '0x123456789', - } as ReturnType< - typeof useApproveTransactionDataModule.useApproveTransactionData - >); + } as ReturnType); const { getByText } = renderWithProvider(, { state: approveERC721TransactionStateMock, }); diff --git a/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.tsx b/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.tsx index d91e85e7fb00..e2af3854bb58 100644 --- a/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.tsx +++ b/app/components/Views/confirmations/components/approve-static-simulations/approve-and-permit2/approve-and-permit2.tsx @@ -134,7 +134,7 @@ function PillAndAddress({ <>

{ tokenStandard: TokenStandard.ERC20, rawAmount: undefined, spender: '0x123456789', - } as ReturnType< - typeof useApproveTransactionDataModule.useApproveTransactionData - >); + } as ReturnType); const { getByText } = renderWithProvider(, { state: increaseAllowanceERC20TransactionStateMock, }); diff --git a/app/components/Views/confirmations/components/info/typed-sign-v3v4/simulation/typed-sign-decoded/typed-sign-decoded.tsx b/app/components/Views/confirmations/components/info/typed-sign-v3v4/simulation/typed-sign-decoded/typed-sign-decoded.tsx index 3ce5506add5b..a80de9e49898 100644 --- a/app/components/Views/confirmations/components/info/typed-sign-v3v4/simulation/typed-sign-decoded/typed-sign-decoded.tsx +++ b/app/components/Views/confirmations/components/info/typed-sign-v3v4/simulation/typed-sign-decoded/typed-sign-decoded.tsx @@ -98,7 +98,7 @@ const getStateChangeLabelMap = ( [DecodingDataChangeType.Listing]: strings( 'confirm.simulation.label_change_type_listing', ), - })[changeType]; + }[changeType]); const StateChangeRow = ({ stateChangeList, diff --git a/app/components/Views/confirmations/components/recipient-list/recipient-list.tsx b/app/components/Views/confirmations/components/recipient-list/recipient-list.tsx index d7ed0ecc6309..f75fe53d2cd4 100644 --- a/app/components/Views/confirmations/components/recipient-list/recipient-list.tsx +++ b/app/components/Views/confirmations/components/recipient-list/recipient-list.tsx @@ -126,17 +126,14 @@ function BIP44RecipientList({ }) { const groupedData = useMemo( () => - data.reduce( - (acc, recipient) => { - const walletName = recipient.walletName || 'Unknown Wallet'; - if (!acc[walletName]) { - acc[walletName] = []; - } - acc[walletName].push(recipient); - return acc; - }, - {} as Record, - ), + data.reduce((acc, recipient) => { + const walletName = recipient.walletName || 'Unknown Wallet'; + if (!acc[walletName]) { + acc[walletName] = []; + } + acc[walletName].push(recipient); + return acc; + }, {} as Record), [data], ); diff --git a/app/components/Views/confirmations/components/rows/bridge-time-row/bridge-time-row.test.tsx b/app/components/Views/confirmations/components/rows/bridge-time-row/bridge-time-row.test.tsx index 6452a0d7e9f3..728f945ea082 100644 --- a/app/components/Views/confirmations/components/rows/bridge-time-row/bridge-time-row.test.tsx +++ b/app/components/Views/confirmations/components/rows/bridge-time-row/bridge-time-row.test.tsx @@ -65,7 +65,7 @@ describe('BridgeTimeRow', () => { srcChainId: 1, destChainId: 2, }, - }) as QuoteResponse, + } as QuoteResponse), ), }); diff --git a/app/components/Views/confirmations/components/rows/transactions/gas-fee-details-row/gas-fee-details-row.test.tsx b/app/components/Views/confirmations/components/rows/transactions/gas-fee-details-row/gas-fee-details-row.test.tsx index 18f0de583e04..c156341038c1 100644 --- a/app/components/Views/confirmations/components/rows/transactions/gas-fee-details-row/gas-fee-details-row.test.tsx +++ b/app/components/Views/confirmations/components/rows/transactions/gas-fee-details-row/gas-fee-details-row.test.tsx @@ -215,7 +215,8 @@ describe('GasFeesDetailsRow', () => { const clonedStakingDepositConfirmationState = cloneDeep( stakingDepositConfirmationState, ); - clonedStakingDepositConfirmationState.engine.backgroundState.TransactionController.transactions[0].isGasFeeSponsored = true; + clonedStakingDepositConfirmationState.engine.backgroundState.TransactionController.transactions[0].isGasFeeSponsored = + true; const { getByText, queryByText } = renderWithProvider( , { diff --git a/app/components/Views/confirmations/components/send/amount/amount.tsx b/app/components/Views/confirmations/components/send/amount/amount.tsx index 2a11773a6ed1..308ae6b2430a 100644 --- a/app/components/Views/confirmations/components/send/amount/amount.tsx +++ b/app/components/Views/confirmations/components/send/amount/amount.tsx @@ -48,7 +48,7 @@ export const Amount = () => { const isNFT = asset?.standard === TokenStandard.ERC1155; const assetSymbol = isNFT ? undefined - : ((asset as AssetType)?.ticker ?? (asset as AssetType)?.symbol); + : (asset as AssetType)?.ticker ?? (asset as AssetType)?.symbol; const assetDisplaySymbol = assetSymbol ?? (isNFT ? 'NFT' : ''); const { styles } = useStyles(styleSheet, { contentLength: amount.length + assetDisplaySymbol.length, diff --git a/app/components/Views/confirmations/components/send/recipient/recipient.tsx b/app/components/Views/confirmations/components/send/recipient/recipient.tsx index 92b7b62ff52b..fd0802b80e5e 100644 --- a/app/components/Views/confirmations/components/send/recipient/recipient.tsx +++ b/app/components/Views/confirmations/components/send/recipient/recipient.tsx @@ -109,10 +109,10 @@ export const Recipient = () => { const onRecipientSelected = useCallback( ( - recipientInputMethod: - | typeof RecipientInputMethod.SelectAccount - | typeof RecipientInputMethod.SelectContact, - ) => + recipientInputMethod: + | typeof RecipientInputMethod.SelectAccount + | typeof RecipientInputMethod.SelectContact, + ) => (recipient: RecipientType) => { if (isSubmittingTransaction) { return; diff --git a/app/components/Views/confirmations/hooks/gas/useGasFeeEstimates.test.ts b/app/components/Views/confirmations/hooks/gas/useGasFeeEstimates.test.ts index 37865222c3e7..670c81e4535f 100644 --- a/app/components/Views/confirmations/hooks/gas/useGasFeeEstimates.test.ts +++ b/app/components/Views/confirmations/hooks/gas/useGasFeeEstimates.test.ts @@ -52,7 +52,7 @@ describe('useGasFeeEstimates', () => { () => ({ chainId: '0x1', - }) as unknown as NetworkConfiguration, + } as unknown as NetworkConfiguration), ); }); diff --git a/app/components/Views/confirmations/hooks/send/useCurrencyConversions.ts b/app/components/Views/confirmations/hooks/send/useCurrencyConversions.ts index 9bf23d2b0119..8c7787ee3658 100644 --- a/app/components/Views/confirmations/hooks/send/useCurrencyConversions.ts +++ b/app/components/Views/confirmations/hooks/send/useCurrencyConversions.ts @@ -87,7 +87,7 @@ export const useCurrencyConversions = () => { const exchangeRate = useMemo( () => asset?.address - ? (contractExchangeRates?.[asset?.address as Hex]?.price ?? 1) + ? contractExchangeRates?.[asset?.address as Hex]?.price ?? 1 : 1, [asset?.address, contractExchangeRates], ); diff --git a/app/components/Views/confirmations/hooks/send/useNfts.test.tsx b/app/components/Views/confirmations/hooks/send/useNfts.test.tsx index 7c08e37c1048..c03e7aa06c7f 100644 --- a/app/components/Views/confirmations/hooks/send/useNfts.test.tsx +++ b/app/components/Views/confirmations/hooks/send/useNfts.test.tsx @@ -118,7 +118,7 @@ const createMockMultichainAccountGroup = ( pinned: false, hidden: false, }, - }) as unknown as AccountGroupObject; + } as unknown as AccountGroupObject); const createMockInternalAccount = ( id: string, @@ -166,7 +166,7 @@ const createMockAllNfts = ( favorite: false, isCurrentlyOwned: true, ...nft, - }) as Nft, + } as Nft), ); }); }); diff --git a/app/components/Views/confirmations/hooks/send/useNfts.ts b/app/components/Views/confirmations/hooks/send/useNfts.ts index 274fd93e8b84..c84a88beed8b 100644 --- a/app/components/Views/confirmations/hooks/send/useNfts.ts +++ b/app/components/Views/confirmations/hooks/send/useNfts.ts @@ -74,16 +74,13 @@ export function useEVMNfts(): Nft[] { } if (missingCollectionNfts.length > 0) { - const groupedByChain = missingCollectionNfts.reduce( - (acc, nft) => { - if (!acc[nft.chainId]) { - acc[nft.chainId] = []; - } - acc[nft.chainId].push(nft); - return acc; - }, - {} as Record, - ); + const groupedByChain = missingCollectionNfts.reduce((acc, nft) => { + if (!acc[nft.chainId]) { + acc[nft.chainId] = []; + } + acc[nft.chainId].push(nft); + return acc; + }, {} as Record); for (const [chainId, nfts] of Object.entries(groupedByChain)) { const typedNfts = nfts as typeof missingCollectionNfts; diff --git a/app/components/Views/confirmations/hooks/send/useSendNavbar.tsx b/app/components/Views/confirmations/hooks/send/useSendNavbar.tsx index 9cc0ff475ae7..24db0530ca27 100644 --- a/app/components/Views/confirmations/hooks/send/useSendNavbar.tsx +++ b/app/components/Views/confirmations/hooks/send/useSendNavbar.tsx @@ -90,15 +90,16 @@ export function useSendNavbar() { ); const createHeaderLeft = useCallback( - (onPress: () => void) => () => ( - - ), + (onPress: () => void) => () => + ( + + ), [], ); diff --git a/app/components/Views/confirmations/hooks/transactions/useTransactionCustomAmountAlerts.ts b/app/components/Views/confirmations/hooks/transactions/useTransactionCustomAmountAlerts.ts index 6e8fef342d32..393446fd5467 100644 --- a/app/components/Views/confirmations/hooks/transactions/useTransactionCustomAmountAlerts.ts +++ b/app/components/Views/confirmations/hooks/transactions/useTransactionCustomAmountAlerts.ts @@ -57,7 +57,7 @@ export function useTransactionCustomAmountAlerts({ isInputChanged); const keyboardAlertMessage = hasAlert - ? (firstAlert?.title ?? (firstAlert?.message as string | undefined)) + ? firstAlert?.title ?? (firstAlert?.message as string | undefined) : undefined; const alertMessage = diff --git a/app/components/Views/confirmations/hooks/useAccountInfo.ts b/app/components/Views/confirmations/hooks/useAccountInfo.ts index 94b7c6242d23..c6e3eef2c9c1 100644 --- a/app/components/Views/confirmations/hooks/useAccountInfo.ts +++ b/app/components/Views/confirmations/hooks/useAccountInfo.ts @@ -90,18 +90,15 @@ const useAccountInfo = (address: string, chainId: Hex) => { return undefined; } - const accountGroupNames = accountGroups.reduce( - (acc, group) => { - group.accounts.forEach((accountId) => { - const account = internalAccountsById[accountId]; - if (account) { - acc[account.address.toLowerCase()] = group.metadata.name; - } - }); - return acc; - }, - {} as Record, - ); + const accountGroupNames = accountGroups.reduce((acc, group) => { + group.accounts.forEach((accountId) => { + const account = internalAccountsById[accountId]; + if (account) { + acc[account.address.toLowerCase()] = group.metadata.name; + } + }); + return acc; + }, {} as Record); return accountGroupNames[activeAddress.toLowerCase()]; }, [ diff --git a/app/components/Views/confirmations/legacy/Approval/components/TransactionEditor/index.js b/app/components/Views/confirmations/legacy/Approval/components/TransactionEditor/index.js index bfd31773396c..1234ad20857a 100644 --- a/app/components/Views/confirmations/legacy/Approval/components/TransactionEditor/index.js +++ b/app/components/Views/confirmations/legacy/Approval/components/TransactionEditor/index.js @@ -241,8 +241,8 @@ class TransactionEditor extends PureComponent { dappSuggestedGasPrice ? fromWei(dappSuggestedGasPrice, 'gwei') : gasEstimateType === GAS_ESTIMATE_TYPES.LEGACY - ? this.props.gasFeeEstimates[selected] - : this.props.gasFeeEstimates.gasPrice; + ? this.props.gasFeeEstimates[selected] + : this.props.gasFeeEstimates.gasPrice; const LegacyGasData = this.parseTransactionDataLegacy( { diff --git a/app/components/Views/confirmations/legacy/Approval/index.js b/app/components/Views/confirmations/legacy/Approval/index.js index 0a35dd667bf1..ba8560d9931a 100644 --- a/app/components/Views/confirmations/legacy/Approval/index.js +++ b/app/components/Views/confirmations/legacy/Approval/index.js @@ -386,8 +386,8 @@ class Approval extends PureComponent { request_source: this.originIsMMSDKRemoteConn ? AppConstants.REQUEST_SOURCES.SDK_REMOTE_CONN : this.originIsWalletConnect - ? AppConstants.REQUEST_SOURCES.WC - : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, + ? AppConstants.REQUEST_SOURCES.WC + : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, }; try { diff --git a/app/components/Views/confirmations/legacy/Send/index.js b/app/components/Views/confirmations/legacy/Send/index.js index 5ccf34137deb..4f7cbb1b059b 100644 --- a/app/components/Views/confirmations/legacy/Send/index.js +++ b/app/components/Views/confirmations/legacy/Send/index.js @@ -460,8 +460,9 @@ class Send extends PureComponent { const { AssetsContractController } = Engine.context; const token = { address }; try { - const decimals = - await AssetsContractController.getERC20TokenDecimals(address); + const decimals = await AssetsContractController.getERC20TokenDecimals( + address, + ); token.decimals = parseInt(String(decimals)); } catch (e) { // Drop tx since we don't have any form to get decimals and send the correct tx @@ -474,8 +475,9 @@ class Send extends PureComponent { this.onCancel(); } try { - token.symbol = - await AssetsContractController.getERC721AssetSymbol(address); + token.symbol = await AssetsContractController.getERC721AssetSymbol( + address, + ); } catch (e) { token.symbol = 'ERC20'; } diff --git a/app/components/Views/confirmations/legacy/SendFlow/Confirm/index.js b/app/components/Views/confirmations/legacy/SendFlow/Confirm/index.js index 6810138e7861..ba6599348802 100644 --- a/app/components/Views/confirmations/legacy/SendFlow/Confirm/index.js +++ b/app/components/Views/confirmations/legacy/SendFlow/Confirm/index.js @@ -366,8 +366,8 @@ class Confirm extends PureComponent { request_source: this.originIsMMSDKRemoteConn ? AppConstants.REQUEST_SOURCES.SDK_REMOTE_CONN : this.originIsWalletConnect - ? AppConstants.REQUEST_SOURCES.WC - : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, + ? AppConstants.REQUEST_SOURCES.WC + : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, is_smart_transaction: shouldUseSmartTransaction || false, }; diff --git a/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.js b/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.js index 03998661ddd8..88f09d790682 100644 --- a/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.js +++ b/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.js @@ -410,8 +410,8 @@ class SendFlow extends PureComponent { return filteredAddressBook[checksummedAddress] ? filteredAddressBook[checksummedAddress].name : matchingAccount - ? matchingAccount.metadata.name - : null; + ? matchingAccount.metadata.name + : null; }; validateAddressOrENSFromInput = async (toAccount) => { diff --git a/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/VerifyContractDetails/VerifyContractDetails.tsx b/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/VerifyContractDetails/VerifyContractDetails.tsx index 3cfc22d3a8b4..d3e6e8cf4cbf 100644 --- a/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/VerifyContractDetails/VerifyContractDetails.tsx +++ b/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/VerifyContractDetails/VerifyContractDetails.tsx @@ -103,8 +103,8 @@ const VerifyContractDetails = ({ {tokenStandard === ERC20 ? strings('contract_allowance.token_allowance.token_contract') : tokenStandard === ERC721 || tokenStandard === ERC1155 - ? strings('contract_allowance.token_allowance.nft_contract') - : strings('contract_allowance.token_allowance.address')} + ? strings('contract_allowance.token_allowance.nft_contract') + : strings('contract_allowance.token_allowance.address')} diff --git a/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/index.js b/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/index.js index 085dc9746de0..56e32819b00f 100644 --- a/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/index.js +++ b/app/components/Views/confirmations/legacy/components/ApproveTransactionReview/index.js @@ -600,8 +600,8 @@ class ApproveTransactionReview extends PureComponent { request_source: this.originIsMMSDKRemoteConn ? AppConstants.REQUEST_SOURCES.SDK_REMOTE_CONN : this.originIsWalletConnect - ? AppConstants.REQUEST_SOURCES.WC - : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, + ? AppConstants.REQUEST_SOURCES.WC + : AppConstants.REQUEST_SOURCES.IN_APP_BROWSER, is_smart_transaction: shouldUseSmartTransaction || false, }; @@ -1334,12 +1334,12 @@ class ApproveTransactionReview extends PureComponent { {viewDetails ? this.renderTransactionReview() : shouldVerifyContractDetails - ? this.renderVerifyContractDetails() - : showBlockExplorerModal - ? this.renderBlockExplorerView() - : isSigningQRObject - ? this.renderQRDetails() - : this.renderDetails()} + ? this.renderVerifyContractDetails() + : showBlockExplorerModal + ? this.renderBlockExplorerView() + : isSigningQRObject + ? this.renderQRDetails() + : this.renderDetails()} ); }; diff --git a/app/components/Views/confirmations/utils/bridge.test.ts b/app/components/Views/confirmations/utils/bridge.test.ts index 21c3c0db808f..f682d679942c 100644 --- a/app/components/Views/confirmations/utils/bridge.test.ts +++ b/app/components/Views/confirmations/utils/bridge.test.ts @@ -102,7 +102,7 @@ describe('Confirmations Bridge Utils', () => { (state) => ({ sortedQuotes: state.engine.backgroundState.BridgeController.quotes, - }) as never, + } as never), ); bridgeControllerMock.fetchQuotes diff --git a/app/components/Views/confirmations/utils/deeplink.test.ts b/app/components/Views/confirmations/utils/deeplink.test.ts index 7fa0f904e353..04119a45ed6d 100644 --- a/app/components/Views/confirmations/utils/deeplink.test.ts +++ b/app/components/Views/confirmations/utils/deeplink.test.ts @@ -134,9 +134,7 @@ describe('addTransactionForDeeplink', () => { jest.clearAllMocks(); mockGetSelectedAccount.mockReturnValue({ address: FROM_ADDRESS_MOCK, - } as ReturnType< - typeof Engine.context.AccountsController.getSelectedAccount - >); + } as ReturnType); mockFindNetworkClientIdByChainId.mockReturnValue('mainnet'); }); diff --git a/app/components/hooks/AssetPolling/useTokenBalancesPolling.test.ts b/app/components/hooks/AssetPolling/useTokenBalancesPolling.test.ts index cf2ea5462429..417ae378f6a1 100644 --- a/app/components/hooks/AssetPolling/useTokenBalancesPolling.test.ts +++ b/app/components/hooks/AssetPolling/useTokenBalancesPolling.test.ts @@ -30,7 +30,7 @@ describe('useTokenBalancesPolling', () => { chainId, rpcEndpoints: [{ networkClientId }], defaultRpcEndpointIndex: 0, - }) as NetworkConfiguration; + } as NetworkConfiguration); beforeEach(() => { jest.resetAllMocks(); diff --git a/app/components/hooks/DisplayName/useAccountNames.ts b/app/components/hooks/DisplayName/useAccountNames.ts index aa18af31eaa2..78befce8e265 100644 --- a/app/components/hooks/DisplayName/useAccountNames.ts +++ b/app/components/hooks/DisplayName/useAccountNames.ts @@ -18,16 +18,13 @@ export function useAccountNames(requests: UseDisplayNameRequest[]) { ); if (isMultichainAccountsState2Enabled) { - const accountGroupNames = accountGroups.reduce( - (acc, group) => { - group.accounts.forEach((accountId) => { - const account = internalAccountsById[accountId]; - acc[account.address.toLowerCase()] = group.metadata.name; - }); - return acc; - }, - {} as Record, - ); + const accountGroupNames = accountGroups.reduce((acc, group) => { + group.accounts.forEach((accountId) => { + const account = internalAccountsById[accountId]; + acc[account.address.toLowerCase()] = group.metadata.name; + }); + return acc; + }, {} as Record); return requests.map((request) => { const { value } = request; diff --git a/app/components/hooks/useAccountsWithNetworkActivitySync.test.tsx b/app/components/hooks/useAccountsWithNetworkActivitySync.test.tsx index 61e023f991ad..d8ccc50ee6d5 100644 --- a/app/components/hooks/useAccountsWithNetworkActivitySync.test.tsx +++ b/app/components/hooks/useAccountsWithNetworkActivitySync.test.tsx @@ -35,9 +35,8 @@ const mockStore = configureMockStore(); export const getWrapper = (store: ReturnType) => - ({ children }: { children: React.ReactNode }) => ( - {children} - ); + ({ children }: { children: React.ReactNode }) => + {children}; interface MockEngineInstance { context: { diff --git a/app/components/hooks/useMetrics/withMetricsAwareness.tsx b/app/components/hooks/useMetrics/withMetricsAwareness.tsx index 1f21c455122a..8ae16c69a035 100644 --- a/app/components/hooks/useMetrics/withMetricsAwareness.tsx +++ b/app/components/hooks/useMetrics/withMetricsAwareness.tsx @@ -5,8 +5,7 @@ import { IWithMetricsAwarenessProps } from './withMetricsAwareness.types'; const withMetricsAwareness = // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - (Children: ComponentType) => (props: any) => ( - - ); + (Children: ComponentType) => (props: any) => + ; export default withMetricsAwareness; diff --git a/app/components/hooks/useNetworksByNamespace/useNetworksByNamespace.ts b/app/components/hooks/useNetworksByNamespace/useNetworksByNamespace.ts index 279bacc0e121..62ca0f0d82e2 100644 --- a/app/components/hooks/useNetworksByNamespace/useNetworksByNamespace.ts +++ b/app/components/hooks/useNetworksByNamespace/useNetworksByNamespace.ts @@ -128,7 +128,7 @@ const useProcessedNetworks = ( : (config as EvmAndMultichainNetworkConfigurationsWithCaipChainId); const rpcEndpointsCount = - 'rpcEndpoints' in network ? (network.rpcEndpoints?.length ?? 0) : 0; + 'rpcEndpoints' in network ? network.rpcEndpoints?.length ?? 0 : 0; const hasMultipleRpcs = rpcEndpointsCount > 1; diff --git a/app/constants/deeplinks.ts b/app/constants/deeplinks.ts index a757d3efbd49..78ed9320eab4 100644 --- a/app/constants/deeplinks.ts +++ b/app/constants/deeplinks.ts @@ -13,6 +13,7 @@ export enum PROTOCOLS { } export enum ACTIONS { + ENABLE_CARD_BUTTON = 'enable-card-button', DAPP = 'dapp', SEND = 'send', APPROVE = 'approve', @@ -62,5 +63,6 @@ export const PREFIXES = { [ACTIONS.PERPS_ASSET]: '', [ACTIONS.REWARDS]: '', [ACTIONS.ONBOARDING]: '', + [ACTIONS.ENABLE_CARD_BUTTON]: '', METAMASK: 'metamask://', }; diff --git a/app/constants/navigation/Routes.ts b/app/constants/navigation/Routes.ts index 21c780f985fe..b7cadfc63915 100644 --- a/app/constants/navigation/Routes.ts +++ b/app/constants/navigation/Routes.ts @@ -359,6 +359,7 @@ const Routes = { HOME: 'CardHome', WELCOME: 'CardWelcome', AUTHENTICATION: 'CardAuthentication', + NOTIFICATION: 'CardNotification', SPENDING_LIMIT: 'CardSpendingLimit', CHANGE_ASSET: 'CardChangeAsset', ONBOARDING: { diff --git a/app/core/Analytics/MetaMetrics.ts b/app/core/Analytics/MetaMetrics.ts index e179c164b448..4d4c697412c6 100644 --- a/app/core/Analytics/MetaMetrics.ts +++ b/app/core/Analytics/MetaMetrics.ts @@ -305,8 +305,9 @@ class MetaMetrics implements IMetaMetrics { } // look for a new Metametics ID and use it or generate a new one - const metametricsId: string | undefined = - await StorageWrapper.getItem(METAMETRICS_ID); + const metametricsId: string | undefined = await StorageWrapper.getItem( + METAMETRICS_ID, + ); if (!metametricsId) { // keep the id format compatible with MixPanel but base it on a UUIDv4 this.metametricsId = uuidv4(); diff --git a/app/core/Authentication/Authentication.test.ts b/app/core/Authentication/Authentication.test.ts index 45bd61087d3d..d3db32646a94 100644 --- a/app/core/Authentication/Authentication.test.ts +++ b/app/core/Authentication/Authentication.test.ts @@ -2101,8 +2101,9 @@ describe('Authentication', () => { } as unknown as ReduxStore); // Act - const result = - await Authentication.importSeedlessMnemonicToVault(mnemonic); + const result = await Authentication.importSeedlessMnemonicToVault( + mnemonic, + ); // Assert expect( diff --git a/app/core/Authentication/Authentication.ts b/app/core/Authentication/Authentication.ts index d64632210a30..a28ee9977f72 100644 --- a/app/core/Authentication/Authentication.ts +++ b/app/core/Authentication/Authentication.ts @@ -305,8 +305,9 @@ class AuthenticationService { const biometryPreviouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if ( availableBiometryType && @@ -436,8 +437,9 @@ class AuthenticationService { const biometryPreviouslyDisabled = await StorageWrapper.getItem( BIOMETRY_CHOICE_DISABLED, ); - const passcodePreviouslyDisabled = - await StorageWrapper.getItem(PASSCODE_DISABLED); + const passcodePreviouslyDisabled = await StorageWrapper.getItem( + PASSCODE_DISABLED, + ); if ( availableBiometryType && @@ -810,8 +812,9 @@ class AuthenticationService { const mnemonicToRestore = encodedSrp; // import the new mnemonic to the current vault - const keyringMetadata = - await this.importSeedlessMnemonicToVault(mnemonicToRestore); + const keyringMetadata = await this.importSeedlessMnemonicToVault( + mnemonicToRestore, + ); // discover multichain accounts from imported srp if (isMultichainAccountsState2Enabled()) { @@ -994,8 +997,9 @@ class AuthenticationService { name: TraceName.OnboardingFetchSrps, op: TraceOperation.OnboardingSecurityOp, }); - allSRPs = - await SeedlessOnboardingController.fetchAllSecretData(password); + allSRPs = await SeedlessOnboardingController.fetchAllSecretData( + password, + ); fetchSrpsSuccess = true; } catch (error) { const errorMessage = diff --git a/app/core/BackgroundBridge/BackgroundBridge.js b/app/core/BackgroundBridge/BackgroundBridge.js index 248c870cb9ec..b6aa1bad6d6d 100644 --- a/app/core/BackgroundBridge/BackgroundBridge.js +++ b/app/core/BackgroundBridge/BackgroundBridge.js @@ -140,8 +140,8 @@ export class BackgroundBridge extends EventEmitter { this.port = isRemoteConn ? new RemotePort(sendMessage) : this.isWalletConnect - ? new WalletConnectPort(wcRequestActions) - : new Port(this._webviewRef, isMainFrame); + ? new WalletConnectPort(wcRequestActions) + : new Port(this._webviewRef, isMainFrame); this.engine = null; this.multichainEngine = null; diff --git a/app/core/BackupVault/backupVault.test.ts b/app/core/BackupVault/backupVault.test.ts index a3af35265b9f..3c1e8fbeb7ed 100644 --- a/app/core/BackupVault/backupVault.test.ts +++ b/app/core/BackupVault/backupVault.test.ts @@ -86,8 +86,9 @@ describe('backupVault file', () => { dummyPassword, ); - const primaryVaultCredentials = - await getInternetCredentials(VAULT_BACKUP_KEY); + const primaryVaultCredentials = await getInternetCredentials( + VAULT_BACKUP_KEY, + ); const temporaryVaultCredentials = await getInternetCredentials( VAULT_BACKUP_TEMP_KEY, @@ -105,8 +106,9 @@ describe('backupVault file', () => { await clearAllVaultBackups(); - const primaryVaultCredentialsAfterReset = - await getInternetCredentials(VAULT_BACKUP_KEY); + const primaryVaultCredentialsAfterReset = await getInternetCredentials( + VAULT_BACKUP_KEY, + ); const temporaryVaultCredentialsAfterReset = await getInternetCredentials( VAULT_BACKUP_TEMP_KEY, @@ -195,8 +197,9 @@ describe('backupVault file', () => { dummyPassword, ); - const internetCredentialsBeforeReset = - await getInternetCredentials(VAULT_BACKUP_KEY); + const internetCredentialsBeforeReset = await getInternetCredentials( + VAULT_BACKUP_KEY, + ); expect(internetCredentialsBeforeReset).toEqual({ username: VAULT_BACKUP_KEY, diff --git a/app/core/BackupVault/backupVault.ts b/app/core/BackupVault/backupVault.ts index 600fd4569a35..722b2af51b24 100644 --- a/app/core/BackupVault/backupVault.ts +++ b/app/core/BackupVault/backupVault.ts @@ -130,8 +130,9 @@ export async function backupVault( } */ export async function getVaultFromBackup(): Promise { - const primaryVaultCredentials = - await getInternetCredentials(VAULT_BACKUP_KEY); + const primaryVaultCredentials = await getInternetCredentials( + VAULT_BACKUP_KEY, + ); if (primaryVaultCredentials) { return { success: true, vault: primaryVaultCredentials.password }; } diff --git a/app/core/DeeplinkManager/DeeplinkManager.ts b/app/core/DeeplinkManager/DeeplinkManager.ts index afa7c677adc3..1663638462c7 100644 --- a/app/core/DeeplinkManager/DeeplinkManager.ts +++ b/app/core/DeeplinkManager/DeeplinkManager.ts @@ -25,6 +25,7 @@ import SharedDeeplinkManager from './SharedDeeplinkManager'; import FCMService from '../../util/notifications/services/FCMService'; import { handleRewardsUrl } from './Handlers/handleRewardsUrl'; import handleFastOnboarding from './Handlers/handleFastOnboarding'; +import { handleEnableCardButton } from './Handlers/handleEnableCardButton'; class DeeplinkManager { // TODO: Replace "any" with type @@ -146,6 +147,10 @@ class DeeplinkManager { handleFastOnboarding({ onboardingPath }); } + _handleEnableCardButton() { + handleEnableCardButton(); + } + async parse( url: string, { diff --git a/app/core/DeeplinkManager/Handlers/handleEnableCardButton.test.ts b/app/core/DeeplinkManager/Handlers/handleEnableCardButton.test.ts new file mode 100644 index 000000000000..5605398882c7 --- /dev/null +++ b/app/core/DeeplinkManager/Handlers/handleEnableCardButton.test.ts @@ -0,0 +1,133 @@ +import { handleEnableCardButton } from './handleEnableCardButton'; +import { store } from '../../../store'; +import { setAlwaysShowCardButton } from '../../../core/redux/slices/card'; +import { selectCardExperimentalSwitch } from '../../../selectors/featureFlagController/card'; +import DevLogger from '../../SDKConnect/utils/DevLogger'; +import Logger from '../../../util/Logger'; + +jest.mock('../../../store'); +jest.mock('../../../core/redux/slices/card'); +jest.mock('../../../selectors/featureFlagController/card'); +jest.mock('../../SDKConnect/utils/DevLogger'); +jest.mock('../../../util/Logger'); + +describe('handleEnableCardButton', () => { + const mockGetState = jest.fn(); + const mockDispatch = jest.fn(); + const mockDevLogger = DevLogger.log as jest.Mock; + const mockLogger = Logger.log as jest.Mock; + const mockLoggerError = Logger.error as jest.Mock; + + beforeEach(() => { + jest.clearAllMocks(); + + (store.getState as jest.Mock) = mockGetState; + (store.dispatch as jest.Mock) = mockDispatch; + }); + + afterEach(() => { + jest.resetAllMocks(); + }); + + describe('when card experimental switch is enabled', () => { + beforeEach(() => { + (selectCardExperimentalSwitch as unknown as jest.Mock).mockReturnValue( + true, + ); + mockGetState.mockReturnValue({}); + }); + + it('dispatches setAlwaysShowCardButton with true', () => { + handleEnableCardButton(); + + expect(mockDispatch).toHaveBeenCalledWith(setAlwaysShowCardButton(true)); + }); + + it('logs successful enablement', () => { + handleEnableCardButton(); + + expect(mockDevLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Successfully enabled card button', + ); + expect(mockLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Card button enabled via deeplink', + ); + }); + + it('logs starting message', () => { + handleEnableCardButton(); + + expect(mockDevLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Starting card button enable deeplink handling', + ); + }); + }); + + describe('when card experimental switch is disabled', () => { + beforeEach(() => { + (selectCardExperimentalSwitch as unknown as jest.Mock).mockReturnValue( + false, + ); + mockGetState.mockReturnValue({}); + }); + + it('does not dispatch setAlwaysShowCardButton', () => { + handleEnableCardButton(); + + expect(mockDispatch).not.toHaveBeenCalled(); + }); + + it('logs that feature flag is disabled', () => { + handleEnableCardButton(); + + expect(mockDevLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Card experimental switch is disabled, skipping', + ); + expect(mockLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Card experimental switch feature flag is disabled', + ); + }); + + it('logs starting message', () => { + handleEnableCardButton(); + + expect(mockDevLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Starting card button enable deeplink handling', + ); + }); + }); + + describe('when an error occurs', () => { + const mockError = new Error('Test error'); + + beforeEach(() => { + mockGetState.mockImplementation(() => { + throw mockError; + }); + }); + + it('logs error with DevLogger', () => { + handleEnableCardButton(); + + expect(mockDevLogger).toHaveBeenCalledWith( + '[handleEnableCardButton] Failed to enable card button:', + mockError, + ); + }); + + it('logs error with Logger', () => { + handleEnableCardButton(); + + expect(mockLoggerError).toHaveBeenCalledWith( + mockError, + '[handleEnableCardButton] Error enabling card button', + ); + }); + + it('does not dispatch setAlwaysShowCardButton', () => { + handleEnableCardButton(); + + expect(mockDispatch).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/app/core/DeeplinkManager/Handlers/handleEnableCardButton.ts b/app/core/DeeplinkManager/Handlers/handleEnableCardButton.ts new file mode 100644 index 000000000000..e312e7f476c2 --- /dev/null +++ b/app/core/DeeplinkManager/Handlers/handleEnableCardButton.ts @@ -0,0 +1,63 @@ +import DevLogger from '../../SDKConnect/utils/DevLogger'; +import Logger from '../../../util/Logger'; +import { store } from '../../../store'; +import { setAlwaysShowCardButton } from '../../../core/redux/slices/card'; +import { selectCardExperimentalSwitch } from '../../../selectors/featureFlagController/card'; +import NavigationService from '../../NavigationService'; +import Routes from '../../../constants/navigation/Routes'; + +/** + * Card deeplink handler to enable the card button + * + * This handler enables the card button by setting the alwaysShowCardButton flag + * to true, but only if the cardExperimentalSwitch feature flag is enabled. + * It shows a success toast notification after enabling the button. + * + * Supported URL formats: + * - https://link.metamask.io/enable-card-button + * - https://metamask.app.link/enable-card-button + */ +export const handleEnableCardButton = () => { + DevLogger.log( + '[handleEnableCardButton] Starting card button enable deeplink handling', + ); + + try { + const state = store.getState(); + const cardExperimentalSwitchEnabled = selectCardExperimentalSwitch(state); + + DevLogger.log( + '[handleEnableCardButton] Card experimental switch enabled:', + cardExperimentalSwitchEnabled, + ); + + if (cardExperimentalSwitchEnabled) { + store.dispatch(setAlwaysShowCardButton(true)); + DevLogger.log( + '[handleEnableCardButton] Successfully enabled card button', + ); + Logger.log('[handleEnableCardButton] Card button enabled via deeplink'); + + // Show success toast via navigation + NavigationService.navigation?.navigate(Routes.MODAL.ROOT_MODAL_FLOW, { + screen: Routes.CARD.NOTIFICATION, + }); + } else { + DevLogger.log( + '[handleEnableCardButton] Card experimental switch is disabled, skipping', + ); + Logger.log( + '[handleEnableCardButton] Card experimental switch feature flag is disabled', + ); + } + } catch (error) { + DevLogger.log( + '[handleEnableCardButton] Failed to enable card button:', + error, + ); + Logger.error( + error as Error, + '[handleEnableCardButton] Error enabling card button', + ); + } +}; diff --git a/app/core/DeeplinkManager/ParseManager/handleUniversalLink.test.ts b/app/core/DeeplinkManager/ParseManager/handleUniversalLink.test.ts index 56f8901d2679..5eba45b5f6ed 100644 --- a/app/core/DeeplinkManager/ParseManager/handleUniversalLink.test.ts +++ b/app/core/DeeplinkManager/ParseManager/handleUniversalLink.test.ts @@ -50,6 +50,7 @@ describe('handleUniversalLinks', () => { const mockHandlePerps = jest.fn(); const mockHandleRewards = jest.fn(); const mockHandleFastOnboarding = jest.fn(); + const mockHandleEnableCardButton = jest.fn(); const mockConnectToChannel = jest.fn(); const mockGetConnections = jest.fn(); const mockRevalidateChannel = jest.fn(); @@ -77,6 +78,7 @@ describe('handleUniversalLinks', () => { _handlePerps: mockHandlePerps, _handleRewards: mockHandleRewards, _handleFastOnboarding: mockHandleFastOnboarding, + _handleEnableCardButton: mockHandleEnableCardButton, } as unknown as DeeplinkManager; const handled = jest.fn(); @@ -697,6 +699,51 @@ describe('handleUniversalLinks', () => { ); }); + describe('ACTIONS.ENABLE_CARD_BUTTON', () => { + const testCases = [ + { + domain: AppConstants.MM_UNIVERSAL_LINK_HOST, + description: 'old deeplink domain', + }, + { + domain: AppConstants.MM_IO_UNIVERSAL_LINK_HOST, + description: 'new deeplink domain', + }, + { + domain: AppConstants.MM_IO_UNIVERSAL_LINK_TEST_HOST, + description: 'test deeplink domain', + }, + ] as const; + + it.each(testCases)( + 'calls _handleEnableCardButton without showing modal for $description', + async ({ domain }) => { + const enableCardButtonUrl = `${PROTOCOLS.HTTPS}://${domain}/${ACTIONS.ENABLE_CARD_BUTTON}`; + const origin = `${PROTOCOLS.HTTPS}://${domain}`; + const enableCardButtonUrlObj = { + ...urlObj, + hostname: domain, + href: enableCardButtonUrl, + pathname: `/${ACTIONS.ENABLE_CARD_BUTTON}`, + origin, + }; + + await handleUniversalLink({ + instance, + handled, + urlObj: enableCardButtonUrlObj, + browserCallBack: mockBrowserCallBack, + url: enableCardButtonUrl, + source: 'test-source', + }); + + expect(mockHandleDeepLinkModalDisplay).not.toHaveBeenCalled(); + expect(handled).toHaveBeenCalled(); + expect(mockHandleEnableCardButton).toHaveBeenCalled(); + }, + ); + }); + describe('signature verification', () => { beforeEach(() => { DevLogger.log = jest.fn(); diff --git a/app/core/DeeplinkManager/ParseManager/handleUniversalLink.ts b/app/core/DeeplinkManager/ParseManager/handleUniversalLink.ts index f35b371219a0..268373239159 100644 --- a/app/core/DeeplinkManager/ParseManager/handleUniversalLink.ts +++ b/app/core/DeeplinkManager/ParseManager/handleUniversalLink.ts @@ -38,6 +38,7 @@ enum SUPPORTED_ACTIONS { REWARDS = ACTIONS.REWARDS, WC = ACTIONS.WC, ONBOARDING = ACTIONS.ONBOARDING, + ENABLE_CARD_BUTTON = ACTIONS.ENABLE_CARD_BUTTON, // MetaMask SDK specific actions ANDROID_SDK = ACTIONS.ANDROID_SDK, CONNECT = ACTIONS.CONNECT, @@ -47,7 +48,10 @@ enum SUPPORTED_ACTIONS { /** * Actions that should not show the deep link modal */ -const WHITELISTED_ACTIONS: SUPPORTED_ACTIONS[] = [SUPPORTED_ACTIONS.WC]; +const WHITELISTED_ACTIONS: SUPPORTED_ACTIONS[] = [ + SUPPORTED_ACTIONS.WC, + SUPPORTED_ACTIONS.ENABLE_CARD_BUTTON, +]; /** * MetaMask SDK actions that should be handled by handleMetaMaskDeeplink @@ -264,6 +268,8 @@ async function handleUniversalLink({ } else if (action === SUPPORTED_ACTIONS.ONBOARDING) { const onboardingPath = urlObj.href.replace(BASE_URL_ACTION, ''); instance._handleFastOnboarding(onboardingPath); + } else if (action === SUPPORTED_ACTIONS.ENABLE_CARD_BUTTON) { + instance._handleEnableCardButton(); } } diff --git a/app/core/Engine/controllers/remote-feature-flag-controller-init.test.ts b/app/core/Engine/controllers/remote-feature-flag-controller-init.test.ts index 9526f3eaf9ba..3dd3c2ed27fb 100644 --- a/app/core/Engine/controllers/remote-feature-flag-controller-init.test.ts +++ b/app/core/Engine/controllers/remote-feature-flag-controller-init.test.ts @@ -46,8 +46,9 @@ describe('remoteFeatureFlagControllerInit', () => { }); it('initializes the controller', () => { - const { controller } = - remoteFeatureFlagControllerInit(getInitRequestMock()); + const { controller } = remoteFeatureFlagControllerInit( + getInitRequestMock(), + ); expect(controller).toBeInstanceOf(Object); }); diff --git a/app/core/Engine/controllers/rewards-controller/RewardsController.test.ts b/app/core/Engine/controllers/rewards-controller/RewardsController.test.ts index ca711713b8f5..513b6df4bf81 100644 --- a/app/core/Engine/controllers/rewards-controller/RewardsController.test.ts +++ b/app/core/Engine/controllers/rewards-controller/RewardsController.test.ts @@ -1853,8 +1853,9 @@ describe('RewardsController', () => { it('should return 0 when feature flag is disabled', async () => { mockSelectRewardsEnabledFlag.mockReturnValue(false); - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_1); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_1, + ); expect(result).toBe(0); }); @@ -1879,8 +1880,9 @@ describe('RewardsController', () => { isDisabled: () => false, }); - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_1); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_1, + ); expect(result).toBe(750); expect(mockMessenger.call).not.toHaveBeenCalledWith( @@ -1914,8 +1916,9 @@ describe('RewardsController', () => { discountBips: 1000, }); - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_1); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_1, + ); expect(mockMessenger.call).toHaveBeenCalledWith( 'RewardsDataService:getPerpsDiscount', @@ -1950,8 +1953,9 @@ describe('RewardsController', () => { }); // Act - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_1); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_1, + ); // Assert - verify state has been updated expect(result).toBe(1500); @@ -1973,8 +1977,9 @@ describe('RewardsController', () => { discountBips: 1500, }); - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_2); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_2, + ); expect(mockMessenger.call).toHaveBeenCalledWith( 'RewardsDataService:getPerpsDiscount', @@ -1990,8 +1995,9 @@ describe('RewardsController', () => { }); // Act - check discount for account that doesn't exist in state - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_3); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_3, + ); // Assert - verify new account state was created with correct values expect(result).toBe(2000); @@ -2011,8 +2017,9 @@ describe('RewardsController', () => { it('should return 0 on data service error', async () => { mockMessenger.call.mockRejectedValue(new Error('Network error')); - const result = - await controller.getPerpsDiscountForAccount(CAIP_ACCOUNT_2); + const result = await controller.getPerpsDiscountForAccount( + CAIP_ACCOUNT_2, + ); expect(result).toBe(0); }); @@ -2029,8 +2036,9 @@ describe('RewardsController', () => { }); // Act - fetch discount for account that needs coercion - const result = - await controller.getPerpsDiscountForAccount(nonCoercedAccount); + const result = await controller.getPerpsDiscountForAccount( + nonCoercedAccount, + ); // Assert - verify result is correct expect(result).toBe(1500); @@ -2077,8 +2085,9 @@ describe('RewardsController', () => { // Act - fetch discount for non-coerced account format (should coerce to same key) const nonCoercedAccount = 'eip155:1:0xABCDEF' as CaipAccountId; - const result = - await controller.getPerpsDiscountForAccount(nonCoercedAccount); + const result = await controller.getPerpsDiscountForAccount( + nonCoercedAccount, + ); // Assert expect(result).toBe(1000); @@ -2101,8 +2110,9 @@ describe('RewardsController', () => { }); // Act - const result = - await controller.getPerpsDiscountForAccount(correctAccount); + const result = await controller.getPerpsDiscountForAccount( + correctAccount, + ); // Assert - should store with same key (lowercased) expect(result).toBe(2000); @@ -7913,8 +7923,9 @@ describe('RewardsController', () => { const accounts = [mockEvmInternalAccount, mockEvmInternalAccount2]; // Act - const result = - await controller.linkAccountsToSubscriptionCandidate(accounts); + const result = await controller.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -7952,8 +7963,9 @@ describe('RewardsController', () => { }); // Act - const result = - await testController.linkAccountsToSubscriptionCandidate(accounts); + const result = await testController.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -8013,8 +8025,9 @@ describe('RewardsController', () => { }); // Act - const result = - await testController.linkAccountsToSubscriptionCandidate(accounts); + const result = await testController.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -8059,8 +8072,9 @@ describe('RewardsController', () => { }); // Act - const result = - await testController.linkAccountsToSubscriptionCandidate(accounts); + const result = await testController.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -8094,8 +8108,9 @@ describe('RewardsController', () => { .mockReturnValue(null); // Act - const result = - await testController.linkAccountsToSubscriptionCandidate(accounts); + const result = await testController.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -8129,8 +8144,9 @@ describe('RewardsController', () => { .mockResolvedValueOnce(false); // Second account returns false // Act - const result = - await testController.linkAccountsToSubscriptionCandidate(accounts); + const result = await testController.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(linkSpy).toHaveBeenCalledTimes(2); @@ -9826,10 +9842,9 @@ describe('RewardsController', () => { mockSelectRewardsEnabledFlag.mockReturnValue(false); // Act - const result = - await controller.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await controller.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(false); @@ -9876,10 +9891,9 @@ describe('RewardsController', () => { jest.spyOn(testController, 'isOptInSupported').mockReturnValue(false); // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(false); @@ -9974,10 +9988,9 @@ describe('RewardsController', () => { }); // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(true); @@ -10040,10 +10053,9 @@ describe('RewardsController', () => { .mockResolvedValueOnce(mockUpdatedSubscription); // mobileJoin // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(true); @@ -10281,10 +10293,9 @@ describe('RewardsController', () => { .mockRejectedValueOnce(mockError); // mobileJoin // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(false); @@ -10372,10 +10383,9 @@ describe('RewardsController', () => { .mockResolvedValueOnce(mockUpdatedSubscription); // mobileJoin // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(true); @@ -10633,10 +10643,9 @@ describe('RewardsController', () => { .mockResolvedValueOnce(mockUpdatedSubscription); // mobileJoin // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(true); @@ -10725,10 +10734,9 @@ describe('RewardsController', () => { }); // Act - const result = - await testController.linkAccountToSubscriptionCandidate( - mockInternalAccount, - ); + const result = await testController.linkAccountToSubscriptionCandidate( + mockInternalAccount, + ); // Assert expect(result).toBe(true); @@ -10789,8 +10797,9 @@ describe('RewardsController', () => { const accounts = [mockInternalAccount1, mockInternalAccount2]; // Act - const result = - await controller.linkAccountsToSubscriptionCandidate(accounts); + const result = await controller.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ @@ -10807,8 +10816,9 @@ describe('RewardsController', () => { const accounts: InternalAccount[] = []; // Act - const result = - await controller.linkAccountsToSubscriptionCandidate(accounts); + const result = await controller.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([]); @@ -10828,8 +10838,9 @@ describe('RewardsController', () => { .mockRejectedValueOnce(new Error('Linking failed')); // Act - const result = - await controller.linkAccountsToSubscriptionCandidate(accounts); + const result = await controller.linkAccountsToSubscriptionCandidate( + accounts, + ); // Assert expect(result).toEqual([ diff --git a/app/core/Engine/controllers/rewards-controller/RewardsController.ts b/app/core/Engine/controllers/rewards-controller/RewardsController.ts index c147c3da7bb8..78f05eb4b2d2 100644 --- a/app/core/Engine/controllers/rewards-controller/RewardsController.ts +++ b/app/core/Engine/controllers/rewards-controller/RewardsController.ts @@ -1039,8 +1039,8 @@ export class RewardsController extends BaseController< .split(':')[2] ?.toLowerCase()}` as CaipAccountId) : account?.startsWith('eip155') - ? (account.toLowerCase() as CaipAccountId) - : (account as CaipAccountId); + ? (account.toLowerCase() as CaipAccountId) + : (account as CaipAccountId); this.update((state: RewardsControllerState) => { // Create account state if it doesn't exist @@ -1614,8 +1614,8 @@ export class RewardsController extends BaseController< type === 'current' ? discoverSeasons.current : type === 'next' - ? discoverSeasons.next - : null; + ? discoverSeasons.next + : null; // If found with valid start date, fetch metadata and populate cache if (seasonInfo?.startDate) { diff --git a/app/core/Engine/controllers/smart-transactions-controller-init.test.ts b/app/core/Engine/controllers/smart-transactions-controller-init.test.ts index 2556c86049ef..905817f817f7 100644 --- a/app/core/Engine/controllers/smart-transactions-controller-init.test.ts +++ b/app/core/Engine/controllers/smart-transactions-controller-init.test.ts @@ -29,8 +29,9 @@ function getInitRequestMock(): jest.Mocked< describe('SmartTransactionsControllerInit', () => { it('initializes the controller', () => { - const { controller } = - smartTransactionsControllerInit(getInitRequestMock()); + const { controller } = smartTransactionsControllerInit( + getInitRequestMock(), + ); expect(controller).toBeInstanceOf(SmartTransactionsController); }); diff --git a/app/core/Engine/controllers/token-search-discovery-controller-init.test.ts b/app/core/Engine/controllers/token-search-discovery-controller-init.test.ts index b2801ce7337b..52871a3983c5 100644 --- a/app/core/Engine/controllers/token-search-discovery-controller-init.test.ts +++ b/app/core/Engine/controllers/token-search-discovery-controller-init.test.ts @@ -32,8 +32,9 @@ function getInitRequestMock(): jest.Mocked< describe('TokenSearchDiscoveryControllerInit', () => { it('initializes the controller', () => { - const { controller } = - tokenSearchDiscoveryControllerInit(getInitRequestMock()); + const { controller } = tokenSearchDiscoveryControllerInit( + getInitRequestMock(), + ); expect(controller).toBeInstanceOf(TokenSearchDiscoveryController); }); diff --git a/app/core/Engine/controllers/token-search-discovery-data-controller-init.test.ts b/app/core/Engine/controllers/token-search-discovery-data-controller-init.test.ts index d53265b720eb..35df0d702aea 100644 --- a/app/core/Engine/controllers/token-search-discovery-data-controller-init.test.ts +++ b/app/core/Engine/controllers/token-search-discovery-data-controller-init.test.ts @@ -30,8 +30,9 @@ function getInitRequestMock(): jest.Mocked< describe('TokenSearchDiscoveryDataControllerInit', () => { it('initializes the controller', () => { - const { controller } = - tokenSearchDiscoveryDataControllerInit(getInitRequestMock()); + const { controller } = tokenSearchDiscoveryDataControllerInit( + getInitRequestMock(), + ); expect(controller).toBeInstanceOf(TokenSearchDiscoveryDataController); }); diff --git a/app/core/Engine/controllers/transaction-controller/transaction-controller-init.test.ts b/app/core/Engine/controllers/transaction-controller/transaction-controller-init.test.ts index a62776eaf180..22f8f5636caa 100644 --- a/app/core/Engine/controllers/transaction-controller/transaction-controller-init.test.ts +++ b/app/core/Engine/controllers/transaction-controller/transaction-controller-init.test.ts @@ -390,7 +390,7 @@ describe('Transaction Controller Init', () => { () => ({ getHook: () => mockDelegation7702Hook, - }) as unknown as InstanceType, + } as unknown as InstanceType), ); }); diff --git a/app/core/Engine/controllers/transaction-controller/transaction-controller-init.ts b/app/core/Engine/controllers/transaction-controller/transaction-controller-init.ts index 38fb69d75312..953ec6ae0b58 100644 --- a/app/core/Engine/controllers/transaction-controller/transaction-controller-init.ts +++ b/app/core/Engine/controllers/transaction-controller/transaction-controller-init.ts @@ -132,8 +132,9 @@ export const TransactionControllerInit: ControllerInitFunction< state, chainId, ); - const isSendBundleSupportedChain = - await isSendBundleSupported(chainId); + const isSendBundleSupportedChain = await isSendBundleSupported( + chainId, + ); // EIP7702 gas fee tokens are enabled when: // - Smart transactions are NOT enabled, OR diff --git a/app/core/Engine/controllers/transaction-controller/utils.test.ts b/app/core/Engine/controllers/transaction-controller/utils.test.ts index 0560073367e5..695c30e3cf4c 100644 --- a/app/core/Engine/controllers/transaction-controller/utils.test.ts +++ b/app/core/Engine/controllers/transaction-controller/utils.test.ts @@ -218,7 +218,7 @@ describe('generateDefaultTransactionMetrics', () => { confirmationMetrics: { metricsById: mockMetricsById, }, - }) as unknown as RootState, + } as unknown as RootState), ); const mockEventHandlerRequest: Partial = { @@ -519,7 +519,7 @@ describe('generateDefaultTransactionMetrics', () => { confirmationMetrics: { metricsById: { [upgradeAccountConfirmation.id]: {} }, }, - }) as RootState, + } as RootState), } as TransactionEventHandlerRequest, ); expect(metrics.properties).toStrictEqual({ @@ -555,7 +555,7 @@ describe('generateDefaultTransactionMetrics', () => { confirmationMetrics: { metricsById: { [upgradeOnlyAccountConfirmation.id]: {} }, }, - }) as RootState, + } as RootState), } as TransactionEventHandlerRequest, ); expect(metrics.properties).toStrictEqual({ @@ -593,7 +593,7 @@ describe('generateDefaultTransactionMetrics', () => { confirmationMetrics: { metricsById: { [upgradeOnlyAccountConfirmation.id]: {} }, }, - }) as RootState, + } as RootState), } as TransactionEventHandlerRequest, ); expect(metrics.properties).toStrictEqual({ @@ -626,7 +626,7 @@ describe('generateDefaultTransactionMetrics', () => { confirmationMetrics: { metricsById: { [batchApprovalConfirmation.id]: {} }, }, - }) as RootState, + } as RootState), } as TransactionEventHandlerRequest, ); expect(metrics.properties).toStrictEqual({ diff --git a/app/core/Engine/controllers/transaction-controller/utils.ts b/app/core/Engine/controllers/transaction-controller/utils.ts index f3c2d84eaf45..f19483b24ba2 100644 --- a/app/core/Engine/controllers/transaction-controller/utils.ts +++ b/app/core/Engine/controllers/transaction-controller/utils.ts @@ -146,8 +146,9 @@ async function getBatchProperties(transactionMeta: TransactionMeta) { properties.batch_transaction_count = nestedTransactions?.length; properties.batch_transaction_method = 'eip7702'; - properties.transaction_contract_method = - await getNestedMethodNames(transactionMeta); + properties.transaction_contract_method = await getNestedMethodNames( + transactionMeta, + ); properties.transaction_contract_address = nestedTransactions ?.filter( @@ -206,8 +207,9 @@ export async function generateDefaultTransactionMetrics( error: error?.message, status, source: 'MetaMask Mobile', - transaction_contract_method: - await getTransactionContractMethod(transactionMeta), + transaction_contract_method: await getTransactionContractMethod( + transactionMeta, + ), transaction_envelope_type: transactionMeta.txParams.type, transaction_internal_id: id, transaction_type: getTransactionTypeValue(type), diff --git a/app/core/GasPolling/GasPolling.ts b/app/core/GasPolling/GasPolling.ts index af3c79645c3a..5434d3a808b2 100644 --- a/app/core/GasPolling/GasPolling.ts +++ b/app/core/GasPolling/GasPolling.ts @@ -33,8 +33,9 @@ export const startGasPolling = async (token?: string) => { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any const { GasFeeController }: any = Engine.context; - const pollToken = - await GasFeeController.getGasFeeEstimatesAndStartPolling(token); + const pollToken = await GasFeeController.getGasFeeEstimatesAndStartPolling( + token, + ); return pollToken; }; diff --git a/app/core/OAuthService/OAuthLoginHandlers/baseHandler.test.ts b/app/core/OAuthService/OAuthLoginHandlers/baseHandler.test.ts index eebef0267dd1..e60af658860c 100644 --- a/app/core/OAuthService/OAuthLoginHandlers/baseHandler.test.ts +++ b/app/core/OAuthService/OAuthLoginHandlers/baseHandler.test.ts @@ -245,8 +245,9 @@ describe('BaseLoginHandler', () => { new Response(JSON.stringify(mockRevokeResponse)), ); - const revokeResult = - await mockHandler.revokeRefreshToken('refresh-token'); + const revokeResult = await mockHandler.revokeRefreshToken( + 'refresh-token', + ); expect(revokeResult).toEqual({ refresh_token: 'refresh-token', diff --git a/app/core/PreventScreenshot.js b/app/core/PreventScreenshot.js index bf2bc96fb132..5db4314de780 100644 --- a/app/core/PreventScreenshot.js +++ b/app/core/PreventScreenshot.js @@ -8,12 +8,12 @@ export default { isQa || isRc ? () => true : isAndroid - ? NativeModules.PreventScreenshot.forbid - : () => true, + ? NativeModules.PreventScreenshot.forbid + : () => true, allow: isQa || isRc ? () => true : isAndroid - ? NativeModules.PreventScreenshot.allow - : () => true, + ? NativeModules.PreventScreenshot.allow + : () => true, }; diff --git a/app/core/RPCMethods/utils.ts b/app/core/RPCMethods/utils.ts index ae9a93168332..cb02a3d1805d 100644 --- a/app/core/RPCMethods/utils.ts +++ b/app/core/RPCMethods/utils.ts @@ -53,15 +53,12 @@ function assertExpectedHook( export function makeMethodMiddlewareMaker( handlers: PermittedHandlerExport[], ) { - const handlerMap = handlers.reduce( - (map, handler) => { - for (const methodName of handler.methodNames) { - map[methodName] = handler; - } - return map; - }, - {} as Record>, - ); + const handlerMap = handlers.reduce((map, handler) => { + for (const methodName of handler.methodNames) { + map[methodName] = handler; + } + return map; + }, {} as Record>); const expectedHookNames = new Set( handlers.flatMap(({ hookNames }) => Object.getOwnPropertyNames(hookNames)), diff --git a/app/core/SDKConnect/ConnectionManagement/connectToChannel.test.ts b/app/core/SDKConnect/ConnectionManagement/connectToChannel.test.ts index 688133413049..9dcbae79e3c5 100644 --- a/app/core/SDKConnect/ConnectionManagement/connectToChannel.test.ts +++ b/app/core/SDKConnect/ConnectionManagement/connectToChannel.test.ts @@ -165,7 +165,7 @@ describe('connectToChannel', () => { setParams: jest.fn(), setOptions: jest.fn(), } as unknown as NavigationContainerRef, - }) as unknown as Connection, + } as unknown as Connection), ); }); diff --git a/app/core/SDKConnect/ConnectionManagement/reconnect.test.ts b/app/core/SDKConnect/ConnectionManagement/reconnect.test.ts index bff5a3335d38..8c0e49ca55c3 100644 --- a/app/core/SDKConnect/ConnectionManagement/reconnect.test.ts +++ b/app/core/SDKConnect/ConnectionManagement/reconnect.test.ts @@ -17,7 +17,7 @@ jest.mock('../Connection', () => ({ isReady: false, connect: jest.fn(), setTrigger: jest.fn(), - }) as unknown as Connection, + } as unknown as Connection), ), })); jest.mock('../SDKConnect'); diff --git a/app/core/SanitizationMiddleware.ts b/app/core/SanitizationMiddleware.ts index 84917b5c0812..705b001a4ed2 100644 --- a/app/core/SanitizationMiddleware.ts +++ b/app/core/SanitizationMiddleware.ts @@ -43,20 +43,17 @@ export const permittedKeys = [ function sanitizeRpcParameter( parameter: Record, ): Record { - return permittedKeys.reduce>( - (copy, permitted) => { - if (permitted in parameter) { - const value = parameter[permitted]; - if (Array.isArray(value)) { - copy[permitted] = value.map(sanitize) as Json; - } else { - copy[permitted] = sanitize(value) as Json; - } + return permittedKeys.reduce>((copy, permitted) => { + if (permitted in parameter) { + const value = parameter[permitted]; + if (Array.isArray(value)) { + copy[permitted] = value.map(sanitize) as Json; + } else { + copy[permitted] = sanitize(value) as Json; } - return copy; - }, - {} as Record, - ); + } + return copy; + }, {} as Record); } /** diff --git a/app/core/SecureKeychain.ts b/app/core/SecureKeychain.ts index f8f5300e5ac4..9f4e61b861ec 100644 --- a/app/core/SecureKeychain.ts +++ b/app/core/SecureKeychain.ts @@ -162,8 +162,9 @@ const SecureKeychain = { if (instance) { try { instance.isAuthenticating = true; - const keychainObject = - await Keychain.getGenericPassword(defaultOptions); + const keychainObject = await Keychain.getGenericPassword( + defaultOptions, + ); if (keychainObject && keychainObject.password) { const encryptedPassword = keychainObject.password; const decrypted = await instance.decryptPassword(encryptedPassword); diff --git a/app/core/redux/slices/bridge/index.test.ts b/app/core/redux/slices/bridge/index.test.ts index 9125a1219c3d..472b6a9f4243 100644 --- a/app/core/redux/slices/bridge/index.test.ts +++ b/app/core/redux/slices/bridge/index.test.ts @@ -226,7 +226,8 @@ describe('bridge slice', () => { const mockState = cloneDeep(mockRootState); mockState.engine.backgroundState.MultichainNetworkController.selectedMultichainNetworkChainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' as unknown as any; - mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = false; + mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = + false; const result = selectBip44DefaultPair(mockState as unknown as RootState); expect(result).toEqual({ @@ -256,7 +257,8 @@ describe('bridge slice', () => { const mockState = cloneDeep(mockRootState); mockState.engine.backgroundState.MultichainNetworkController.selectedMultichainNetworkChainId = 'bip122:000000000019d6689c085ae165831e93' as unknown as any; - mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = false; + mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = + false; const result = selectBip44DefaultPair(mockState as unknown as RootState); expect(result).toEqual({ @@ -295,7 +297,8 @@ describe('bridge slice', () => { const mockState = cloneDeep(mockRootState); mockState.engine.backgroundState.MultichainNetworkController.selectedMultichainNetworkChainId = 'bip122:000000000019d6689c085ae165831e93' as unknown as any; - mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = false; + mockState.engine.backgroundState.MultichainNetworkController.isEvmSelected = + false; mockState.engine.backgroundState.RemoteFeatureFlagController.remoteFeatureFlags.bridgeConfigV2.bip44DefaultPairs = { eip155: { diff --git a/app/core/redux/slices/card/index.ts b/app/core/redux/slices/card/index.ts index b93553c3cc73..327f91b54a62 100644 --- a/app/core/redux/slices/card/index.ts +++ b/app/core/redux/slices/card/index.ts @@ -228,8 +228,8 @@ export const selectCardPriorityToken = ( authenticated ? card.authenticatedPriorityToken : address - ? card.priorityTokensByAddress[address.toLowerCase()] || null - : null, + ? card.priorityTokensByAddress[address.toLowerCase()] || null + : null, ); export const selectCardPriorityTokenLastFetched = ( @@ -240,8 +240,8 @@ export const selectCardPriorityTokenLastFetched = ( authenticated ? card.authenticatedPriorityTokenLastFetched : address - ? card.lastFetchedByAddress[address.toLowerCase()] || null - : null, + ? card.lastFetchedByAddress[address.toLowerCase()] || null + : null, ); export const selectIsCardCacheValid = ( diff --git a/app/lib/ppom/ppom-util.test.ts b/app/lib/ppom/ppom-util.test.ts index dc9e30093a36..320cb0e2df22 100644 --- a/app/lib/ppom/ppom-util.test.ts +++ b/app/lib/ppom/ppom-util.test.ts @@ -235,7 +235,8 @@ describe('PPOM Utils', () => { TransactionActions, 'setTransactionSecurityAlertResponse', ); - MockEngine.context.PreferencesController.state.securityAlertsEnabled = false; + MockEngine.context.PreferencesController.state.securityAlertsEnabled = + false; await PPOMUtil.validateRequest(mockRequest, { transactionMeta: { id: TRANSACTION_ID_MOCK } as TransactionMeta, }); @@ -292,7 +293,8 @@ describe('PPOM Utils', () => { TransactionActions, 'setTransactionSecurityAlertResponse', ); - MockEngine.context.PreferencesController.state.securityAlertsEnabled = false; + MockEngine.context.PreferencesController.state.securityAlertsEnabled = + false; await PPOMUtil.validateRequest( { ...mockRequest, diff --git a/app/reducers/collectibles/index.test.ts b/app/reducers/collectibles/index.test.ts index fa8f5b7ce467..04daf27caa60 100644 --- a/app/reducers/collectibles/index.test.ts +++ b/app/reducers/collectibles/index.test.ts @@ -236,7 +236,7 @@ describe('collectibles selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('multichainCollectiblesByEnabledNetworksSelector', () => { it('should return NFTs only for enabled networks', () => { diff --git a/app/reducers/index.ts b/app/reducers/index.ts index 967ccfd0cbeb..a89643616d38 100644 --- a/app/reducers/index.ts +++ b/app/reducers/index.ts @@ -53,15 +53,14 @@ import { isTest } from '../util/test/utils'; * * @template reducer A reducer function */ -export type StateFromReducer = - reducer extends Reducer< - infer State, - // TODO: Replace "any" with type - // eslint-disable-next-line @typescript-eslint/no-explicit-any - any - > - ? State - : never; +export type StateFromReducer = reducer extends Reducer< + infer State, + // TODO: Replace "any" with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + any +> + ? State + : never; // TODO: Convert all reducers to valid TypeScript Redux reducers, and add them // to this type. Once that is complete, we can automatically generate this type diff --git a/app/reducers/rewards/selectors.test.ts b/app/reducers/rewards/selectors.test.ts index 06d6ec5fd3f0..d91057af574e 100644 --- a/app/reducers/rewards/selectors.test.ts +++ b/app/reducers/rewards/selectors.test.ts @@ -59,7 +59,7 @@ describe('Rewards selectors', () => { // Helper function to create mock root state const createMockRootState = ( rewardsState: Partial, - ): RootState => ({ rewards: rewardsState }) as RootState; + ): RootState => ({ rewards: rewardsState } as RootState); beforeEach(() => { jest.clearAllMocks(); diff --git a/app/reducers/swaps/utils.ts b/app/reducers/swaps/utils.ts index 633ce1d10672..be1494618277 100644 --- a/app/reducers/swaps/utils.ts +++ b/app/reducers/swaps/utils.ts @@ -41,7 +41,7 @@ export const getSwapsLiveness = ( const liveness = typeof chainFeatureFlags === 'boolean' ? chainFeatureFlags - : (chainFeatureFlags?.[featureFlagKey] ?? false); + : chainFeatureFlags?.[featureFlagKey] ?? false; return liveness; }; diff --git a/app/selectors/assets/assets-list.test.ts b/app/selectors/assets/assets-list.test.ts index 53cfa143c65a..7f583382aeb2 100644 --- a/app/selectors/assets/assets-list.test.ts +++ b/app/selectors/assets/assets-list.test.ts @@ -345,7 +345,7 @@ const mockState = ({ }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('selectAssetsBySelectedAccountGroup', () => { it('builds the initial state object', () => { diff --git a/app/selectors/assets/balances.ts b/app/selectors/assets/balances.ts index 49e1180e9165..ea81f547a7a5 100644 --- a/app/selectors/assets/balances.ts +++ b/app/selectors/assets/balances.ts @@ -57,7 +57,7 @@ const selectAccountTreeStateForBalances = createSelector( accountWalletsMetadata?: AccountTreeControllerState['accountWalletsMetadata']; } ).accountWalletsMetadata ?? {}, - }) as AccountTreeControllerState, + } as AccountTreeControllerState), ); const selectAccountsStateForBalances = createSelector( @@ -68,31 +68,31 @@ const selectAccountsStateForBalances = createSelector( accounts: accountsById, selectedAccount: selectedAccountId ?? '', }, - }) as AccountsControllerState, + } as AccountsControllerState), ); const selectTokenBalancesStateForBalances = createSelector( [selectAllTokenBalances], (tokenBalances): TokenBalancesControllerState => - ({ tokenBalances }) as TokenBalancesControllerState, + ({ tokenBalances } as TokenBalancesControllerState), ); const selectTokenRatesStateForBalances = createSelector( [selectTokenMarketData], (marketData): TokenRatesControllerState => - ({ marketData }) as TokenRatesControllerState, + ({ marketData } as TokenRatesControllerState), ); const selectMultichainBalancesStateForBalances = createSelector( [selectMultichainBalances], (balances): MultichainBalancesControllerState => - ({ balances }) as MultichainBalancesControllerState, + ({ balances } as MultichainBalancesControllerState), ); const selectMultichainAssetsRatesStateForBalances = createSelector( [selectMultichainAssetsRates], (conversionRates): MultichainAssetsRatesControllerState => - ({ conversionRates }) as MultichainAssetsRatesControllerState, + ({ conversionRates } as MultichainAssetsRatesControllerState), ); const selectTokensStateForBalances = createSelector( @@ -102,7 +102,7 @@ const selectTokensStateForBalances = createSelector( allTokens: allTokens ?? {}, allIgnoredTokens: {}, allDetectedTokens: {}, - }) as TokensControllerState, + } as TokensControllerState), ); const selectCurrencyRateStateForBalances = createSelector( @@ -111,7 +111,7 @@ const selectCurrencyRateStateForBalances = createSelector( ({ currentCurrency: currentCurrency ?? 'usd', currencyRates: currencyRates ?? {}, - }) as CurrencyRateState, + } as CurrencyRateState), ); export const selectBalanceForAllWallets = createSelector( diff --git a/app/selectors/browser.ts b/app/selectors/browser.ts index efc684302aff..2186070764cf 100644 --- a/app/selectors/browser.ts +++ b/app/selectors/browser.ts @@ -13,7 +13,7 @@ export const selectBrowserHistoryWithType = createDeepEqualSelector( history .map( (item) => - ({ ...item, category: UrlAutocompleteCategory.Recents }) as const, + ({ ...item, category: UrlAutocompleteCategory.Recents } as const), ) .reverse(), ); @@ -23,7 +23,7 @@ export const selectBrowserBookmarksWithType = createDeepEqualSelector( (bookmarks: SiteItem[]) => bookmarks.map( (item) => - ({ ...item, category: UrlAutocompleteCategory.Favorites }) as const, + ({ ...item, category: UrlAutocompleteCategory.Favorites } as const), ), ); diff --git a/app/selectors/currencyRateController.test.ts b/app/selectors/currencyRateController.test.ts index 5ad2614396ec..8bcedbd807ea 100644 --- a/app/selectors/currencyRateController.test.ts +++ b/app/selectors/currencyRateController.test.ts @@ -243,7 +243,7 @@ describe('CurrencyRateController Selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); it('returns the correct USD conversion rate for a valid chain ID and native currency', () => { jest diff --git a/app/selectors/defiPositionsController.test.ts b/app/selectors/defiPositionsController.test.ts index 90548373766f..64e46e29627f 100644 --- a/app/selectors/defiPositionsController.test.ts +++ b/app/selectors/defiPositionsController.test.ts @@ -80,7 +80,7 @@ describe('defiPositionsController selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('selectDeFiPositionsByAddress', () => { it('should return defi positions for the selected address', () => { diff --git a/app/selectors/multichain/evm.test.tsx b/app/selectors/multichain/evm.test.tsx index b40cc39f9097..7b42c4d5ef04 100644 --- a/app/selectors/multichain/evm.test.tsx +++ b/app/selectors/multichain/evm.test.tsx @@ -817,7 +817,7 @@ describe('Multichain Selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); const createTestStateWithSelectedNetwork = (selectedNetworkId: string) => ({ @@ -867,7 +867,7 @@ describe('Multichain Selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); beforeEach(() => { jest.resetModules(); diff --git a/app/selectors/multichain/multichain.test.ts b/app/selectors/multichain/multichain.test.ts index 1d677f5156bc..3987c8a95777 100644 --- a/app/selectors/multichain/multichain.test.ts +++ b/app/selectors/multichain/multichain.test.ts @@ -167,8 +167,8 @@ function getNonEvmState( selectedAccount.type === SolAccountType.DataAccount ? SolScope.Mainnet : selectedAccount.scopes[0] === BtcScope.Testnet - ? BtcScope.Testnet - : BtcScope.Mainnet; + ? BtcScope.Testnet + : BtcScope.Mainnet; const state = { ...getEvmState(undefined, 1500, showFiatOnTestnets), diff --git a/app/selectors/multichain/multichain.ts b/app/selectors/multichain/multichain.ts index 412d88f1b61c..5a427b6bbb43 100644 --- a/app/selectors/multichain/multichain.ts +++ b/app/selectors/multichain/multichain.ts @@ -142,7 +142,7 @@ export const selectMultichainSelectedAccountCachedBalance = selectNonEvmCachedBalance, (isEvmSelected, accountBalanceByChainId, nonEvmCachedBalance) => isEvmSelected - ? (accountBalanceByChainId?.balance ?? '0x0') + ? accountBalanceByChainId?.balance ?? '0x0' : nonEvmCachedBalance, ); diff --git a/app/selectors/multichainAccounts/accountTreeController.test.ts b/app/selectors/multichainAccounts/accountTreeController.test.ts index e7f866986bae..4ce5aa53fa08 100644 --- a/app/selectors/multichainAccounts/accountTreeController.test.ts +++ b/app/selectors/multichainAccounts/accountTreeController.test.ts @@ -68,7 +68,7 @@ const createMockAccountGroup = ( type: AccountGroupType.SingleAccount, accounts: accounts as [string, ...string[]], metadata: { name }, - }) as unknown as AccountGroupObject; + } as unknown as AccountGroupObject); const createMockGroup = (accounts: string[]) => ({ accounts }); @@ -112,7 +112,7 @@ const createMockState = ( }, }, }, - }) as unknown as RootState; + } as unknown as RootState); const createStateWithSelectedAccount = ( accountTreeController: Record | undefined, @@ -153,7 +153,7 @@ const createStateWithSelectedAccount = ( }, }, }, - }) as unknown as RootState; + } as unknown as RootState); // Common test data const mockWallet1 = createMockWallet(WALLET_ID_1, 'Wallet 1', { diff --git a/app/selectors/multichainAccounts/accountTreeController.ts b/app/selectors/multichainAccounts/accountTreeController.ts index dd207e4c97ea..bcc265270cc0 100644 --- a/app/selectors/multichainAccounts/accountTreeController.ts +++ b/app/selectors/multichainAccounts/accountTreeController.ts @@ -245,7 +245,7 @@ export const selectWalletByAccount = createSelector( if (!wallets) return null; const walletId = accountToWalletMap[accountId]; - return walletId ? (wallets[walletId] ?? null) : null; + return walletId ? wallets[walletId] ?? null : null; }, ); diff --git a/app/selectors/multichainAccounts/accounts.test.ts b/app/selectors/multichainAccounts/accounts.test.ts index 3bd859af8278..32bc514f9402 100644 --- a/app/selectors/multichainAccounts/accounts.test.ts +++ b/app/selectors/multichainAccounts/accounts.test.ts @@ -178,7 +178,7 @@ const createMockState = ( }, }, }, - }) as unknown as RootState; + } as unknown as RootState); // Additional test utility functions const createStateWithNetworkConfigurations = ( @@ -233,7 +233,7 @@ const createStateWithNetworkConfigurations = ( }, }, }, - }) as unknown as RootState; + } as unknown as RootState); // Ensure all states created with createStateWithNetworkConfigurations have KeyringController const createStateWithNetworkConfigurationsAndKeyring = ( diff --git a/app/selectors/multichainAccounts/accounts.ts b/app/selectors/multichainAccounts/accounts.ts index 51c03b8daf4c..50f0ca99d3c6 100644 --- a/app/selectors/multichainAccounts/accounts.ts +++ b/app/selectors/multichainAccounts/accounts.ts @@ -172,9 +172,9 @@ const filterTestnets = ( export const selectSelectedInternalAccountByScope = createDeepEqualSelector( [selectAccountTreeControllerState, selectInternalAccountsById], ( - accountTreeState: AccountTreeControllerState, - internalAccountsMap: Record, - ) => + accountTreeState: AccountTreeControllerState, + internalAccountsMap: Record, + ) => (scope: CaipChainId): InternalAccount | undefined => { if (!accountTreeState?.accountTree?.selectedAccountGroup) { return undefined; @@ -211,9 +211,9 @@ export const selectInternalAccountByAccountGroupAndScope = createDeepEqualSelector( [selectAccountTreeControllerState, selectInternalAccountsById], ( - accountTreeState: AccountTreeControllerState, - internalAccountsMap: Record, - ) => + accountTreeState: AccountTreeControllerState, + internalAccountsMap: Record, + ) => ( scope: CaipChainId, accountGroupId: string, diff --git a/app/selectors/multichainAccounts/wallets.test.ts b/app/selectors/multichainAccounts/wallets.test.ts index 92b8a9cc2e37..399c7dfd6bba 100644 --- a/app/selectors/multichainAccounts/wallets.test.ts +++ b/app/selectors/multichainAccounts/wallets.test.ts @@ -44,7 +44,7 @@ const createMockState = ( }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('selectWallets', () => { it('returns empty array when multichain accounts feature is disabled', () => { diff --git a/app/selectors/multisrp/index.test.ts b/app/selectors/multisrp/index.test.ts index 7347fb032d1e..aa4bbbf90098 100644 --- a/app/selectors/multisrp/index.test.ts +++ b/app/selectors/multisrp/index.test.ts @@ -123,7 +123,7 @@ const mockState = (selectedAccount: InternalAccount = mockAccount1) => }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('multisrp selectors', () => { describe('selectHdKeyringIndexByIdOrDefault', () => { diff --git a/app/selectors/nftController.test.ts b/app/selectors/nftController.test.ts index 2a22ec154a02..2ff03b2ca588 100644 --- a/app/selectors/nftController.test.ts +++ b/app/selectors/nftController.test.ts @@ -154,7 +154,7 @@ describe('NftController Selectors', () => { }, }, }, - }) as unknown as RootState; + } as unknown as RootState); describe('selectAllNftContracts', () => { it('returns all NFT contracts from NftController state', () => { diff --git a/app/selectors/rewards/index.test.ts b/app/selectors/rewards/index.test.ts index 7ed046a298ed..d5b09911f04a 100644 --- a/app/selectors/rewards/index.test.ts +++ b/app/selectors/rewards/index.test.ts @@ -33,7 +33,7 @@ const createMockRootState = ( }, }, rewards: createMockRewardsState(rewardsStateOverrides), - }) as RootState; + } as RootState); describe('Rewards Selectors', () => { describe('selectRewardsControllerState', () => { diff --git a/app/selectors/seedlessOnboardingController.test.ts b/app/selectors/seedlessOnboardingController.test.ts index 70bcd1083432..eb5d2d2ea949 100644 --- a/app/selectors/seedlessOnboardingController.test.ts +++ b/app/selectors/seedlessOnboardingController.test.ts @@ -20,7 +20,7 @@ const createMockState = ( }, }, }, - }) as RootState; + } as RootState); describe('Seedless Onboarding Controller Selectors', () => { describe('selectSeedlessOnboardingUserId', () => { diff --git a/app/selectors/smartTransactionsController.test.ts b/app/selectors/smartTransactionsController.test.ts index e79e13c24feb..78ad16d5d729 100644 --- a/app/selectors/smartTransactionsController.test.ts +++ b/app/selectors/smartTransactionsController.test.ts @@ -99,8 +99,10 @@ const getDefaultState = () => { rpcUrl: undefined, // default rpc for chain 0x1 chainId: '0x1', }; - defaultState.engine.backgroundState.SmartTransactionsController.smartTransactionsState.liveness = true; - defaultState.engine.backgroundState.PreferencesController.smartTransactionsOptInStatus = true; + defaultState.engine.backgroundState.SmartTransactionsController.smartTransactionsState.liveness = + true; + defaultState.engine.backgroundState.PreferencesController.smartTransactionsOptInStatus = + true; defaultState.engine.backgroundState.SmartTransactionsController.smartTransactionsState.smartTransactions = { @@ -126,7 +128,8 @@ describe('SmartTransactionsController Selectors', () => { ); it('should return false if smart transactions liveness is false', () => { const state = getDefaultState(); - state.engine.backgroundState.SmartTransactionsController.smartTransactionsState.liveness = false; + state.engine.backgroundState.SmartTransactionsController.smartTransactionsState.liveness = + false; const enabled = selectSmartTransactionsEnabled(state); expect(enabled).toEqual(false); }); @@ -155,7 +158,8 @@ describe('SmartTransactionsController Selectors', () => { describe('getShouldUseSmartTransaction', () => { it('should return false if smart transactions are not opted into', () => { const state = getDefaultState(); - state.engine.backgroundState.PreferencesController.smartTransactionsOptInStatus = false; + state.engine.backgroundState.PreferencesController.smartTransactionsOptInStatus = + false; const shouldUseSmartTransaction = selectShouldUseSmartTransaction(state); expect(shouldUseSmartTransaction).toEqual(false); }); diff --git a/app/selectors/tokenList.test.ts b/app/selectors/tokenList.test.ts index f2e9ff06bb48..fc389724d046 100644 --- a/app/selectors/tokenList.test.ts +++ b/app/selectors/tokenList.test.ts @@ -27,7 +27,7 @@ jest.mock('../store', () => ({ // This selector consumes many selectors and is very hard to create exact state // So instead uses mocks to simulate the internal selector changes describe('selectSortedTokenKeys', () => { - const mockState = () => ({}) as unknown as RootState; + const mockState = () => ({} as unknown as RootState); const createEvmTokens = (tokenAddrs: string[]) => tokenAddrs.map( @@ -36,7 +36,7 @@ describe('selectSortedTokenKeys', () => { address, chainId: '0x1', isStaked: false, - }) as TokenI, + } as TokenI), ); const createNonEvmTokens = (tokenAddrs: string[]) => @@ -47,9 +47,9 @@ describe('selectSortedTokenKeys', () => { chainId: '0x1337', isStaked: undefined, balanceFiat: idx + 10, - }) as unknown as ReturnType< + } as unknown as ReturnType< typeof selectMultichainTokenListForAccountId - >[number], + >[number]), ); const arrangeMocks = () => { diff --git a/app/selectors/tokenRatesController.test.ts b/app/selectors/tokenRatesController.test.ts index 87187a5734c0..ba349a1eb40c 100644 --- a/app/selectors/tokenRatesController.test.ts +++ b/app/selectors/tokenRatesController.test.ts @@ -19,7 +19,7 @@ const createMockState = () => }, }, }, - }) as RootState; + } as RootState); const createMockMarketTokenDetails = () => { const mockChainMarketDetails = { diff --git a/app/store/migrations/027.js b/app/store/migrations/027.js index 72fe0262fd91..97d500a814ff 100644 --- a/app/store/migrations/027.js +++ b/app/store/migrations/027.js @@ -35,8 +35,8 @@ export default function migrate(state) { const networkType = matchingProviderConfig ? matchingProviderConfig.type : matchingNetworkConfigurations?.length - ? NetworkType.rpc - : undefined; + ? NetworkType.rpc + : undefined; return { chainId: tx.chainId, diff --git a/app/store/migrations/085.ts b/app/store/migrations/085.ts index ade279ab7c6d..56be9053b590 100644 --- a/app/store/migrations/085.ts +++ b/app/store/migrations/085.ts @@ -21,8 +21,10 @@ const migration = (state: unknown): unknown => { hasProperty(state.engine.backgroundState, 'UserStorageController') && isObject(state.engine.backgroundState.UserStorageController) ) { - state.engine.backgroundState.UserStorageController.isBackupAndSyncEnabled = true; - state.engine.backgroundState.UserStorageController.isAccountSyncingEnabled = true; + state.engine.backgroundState.UserStorageController.isBackupAndSyncEnabled = + true; + state.engine.backgroundState.UserStorageController.isAccountSyncingEnabled = + true; } else { captureException( new Error( diff --git a/app/store/migrations/096.ts b/app/store/migrations/096.ts index bc2469e9decb..2f3c69704fcf 100644 --- a/app/store/migrations/096.ts +++ b/app/store/migrations/096.ts @@ -53,8 +53,8 @@ const migration = async (state: unknown): Promise => { const cryptocurrency = isObject(order.cryptocurrency) ? order.cryptocurrency?.symbol : typeof order.cryptocurrency === 'string' - ? order.cryptocurrency - : undefined; + ? order.cryptocurrency + : undefined; const network = isObject(order.cryptocurrency) ? order.cryptocurrency?.chainId @@ -63,7 +63,7 @@ const migration = async (state: unknown): Promise => { ...order, cryptocurrency: cryptocurrency ?? '...', network: - typeof order.network === 'string' ? order.network : (network ?? ''), + typeof order.network === 'string' ? order.network : network ?? '', forceUpdate: true, }; } diff --git a/app/util/address/index.ts b/app/util/address/index.ts index a47b5c531a17..6b3e24af283d 100644 --- a/app/util/address/index.ts +++ b/app/util/address/index.ts @@ -662,10 +662,9 @@ export async function validateAddressOrENS( // Check if it's token contract address on mainnet if (isMainnet) { try { - const symbol = - await AssetsContractController.getERC721AssetSymbol( - checksummedAddress, - ); + const symbol = await AssetsContractController.getERC721AssetSymbol( + checksummedAddress, + ); if (symbol) { addressError = SYMBOL_ERROR; errorContinue = true; diff --git a/app/util/date/index.test.ts b/app/util/date/index.test.ts index 127d38199852..a71879af94b8 100644 --- a/app/util/date/index.test.ts +++ b/app/util/date/index.test.ts @@ -41,16 +41,18 @@ describe('Date util :: msBetweenDates', () => { const DateReal = global.Date; const mockDate = new Date(); - const spy = jest.spyOn(global, 'Date').mockImplementation(function ( - ...args: ConstructorParameters - ) { - if (args.length) { - return new DateReal(...args); - } - return mockDate; - // TODO: Replace "any" with type - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } as any); + const spy = jest + .spyOn(global, 'Date') + .mockImplementation(function ( + ...args: ConstructorParameters + ) { + if (args.length) { + return new DateReal(...args); + } + return mockDate; + // TODO: Replace "any" with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any); const todayOneHourEarlier = new Date().getTime() - 1000; const dateOneHourEarlier = new Date(todayOneHourEarlier); diff --git a/app/util/environment.ts b/app/util/environment.ts index 4e8a42963cd6..717f279e2eae 100644 --- a/app/util/environment.ts +++ b/app/util/environment.ts @@ -6,7 +6,7 @@ export const isProduction = (): boolean => // TODO: process.env.NODE_ENV === 'production' doesn't work with tests yet. Once we make it work, // we can remove the following line and use the code above instead. - ({ ...process.env })?.NODE_ENV === 'production'; + ({ ...process.env }?.NODE_ENV === 'production'); export const isGatorPermissionsFeatureEnabled = (): boolean => process.env.GATOR_PERMISSIONS_ENABLED?.toString() === 'true'; diff --git a/app/util/networks/handleNetworkSwitch.test.ts b/app/util/networks/handleNetworkSwitch.test.ts index a9328666fb3e..c3a1366236df 100644 --- a/app/util/networks/handleNetworkSwitch.test.ts +++ b/app/util/networks/handleNetworkSwitch.test.ts @@ -97,7 +97,7 @@ function setupGetStateMock() { // Cast to 'any' because we don't have a complete Redux mock to use // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - }) as any, + } as any), ); } diff --git a/app/util/notifications/services/FCMService.test.ts b/app/util/notifications/services/FCMService.test.ts index 7a4f4f7de421..4a0b9c156ff2 100644 --- a/app/util/notifications/services/FCMService.test.ts +++ b/app/util/notifications/services/FCMService.test.ts @@ -236,8 +236,9 @@ describe('FCMService - listenToPushNotificationsReceived()', () => { it('sets up listeners for push notifications and returns an unsubscribe handler', async () => { const { mockHandler, firebaseMocks } = arrangeMocks(); - const result = - await FCMService.listenToPushNotificationsReceived(mockHandler); + const result = await FCMService.listenToPushNotificationsReceived( + mockHandler, + ); expect(result).toBeDefined(); expect(firebaseMocks.mockOnMessage).toHaveBeenCalled(); }); @@ -248,8 +249,9 @@ describe('FCMService - listenToPushNotificationsReceived()', () => { throw new Error('TEST ERROR'); }); - const result = - await FCMService.listenToPushNotificationsReceived(mockHandler); + const result = await FCMService.listenToPushNotificationsReceived( + mockHandler, + ); expect(result).toBe(null); }); @@ -352,7 +354,7 @@ describe('FCMService - onClickPushNotificationWhenAppClosed', () => { ): FirebaseMessagingTypes.RemoteMessage => ({ data, - }) as unknown as FirebaseMessagingTypes.RemoteMessage; + } as unknown as FirebaseMessagingTypes.RemoteMessage); const platformTestConfigs = [ { @@ -484,7 +486,7 @@ describe('FCMService - onClickPushNotificationWhenAppSuspended', () => { ): FirebaseMessagingTypes.RemoteMessage => ({ data, - }) as unknown as FirebaseMessagingTypes.RemoteMessage; + } as unknown as FirebaseMessagingTypes.RemoteMessage); const arrangeAct = ( // Remote Message Data prop only contains string entries diff --git a/app/util/number/index.js b/app/util/number/index.js index ec03320d9b18..f2fefe96a2b8 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -32,8 +32,8 @@ export const hexToBN = (inputHex) => typeof inputHex !== 'string' ? new BN4(inputHex, 16) : inputHex - ? new BN4(remove0x(inputHex), 16) - : new BN4(0); + ? new BN4(remove0x(inputHex), 16) + : new BN4(0); /** * Converts a BN object to a hex string with a '0x' prefix. diff --git a/app/util/sentry/utils.ts b/app/util/sentry/utils.ts index ca0390a47775..adb9823060e7 100644 --- a/app/util/sentry/utils.ts +++ b/app/util/sentry/utils.ts @@ -406,40 +406,37 @@ export function maskObject( ? (Reflect.get(mask, AllProperties) as MaskValue | undefined) : undefined; - return Object.keys(objectToMask).reduce( - (maskedObject, key) => { - // Start with the AllProperties mask if available - let maskKey = allPropertiesMask; - - // If a key-specific mask exists, it overrides the AllProperties mask - if (mask[key] !== undefined && mask[key] !== AllProperties) { - maskKey = mask[key]; - } + return Object.keys(objectToMask).reduce((maskedObject, key) => { + // Start with the AllProperties mask if available + let maskKey = allPropertiesMask; - const shouldPrintValue = maskKey === true; - const shouldIterateSubMask = - maskKey !== AllProperties && - Boolean(maskKey) && - typeof maskKey === 'object'; - const shouldPrintType = maskKey === undefined || maskKey === false; - - if (shouldPrintValue) { - maskedObject[key] = objectToMask[key]; - } else if (shouldIterateSubMask) { - maskedObject[key] = maskObject( - objectToMask[key] as Record, - maskKey as Record, - ); - } else if (shouldPrintType) { - // For excluded fields, return their type or a placeholder - maskedObject[key] = - objectToMask[key] === null ? 'null' : typeof objectToMask[key]; - } + // If a key-specific mask exists, it overrides the AllProperties mask + if (mask[key] !== undefined && mask[key] !== AllProperties) { + maskKey = mask[key]; + } - return maskedObject; - }, - {} as Record, - ); + const shouldPrintValue = maskKey === true; + const shouldIterateSubMask = + maskKey !== AllProperties && + Boolean(maskKey) && + typeof maskKey === 'object'; + const shouldPrintType = maskKey === undefined || maskKey === false; + + if (shouldPrintValue) { + maskedObject[key] = objectToMask[key]; + } else if (shouldIterateSubMask) { + maskedObject[key] = maskObject( + objectToMask[key] as Record, + maskKey as Record, + ); + } else if (shouldPrintType) { + // For excluded fields, return their type or a placeholder + maskedObject[key] = + objectToMask[key] === null ? 'null' : typeof objectToMask[key]; + } + + return maskedObject; + }, {} as Record); } export function rewriteReport(report: SentryEvent): SentryEvent { diff --git a/app/util/smart-transactions/index.ts b/app/util/smart-transactions/index.ts index 8bf39b25de1c..850f0b5fa63e 100644 --- a/app/util/smart-transactions/index.ts +++ b/app/util/smart-transactions/index.ts @@ -117,8 +117,9 @@ export const getSmartTransactionMetricsProperties = async ( !smartTransaction?.statusMetadata && // We get this after polling for a status for a Smart Transaction. controllerMessenger; if (shouldWaitForSmartTransactionConfirmationDoneEvent) { - smartTransaction = - await waitForSmartTransactionConfirmationDone(controllerMessenger); + smartTransaction = await waitForSmartTransactionConfirmationDone( + controllerMessenger, + ); } if (!smartTransaction) { return {}; diff --git a/app/util/smart-transactions/smart-publish-hook.test.ts b/app/util/smart-transactions/smart-publish-hook.test.ts index e8d2ab4747b9..d3de7a17604f 100644 --- a/app/util/smart-transactions/smart-publish-hook.test.ts +++ b/app/util/smart-transactions/smart-publish-hook.test.ts @@ -77,7 +77,7 @@ const createTransactionControllerMock = () => ), state: { transactions: [] }, update: jest.fn(), - }) as unknown as jest.Mocked; + } as unknown as jest.Mocked); const getDefaultAddAndShowApprovalRequest = () => jest.fn(); const createApprovalControllerMock = ({ @@ -93,7 +93,7 @@ const createApprovalControllerMock = ({ }, addAndShowApprovalRequest, updateRequestState: jest.fn(), - }) as unknown as jest.Mocked; + } as unknown as jest.Mocked); const defaultTransactionMeta: TransactionMeta = { origin: 'http://localhost', diff --git a/app/util/test/network.ts b/app/util/test/network.ts index 753190d2bf22..33fc493f727a 100644 --- a/app/util/test/network.ts +++ b/app/util/test/network.ts @@ -32,8 +32,8 @@ export const mockNetworkState = ( const networkConfigurations = networks.map((network) => { const blockExplorer = !('blockExplorerUrl' in network) || network.blockExplorerUrl - ? (network.blockExplorerUrl ?? - `https://localhost/blockExplorer/${network.chainId}`) + ? network.blockExplorerUrl ?? + `https://localhost/blockExplorer/${network.chainId}` : undefined; const rpc = diff --git a/app/util/test/renderWithProvider.tsx b/app/util/test/renderWithProvider.tsx index fcfb11b21b11..3a30ca8c31a5 100644 --- a/app/util/test/renderWithProvider.tsx +++ b/app/util/test/renderWithProvider.tsx @@ -22,13 +22,13 @@ export type DeepPartial = T extends (...args: unknown[]) => unknown ? // If T is a function, return T as is. T : T extends (infer U)[] - ? // If T is an array, apply DeepPartial to its elements. - DeepPartial[] - : T extends object - ? // If T is an object, apply DeepPartial to each property of T. - { [K in keyof T]?: DeepPartial } - : // Otherwise, return T or undefined. - T | undefined; + ? // If T is an array, apply DeepPartial to its elements. + DeepPartial[] + : T extends object + ? // If T is an object, apply DeepPartial to each property of T. + { [K in keyof T]?: DeepPartial } + : // Otherwise, return T or undefined. + T | undefined; export interface ProviderValues { state?: DeepPartial; theme?: Theme; diff --git a/app/util/transaction-controller/index.test.ts b/app/util/transaction-controller/index.test.ts index 69f9fdf2ae8d..8688803f8264 100644 --- a/app/util/transaction-controller/index.test.ts +++ b/app/util/transaction-controller/index.test.ts @@ -604,8 +604,9 @@ describe('Transaction Controller Util', () => { Engine.context.TransactionController.isAtomicBatchSupported as jest.Mock ).mockResolvedValueOnce(mockResult); - const result = - await TransactionControllerUtils.isAtomicBatchSupported(request); + const result = await TransactionControllerUtils.isAtomicBatchSupported( + request, + ); expect( Engine.context.TransactionController.isAtomicBatchSupported, diff --git a/app/util/transactions/index.js b/app/util/transactions/index.js index 2b5dd105f480..bad5fbc80369 100644 --- a/app/util/transactions/index.js +++ b/app/util/transactions/index.js @@ -630,11 +630,11 @@ export async function getActionKey(tx, selectedAddress, ticker, chainId) { ? strings('transactions.self_sent_unit', { unit: currencySymbol }) : strings('transactions.self_sent_ether') : currencySymbol - ? strings('transactions.received_unit', { unit: currencySymbol }) - : strings('transactions.received_ether') + ? strings('transactions.received_unit', { unit: currencySymbol }) + : strings('transactions.received_ether') : currencySymbol - ? strings('transactions.sent_unit', { unit: currencySymbol }) - : strings('transactions.sent_ether'); + ? strings('transactions.sent_unit', { unit: currencySymbol }) + : strings('transactions.sent_ether'); } const transactionActionKey = actionKeys[actionKey]; diff --git a/appwright/reporters/custom-reporter.js b/appwright/reporters/custom-reporter.js index 27c4836aba9e..a60d7e43ce02 100644 --- a/appwright/reporters/custom-reporter.js +++ b/appwright/reporters/custom-reporter.js @@ -427,8 +427,8 @@ class CustomReporter { Performance Metrics: ${testName} - ${ - this.metrics[0].device - } + this.metrics[0].device + }