Skip to content

Commit 35ac762

Browse files
authored
Add Snaps via Flask (#13462)
This PR adds `snaps` under Flask build flags to the extension. This branch is mostly equivalent to the current production version of Flask, excepting some bug fixes and tweaks. Closes #11626
1 parent 2b5b787 commit 35ac762

File tree

84 files changed

+2706
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2706
-343
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ module.exports = {
171171
'app/scripts/migrations/*.test.js',
172172
'app/scripts/platforms/*.test.js',
173173
'app/scripts/controllers/network/**/*.test.js',
174-
'app/scripts/controllers/permissions/*.test.js',
174+
'app/scripts/controllers/permissions/**/*.test.js',
175175
],
176176
extends: ['@metamask/eslint-config-mocha'],
177177
rules: {
@@ -198,7 +198,7 @@ module.exports = {
198198
'app/scripts/migrations/*.test.js',
199199
'app/scripts/platforms/*.test.js',
200200
'app/scripts/controllers/network/**/*.test.js',
201-
'app/scripts/controllers/permissions/*.test.js',
201+
'app/scripts/controllers/permissions/**/*.test.js',
202202
],
203203
extends: ['@metamask/eslint-config-jest'],
204204
rules: {

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
'./app/scripts/migrations/*.test.js',
77
'./app/scripts/platforms/*.test.js',
88
'./app/scripts/controllers/network/**/*.test.js',
9-
'./app/scripts/controllers/permissions/*.test.js',
9+
'./app/scripts/controllers/permissions/**/*.test.js',
1010
],
1111
recursive: true,
1212
require: ['test/env.js', 'test/setup.js'],

.storybook/test-data.js

Lines changed: 115 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,85 @@ const state = {
102102
swapsFeatureIsLive: false,
103103
swapsQuoteRefreshTime: 60000,
104104
},
105+
"snapStates": {},
106+
"snaps": {
107+
"local:http://localhost:8080/": {
108+
"enabled": true,
109+
"id": "local:http://localhost:8080/",
110+
"initialPermissions": {
111+
"snap_confirm": {}
112+
},
113+
"manifest": {
114+
"description": "An example MetaMask Snap.",
115+
"initialPermissions": {
116+
"snap_confirm": {}
117+
},
118+
"manifestVersion": "0.1",
119+
"proposedName": "MetaMask Example Snap",
120+
"repository": {
121+
"type": "git",
122+
"url": "https://github.com/MetaMask/snaps-skunkworks.git"
123+
},
124+
"source": {
125+
"location": {
126+
"npm": {
127+
"filePath": "dist/bundle.js",
128+
"iconPath": "images/icon.svg",
129+
"packageName": "@metamask/example-snap",
130+
"registry": "https://registry.npmjs.org/"
131+
}
132+
},
133+
"shasum": "3lEt0yUu080DwV78neROaAAIQWXukSkMnP4OBhOhBnE="
134+
},
135+
"version": "0.6.0"
136+
},
137+
"permissionName": "wallet_snap_local:http://localhost:8080/",
138+
"sourceCode": "(...)",
139+
"status": "stopped",
140+
"svgIcon": "<svg>...</svg>",
141+
"version": "0.6.0"
142+
},
143+
"Filecoin Snap": {
144+
"enabled": true,
145+
"id": "npm:http://localhost:8080/",
146+
"initialPermissions": {
147+
"snap_confirm": {},
148+
"eth_accounts": {},
149+
"snap_manageState": {},
150+
},
151+
"manifest": {
152+
"description": "This swap provides developers everywhere access to an entirely new data storage paradigm, even letting your programs store data autonomously. Learn more.",
153+
"initialPermissions": {
154+
"snap_confirm": {},
155+
"eth_accounts": {},
156+
"snap_manageState": {},
157+
},
158+
"manifestVersion": "0.1",
159+
"proposedName": "Filecoin Snap",
160+
"repository": {
161+
"type": "git",
162+
"url": "https://github.com/MetaMask/snaps-skunkworks.git"
163+
},
164+
"source": {
165+
"location": {
166+
"npm": {
167+
"filePath": "dist/bundle.js",
168+
"iconPath": "images/icon.svg",
169+
"packageName": "@metamask/example-snap",
170+
"registry": "https://registry.npmjs.org/"
171+
}
172+
},
173+
"shasum": "3lEt0yUu080DwV78neROaAAIQWXukSkMnP4OBhOhBnE="
174+
},
175+
"version": "0.6.0"
176+
},
177+
"permissionName": "wallet_snap_npm:http://localhost:8080/",
178+
"sourceCode": "(...)",
179+
"status": "stopped",
180+
"svgIcon": "<svg>...</svg>",
181+
"version": "0.6.0"
182+
},
183+
},
105184
accountArray: [
106185
{
107186
name: 'This is a Really Long Account Name',
@@ -1030,6 +1109,17 @@ const state = {
10301109
},
10311110
},
10321111
},
1112+
"local:http://localhost:8080/": {
1113+
permissions: {
1114+
'snap_confirm': {
1115+
invoker: "local:http://localhost:8080/",
1116+
parentCapability: 'snap_confirm',
1117+
id: 'a7342F4b-beae-4525-a36c-c0635fd03359',
1118+
date: 1620710693178,
1119+
caveats: []
1120+
},
1121+
},
1122+
},
10331123
},
10341124
permissionActivityLog: [
10351125
{
@@ -1172,20 +1262,6 @@ const state = {
11721262
},
11731263
},
11741264
},
1175-
subjectMetadata: {
1176-
'https://metamask.github.io': {
1177-
name: 'E2E Test Dapp',
1178-
origin: 'https://metamask.github.io',
1179-
iconUrl: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
1180-
subjectType: 'website',
1181-
},
1182-
'https://app.uniswap.org': {
1183-
name: 'Uniswap',
1184-
origin: 'https://app.uniswap.org',
1185-
iconUrl: './UNI.png',
1186-
subjectType: 'website',
1187-
},
1188-
},
11891265
threeBoxSyncingAllowed: false,
11901266
showRestorePrompt: true,
11911267
threeBoxLastUpdated: 0,
@@ -1212,6 +1288,31 @@ const state = {
12121288
ensResolutionsByAddress: {},
12131289
pendingApprovals: {},
12141290
pendingApprovalCount: 0,
1291+
subjectMetadata: {
1292+
"http://localhost:8080": {
1293+
extensionId: null,
1294+
iconUrl: null,
1295+
name: "Hello, Snaps!",
1296+
origin: "http://localhost:8080",
1297+
subjectType: "website"
1298+
},
1299+
"https://metamask.github.io": {
1300+
extensionId: null,
1301+
iconUrl: null,
1302+
name: "Snaps Iframe Execution Environment",
1303+
origin: "https://metamask.github.io",
1304+
subjectType: "website"
1305+
},
1306+
"local:http://localhost:8080/": {
1307+
extensionId: null,
1308+
iconUrl: null,
1309+
name: "MetaMask Example Snap",
1310+
origin: "local:http://localhost:8080/",
1311+
subjectType: "snap",
1312+
svgIcon: "<svg>...</svg>",
1313+
version: "0.6.0"
1314+
}
1315+
}
12151316
},
12161317
appState: {
12171318
shouldClose: false,

app/_locales/de/messages.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/el/messages.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)