From cffb38e2b35991729c11dc42ce9eea7a369cd7f2 Mon Sep 17 00:00:00 2001 From: Nicole O'Brien Date: Mon, 6 May 2024 10:31:36 +0100 Subject: [PATCH] chore: feature flag default isc chains --- .../desktop/features/onboarding.features.ts | 12 +++ .../constants/default-base-token.constant.ts | 2 +- ...ault-isc-chains-configurations.constant.ts | 93 ++++++++++--------- ...boarding-features-for-network.interface.ts | 1 + 4 files changed, 64 insertions(+), 44 deletions(-) diff --git a/packages/desktop/features/onboarding.features.ts b/packages/desktop/features/onboarding.features.ts index d7bc4104e2..41d31406ef 100644 --- a/packages/desktop/features/onboarding.features.ts +++ b/packages/desktop/features/onboarding.features.ts @@ -41,6 +41,9 @@ const onboardingFeaturesForIota: IOnboardingFeaturesForNetwork = { enabled: false, }, }, + defaultIscChains: { + enabled: false, + }, } const onboardingFeaturesForShimmer: IOnboardingFeaturesForNetwork = { @@ -82,6 +85,9 @@ const onboardingFeaturesForShimmer: IOnboardingFeaturesForNetwork = { enabled: true, }, }, + defaultIscChains: { + enabled: true, + }, } const onboardingFeaturesForTestnet: IOnboardingFeaturesForNetwork = { @@ -123,6 +129,9 @@ const onboardingFeaturesForTestnet: IOnboardingFeaturesForNetwork = { enabled: true, }, }, + defaultIscChains: { + enabled: true, + }, } const onboardingFeaturesForCustom: IOnboardingFeaturesForNetwork = { @@ -164,6 +173,9 @@ const onboardingFeaturesForCustom: IOnboardingFeaturesForNetwork = { enabled: true, }, }, + defaultIscChains: { + enabled: false, + }, } const onboardingFeatures: OnboardingFeatures = { diff --git a/packages/shared/src/lib/core/network/constants/default-base-token.constant.ts b/packages/shared/src/lib/core/network/constants/default-base-token.constant.ts index 949647c3fb..b138e035ed 100644 --- a/packages/shared/src/lib/core/network/constants/default-base-token.constant.ts +++ b/packages/shared/src/lib/core/network/constants/default-base-token.constant.ts @@ -31,7 +31,7 @@ export const EVM_BASE_TOKEN: IBaseToken = { decimals: 18, } -export const DEFAULT_BASE_TOKEN: Readonly<{ [id in NetworkId]?: IBaseToken }> = { +export const DEFAULT_BASE_TOKEN: Readonly<{ [id in NetworkId]: IBaseToken }> = { [SupportedNetworkId.Iota]: IOTA_BASE_TOKEN, [SupportedNetworkId.Shimmer]: SHIMMER_BASE_TOKEN, [SupportedNetworkId.Testnet]: SHIMMER_BASE_TOKEN, diff --git a/packages/shared/src/lib/core/network/constants/default-isc-chains-configurations.constant.ts b/packages/shared/src/lib/core/network/constants/default-isc-chains-configurations.constant.ts index 0e3bdf379e..f37c100e04 100644 --- a/packages/shared/src/lib/core/network/constants/default-isc-chains-configurations.constant.ts +++ b/packages/shared/src/lib/core/network/constants/default-isc-chains-configurations.constant.ts @@ -1,3 +1,4 @@ +import features from '@features/features' import { NetworkType, NetworkNamespace, ChainId } from '../enums' import { IIscChainConfiguration } from '../interfaces' import { StardustNetworkId } from '../types' @@ -6,47 +7,53 @@ import { DEFAULT_COIN_TYPE } from './default-coin-type.constant' import { SupportedIscNetworkId, SupportedNetworkId, SupportedStardustNetworkId } from './supported-network-id.constant' export const DEFAULT_ISC_CHAINS_CONFIGURATIONS: Readonly<{ [id in StardustNetworkId]?: IIscChainConfiguration }> = { - [SupportedStardustNetworkId.Iota]: { - id: SupportedIscNetworkId.IotaEvm, - type: NetworkType.Isc, - name: 'IOTA EVM', - chainId: ChainId.IotaEvm, - namespace: NetworkNamespace.Evm, - baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.IotaEvm], - coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.IotaEvm], - aliasAddress: - 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', - rpcEndpoint: - 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', - apiEndpoint: - 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', - explorerUrl: - 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', - } as IIscChainConfiguration, - [SupportedStardustNetworkId.Shimmer]: { - id: SupportedIscNetworkId.ShimmerEvm, - type: NetworkType.Isc, - name: 'Shimmer EVM', - chainId: ChainId.ShimmerEvm, - namespace: NetworkNamespace.Evm, - baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.ShimmerEVM], - coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.ShimmerEvm] ?? 0, - aliasAddress: 'smr1prxvwqvwf7nru5q5xvh5thwg54zsm2y4wfnk6yk56hj3exxkg92mx20wl3s', - rpcEndpoint: 'https://json-rpc.evm.shimmer.network/', - apiEndpoint: 'https://api.evm.shimmer.network/', - explorerUrl: 'https://explorer.evm.shimmer.network/', - }, - [SupportedStardustNetworkId.Testnet]: { - id: SupportedIscNetworkId.TestnetEvm, - type: NetworkType.Isc, - name: 'Testnet EVM', - chainId: ChainId.TestnetEvm, - namespace: NetworkNamespace.Evm, - baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.TestnetEvm], - coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.TestnetEvm] ?? 0, - aliasAddress: 'rms1ppp00k5mmd2m8my8ukkp58nd3rskw6rx8l09aj35984k74uuc5u2cywn3ex', - rpcEndpoint: 'https://json-rpc.evm.testnet.shimmer.network/', - apiEndpoint: 'https://api.evm.testnet.shimmer.network/', - explorerUrl: 'https://explorer.evm.testnet.shimmer.network/', - }, + ...(features.onboarding.iota?.defaultIscChains.enabled && { + [SupportedStardustNetworkId.Iota]: { + id: SupportedIscNetworkId.IotaEvm, + type: NetworkType.Isc, + name: 'IOTA EVM', + chainId: ChainId.IotaEvm, + namespace: NetworkNamespace.Evm, + baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.IotaEvm], + coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.IotaEvm], + aliasAddress: + 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', + rpcEndpoint: + 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', + apiEndpoint: + 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', + explorerUrl: + 'https://github.com/bloomwalletio/bloom-private/pull/17/files#diff-2e95221dbfb375be5e97b45bad40479c2b3f9a70efa14e66caa1b7fe37df8296', + }, + }), + ...(features.onboarding.shimmer?.defaultIscChains.enabled && { + [SupportedStardustNetworkId.Shimmer]: { + id: SupportedIscNetworkId.ShimmerEvm, + type: NetworkType.Isc, + name: 'Shimmer EVM', + chainId: ChainId.ShimmerEvm, + namespace: NetworkNamespace.Evm, + baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.ShimmerEVM], + coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.ShimmerEvm] ?? 0, + aliasAddress: 'smr1prxvwqvwf7nru5q5xvh5thwg54zsm2y4wfnk6yk56hj3exxkg92mx20wl3s', + rpcEndpoint: 'https://json-rpc.evm.shimmer.network/', + apiEndpoint: 'https://api.evm.shimmer.network/', + explorerUrl: 'https://explorer.evm.shimmer.network/', + }, + }), + ...(features.onboarding.testnet?.defaultIscChains.enabled && { + [SupportedStardustNetworkId.Testnet]: { + id: SupportedIscNetworkId.TestnetEvm, + type: NetworkType.Isc, + name: 'Testnet EVM', + chainId: ChainId.TestnetEvm, + namespace: NetworkNamespace.Evm, + baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.TestnetEvm], + coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.TestnetEvm] ?? 0, + aliasAddress: 'rms1ppp00k5mmd2m8my8ukkp58nd3rskw6rx8l09aj35984k74uuc5u2cywn3ex', + rpcEndpoint: 'https://json-rpc.evm.testnet.shimmer.network/', + apiEndpoint: 'https://api.evm.testnet.shimmer.network/', + explorerUrl: 'https://explorer.evm.testnet.shimmer.network/', + }, + }), } diff --git a/packages/shared/src/lib/features/interfaces/onboarding-features-for-network.interface.ts b/packages/shared/src/lib/features/interfaces/onboarding-features-for-network.interface.ts index ae3c63f411..6fc84fc93c 100644 --- a/packages/shared/src/lib/features/interfaces/onboarding-features-for-network.interface.ts +++ b/packages/shared/src/lib/features/interfaces/onboarding-features-for-network.interface.ts @@ -17,4 +17,5 @@ export interface IOnboardingFeaturesForNetwork extends IFeatureFlag { strongholdBackup: IFeatureFlag ledgerBackup: IFeatureFlag } + defaultIscChains: IFeatureFlag }