File tree Expand file tree Collapse file tree 11 files changed +80
-39
lines changed Expand file tree Collapse file tree 11 files changed +80
-39
lines changed Original file line number Diff line number Diff line change @@ -154,3 +154,6 @@ export IOS_GOOGLE_REDIRECT_URI='com.googleusercontent.apps.615965109465-h6tp2h3c
154154
155155# Enable 7702 locally
156156export MM_SMART_ACCOUNT_UI_ENABLED="true"
157+
158+ # Preinstalled Snaps
159+ export FORCE_PREINSTALLED_SNAPS="false"
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export const SnapUICard: FunctionComponent<SnapUICardProps> = ({
3333 alignItems = { AlignItems . center }
3434 // eslint-disable-next-line react-native/no-inline-styles
3535 style = { { flex : 1 } }
36+ gap = { 8 }
3637 >
3738 < Box
3839 gap = { 16 }
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ export const SnapUIFooterButton: FunctionComponent<SnapUIFooterButtonProps> = ({
119119 color = {
120120 variant === ButtonVariants . Primary
121121 ? theme . colors . primary . inverse
122- : theme . colors . primary . default
122+ : theme . colors . text . default
123123 }
124124 >
125125 { children }
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ exports[`SnapUIRenderer adds a footer if required 1`] = `
139139 accessibilityRole = " text"
140140 style = {
141141 {
142- " color" : " #4459ff " ,
142+ " color" : " #121314 " ,
143143 " fontFamily" : " Geist Medium" ,
144144 " fontSize" : 16 ,
145145 " letterSpacing" : 0 ,
@@ -940,12 +940,14 @@ exports[`SnapUIRenderer renders complex nested components 1`] = `
940940 <View
941941 alignItems = " center"
942942 flexDirection = " row"
943+ gap = { 8 }
943944 justifyContent = " space-between"
944945 style = {
945946 [
946947 {
947948 " alignItems" : " center" ,
948949 " flexDirection" : " row" ,
950+ " gap" : 8 ,
949951 " justifyContent" : " space-between" ,
950952 },
951953 {
@@ -1165,7 +1167,7 @@ exports[`SnapUIRenderer renders complex nested components 1`] = `
11651167 accessibilityRole = " text"
11661168 style = {
11671169 {
1168- " color" : " #4459ff " ,
1170+ " color" : " #121314 " ,
11691171 " fontFamily" : " Geist Medium" ,
11701172 " fontSize" : 16 ,
11711173 " letterSpacing" : 0 ,
@@ -1417,7 +1419,7 @@ exports[`SnapUIRenderer renders footers 1`] = `
14171419 accessibilityRole = " text"
14181420 style = {
14191421 {
1420- " color" : " #4459ff " ,
1422+ " color" : " #121314 " ,
14211423 " fontFamily" : " Geist Medium" ,
14221424 " fontSize" : 16 ,
14231425 " letterSpacing" : 0 ,
@@ -2088,7 +2090,7 @@ exports[`SnapUIRenderer supports the onCancel prop 1`] = `
20882090 accessibilityRole = " text"
20892091 style = {
20902092 {
2091- " color" : " #4459ff " ,
2093+ " color" : " #121314 " ,
20922094 " fontFamily" : " Geist Medium" ,
20932095 " fontSize" : 16 ,
20942096 " letterSpacing" : 0 ,
Original file line number Diff line number Diff line change @@ -474,12 +474,14 @@ exports[`SnapUIForm will render with fields 1`] = `
474474 <View
475475 alignItems = " center"
476476 flexDirection = " row"
477+ gap = { 8 }
477478 justifyContent = " space-between"
478479 style = {
479480 [
480481 {
481482 " alignItems" : " center" ,
482483 " flexDirection" : " row" ,
484+ " gap" : 8 ,
483485 " justifyContent" : " space-between" ,
484486 },
485487 {
@@ -909,12 +911,14 @@ exports[`SnapUIForm will render with fields 1`] = `
909911 <View
910912 alignItems = " center"
911913 flexDirection = " row"
914+ gap = { 8 }
912915 justifyContent = " space-between"
913916 style = {
914917 [
915918 {
916919 " alignItems" : " center" ,
917920 " flexDirection" : " row" ,
921+ " gap" : 8 ,
918922 " justifyContent" : " space-between" ,
919923 },
920924 {
@@ -1057,12 +1061,14 @@ exports[`SnapUIForm will render with fields 1`] = `
10571061 <View
10581062 alignItems = " center"
10591063 flexDirection = " row"
1064+ gap = { 8 }
10601065 justifyContent = " space-between"
10611066 style = {
10621067 [
10631068 {
10641069 " alignItems" : " center" ,
10651070 " flexDirection" : " row" ,
1071+ " gap" : 8 ,
10661072 " justifyContent" : " space-between" ,
10671073 },
10681074 {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { form } from './form';
1616import { icon } from './icon' ;
1717import { field } from './field' ;
1818import { section } from './section' ;
19+ import { selector } from './selector' ;
1920import { spinner } from './spinner' ;
2021import { skeleton } from './skeleton' ;
2122import { address } from './address' ;
@@ -45,6 +46,7 @@ export const COMPONENT_MAPPING = {
4546 Field : field ,
4647 Icon : icon ,
4748 Section : section ,
49+ Selector : selector ,
4850 Spinner : spinner ,
4951 Skeleton : skeleton ,
5052 Avatar : avatar ,
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ describe('SnapControllerInit', () => {
6565 disableSnapInstallation : true ,
6666 requireAllowlist : true ,
6767 useCaip25Permission : true ,
68+ forcePreinstalledSnaps : false ,
6869 } ,
6970 getFeatureFlags : expect . any ( Function ) ,
7071 getMnemonicSeed : expect . any ( Function ) ,
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ export const snapControllerInit: ControllerInitFunction<
4444 const disableSnapInstallation = process . env . METAMASK_BUILD_TYPE !== 'flask' ;
4545 const allowLocalSnaps = process . env . METAMASK_BUILD_TYPE === 'flask' ;
4646
47+ ///: BEGIN:ONLY_INCLUDE_IF(flask)
48+ const forcePreinstalledSnaps = process . env . FORCE_PREINSTALLED_SNAPS === 'true' ;
49+ ///: END:ONLY_INCLUDE_IF
50+
4751 const encryptor = new Encryptor ( {
4852 keyDerivationOptions : LEGACY_DERIVATION_OPTIONS ,
4953 } ) ;
@@ -103,6 +107,9 @@ export const snapControllerInit: ControllerInitFunction<
103107 disableSnapInstallation,
104108 requireAllowlist,
105109 useCaip25Permission : true ,
110+ ///: BEGIN:ONLY_INCLUDE_IF(flask)
111+ forcePreinstalledSnaps,
112+ ///: END:ONLY_INCLUDE_IF
106113 } ,
107114
108115 // @ts -expect-error: `encryptorFactory` is not compatible with the expected
Original file line number Diff line number Diff line change @@ -9,13 +9,32 @@ import {
99import { SnapKeyringBuilderMessenger } from '../types' ;
1010import I18n from '../../../../locales/i18n' ;
1111
12+ ///: BEGIN:ONLY_INCLUDE_IF(flask)
13+ /**
14+ * Whether to force local Snaps to be treated as preinstalled Snaps.
15+ *
16+ * This is used in development environments to allow Snaps to use features that
17+ * are normally reserved for preinstalled Snaps.
18+ */
19+ const FORCE_PREINSTALLED_SNAPS =
20+ process . env . FORCE_PREINSTALLED_SNAPS === 'true' ;
21+ ///: END:ONLY_INCLUDE_IF
22+
1223/**
1324 * Check if a Snap is a preinstalled Snap.
1425 *
1526 * @param snapId - Snap ID to verify.
1627 * @returns True if Snap is a preinstalled Snap, false otherwise.
1728 */
1829export function isSnapPreinstalled ( snapId : SnapId ) {
30+ ///: BEGIN:ONLY_INCLUDE_IF(flask)
31+ // For development purposes, allow local Snaps to be treated as preinstalled
32+ // Snaps if the `FORCE_PREINSTALLED_SNAPS` environment variable is enabled.
33+ if ( FORCE_PREINSTALLED_SNAPS && snapId . startsWith ( 'local:' ) ) {
34+ return true ;
35+ }
36+ ///: END:ONLY_INCLUDE_IF
37+
1938 return PREINSTALLED_SNAPS . some ( ( snap ) => snap . snapId === snapId ) ;
2039}
2140
Original file line number Diff line number Diff line change 241241 "@metamask/signature-controller" : " ^30.0.0" ,
242242 "@metamask/slip44" : " ^4.2.0" ,
243243 "@metamask/smart-transactions-controller" : " ^16.5.0" ,
244- "@metamask/snaps-controllers" : " ^14.0.2 " ,
245- "@metamask/snaps-execution-environments" : " ^10.0 .0" ,
244+ "@metamask/snaps-controllers" : " ^14.1.0 " ,
245+ "@metamask/snaps-execution-environments" : " ^10.1 .0" ,
246246 "@metamask/snaps-rpc-methods" : " ^13.3.0" ,
247- "@metamask/snaps-sdk" : " ^9.1 .0" ,
248- "@metamask/snaps-utils" : " ^11.0 .0" ,
247+ "@metamask/snaps-sdk" : " ^9.2 .0" ,
248+ "@metamask/snaps-utils" : " ^11.1 .0" ,
249249 "@metamask/solana-wallet-snap" : " ^1.35.2" ,
250250 "@metamask/solana-wallet-standard" : " ^0.5.0" ,
251251 "@metamask/stake-sdk" : " ^3.2.0" ,
You can’t perform that action at this time.
0 commit comments