From 634991f95a7f85aa3e36b44df79eb046371f61a4 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:37:05 +0000 Subject: [PATCH] chore: eslint + import sort --- apps/wallet/.eslintrc.js | 10 +- apps/wallet/.tool-versions | 1 + apps/wallet/package.json | 3 + .../src/components/Accordion/Accordion.tsx | 2 +- .../src/components/Boundary/Boundary.tsx | 2 +- apps/wallet/src/components/SafeArea.tsx | 2 +- apps/wallet/src/features/Auth/common/hooks.ts | 14 +- .../Auth/common/useEnableEasyConfirmation.tsx | 2 +- .../Discover/common/ChainDAppsWarning.tsx | 2 +- .../Discover/common/useDAppsConnected.tsx | 2 +- .../Discover/common/useShowWelcomeDApp.tsx | 4 +- .../common/useResetShowBuyBannerSmall.tsx | 2 +- .../Exchange/common/useShowBuyBannerSmall.tsx | 2 +- .../ChooseBiometricLoginScreen.tsx | 2 +- .../DarkThemeAnnouncement.tsx | 2 +- .../features/Initialization/common/terms.ts | 2 +- .../Legal/PrivacyPolicy/PrivacyPolicy.tsx | 2 +- .../Legal/TermsOfService/TermsOfService.tsx | 2 +- .../Portfolio/common/PnlTag/PnlTag.tsx | 2 +- .../common/PortfolioTokenActivityProvider.tsx | 2 +- .../common/hooks/useGetLiquidityPool.ts | 2 +- .../common/hooks/useGetOpenOrders.ts | 2 +- .../common/hooks/useGetPortfolioTokenChart.ts | 2 +- .../common/hooks/useGetPortfolioTokenInfo.ts | 2 +- .../common/hooks/usePortfolioImage.ts | 2 +- .../common/hooks/usePortfolioTokenInfos.ts | 2 +- .../ZoomMediaImageScreen.tsx | 1 - .../common/useMultipleAddressesInfo.tsx | 10 +- .../features/RegisterCatalyst/common/hooks.ts | 2 +- .../useCases/ConfirmPin/ConfirmPin.tsx | 2 +- .../ReviewTx/common/hooks/useFormattedTx.tsx | 2 +- .../features/ReviewTx/common/operations.tsx | 2 +- .../features/Send/common/useSendAddress.tsx | 2 +- .../features/Send/common/useSendReceiver.tsx | 2 +- .../ListAmountsToSendScreen.tsx | 2 +- .../ChangeNetwork/ChangeNetworkScreen.tsx | 10 +- .../Currency/CurrencyContext.tsx | 6 +- .../PrivacyMode/PrivacyMode.tsx | 2 +- .../ScreenShare/ScreenShare.ts | 2 +- .../ChangePassword/ChangePasswordScreen.tsx | 2 +- .../ManageCollateralScreen.tsx | 2 +- .../Staking/Governance/common/helpers.tsx | 2 +- .../src/features/Swap/common/helpers.ts | 2 +- .../src/features/Swap/common/useSwapTx.ts | 2 +- .../common/hooks/useBestBlock.tsx | 2 +- .../common/hooks/useCreateWalletMnemonic.tsx | 2 +- .../common/hooks/useCreateWalletXPub.tsx | 2 +- .../src/kernel/i18n/LanguageProvider.tsx | 13 +- apps/wallet/src/kernel/query-client.ts | 2 +- .../src/legacy/Dashboard/StakePoolInfo.tsx | 2 +- .../src/legacy/Dashboard/StakePoolInfos.tsx | 2 +- .../Staking/PoolDetails/PoolDetailScreen.tsx | 2 +- .../PoolTransition/usePoolTransition.tsx | 2 +- .../Staking/StakingCenter/StakingCenter.tsx | 2 +- .../wallet/src/yoroi-wallets/cardano/hw/hw.ts | 1 - .../cardano/mnemonic/mnemonic.ts | 1 - .../cardano/usePrimaryTokenActivity.tsx | 2 +- .../utxoManager/useSetCollateralId.tsx | 2 +- apps/wallet/src/yoroi-wallets/hooks/index.ts | 18 +-- apps/wallet/src/yoroi-wallets/hw/hw.ts | 2 +- apps/wallet/tsconfig.json | 3 +- yarn.lock | 122 +++++++++++++++++- 62 files changed, 218 insertions(+), 93 deletions(-) create mode 100644 apps/wallet/.tool-versions diff --git a/apps/wallet/.eslintrc.js b/apps/wallet/.eslintrc.js index 7bac441f25..4d56335166 100644 --- a/apps/wallet/.eslintrc.js +++ b/apps/wallet/.eslintrc.js @@ -1,6 +1,11 @@ module.exports = { root: true, + parser: '@typescript-eslint/parser', extends: ['@react-native', 'prettier'], + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + }, rules: { 'prettier/prettier': [ 'error', @@ -14,6 +19,8 @@ module.exports = { semi: false, }, ], + 'simple-import-sort/exports': 'error', + 'simple-import-sort/imports': 'error', 'react-native/no-inline-styles': 'off', '@typescript-eslint/no-unused-vars': [ 'error', @@ -21,5 +28,6 @@ module.exports = { ], '@typescript-eslint/no-shadow': 'off', }, - ignorePatterns: ['node_modules/', 'android/', 'ios/', 'coverage/'], + plugins: ['eslint-plugin-simple-import-sort'], + ignorePatterns: ['node_modules/', 'android/', 'ios/', 'coverage/', 'stories/'], } diff --git a/apps/wallet/.tool-versions b/apps/wallet/.tool-versions new file mode 100644 index 0000000000..c2ca3d3d25 --- /dev/null +++ b/apps/wallet/.tool-versions @@ -0,0 +1 @@ +nodejs 20.9.0 diff --git a/apps/wallet/package.json b/apps/wallet/package.json index 81fbea1bab..5d438e9bc4 100644 --- a/apps/wallet/package.json +++ b/apps/wallet/package.json @@ -135,9 +135,12 @@ "@types/react": "~18.2.79", "@types/react-test-renderer": "^18.0.0", "@types/uuid": "^10.0.0", + "@typescript-eslint/eslint-plugin": "^8.16.0", + "@typescript-eslint/parser": "^8.16.0", "babel-jest": "^29.6.3", "dependency-cruiser": "^13.1.1", "eslint": "^8.19.0", + "eslint-plugin-simple-import-sort": "^12.1.1", "i18n-unused": "^0.16.0", "jest": "^29.6.3", "prettier": "2.8.8", diff --git a/apps/wallet/src/components/Accordion/Accordion.tsx b/apps/wallet/src/components/Accordion/Accordion.tsx index 51b8e53247..d40dbc71e6 100644 --- a/apps/wallet/src/components/Accordion/Accordion.tsx +++ b/apps/wallet/src/components/Accordion/Accordion.tsx @@ -2,11 +2,11 @@ import {isString} from '@yoroi/common' import {useTheme} from '@yoroi/theme' import React, {forwardRef, ReactNode} from 'react' import { - type ViewProps, StyleSheet, Text, TouchableOpacity, View, + type ViewProps, } from 'react-native' import {Icon} from '../Icon' diff --git a/apps/wallet/src/components/Boundary/Boundary.tsx b/apps/wallet/src/components/Boundary/Boundary.tsx index c99d49fc43..4c936edf5e 100644 --- a/apps/wallet/src/components/Boundary/Boundary.tsx +++ b/apps/wallet/src/components/Boundary/Boundary.tsx @@ -1,3 +1,4 @@ +import {useQueryErrorResetBoundary} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React, {SuspenseProps} from 'react' import { @@ -15,7 +16,6 @@ import { View, ViewProps, } from 'react-native' -import {useQueryErrorResetBoundary} from '@tanstack/react-query' import image from '../../assets/img/error.png' import {LocalizableError} from '../../kernel/i18n/LocalizableError' diff --git a/apps/wallet/src/components/SafeArea.tsx b/apps/wallet/src/components/SafeArea.tsx index 6a19f4eec7..43683a1c05 100644 --- a/apps/wallet/src/components/SafeArea.tsx +++ b/apps/wallet/src/components/SafeArea.tsx @@ -2,8 +2,8 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {StyleSheet} from 'react-native' import { - type SafeAreaViewProps, SafeAreaView, + type SafeAreaViewProps, } from 'react-native-safe-area-context' export const SafeArea = ({children, ...rest}: SafeAreaViewProps) => { diff --git a/apps/wallet/src/features/Auth/common/hooks.ts b/apps/wallet/src/features/Auth/common/hooks.ts index 6520e2f481..61734601cd 100644 --- a/apps/wallet/src/features/Auth/common/hooks.ts +++ b/apps/wallet/src/features/Auth/common/hooks.ts @@ -1,3 +1,10 @@ +import { + useMutation, + UseMutationOptions, + useQuery, + useQueryClient, + UseQueryOptions, +} from '@tanstack/react-query' import { parseSafe, parseString, @@ -9,13 +16,6 @@ import * as React from 'react' import {defineMessages, useIntl} from 'react-intl' import {Alert, AppState, Platform} from 'react-native' import RNKeychain from 'react-native-keychain' -import { - useMutation, - UseMutationOptions, - useQuery, - useQueryClient, - UseQueryOptions, -} from '@tanstack/react-query' import {decryptData, encryptData} from '../../../kernel/encryption/encryption' import globalMessages from '../../../kernel/i18n/global-messages' diff --git a/apps/wallet/src/features/Auth/common/useEnableEasyConfirmation.tsx b/apps/wallet/src/features/Auth/common/useEnableEasyConfirmation.tsx index 5cb7107cdb..0f2ae53589 100644 --- a/apps/wallet/src/features/Auth/common/useEnableEasyConfirmation.tsx +++ b/apps/wallet/src/features/Auth/common/useEnableEasyConfirmation.tsx @@ -1,5 +1,5 @@ -import {useMutationWithInvalidations} from '@yoroi/common' import {UseMutationOptions} from '@tanstack/react-query' +import {useMutationWithInvalidations} from '@yoroi/common' import {YoroiWallet} from '../../../yoroi-wallets/cardano/types' import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' diff --git a/apps/wallet/src/features/Discover/common/ChainDAppsWarning.tsx b/apps/wallet/src/features/Discover/common/ChainDAppsWarning.tsx index b7c1e7fa6c..3f1cc5e80c 100644 --- a/apps/wallet/src/features/Discover/common/ChainDAppsWarning.tsx +++ b/apps/wallet/src/features/Discover/common/ChainDAppsWarning.tsx @@ -1,7 +1,7 @@ +import {useQuery} from '@tanstack/react-query' import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common' import {Chain} from '@yoroi/types' import * as React from 'react' -import {useQuery} from '@tanstack/react-query' import {GradientWarning} from '../../../components/ChainWarning/GradientWarning' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet/src/features/Discover/common/useDAppsConnected.tsx b/apps/wallet/src/features/Discover/common/useDAppsConnected.tsx index f26b742f68..c2def22127 100644 --- a/apps/wallet/src/features/Discover/common/useDAppsConnected.tsx +++ b/apps/wallet/src/features/Discover/common/useDAppsConnected.tsx @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {DappConnection, useDappConnector} from '@yoroi/dapp-connector' import {Chain} from '@yoroi/types' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet/src/features/Discover/common/useShowWelcomeDApp.tsx b/apps/wallet/src/features/Discover/common/useShowWelcomeDApp.tsx index 104e980d07..435d8b65ed 100644 --- a/apps/wallet/src/features/Discover/common/useShowWelcomeDApp.tsx +++ b/apps/wallet/src/features/Discover/common/useShowWelcomeDApp.tsx @@ -1,11 +1,11 @@ -import {isBoolean, useAsyncStorage} from '@yoroi/common' -import * as React from 'react' import { useMutation, UseMutationOptions, useQuery, UseQueryOptions, } from '@tanstack/react-query' +import {isBoolean, useAsyncStorage} from '@yoroi/common' +import * as React from 'react' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet/src/features/Exchange/common/useResetShowBuyBannerSmall.tsx b/apps/wallet/src/features/Exchange/common/useResetShowBuyBannerSmall.tsx index 55cff3468e..3b7a0e9e12 100644 --- a/apps/wallet/src/features/Exchange/common/useResetShowBuyBannerSmall.tsx +++ b/apps/wallet/src/features/Exchange/common/useResetShowBuyBannerSmall.tsx @@ -1,5 +1,5 @@ -import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common' import {UseMutationOptions} from '@tanstack/react-query' +import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' import {storageKeyShowBuyBannerSmall, storageRootExchange} from './constants' diff --git a/apps/wallet/src/features/Exchange/common/useShowBuyBannerSmall.tsx b/apps/wallet/src/features/Exchange/common/useShowBuyBannerSmall.tsx index 25c8851ea9..cc1f02930f 100644 --- a/apps/wallet/src/features/Exchange/common/useShowBuyBannerSmall.tsx +++ b/apps/wallet/src/features/Exchange/common/useShowBuyBannerSmall.tsx @@ -1,5 +1,5 @@ -import {isNumber, parseNumber, useAsyncStorage} from '@yoroi/common' import {useQuery, UseQueryOptions} from '@tanstack/react-query' +import {isNumber, parseNumber, useAsyncStorage} from '@yoroi/common' import {useBalances} from '../../../yoroi-wallets/hooks' import { diff --git a/apps/wallet/src/features/Initialization/ChooseBiometricLogin/ChooseBiometricLoginScreen.tsx b/apps/wallet/src/features/Initialization/ChooseBiometricLogin/ChooseBiometricLoginScreen.tsx index 1c796ae139..639889e075 100644 --- a/apps/wallet/src/features/Initialization/ChooseBiometricLogin/ChooseBiometricLoginScreen.tsx +++ b/apps/wallet/src/features/Initialization/ChooseBiometricLogin/ChooseBiometricLoginScreen.tsx @@ -1,3 +1,4 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import { parseBoolean, useAsyncStorage, @@ -8,7 +9,6 @@ import * as React from 'react' import {Alert, StyleSheet, Text, View} from 'react-native' import DeviceInfo from 'react-native-device-info' import {SafeAreaView} from 'react-native-safe-area-context' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {Button, ButtonType} from '../../../components/Button/Button' import {Space} from '../../../components/Space/Space' diff --git a/apps/wallet/src/features/Initialization/DarkThemeAnnouncement/DarkThemeAnnouncement.tsx b/apps/wallet/src/features/Initialization/DarkThemeAnnouncement/DarkThemeAnnouncement.tsx index 1404df156a..61db8db42d 100644 --- a/apps/wallet/src/features/Initialization/DarkThemeAnnouncement/DarkThemeAnnouncement.tsx +++ b/apps/wallet/src/features/Initialization/DarkThemeAnnouncement/DarkThemeAnnouncement.tsx @@ -1,3 +1,4 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import { parseBoolean, useAsyncStorage, @@ -9,7 +10,6 @@ import {defineMessages, useIntl} from 'react-intl' import {Platform, Pressable, StyleSheet, Switch, View} from 'react-native' import {ScrollView} from 'react-native-gesture-handler' import {SafeAreaView} from 'react-native-safe-area-context' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {Button} from '../../../components/Button/Button' import {Space} from '../../../components/Space/Space' diff --git a/apps/wallet/src/features/Initialization/common/terms.ts b/apps/wallet/src/features/Initialization/common/terms.ts index 6180eefbde..d57b7a920d 100644 --- a/apps/wallet/src/features/Initialization/common/terms.ts +++ b/apps/wallet/src/features/Initialization/common/terms.ts @@ -1,6 +1,6 @@ +import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' import {useAsyncStorage} from '@yoroi/common' import {useCallback} from 'react' -import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' import {agreementDate} from '../../../kernel/config' diff --git a/apps/wallet/src/features/Legal/PrivacyPolicy/PrivacyPolicy.tsx b/apps/wallet/src/features/Legal/PrivacyPolicy/PrivacyPolicy.tsx index c97178e787..a6439def09 100644 --- a/apps/wallet/src/features/Legal/PrivacyPolicy/PrivacyPolicy.tsx +++ b/apps/wallet/src/features/Legal/PrivacyPolicy/PrivacyPolicy.tsx @@ -1,8 +1,8 @@ +import {useQuery} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {ActivityIndicator, StyleSheet, View} from 'react-native' import Markdown from 'react-native-markdown-display' -import {useQuery} from '@tanstack/react-query' import {Spacer} from '../../../components/Spacer/Spacer' import {LanguageCode} from '../../../kernel/i18n/languages' diff --git a/apps/wallet/src/features/Legal/TermsOfService/TermsOfService.tsx b/apps/wallet/src/features/Legal/TermsOfService/TermsOfService.tsx index 444db463f7..681c51413f 100644 --- a/apps/wallet/src/features/Legal/TermsOfService/TermsOfService.tsx +++ b/apps/wallet/src/features/Legal/TermsOfService/TermsOfService.tsx @@ -1,8 +1,8 @@ +import {useQuery} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {ActivityIndicator, StyleSheet, View} from 'react-native' import Markdown from 'react-native-markdown-display' -import {useQuery} from '@tanstack/react-query' import {Spacer} from '../../../components/Spacer/Spacer' import {LanguageCode} from '../../../kernel/i18n/languages' diff --git a/apps/wallet/src/features/Portfolio/common/PnlTag/PnlTag.tsx b/apps/wallet/src/features/Portfolio/common/PnlTag/PnlTag.tsx index ac4dad7842..8ce32e9be3 100644 --- a/apps/wallet/src/features/Portfolio/common/PnlTag/PnlTag.tsx +++ b/apps/wallet/src/features/Portfolio/common/PnlTag/PnlTag.tsx @@ -1,6 +1,6 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' -import {type ViewProps, StyleSheet, Text, View} from 'react-native' +import {StyleSheet, Text, View, type ViewProps} from 'react-native' import {Icon} from '../../../../components/Icon' diff --git a/apps/wallet/src/features/Portfolio/common/PortfolioTokenActivityProvider.tsx b/apps/wallet/src/features/Portfolio/common/PortfolioTokenActivityProvider.tsx index 0c13bb56d6..a38df80c4a 100644 --- a/apps/wallet/src/features/Portfolio/common/PortfolioTokenActivityProvider.tsx +++ b/apps/wallet/src/features/Portfolio/common/PortfolioTokenActivityProvider.tsx @@ -1,9 +1,9 @@ +import {useQuery, useQueryClient} from '@tanstack/react-query' import {invalid, isNonNullable} from '@yoroi/common' import {isPrimaryToken} from '@yoroi/portfolio' import {Portfolio} from '@yoroi/types' import {freeze, produce} from 'immer' import React from 'react' -import {useQuery, useQueryClient} from '@tanstack/react-query' import {merge, switchMap} from 'rxjs' import {time} from '../../../kernel/constants' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/useGetLiquidityPool.ts b/apps/wallet/src/features/Portfolio/common/hooks/useGetLiquidityPool.ts index 00d4660960..1c8012eefe 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/useGetLiquidityPool.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/useGetLiquidityPool.ts @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {Portfolio} from '@yoroi/types' import {ImageSourcePropType} from 'react-native' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {getDappFallbackLogo} from '../../../Discover/common/helpers' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/useGetOpenOrders.ts b/apps/wallet/src/features/Portfolio/common/hooks/useGetOpenOrders.ts index 7027bd23e5..3620ae2f67 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/useGetOpenOrders.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/useGetOpenOrders.ts @@ -1,5 +1,5 @@ -import {ImageSourcePropType} from 'react-native' import {useQuery, UseQueryOptions} from '@tanstack/react-query' +import {ImageSourcePropType} from 'react-native' import {getDappFallbackLogo} from '../../../Discover/common/helpers' import {IAsset, mockAmount} from './useGetLiquidityPool' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts b/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts index 8b7b3666c8..7ad3e0200a 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts @@ -1,7 +1,7 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {isRight} from '@yoroi/common' import {isPrimaryToken} from '@yoroi/portfolio' import {Chain, Portfolio} from '@yoroi/types' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {supportedCurrencies, time} from '../../../../kernel/constants' import {useLanguage} from '../../../../kernel/i18n' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenInfo.ts b/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenInfo.ts index 7071fb4816..9f505b93e8 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenInfo.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/useGetPortfolioTokenInfo.ts @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {type Portfolio} from '@yoroi/types' import {ImageSourcePropType} from 'react-native' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import AdaLogo from '../../../../assets/img/ada.png' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioImage.ts b/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioImage.ts index fbf97f31b7..040f5559a4 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioImage.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioImage.ts @@ -1,6 +1,6 @@ +import {useMutation} from '@tanstack/react-query' import {Portfolio} from '@yoroi/types' import {Image} from 'expo-image' -import {useMutation} from '@tanstack/react-query' import {useSelectedNetwork} from '../../../WalletManager/common/hooks/useSelectedNetwork' diff --git a/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts b/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts index d2df3738ee..49e54ee78a 100644 --- a/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts +++ b/apps/wallet/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {createUnknownTokenInfo, isPrimaryToken} from '@yoroi/portfolio' import {Portfolio} from '@yoroi/types' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' diff --git a/apps/wallet/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ZoomMediaImageScreen.tsx b/apps/wallet/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ZoomMediaImageScreen.tsx index 5e3b0fadc4..5024fd6e89 100644 --- a/apps/wallet/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ZoomMediaImageScreen.tsx +++ b/apps/wallet/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ZoomMediaImageScreen.tsx @@ -1,7 +1,6 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {StyleSheet, useWindowDimensions, View} from 'react-native' - // @ts-ignore import ViewTransformer from 'react-native-easy-view-transformer' diff --git a/apps/wallet/src/features/Receive/common/useMultipleAddressesInfo.tsx b/apps/wallet/src/features/Receive/common/useMultipleAddressesInfo.tsx index a92a3ab7be..c733ef0094 100644 --- a/apps/wallet/src/features/Receive/common/useMultipleAddressesInfo.tsx +++ b/apps/wallet/src/features/Receive/common/useMultipleAddressesInfo.tsx @@ -1,14 +1,14 @@ +import { + UseMutationOptions, + useQuery, + UseQueryOptions, +} from '@tanstack/react-query' import { isBoolean, parseSafe, useAsyncStorage, useMutationWithInvalidations, } from '@yoroi/common' -import { - UseMutationOptions, - useQuery, - UseQueryOptions, -} from '@tanstack/react-query' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet/src/features/RegisterCatalyst/common/hooks.ts b/apps/wallet/src/features/RegisterCatalyst/common/hooks.ts index f99890640e..c62bc31409 100644 --- a/apps/wallet/src/features/RegisterCatalyst/common/hooks.ts +++ b/apps/wallet/src/features/RegisterCatalyst/common/hooks.ts @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {Catalyst, useCatalyst} from '@yoroi/staking' import {App} from '@yoroi/types' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {time} from '../../../kernel/constants' import {throwLoggedError} from '../../../kernel/logger/helpers/throw-logged-error' diff --git a/apps/wallet/src/features/RegisterCatalyst/useCases/ConfirmPin/ConfirmPin.tsx b/apps/wallet/src/features/RegisterCatalyst/useCases/ConfirmPin/ConfirmPin.tsx index cf627f1b7a..08110c4685 100644 --- a/apps/wallet/src/features/RegisterCatalyst/useCases/ConfirmPin/ConfirmPin.tsx +++ b/apps/wallet/src/features/RegisterCatalyst/useCases/ConfirmPin/ConfirmPin.tsx @@ -1,3 +1,4 @@ +import {useMutation, UseMutationOptions} from '@tanstack/react-query' import {useCatalyst} from '@yoroi/staking' import {useTheme} from '@yoroi/theme' import React from 'react' @@ -9,7 +10,6 @@ import { ViewProps, } from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {useMutation, UseMutationOptions} from '@tanstack/react-query' import {Button} from '../../../../components/Button/Button' import { diff --git a/apps/wallet/src/features/ReviewTx/common/hooks/useFormattedTx.tsx b/apps/wallet/src/features/ReviewTx/common/hooks/useFormattedTx.tsx index c334f32b76..c3ef96f926 100644 --- a/apps/wallet/src/features/ReviewTx/common/hooks/useFormattedTx.tsx +++ b/apps/wallet/src/features/ReviewTx/common/hooks/useFormattedTx.tsx @@ -1,9 +1,9 @@ import {CredKind} from '@emurgo/cross-csl-core' +import {useQuery} from '@tanstack/react-query' import {isNonNullable} from '@yoroi/common' import {infoExtractName} from '@yoroi/portfolio' import {Portfolio} from '@yoroi/types' import _ from 'lodash' -import {useQuery} from '@tanstack/react-query' import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' import {deriveRewardAddressFromAddress} from '../../../../yoroi-wallets/cardano/utils' diff --git a/apps/wallet/src/features/ReviewTx/common/operations.tsx b/apps/wallet/src/features/ReviewTx/common/operations.tsx index 4c3097aa8e..a8c9521980 100644 --- a/apps/wallet/src/features/ReviewTx/common/operations.tsx +++ b/apps/wallet/src/features/ReviewTx/common/operations.tsx @@ -1,8 +1,8 @@ +import {useQuery} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import * as React from 'react' import {Linking, StyleSheet, Text, View} from 'react-native' import {TouchableOpacity} from 'react-native-gesture-handler' -import {useQuery} from '@tanstack/react-query' import {Space} from '../../../components/Space/Space' import {wrappedCsl} from '../../../yoroi-wallets/cardano/wrappedCsl' diff --git a/apps/wallet/src/features/Send/common/useSendAddress.tsx b/apps/wallet/src/features/Send/common/useSendAddress.tsx index a723b392a7..3c55d3b133 100644 --- a/apps/wallet/src/features/Send/common/useSendAddress.tsx +++ b/apps/wallet/src/features/Send/common/useSendAddress.tsx @@ -1,7 +1,7 @@ import {normalizeToAddress} from '@emurgo/yoroi-lib/dist/internals/utils/addresses' +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {useTransfer} from '@yoroi/transfer' import * as React from 'react' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {CardanoMobile} from '../../../yoroi-wallets/wallets' import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet/src/features/Send/common/useSendReceiver.tsx b/apps/wallet/src/features/Send/common/useSendReceiver.tsx index cf25847549..2a8ada8153 100644 --- a/apps/wallet/src/features/Send/common/useSendReceiver.tsx +++ b/apps/wallet/src/features/Send/common/useSendReceiver.tsx @@ -1,3 +1,4 @@ +import {useQueryClient} from '@tanstack/react-query' import { isDomain, isNameServer, @@ -7,7 +8,6 @@ import { import {useTransfer} from '@yoroi/transfer' import {Resolver} from '@yoroi/types' import * as React from 'react' -import {useQueryClient} from '@tanstack/react-query' export const useSendReceiver = () => { const queryClient = useQueryClient() diff --git a/apps/wallet/src/features/Send/useCases/ListAmountsToSend/ListAmountsToSendScreen.tsx b/apps/wallet/src/features/Send/useCases/ListAmountsToSend/ListAmountsToSendScreen.tsx index 7422f8dbee..8c6452b771 100644 --- a/apps/wallet/src/features/Send/useCases/ListAmountsToSend/ListAmountsToSendScreen.tsx +++ b/apps/wallet/src/features/Send/useCases/ListAmountsToSend/ListAmountsToSendScreen.tsx @@ -1,4 +1,5 @@ import {useNavigation} from '@react-navigation/native' +import {useMutation} from '@tanstack/react-query' import {isNft} from '@yoroi/portfolio' import {useTheme} from '@yoroi/theme' import {useTransfer} from '@yoroi/transfer' @@ -9,7 +10,6 @@ import {defineMessages, useIntl} from 'react-intl' import {StyleSheet, TouchableOpacity, View, ViewProps} from 'react-native' import {FlatList} from 'react-native-gesture-handler' import {SafeAreaView} from 'react-native-safe-area-context' -import {useMutation} from '@tanstack/react-query' import {Boundary} from '../../../../components/Boundary/Boundary' import {Button} from '../../../../components/Button/Button' diff --git a/apps/wallet/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx b/apps/wallet/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx index dd608fb1fe..b74de1c504 100644 --- a/apps/wallet/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx +++ b/apps/wallet/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx @@ -1,3 +1,8 @@ +import { + UseMutationOptions, + useQuery, + UseQueryOptions, +} from '@tanstack/react-query' import { isBoolean, parseSafe, @@ -8,11 +13,6 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {Platform, StyleSheet, Text, View} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import { - UseMutationOptions, - useQuery, - UseQueryOptions, -} from '@tanstack/react-query' import {Boundary} from '../../../../../components/Boundary/Boundary' import {Button} from '../../../../../components/Button/Button' diff --git a/apps/wallet/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx b/apps/wallet/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx index d80ebd8095..93d894f687 100644 --- a/apps/wallet/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx +++ b/apps/wallet/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx @@ -1,12 +1,12 @@ -import {parseSafe, useAsyncStorage} from '@yoroi/common' -import {App} from '@yoroi/types' -import React from 'react' import { useMutation, UseMutationOptions, useQuery, useQueryClient, } from '@tanstack/react-query' +import {parseSafe, useAsyncStorage} from '@yoroi/common' +import {App} from '@yoroi/types' +import React from 'react' import { configCurrencies, diff --git a/apps/wallet/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx b/apps/wallet/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx index 2007f79afd..362aa3fa8b 100644 --- a/apps/wallet/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx +++ b/apps/wallet/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx @@ -1,9 +1,9 @@ +import {UseMutationOptions, useQuery} from '@tanstack/react-query' import { parseSafe, useAsyncStorage, useMutationWithInvalidations, } from '@yoroi/common' -import {UseMutationOptions, useQuery} from '@tanstack/react-query' const useReadPrivacyMode = () => { const storage = useAsyncStorage() diff --git a/apps/wallet/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts b/apps/wallet/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts index 3bd443a171..08ab20ba8a 100644 --- a/apps/wallet/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts +++ b/apps/wallet/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts @@ -1,3 +1,4 @@ +import {useQuery} from '@tanstack/react-query' import { isBoolean, useAsyncStorage, @@ -5,7 +6,6 @@ import { } from '@yoroi/common' import {useEffect, useState} from 'react' import {NativeModules, Platform} from 'react-native' -import {useQuery} from '@tanstack/react-query' const {FlagSecure} = NativeModules diff --git a/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx b/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx index 3afc61c541..455b44f12e 100644 --- a/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx +++ b/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx @@ -1,4 +1,5 @@ import {useNavigation} from '@react-navigation/native' +import {MutationOptions, useMutation} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {defineMessages, useIntl} from 'react-intl' @@ -10,7 +11,6 @@ import { ViewProps, } from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {MutationOptions, useMutation} from '@tanstack/react-query' import {Button} from '../../../../../components/Button/Button' import {KeyboardAvoidingView} from '../../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' diff --git a/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx b/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx index 98e70aad2e..12d2315145 100644 --- a/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx +++ b/apps/wallet/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx @@ -1,3 +1,4 @@ +import {useMutation} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import {Portfolio} from '@yoroi/types' import BigNumber from 'bignumber.js' @@ -14,7 +15,6 @@ import { ViewProps, } from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {useMutation} from '@tanstack/react-query' import {Button} from '../../../../../components/Button/Button' import {CopyButton} from '../../../../../components/CopyButton' diff --git a/apps/wallet/src/features/Staking/Governance/common/helpers.tsx b/apps/wallet/src/features/Staking/Governance/common/helpers.tsx index be043be742..f0f3563938 100644 --- a/apps/wallet/src/features/Staking/Governance/common/helpers.tsx +++ b/apps/wallet/src/features/Staking/Governance/common/helpers.tsx @@ -1,8 +1,8 @@ import {useAsyncStorage} from '@yoroi/common' import { - type StakingKeyState, governanceApiMaker, governanceManagerMaker, + type StakingKeyState, useStakingKeyState, useUpdateLatestGovernanceAction, } from '@yoroi/staking' diff --git a/apps/wallet/src/features/Swap/common/helpers.ts b/apps/wallet/src/features/Swap/common/helpers.ts index c2175dd4b7..f6bda68ca9 100644 --- a/apps/wallet/src/features/Swap/common/helpers.ts +++ b/apps/wallet/src/features/Swap/common/helpers.ts @@ -1,8 +1,8 @@ +import {useMutation, UseMutationOptions} from '@tanstack/react-query' import {createTypeGuardFromSchema, parseSafe} from '@yoroi/common' import {useTheme} from '@yoroi/theme' import {HW} from '@yoroi/types' import {SwapApi} from '@yoroi/types/src/swap/api' -import {useMutation, UseMutationOptions} from '@tanstack/react-query' import {z} from 'zod' import {normalisePtId} from '../../../kernel/helpers/normalisePtId' diff --git a/apps/wallet/src/features/Swap/common/useSwapTx.ts b/apps/wallet/src/features/Swap/common/useSwapTx.ts index d3f32fc10d..a592e8a727 100644 --- a/apps/wallet/src/features/Swap/common/useSwapTx.ts +++ b/apps/wallet/src/features/Swap/common/useSwapTx.ts @@ -1,6 +1,6 @@ +import {UseMutationOptions} from '@tanstack/react-query' import {useMutationWithInvalidations} from '@yoroi/common' import {useSwap} from '@yoroi/swap' -import {UseMutationOptions} from '@tanstack/react-query' import {YoroiEntry, YoroiUnsignedTx} from '../../../yoroi-wallets/types/yoroi' import {splitStringInto64CharArray} from '../../../yoroi-wallets/utils/utils' diff --git a/apps/wallet/src/features/WalletManager/common/hooks/useBestBlock.tsx b/apps/wallet/src/features/WalletManager/common/hooks/useBestBlock.tsx index b7a7e6277b..79fa884f2f 100644 --- a/apps/wallet/src/features/WalletManager/common/hooks/useBestBlock.tsx +++ b/apps/wallet/src/features/WalletManager/common/hooks/useBestBlock.tsx @@ -1,5 +1,5 @@ -import {Chain} from '@yoroi/types' import {useQuery, UseQueryOptions} from '@tanstack/react-query' +import {Chain} from '@yoroi/types' import {useSelectedNetwork} from './useSelectedNetwork' diff --git a/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletMnemonic.tsx b/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletMnemonic.tsx index b13936d08f..604317437c 100644 --- a/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletMnemonic.tsx +++ b/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletMnemonic.tsx @@ -1,5 +1,5 @@ -import {Wallet} from '@yoroi/types' import {useMutation, UseMutationOptions} from '@tanstack/react-query' +import {Wallet} from '@yoroi/types' import {useWalletManager} from '../../context/WalletManagerProvider' diff --git a/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletXPub.tsx b/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletXPub.tsx index 4038553056..6fc409d22b 100644 --- a/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletXPub.tsx +++ b/apps/wallet/src/features/WalletManager/common/hooks/useCreateWalletXPub.tsx @@ -1,5 +1,5 @@ -import {HW, Wallet} from '@yoroi/types' import {useMutation, UseMutationOptions} from '@tanstack/react-query' +import {HW, Wallet} from '@yoroi/types' import {useWalletManager} from '../../context/WalletManagerProvider' diff --git a/apps/wallet/src/kernel/i18n/LanguageProvider.tsx b/apps/wallet/src/kernel/i18n/LanguageProvider.tsx index e5469c9b50..28ae1032ce 100644 --- a/apps/wallet/src/kernel/i18n/LanguageProvider.tsx +++ b/apps/wallet/src/kernel/i18n/LanguageProvider.tsx @@ -1,10 +1,3 @@ -import {parseSafe, useAsyncStorage} from '@yoroi/common' -import React, {useMemo} from 'react' -import {IntlProvider} from 'react-intl' -import {Text} from 'react-native' - -// @ts-ignore -import TimeZone from 'react-native-timezone' import { QueryKey, QueryObserver, @@ -14,6 +7,12 @@ import { useQueryClient, UseQueryOptions, } from '@tanstack/react-query' +import {parseSafe, useAsyncStorage} from '@yoroi/common' +import React, {useMemo} from 'react' +import {IntlProvider} from 'react-intl' +import {Text} from 'react-native' +// @ts-ignore +import TimeZone from 'react-native-timezone' import {numberLocale, systemLocale} from './initialization' import {LanguageCode, NumberLocale, supportedLanguages} from './languages' diff --git a/apps/wallet/src/kernel/query-client.ts b/apps/wallet/src/kernel/query-client.ts index 663e52d192..8b60d3938b 100644 --- a/apps/wallet/src/kernel/query-client.ts +++ b/apps/wallet/src/kernel/query-client.ts @@ -1,5 +1,5 @@ -import {freeze} from 'immer' import {QueryClient} from '@tanstack/react-query' +import {freeze} from 'immer' import { ptPriceQueryFn, diff --git a/apps/wallet/src/legacy/Dashboard/StakePoolInfo.tsx b/apps/wallet/src/legacy/Dashboard/StakePoolInfo.tsx index 057961e12c..4fad0dcc20 100644 --- a/apps/wallet/src/legacy/Dashboard/StakePoolInfo.tsx +++ b/apps/wallet/src/legacy/Dashboard/StakePoolInfo.tsx @@ -1,8 +1,8 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {defineMessages, useIntl} from 'react-intl' import {ActivityIndicator, Linking, StyleSheet, View} from 'react-native' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {Button, ButtonType} from '../../components/Button/Button' import {CopyButton} from '../../components/CopyButton' diff --git a/apps/wallet/src/legacy/Dashboard/StakePoolInfos.tsx b/apps/wallet/src/legacy/Dashboard/StakePoolInfos.tsx index abe177f058..4190e6e38b 100644 --- a/apps/wallet/src/legacy/Dashboard/StakePoolInfos.tsx +++ b/apps/wallet/src/legacy/Dashboard/StakePoolInfos.tsx @@ -1,8 +1,8 @@ +import {useQuery, useQueryClient, UseQueryOptions} from '@tanstack/react-query' import {Balance, Wallet} from '@yoroi/types' import BigNumber from 'bignumber.js' import React from 'react' import {ActivityIndicator, StyleSheet, View} from 'react-native' -import {useQuery, useQueryClient, UseQueryOptions} from '@tanstack/react-query' import {useSelectedWallet} from '../../features/WalletManager/common/hooks/useSelectedWallet' import {YoroiWallet} from '../../yoroi-wallets/cardano/types' diff --git a/apps/wallet/src/legacy/Staking/PoolDetails/PoolDetailScreen.tsx b/apps/wallet/src/legacy/Staking/PoolDetails/PoolDetailScreen.tsx index 5fc97c4c11..06a96935e2 100644 --- a/apps/wallet/src/legacy/Staking/PoolDetails/PoolDetailScreen.tsx +++ b/apps/wallet/src/legacy/Staking/PoolDetails/PoolDetailScreen.tsx @@ -1,8 +1,8 @@ +import {useQuery} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {defineMessages, useIntl} from 'react-intl' import {StyleSheet} from 'react-native' -import {useQuery} from '@tanstack/react-query' import {Button} from '../../../components/Button/Button' import {GradientWarning} from '../../../components/ChainWarning/GradientWarning' diff --git a/apps/wallet/src/legacy/Staking/PoolTransition/usePoolTransition.tsx b/apps/wallet/src/legacy/Staking/PoolTransition/usePoolTransition.tsx index c29d7e1d6e..fd629a96a7 100644 --- a/apps/wallet/src/legacy/Staking/PoolTransition/usePoolTransition.tsx +++ b/apps/wallet/src/legacy/Staking/PoolTransition/usePoolTransition.tsx @@ -1,10 +1,10 @@ import {init} from '@emurgo/cross-csl-mobile' import {PoolInfoApi} from '@emurgo/yoroi-lib' +import {useQuery} from '@tanstack/react-query' import {Wallet} from '@yoroi/types' import BigNumber from 'bignumber.js' import * as React from 'react' import {defineMessages, useIntl} from 'react-intl' -import {useQuery} from '@tanstack/react-query' import {useReviewTx} from '../../../features/ReviewTx/common/ReviewTxProvider' import {useSelectedNetwork} from '../../../features/WalletManager/common/hooks/useSelectedNetwork' diff --git a/apps/wallet/src/legacy/Staking/StakingCenter/StakingCenter.tsx b/apps/wallet/src/legacy/Staking/StakingCenter/StakingCenter.tsx index 881c7033d3..a52156160d 100644 --- a/apps/wallet/src/legacy/Staking/StakingCenter/StakingCenter.tsx +++ b/apps/wallet/src/legacy/Staking/StakingCenter/StakingCenter.tsx @@ -1,11 +1,11 @@ import {useFocusEffect} from '@react-navigation/native' +import {useQueryClient} from '@tanstack/react-query' import {useTheme} from '@yoroi/theme' import React from 'react' import {defineMessages, useIntl} from 'react-intl' import {StyleSheet, View} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' import {WebView, WebViewMessageEvent} from 'react-native-webview' -import {useQueryClient} from '@tanstack/react-query' import {PleaseWaitModal} from '../../../components/PleaseWaitModal' import {Spacer} from '../../../components/Spacer/Spacer' diff --git a/apps/wallet/src/yoroi-wallets/cardano/hw/hw.ts b/apps/wallet/src/yoroi-wallets/cardano/hw/hw.ts index 6e89c9ed33..42f1578239 100644 --- a/apps/wallet/src/yoroi-wallets/cardano/hw/hw.ts +++ b/apps/wallet/src/yoroi-wallets/cardano/hw/hw.ts @@ -9,7 +9,6 @@ import type { import AppAda, { DeviceStatusCodes, } from '@cardano-foundation/ledgerjs-hw-app-cardano' - // @ts-ignore import TransportHID from '@emurgo/react-native-hid' import TransportBLE from '@ledgerhq/react-native-hw-transport-ble' diff --git a/apps/wallet/src/yoroi-wallets/cardano/mnemonic/mnemonic.ts b/apps/wallet/src/yoroi-wallets/cardano/mnemonic/mnemonic.ts index 26e330b7ea..9b98acd00e 100644 --- a/apps/wallet/src/yoroi-wallets/cardano/mnemonic/mnemonic.ts +++ b/apps/wallet/src/yoroi-wallets/cardano/mnemonic/mnemonic.ts @@ -1,6 +1,5 @@ import {WasmModuleProxy} from '@emurgo/cross-csl-core' import {generateMnemonic, mnemonicToEntropy} from 'bip39' - // @ts-ignore import {randomBytes} from 'react-native-randombytes' diff --git a/apps/wallet/src/yoroi-wallets/cardano/usePrimaryTokenActivity.tsx b/apps/wallet/src/yoroi-wallets/cardano/usePrimaryTokenActivity.tsx index 055c5d6448..dad2a96577 100644 --- a/apps/wallet/src/yoroi-wallets/cardano/usePrimaryTokenActivity.tsx +++ b/apps/wallet/src/yoroi-wallets/cardano/usePrimaryTokenActivity.tsx @@ -1,6 +1,6 @@ +import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {fetchData, isRight} from '@yoroi/common' import {Chain} from '@yoroi/types' -import {useQuery, UseQueryOptions} from '@tanstack/react-query' import {networkConfigs} from '../../features/WalletManager/network-manager/network-manager' import {time} from '../../kernel/constants' diff --git a/apps/wallet/src/yoroi-wallets/cardano/utxoManager/useSetCollateralId.tsx b/apps/wallet/src/yoroi-wallets/cardano/utxoManager/useSetCollateralId.tsx index 98c6a6e30e..623894c96c 100644 --- a/apps/wallet/src/yoroi-wallets/cardano/utxoManager/useSetCollateralId.tsx +++ b/apps/wallet/src/yoroi-wallets/cardano/utxoManager/useSetCollateralId.tsx @@ -1,5 +1,5 @@ -import {useMutationWithInvalidations} from '@yoroi/common' import {UseMutationOptions} from '@tanstack/react-query' +import {useMutationWithInvalidations} from '@yoroi/common' import {RawUtxo} from '../../types/other' import {YoroiWallet} from '../types' diff --git a/apps/wallet/src/yoroi-wallets/hooks/index.ts b/apps/wallet/src/yoroi-wallets/hooks/index.ts index 70c8bca001..157f17fef4 100644 --- a/apps/wallet/src/yoroi-wallets/hooks/index.ts +++ b/apps/wallet/src/yoroi-wallets/hooks/index.ts @@ -4,6 +4,15 @@ import {PoolInfoApi} from '@emurgo/yoroi-lib' import AsyncStorage, { AsyncStorageStatic, } from '@react-native-async-storage/async-storage' +import { + onlineManager, + useMutation, + UseMutationOptions, + useQueries, + useQuery, + useQueryClient, + UseQueryOptions, +} from '@tanstack/react-query' import { mountMMKVStorage, observableStorageMaker, @@ -16,15 +25,6 @@ import {Buffer} from 'buffer' import * as React from 'react' import {useCallback, useMemo} from 'react' import {PixelRatio, Platform} from 'react-native' -import { - onlineManager, - useMutation, - UseMutationOptions, - useQueries, - useQuery, - useQueryClient, - UseQueryOptions, -} from '@tanstack/react-query' import {cardanoConfig} from '../../features/WalletManager/common/adapters/cardano/cardano-config' import {useSelectedNetwork} from '../../features/WalletManager/common/hooks/useSelectedNetwork' diff --git a/apps/wallet/src/yoroi-wallets/hw/hw.ts b/apps/wallet/src/yoroi-wallets/hw/hw.ts index a8c2321900..935d80f114 100644 --- a/apps/wallet/src/yoroi-wallets/hw/hw.ts +++ b/apps/wallet/src/yoroi-wallets/hw/hw.ts @@ -1,5 +1,5 @@ -import {Permission, PermissionsAndroid, Platform} from 'react-native' import {useMutation, UseMutationOptions} from '@tanstack/react-query' +import {Permission, PermissionsAndroid, Platform} from 'react-native' import {ledgerMessages} from '../../kernel/i18n/global-messages' import {LocalizableError} from '../../kernel/i18n/LocalizableError' diff --git a/apps/wallet/tsconfig.json b/apps/wallet/tsconfig.json index e0ffbbe0c5..9f4680bb94 100644 --- a/apps/wallet/tsconfig.json +++ b/apps/wallet/tsconfig.json @@ -3,5 +3,6 @@ "include": [ "./.d.ts", "./src" - ] + ], + "exclude": ["stories/"] } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 7774a26c28..edda3cae80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4449,6 +4449,21 @@ natural-compare "^1.4.0" ts-api-utils "^1.3.0" +"@typescript-eslint/eslint-plugin@^8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.16.0.tgz#ac56825bcdf3b392fc76a94b1315d4a162f201a6" + integrity sha512-5YTHKV8MYlyMI6BaEG7crQ9BhSc8RxzshOReKwZwRWN0+XvvTOm+L/UYLCYxFpfwYuAAqhxiq4yae0CMFwbL7Q== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "8.16.0" + "@typescript-eslint/type-utils" "8.16.0" + "@typescript-eslint/utils" "8.16.0" + "@typescript-eslint/visitor-keys" "8.16.0" + graphemer "^1.4.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + ts-api-utils "^1.3.0" + "@typescript-eslint/parser@^5.30.5": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" @@ -4470,6 +4485,17 @@ "@typescript-eslint/visitor-keys" "7.18.0" debug "^4.3.4" +"@typescript-eslint/parser@^8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.16.0.tgz#ee5b2d6241c1ab3e2e53f03fd5a32d8e266d8e06" + integrity sha512-D7DbgGFtsqIPIFMPJwCad9Gfi/hC0PWErRRHFnaCWoEDYi5tQUDiJCTmGUbBiLzjqAck4KcXt9Ayj0CNlIrF+w== + dependencies: + "@typescript-eslint/scope-manager" "8.16.0" + "@typescript-eslint/types" "8.16.0" + "@typescript-eslint/typescript-estree" "8.16.0" + "@typescript-eslint/visitor-keys" "8.16.0" + debug "^4.3.4" + "@typescript-eslint/scope-manager@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" @@ -4486,6 +4512,14 @@ "@typescript-eslint/types" "7.18.0" "@typescript-eslint/visitor-keys" "7.18.0" +"@typescript-eslint/scope-manager@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.16.0.tgz#ebc9a3b399a69a6052f3d88174456dd399ef5905" + integrity sha512-mwsZWubQvBki2t5565uxF0EYvG+FwdFb8bMtDuGQLdCCnGPrDEDvm1gtfynuKlnpzeBRqdFCkMf9jg1fnAK8sg== + dependencies: + "@typescript-eslint/types" "8.16.0" + "@typescript-eslint/visitor-keys" "8.16.0" + "@typescript-eslint/type-utils@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" @@ -4506,6 +4540,16 @@ debug "^4.3.4" ts-api-utils "^1.3.0" +"@typescript-eslint/type-utils@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.16.0.tgz#585388735f7ac390f07c885845c3d185d1b64740" + integrity sha512-IqZHGG+g1XCWX9NyqnI/0CX5LL8/18awQqmkZSl2ynn8F76j579dByc0jhfVSnSnhf7zv76mKBQv9HQFKvDCgg== + dependencies: + "@typescript-eslint/typescript-estree" "8.16.0" + "@typescript-eslint/utils" "8.16.0" + debug "^4.3.4" + ts-api-utils "^1.3.0" + "@typescript-eslint/types@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" @@ -4516,6 +4560,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.18.0.tgz#b90a57ccdea71797ffffa0321e744f379ec838c9" integrity sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ== +"@typescript-eslint/types@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.16.0.tgz#49c92ae1b57942458ab83d9ec7ccab3005e64737" + integrity sha512-NzrHj6thBAOSE4d9bsuRNMvk+BvaQvmY4dDglgkgGC0EW/tB3Kelnp3tAKH87GEwzoxgeQn9fNGRyFJM/xd+GQ== + "@typescript-eslint/typescript-estree@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" @@ -4543,6 +4592,20 @@ semver "^7.6.0" ts-api-utils "^1.3.0" +"@typescript-eslint/typescript-estree@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.16.0.tgz#9d741e56e5b13469b5190e763432ce5551a9300c" + integrity sha512-E2+9IzzXMc1iaBy9zmo+UYvluE3TW7bCGWSF41hVWUE01o8nzr1rvOQYSxelxr6StUvRcTMe633eY8mXASMaNw== + dependencies: + "@typescript-eslint/types" "8.16.0" + "@typescript-eslint/visitor-keys" "8.16.0" + debug "^4.3.4" + fast-glob "^3.3.2" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + "@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.10.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" @@ -4567,6 +4630,16 @@ "@typescript-eslint/types" "7.18.0" "@typescript-eslint/typescript-estree" "7.18.0" +"@typescript-eslint/utils@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.16.0.tgz#c71264c437157feaa97842809836254a6fc833c3" + integrity sha512-C1zRy/mOL8Pj157GiX4kaw7iyRLKfJXBR3L82hk5kS/GyHcOFmy4YUq/zfZti72I9wnuQtA/+xzft4wCC8PJdA== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "8.16.0" + "@typescript-eslint/types" "8.16.0" + "@typescript-eslint/typescript-estree" "8.16.0" + "@typescript-eslint/visitor-keys@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" @@ -4583,6 +4656,14 @@ "@typescript-eslint/types" "7.18.0" eslint-visitor-keys "^3.4.3" +"@typescript-eslint/visitor-keys@8.16.0": + version "8.16.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.16.0.tgz#d5086afc060b01ff7a4ecab8d49d13d5a7b07705" + integrity sha512-pq19gbaMOmFE3CbL0ZB8J8BFCo2ckfHBfaIsaOZgBIF4EoISJIdLX5xRhd0FGB0LlHReNRuzoJoMGpTjq8F2CQ== + dependencies: + "@typescript-eslint/types" "8.16.0" + eslint-visitor-keys "^4.2.0" + "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" @@ -8028,6 +8109,11 @@ eslint-plugin-react@^7.30.1: string.prototype.matchall "^4.0.11" string.prototype.repeat "^1.0.0" +eslint-plugin-simple-import-sort@^12.1.1: + version "12.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz#e64bfdaf91c5b98a298619aa634a9f7aa43b709e" + integrity sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA== + eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -8054,6 +8140,11 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== +eslint-visitor-keys@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" + integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== + eslint@^8.19.0, eslint@^8.4.1, eslint@^8.46.0: version "8.57.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" @@ -15757,7 +15848,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -15852,7 +15952,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -15866,6 +15966,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -17125,7 +17232,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -17161,6 +17268,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"