diff --git a/src/app/pages/ParaTimesPage/ParaTimeSelection/index.tsx b/src/app/pages/ParaTimesPage/ParaTimeSelection/index.tsx index 1f6719ef7f..ca6ea4cfdb 100644 --- a/src/app/pages/ParaTimesPage/ParaTimeSelection/index.tsx +++ b/src/app/pages/ParaTimesPage/ParaTimeSelection/index.tsx @@ -7,7 +7,8 @@ import { Select } from 'grommet/es6/components/Select' import { useTranslation } from 'react-i18next' import { ParaTimeContent } from '../ParaTimeContent' import { ParaTimeFormFooter } from '../ParaTimeFormFooter' -import { getParaTimeName, useParaTimes } from '../useParaTimes' +import { useParaTimes } from '../useParaTimes' +import { getParaTimeName } from '../getParaTimeName' import { useParaTimesNavigation } from '../useParaTimesNavigation' import { ThemeContext } from 'styled-components' import { ThemeType } from 'grommet/es6/themes' diff --git a/src/app/pages/ParaTimesPage/getParaTimeName.ts b/src/app/pages/ParaTimesPage/getParaTimeName.ts new file mode 100644 index 0000000000..88317b4f2d --- /dev/null +++ b/src/app/pages/ParaTimesPage/getParaTimeName.ts @@ -0,0 +1,24 @@ +import { TFunction } from 'i18next' +import { ExhaustedTypeError } from 'types/errors' +import { ParaTime } from '../../../config' + +export const getParaTimeName = (t: TFunction, paraTime: ParaTime) => { + switch (paraTime) { + case ParaTime.Cipher: + return `${t('paraTimes.common.cipher', 'Cipher')} ${t( + 'paraTimes.common.discouragedType', + // Discourage mistaken ParaTime deposits into Cipher accounts controlled + // by Binance. That requires contacting support to recover it. + '(experimental)', + )}` + case ParaTime.Emerald: + return t('paraTimes.common.emerald', 'Emerald') + case ParaTime.Sapphire: + return t('paraTimes.common.sapphire', 'Sapphire') + default: + throw new ExhaustedTypeError( + t('paraTimes.validation.unsupportedParaTime', 'Unsupported ParaTime'), + paraTime, + ) + } +} diff --git a/src/app/pages/ParaTimesPage/useParaTimes.ts b/src/app/pages/ParaTimesPage/useParaTimes.ts index f192e4cbf8..b8ff078a4d 100644 --- a/src/app/pages/ParaTimesPage/useParaTimes.ts +++ b/src/app/pages/ParaTimesPage/useParaTimes.ts @@ -1,7 +1,6 @@ import { useCallback } from 'react' import { useDispatch, useSelector } from 'react-redux' import { useTranslation } from 'react-i18next' -import { TFunction } from 'i18next' import { paraTimesActions } from 'app/state/paratimes' import { TransactionForm, TransactionTypes } from 'app/state/paratimes/types' import { selectSelectedNetwork, selectTicker } from 'app/state/network/selectors' @@ -9,10 +8,11 @@ import { selectAccountAvailableBalance, selectAccountIsLoading } from 'app/state import { selectAddress } from 'app/state/wallet/selectors' import { selectParaTimes } from 'app/state/paratimes/selectors' import { StringifiedBigInt } from 'types/StringifiedBigInt' -import { ErrorPayload, ExhaustedTypeError } from 'types/errors' +import { ErrorPayload } from 'types/errors' import { paraTimesConfig, RuntimeTypes, ParaTime, type ParaTimeConfig } from '../../../config' import { selectEvmAccounts } from 'app/state/evmAccounts/selectors' import { EvmAccount } from 'app/state/evmAccounts/types' +import { getParaTimeName } from './getParaTimeName' type AvailableParaTimesForNetwork = { isEvm: boolean @@ -45,27 +45,6 @@ export type ParaTimesHook = { usesOasisAddress: boolean } -export const getParaTimeName = (t: TFunction, paraTime: ParaTime) => { - switch (paraTime) { - case ParaTime.Cipher: - return `${t('paraTimes.common.cipher', 'Cipher')} ${t( - 'paraTimes.common.discouragedType', - // Discourage mistaken ParaTime deposits into Cipher accounts controlled - // by Binance. That requires contacting support to recover it. - '(experimental)', - )}` - case ParaTime.Emerald: - return t('paraTimes.common.emerald', 'Emerald') - case ParaTime.Sapphire: - return t('paraTimes.common.sapphire', 'Sapphire') - default: - throw new ExhaustedTypeError( - t('paraTimes.validation.unsupportedParaTime', 'Unsupported ParaTime'), - paraTime, - ) - } -} - export const useParaTimes = (): ParaTimesHook => { const { t } = useTranslation() const dispatch = useDispatch()