Skip to content

Commit

Permalink
TW-1362 Remove migration to mainnet and prevention of adding TalentNet
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Mar 6, 2024
1 parent 0672724 commit 9b41144
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 38 deletions.
24 changes: 4 additions & 20 deletions src/modals/custom-rpc-modals/add-modal/add-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TezosToolkit } from '@taquito/taquito';
import { Formik } from 'formik';
import React, { FC } from 'react';
import { View } from 'react-native';
Expand All @@ -19,9 +18,7 @@ import { useNavigation } from 'src/navigator/hooks/use-navigation.hook';
import { addCustomRpc, setSelectedRpcUrl } from 'src/store/settings/settings-actions';
import { useRpcListSelector } from 'src/store/settings/settings-selectors';
import { formatSize } from 'src/styles/format-size';
import { showWarningToast } from 'src/toast/toast.utils';
import { usePageAnalytic } from 'src/utils/analytics/use-analytics.hook';
import { TALENT_MAINNET_CHAIN_ID } from 'src/utils/network.utils';

import { formInitialValues, formValidationSchema, confirmUniqueRPC } from '../form.utils';

Expand All @@ -32,27 +29,14 @@ export const AddCustomRpcModal: FC = () => {
const { goBack } = useNavigation();
const rpcList = useRpcListSelector();

const handleSubmit = async (newRpc: RpcInterface) => {
const handleSubmit = (newRpc: RpcInterface) => {
if (confirmUniqueRPC(rpcList, newRpc) === false) {
return;
}

let isTalentNet = false;
try {
const tezos = new TezosToolkit(newRpc.url);
const chainId = await tezos.rpc.getChainId();
isTalentNet = chainId === TALENT_MAINNET_CHAIN_ID;
} catch (e) {
console.error(e);
}

if (isTalentNet) {
showWarningToast({ description: 'The T4L3NT Mainnet RPC is temporarily unavailable.' });
} else {
dispatch(addCustomRpc(newRpc));
dispatch(setSelectedRpcUrl(newRpc.url));
goBack();
}
dispatch(addCustomRpc(newRpc));
dispatch(setSelectedRpcUrl(newRpc.url));
goBack();
};

usePageAnalytic(ModalsEnum.AddCustomRpc);
Expand Down
18 changes: 0 additions & 18 deletions src/store/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { KNOWN_TOKENS_SLUGS } from 'src/token/data/token-slugs';
import { OVERRIDEN_MAINNET_TOKENS_METADATA, PREDEFINED_DCP_TOKENS_METADATA } from 'src/token/data/tokens-metadata';
import { getTokenSlug } from 'src/token/utils/token.utils';
import { isDefined } from 'src/utils/is-defined';
import { isDcpNode } from 'src/utils/network.utils';
import { DCP_RPC, MARIGOLD_RPC, OLD_TEMPLE_RPC_URLS, TEMPLE_RPC } from 'src/utils/rpc/rpc-list';

import type { RootState } from './types';
Expand Down Expand Up @@ -154,22 +153,5 @@ export const MIGRATIONS: MigrationManifest = {
accountsStateRecord
}
};
},
'6': (untypedState: PersistedState): undefined | TypedPersistedRootState => {
if (!untypedState) {
return untypedState;
}

const state = untypedState as TypedPersistedRootState;

return isDcpNode(state.settings.selectedRpcUrl)
? {
...state,
settings: {
...state.settings,
selectedRpcUrl: TEMPLE_RPC.url
}
}
: state;
}
};

0 comments on commit 9b41144

Please sign in to comment.