4
4
} from '../remote-feature-flags' ;
5
5
6
6
/**
7
- *
7
+ * Feature flag type for multichain accounts features
8
8
*/
9
9
export type MultichainAccountsFeatureFlag = {
10
10
enabled : boolean ;
@@ -24,7 +24,7 @@ const FEATURE_VERSION_2 = '2';
24
24
* @param version2 - The second version string to compare.
25
25
* @returns boolean - True if version1 is greater than or equal to version2, false otherwise.
26
26
*/
27
- const compareVersions = ( version1 : string , version2 : string ) => {
27
+ export const compareVersions = ( version1 : string , version2 : string ) => {
28
28
const regex = / ^ \d + \. \d + \. \d + $ / u;
29
29
if ( ! regex . test ( version1 ) || ! regex . test ( version2 ) ) {
30
30
return false ; // Invalid version format
@@ -57,37 +57,44 @@ const compareVersions = (version1: string, version2: string) => {
57
57
export const getIsMultichainAccountsState1Enabled = (
58
58
state : RemoteFeatureFlagsState ,
59
59
) => {
60
- const { enableMultichainAccounts } = getRemoteFeatureFlags ( state ) ;
61
- const { enabled, featureVersion, minimumVersion } =
62
- enableMultichainAccounts as MultichainAccountsFeatureFlag ;
63
- return (
64
- enabled &&
65
- featureVersion &&
66
- minimumVersion &&
67
- featureVersion === FEATURE_VERSION_1 &&
68
- // @ts -expect-error - we can ignore the error for passing MINIMUM_SUPPORTED_VERSION as null
69
- compareVersions ( minimumVersion , MINIMUM_SUPPORTED_VERSION )
70
- ) ;
60
+ return false ;
61
+
62
+ // TODO: Uncomment this section and update the value of MINIMUM_SUPPORTED_VERSION
63
+ // to use the remote feature flags for multichain accounts state 1.
64
+
65
+ // const { enabled, featureVersion, minimumVersion } =
66
+ // enableMultichainAccounts as MultichainAccountsFeatureFlag;
67
+ // return (
68
+ // enabled &&
69
+ // featureVersion &&
70
+ // minimumVersion &&
71
+ // featureVersion === FEATURE_VERSION_1 &&
72
+ // compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
73
+ // );
71
74
} ;
72
75
73
76
/**
74
- * Checks if the multichain accounts feature is enabled for state 1 .
77
+ * Checks if the multichain accounts feature is enabled for state 2 .
75
78
*
76
79
* @param state - The MetaMask state object
77
- * @returns boolean - True if the feature is enabled for state 1 , false otherwise.
80
+ * @returns boolean - True if the feature is enabled for state 2 , false otherwise.
78
81
*/
79
82
export const getIsMultichainAccountsState2Enabled = (
80
83
state : RemoteFeatureFlagsState ,
81
84
) => {
82
- const { enableMultichainAccounts } = getRemoteFeatureFlags ( state ) ;
83
- const { enabled, featureVersion, minimumVersion } =
84
- enableMultichainAccounts as MultichainAccountsFeatureFlag ;
85
- return (
86
- enabled &&
87
- featureVersion &&
88
- minimumVersion &&
89
- featureVersion === FEATURE_VERSION_2 &&
90
- // @ts -expect-error - we can ignore the error for passing MINIMUM_SUPPORTED_VERSION as null
91
- compareVersions ( minimumVersion , MINIMUM_SUPPORTED_VERSION )
92
- ) ;
85
+ return false ;
86
+
87
+ // TODO: Uncomment this section and update the value of MINIMUM_SUPPORTED_VERSION
88
+ // to use the remote feature flags for multichain accounts state 2.
89
+
90
+ // const { enableMultichainAccounts } = getRemoteFeatureFlags(state);
91
+ // const { enabled, featureVersion, minimumVersion } =
92
+ // enableMultichainAccounts as MultichainAccountsFeatureFlag;
93
+ // return (
94
+ // enabled &&
95
+ // featureVersion &&
96
+ // minimumVersion &&
97
+ // featureVersion === FEATURE_VERSION_2 &&
98
+ // compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
99
+ // );
93
100
} ;
0 commit comments