Skip to content

Commit

Permalink
fix: remove kusama CC2 Network (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwencheng authored Aug 11, 2020
1 parent 2a80054 commit 28ce011
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/components/DerivationNetworkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ACCOUNT_NETWORK = 'Account Network';
const Touchable: React.ComponentClass<TouchableNativeFeedbackProps> =
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;

const excludedNetworks = [SubstrateNetworkKeys.KUSAMA_CC2];
const excludedNetworks: string[] = [];
if (!__DEV__) {
excludedNetworks.push(SubstrateNetworkKeys.SUBSTRATE_DEV);
excludedNetworks.push(SubstrateNetworkKeys.KUSAMA_DEV);
Expand Down
9 changes: 6 additions & 3 deletions src/components/PathGroupCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
PathGroup
} from 'types/identityTypes';
import {
isSubstrateNetworkParams,
isUnknownNetworkParams,
SubstrateNetworkParams,
UnknownNetworkParams
} from 'types/networkSpecsTypes';
Expand Down Expand Up @@ -98,8 +98,11 @@ export default function PathGroupCard({
}
};

const isUnknownNetwork = isUnknownNetworkParams(networkParams);
const headerTitle = removeSlash(pathGroup.title);
const headerCode = `//${networkParams.pathId}${pathGroup.title}`;
const headerCode = isUnknownNetwork
? pathGroup.title
: `//${networkParams.pathId}${pathGroup.title}`;
return (
<View key={`group${pathGroup.title}`} style={{ marginTop: 24 }}>
<Separator shadow={true} style={styles.separator} />
Expand All @@ -110,7 +113,7 @@ export default function PathGroupCard({
<Text style={fontStyles.t_codeS}>{headerCode}</Text>
</View>
</View>
{isSubstrateNetworkParams(networkParams) && (
{!isUnknownNetwork && (
<TouchableItem
onPress={(): any => addDerivationPath(true)}
style={styles.derivationButton}
Expand Down
13 changes: 0 additions & 13 deletions src/constants/networkSpecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export const SubstrateNetworkKeys: Record<string, string> = Object.freeze({
'0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b', // https://polkascan.io/pre/edgeware/block/0
KULUPU: '0xf7a99d3cb92853d00d5275c971c132c074636256583fee53b3bbe60d7b8769ba',
KUSAMA: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe', // https://polkascan.io/pre/kusama-cc3/block/0
KUSAMA_CC2:
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636',
KUSAMA_DEV:
'0x5e9679182f658e148f33d3f760f11179977398bb3da8d1f0bf7b267fe6b3ebb0',
POLKADOT:
Expand Down Expand Up @@ -137,17 +135,6 @@ const substrateNetworkBase: Record<string, Partial<SubstrateNetworkParams>> = {
title: 'Kusama',
unit: 'KSM'
},
[SubstrateNetworkKeys.KUSAMA_CC2]: {
color: '#000',
decimals: 12,
genesisHash: SubstrateNetworkKeys.KUSAMA,
logo: require('res/img/logos/Kusama.png'),
order: 2,
pathId: 'kusama_CC2',
prefix: 2,
title: 'Kusama',
unit: 'KSM'
},
[SubstrateNetworkKeys.KUSAMA_DEV]: {
color: '#000',
decimals: 12,
Expand Down
7 changes: 2 additions & 5 deletions src/modules/network/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export const filterSubstrateNetworks = (
networkList: Record<string, NetworkParams>,
extraFilter?: (networkKey: string, shouldExclude: boolean) => boolean
): Array<[string, NetworkParams]> => {
const excludedNetworks = [
UnknownNetworkKeys.UNKNOWN,
SubstrateNetworkKeys.KUSAMA_CC2
];
const excludedNetworks = [UnknownNetworkKeys.UNKNOWN];
if (!__DEV__) {
excludedNetworks.push(SubstrateNetworkKeys.SUBSTRATE_DEV);
excludedNetworks.push(SubstrateNetworkKeys.KUSAMA_DEV);
Expand Down Expand Up @@ -96,7 +93,7 @@ export function getCompleteSubstrateNetworkSpec(
}

export function defaultNetworkSpecs(): SubstrateNetworkParams[] {
const excludedNetworks = [SubstrateNetworkKeys.KUSAMA_CC2];
const excludedNetworks: string[] = [];
if (!__DEV__) {
excludedNetworks.push(SubstrateNetworkKeys.SUBSTRATE_DEV);
excludedNetworks.push(SubstrateNetworkKeys.KUSAMA_DEV);
Expand Down
1 change: 0 additions & 1 deletion src/utils/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,5 @@ export async function getNetworkSpecs(): Promise<SubstrateNetworkParams[]> {
*/
export async function saveDefaultNetworks(): Promise<void> {
const networkSpecsString = JSON.stringify(defaultNetworkSpecs());
console.log('networkSpecs to be stored is', networkSpecsString); //TODO to be removed
// AsyncStorage.setItem(networkSpecsStorageLabel, networkSpecsString);
}
6 changes: 3 additions & 3 deletions src/utils/identitiesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ export const getPathsWithSubstrateNetworkKey = (
let pathId;
if (!isSubstratePath(path)) return groupedPaths;
if (pathMeta.networkPathId !== undefined) {
pathId = pathMeta.networkPathId;
pathId = PATH_IDS_LIST.includes(pathMeta.networkPathId)
? pathMeta.networkPathId
: unknownNetworkPathId;
} else {
pathId = extractPathId(path);
}

if (pathId === targetPathId) {
groupedPaths.push(path);
return groupedPaths;
Expand Down Expand Up @@ -442,7 +443,6 @@ export const getMetadata = (networkKey: string): string => {
case SubstrateNetworkKeys.CENTRIFUGE_AMBER:
return centrifugeAmberMetadata;
case SubstrateNetworkKeys.KUSAMA:
case SubstrateNetworkKeys.KUSAMA_CC2:
case SubstrateNetworkKeys.KUSAMA_DEV:
return kusamaMetadata;
case SubstrateNetworkKeys.WESTEND:
Expand Down

0 comments on commit 28ce011

Please sign in to comment.