Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
wolverineks committed Feb 10, 2023
1 parent 4225e89 commit 9e3b10f
Show file tree
Hide file tree
Showing 39 changed files with 157 additions and 145 deletions.
2 changes: 1 addition & 1 deletion src/Catalyst/ConfirmPin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {ScrollView, StyleSheet, View} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'

import {PinInputKeyboard, ProgressStep, Spacer} from '../components'
import {showErrorDialog} from '../dialogs'
import {errorMessages} from '../i18n/global-messages'
import {showErrorDialog} from '../legacy/actions'
import {Description, PinBox, Row, Title} from './components'

const PIN_LENGTH = 4
Expand Down
2 changes: 1 addition & 1 deletion src/Receive/AddressModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {StyleSheet, View} from 'react-native'
import QRCode from 'react-native-qrcode-svg'

import {CopyButton, Modal, Spacer, Text} from '../components'
import {AddressType, formatPath} from '../legacy/commonUtils'
import {useSelectedWallet} from '../SelectedWallet'
import {AddressType, formatPath} from '../yoroi-wallets'
import {getSpendingKey, getStakingKey} from '../yoroi-wallets/cardano/addressInfo'

type Path = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {FlatList, InteractionManager, Linking, RefreshControl, StyleSheet, Text,
import {SafeAreaView} from 'react-native-safe-area-context'

import {Button, Icon, PleaseWaitModal, StatusBar} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {useOpenWallet, useWalletMetas} from '../../hooks'
import globalMessages, {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG, isNightly} from '../../legacy/config'
import {InvalidState, NetworkError} from '../../legacy/errors'
import {isJormungandr} from '../../legacy/networks'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {SafeAreaView} from 'react-native-safe-area-context'
import {useEnableEasyConfirmation} from '../../auth'
import {Button, StatusBar, Text, TextInput} from '../../components'
import {LoadingOverlay} from '../../components/LoadingOverlay'
import {showErrorDialog} from '../../dialogs'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {WrongPassword} from '../../legacy/errors'
import {isEmptyString} from '../../legacy/utils'
import {useSelectedWallet, useSelectedWalletMeta, useSetSelectedWalletMeta} from '../../SelectedWallet'
Expand Down
2 changes: 1 addition & 1 deletion src/Settings/WalletSettings/WalletSettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {ScrollView, StyleSheet, Switch} from 'react-native'
import {useAuthSetting, useEasyConfirmationEnabled} from '../../auth'
import {useAuth} from '../../auth/AuthProvider'
import {StatusBar} from '../../components'
import {DIALOG_BUTTONS, showConfirmationDialog} from '../../dialogs'
import {useResync, useWalletName} from '../../hooks'
import {confirmationMessages} from '../../i18n/global-messages'
import {DIALOG_BUTTONS, showConfirmationDialog} from '../../legacy/actions'
import {isByron, isHaskellShelley} from '../../legacy/config'
import {getNetworkConfigById} from '../../legacy/networks'
import {useWalletNavigation} from '../../navigation'
Expand Down
2 changes: 1 addition & 1 deletion src/Staking/StakingCenter/StakingCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {WebView, WebViewMessageEvent} from 'react-native-webview'

import {PleaseWaitModal, Spacer} from '../../components'
import {useStakingTx} from '../../Dashboard/StakePoolInfos'
import {showErrorDialog} from '../../dialogs'
import {useLanguage} from '../../i18n'
import globalMessages, {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG, isNightly, SHOW_PROD_POOLS_IN_DEV} from '../../legacy/config'
import {Logger} from '../../legacy/logging'
import {getNetworkConfigById} from '../../legacy/networks'
Expand Down
2 changes: 1 addition & 1 deletion src/WalletInit/ConnectNanoX/ConnectNanoXScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'

import {ProgressStep} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {LedgerConnect} from '../../HW'
import {errorMessages} from '../../i18n/global-messages'
import LocalizableError from '../../i18n/LocalizableError'
import {showErrorDialog} from '../../legacy/actions'
import type {DeviceId, DeviceObj} from '../../legacy/ledgerUtils'
import {getHWDeviceInfo} from '../../legacy/ledgerUtils'
import {Logger} from '../../legacy/logging'
Expand Down
2 changes: 1 addition & 1 deletion src/WalletInit/CreateWallet/CreateWalletScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import React from 'react'
import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'

import {generateAdaMnemonic} from '../../legacy/commonUtils'
import {isEmptyString} from '../../legacy/utils'
import {WalletInitRouteNavigation, WalletInitRoutes} from '../../navigation'
import {COLORS} from '../../theme'
import {generateAdaMnemonic} from '../../yoroi-wallets'
import {MnemonicExplanationModal} from '../MnemonicExplanationModal'
import {WalletForm} from '../WalletForm'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'
import QRCodeScanner from 'react-native-qrcode-scanner'

import {BulletPointItem, Spacer, Text} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {Logger} from '../../legacy/logging'
import {WalletInitRouteNavigation, WalletInitRoutes} from '../../navigation'
import {theme} from '../../theme'
Expand Down
2 changes: 1 addition & 1 deletion src/WalletInit/MnemonicCheck/MnemonicCheckScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'

import {Button, Spacer, StatusBar, Text} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {useCreateWallet} from '../../hooks'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {NetworkError} from '../../legacy/errors'
import {useWalletNavigation, WalletInitRoutes} from '../../navigation'
import {COLORS} from '../../theme'
Expand Down
2 changes: 1 addition & 1 deletion src/WalletInit/SaveNanoX/SaveNanoXScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {defineMessages, useIntl} from 'react-intl'
import {InteractionManager} from 'react-native'

import image from '../../assets/img/ledger_2.png'
import {showErrorDialog} from '../../dialogs'
import {useCreateBip44Wallet} from '../../hooks'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {NetworkError} from '../../legacy/errors'
import {useWalletNavigation, WalletInitRoutes} from '../../navigation'
import {WalletNameForm} from '../WalletNameForm'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {FlatList, InteractionManager, ScrollView, StyleSheet, View} from 'react-
import {SafeAreaView} from 'react-native-safe-area-context'

import {Boundary, Icon, Line, StatusBar, Text} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {useCreateBip44Wallet, usePlate} from '../../hooks'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG} from '../../legacy/config'
import {NetworkError} from '../../legacy/errors'
import {isEmptyString} from '../../legacy/utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {useIntl} from 'react-intl'
import {ActivityIndicator, InteractionManager, StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'

import {showErrorDialog} from '../../dialogs'
import {useCreateWallet} from '../../hooks'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {NetworkError} from '../../legacy/errors'
import {useWalletNavigation, WalletInitRoutes} from '../../navigation'
import {COLORS} from '../../theme'
Expand Down
2 changes: 1 addition & 1 deletion src/auth/CheckPinInput/CheckPinInput.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import {defineMessages, useIntl} from 'react-intl'

import {showErrorDialog} from '../../dialogs'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG} from '../../legacy/config'
import {useCheckPin} from '../hooks'
import {PinInput, PinInputRef} from '../PinInput'
Expand Down
2 changes: 1 addition & 1 deletion src/auth/CreatePinInput/CreatePinInput.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import {defineMessages, useIntl} from 'react-intl'

import {showErrorDialog} from '../../dialogs'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG} from '../../legacy/config'
import {useCreatePin} from '../hooks'
import {PinInput, PinInputRef} from '../PinInput'
Expand Down
3 changes: 1 addition & 2 deletions src/auth/EncryptedStorage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {decryptData, encryptData} from '../legacy/commonUtils'
import {YoroiWallet} from '../yoroi-wallets'
import {decryptData, encryptData, YoroiWallet} from '../yoroi-wallets'
import {storage} from '../yoroi-wallets/storage'
import {parseString} from '../yoroi-wallets/utils/parsing'

Expand Down
2 changes: 1 addition & 1 deletion src/auth/PinLoginScreen/PinLoginScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {defineMessages, useIntl} from 'react-intl'
import {SafeAreaView} from 'react-native-safe-area-context'

import {StatusBar} from '../../components'
import {showErrorDialog} from '../../dialogs'
import {errorMessages} from '../../i18n/global-messages'
import {showErrorDialog} from '../../legacy/actions'
import {CONFIG} from '../../legacy/config'
import {useAuth} from '../AuthProvider'
import {useCheckPin} from '../hooks'
Expand Down
3 changes: 1 addition & 2 deletions src/auth/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import {useMutation, UseMutationOptions, useQuery, useQueryClient, UseQueryOptio

import {useMutationWithInvalidations, useWallet} from '../hooks'
import globalMessages from '../i18n/global-messages'
import {decryptData, encryptData} from '../legacy/commonUtils'
import {WrongPassword} from '../legacy/errors'
import {useStorage} from '../Storage'
import {parseWalletMeta} from '../Storage/migrations/walletMeta'
import {WalletJSON, walletManager, YoroiWallet} from '../yoroi-wallets'
import {decryptData, encryptData, WalletJSON, walletManager, YoroiWallet} from '../yoroi-wallets'
import {YoroiStorage} from '../yoroi-wallets/storage'
import {parseSafe, parseString} from '../yoroi-wallets/utils/parsing'
import {Keychain} from './Keychain'
Expand Down
5 changes: 3 additions & 2 deletions src/legacy/actions.ts → src/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'react-intl'
import type {IntlShape} from 'react-intl'
import {Alert} from 'react-native'

import globalMessages, {errorMessages} from '../i18n/global-messages'
import assert from './assert'
import globalMessages, {errorMessages} from './i18n/global-messages'
import assert from './legacy/assert'

type DialogOptions = {
title: string
Expand Down Expand Up @@ -78,6 +78,7 @@ export const showErrorDialog = (
yesButton,
})
}

export const showConfirmationDialog = (dialog: any | DialogOptions, intl: IntlShape): Promise<DialogButton> =>
showDialog({
title: intl.formatMessage(dialog.title),
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import App from './App'
import {name as appName} from './app.json'
import {LoadingBoundary} from './components'
import {ErrorBoundary} from './components/ErrorBoundary'
import {handleGeneralError} from './dialogs'
import {LanguageProvider} from './i18n'
import translations from './i18n/translations'
import {handleGeneralError} from './legacy/actions'
import {CONFIG} from './legacy/config'
import {ApiError, NetworkError} from './legacy/errors'
import {Logger, setLogLevel} from './legacy/logging'
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/DeveloperScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import * as Keychain from 'react-native-keychain'

import {useAuth} from '../auth/AuthProvider'
import {Button, StatusBar, Text, TextInput} from '../components'
import {showErrorDialog} from '../dialogs'
import {useCreateWallet} from '../hooks'
import {errorMessages} from '../i18n/global-messages'
import {AppRoutes, useWalletNavigation} from '../navigation'
import {useSelectedWalletContext} from '../SelectedWallet'
import {showErrorDialog} from './actions'
import {generateAdaMnemonic} from '../yoroi-wallets'
import assert from './assert'
import {generateAdaMnemonic} from './commonUtils'
import {NetworkError} from './errors'
import {isEmptyString} from './utils'

Expand Down
95 changes: 0 additions & 95 deletions src/legacy/commonUtils.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/yoroi-wallets/cardano/CardanoWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {Keychain} from '../../auth/Keychain'
import {encryptWithPassword} from '../../Catalyst/catalystCipher'
import LocalizableError from '../../i18n/LocalizableError'
import assert from '../../legacy/assert'
import {ADDRESS_TYPE_TO_CHANGE, generateWalletRootKey} from '../../legacy/commonUtils'
import {
CONFIG,
DISABLE_BACKGROUND_SYNC,
Expand Down Expand Up @@ -54,10 +53,12 @@ import {parseSafe} from '../utils/parsing'
import {genTimeToSlot} from '../utils/timeUtils'
import {validatePassword} from '../utils/validators'
import {
ADDRESS_TYPE_TO_CHANGE,
Cardano,
CardanoMobile,
CardanoTypes,
generatePrivateKeyForCatalyst,
generateWalletRootKey,
legacyWalletChecksum,
NoOutputsError,
NotEnoughMoneyToSendError,
Expand Down
4 changes: 1 addition & 3 deletions src/yoroi-wallets/cardano/byron/plate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type {AddressType} from '../../../legacy/commonUtils'
import {generateWalletRootKey} from '../../../legacy/commonUtils'
import type {PlateResponse} from '../../types/other'
import {legacyWalletChecksum} from '..'
import {AddressType, generateWalletRootKey, legacyWalletChecksum} from '..'
import {getAccountFromMasterKey, getAddresses} from './util'

export const generateByronPlateFromMnemonics = async (phrase: string, count: number): Promise<PlateResponse> => {
Expand Down
4 changes: 1 addition & 3 deletions src/yoroi-wallets/cardano/byron/util.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import bs58 from 'bs58'

import type {AddressType} from '../../../legacy/commonUtils'
import {ADDRESS_TYPE_TO_CHANGE, generateWalletRootKey} from '../../../legacy/commonUtils'
import {CONFIG} from '../../../legacy/config'
import {CardanoError} from '../../../legacy/errors'
import {getCardanoByronConfig} from '../../../legacy/networks'
import {CardanoMobile} from '..'
import {ADDRESS_TYPE_TO_CHANGE, AddressType, CardanoMobile, generateWalletRootKey} from '..'

const BYRON_PROTOCOL_MAGIC = getCardanoByronConfig().PROTOCOL_MAGIC

Expand Down
3 changes: 1 addition & 2 deletions src/yoroi-wallets/cardano/catalyst/catalystUtils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {mnemonicToEntropy} from 'bip39'
import blake2b from 'blake2b'

import {generateAdaMnemonic} from '../../../legacy/commonUtils'
import {CONFIG} from '../../../legacy/config'
import {Logger} from '../../../legacy/logging'
import {CardanoMobile, CardanoTypes} from '..'
import {CardanoMobile, CardanoTypes, generateAdaMnemonic} from '..'

export const CatalystLabels = {
DATA: 61284,
Expand Down

0 comments on commit 9e3b10f

Please sign in to comment.