@metamask/snaps-utils 0.35.0-flask.1 → 1.0.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -41
- package/dist/{esm/array.js → array.js} +7 -3
- package/dist/array.js.map +1 -0
- package/dist/{types/caveats.d.ts → caveats.d.ts} +4 -0
- package/dist/caveats.js +35 -0
- package/dist/caveats.js.map +1 -0
- package/dist/checksum.js +42 -0
- package/dist/checksum.js.map +1 -0
- package/dist/cronjob.js +71 -0
- package/dist/cronjob.js.map +1 -0
- package/dist/deep-clone.js +9 -0
- package/dist/deep-clone.js.map +1 -0
- package/dist/{esm/default-endowments.js → default-endowments.js} +6 -3
- package/dist/default-endowments.js.map +1 -0
- package/dist/entropy.js +8 -0
- package/dist/entropy.js.map +1 -0
- package/dist/{cjs/eval-worker.js → eval-worker.js} +21 -22
- package/dist/eval-worker.js.map +1 -0
- package/dist/eval.js +27 -0
- package/dist/eval.js.map +1 -0
- package/dist/{esm/fs.js → fs.js} +56 -33
- package/dist/fs.js.map +1 -0
- package/dist/{types/handlers.d.ts → handlers.d.ts} +42 -5
- package/dist/handlers.js +3 -0
- package/dist/handlers.js.map +1 -0
- package/dist/{types/iframe.d.ts → iframe.d.ts} +2 -3
- package/dist/{esm/iframe.js → iframe.js} +18 -16
- package/dist/iframe.js.map +1 -0
- package/dist/iframe.test.browser.js +15 -0
- package/dist/iframe.test.browser.js.map +1 -0
- package/dist/{types/index.browser.d.ts → index.browser.d.ts} +1 -2
- package/dist/index.browser.js +37 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/{types/index.d.ts → index.d.ts} +1 -2
- package/dist/index.executionenv.js +22 -0
- package/dist/index.executionenv.js.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/json-rpc.js +46 -0
- package/dist/json-rpc.js.map +1 -0
- package/dist/json.d.ts +9 -0
- package/dist/json.js +18 -0
- package/dist/json.js.map +1 -0
- package/dist/{esm/logging.js → logging.js} +14 -6
- package/dist/logging.js.map +1 -0
- package/dist/manifest/index.browser.js +18 -0
- package/dist/manifest/index.browser.js.map +1 -0
- package/dist/manifest/index.js +19 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/{esm/manifest → manifest}/manifest.js +113 -98
- package/dist/manifest/manifest.js.map +1 -0
- package/dist/{types/manifest → manifest}/validation.d.ts +73 -31
- package/dist/manifest/validation.js +141 -0
- package/dist/manifest/validation.js.map +1 -0
- package/dist/{esm/mock.js → mock.js} +40 -42
- package/dist/mock.js.map +1 -0
- package/dist/namespace.d.ts +275 -0
- package/dist/namespace.js +225 -0
- package/dist/namespace.js.map +1 -0
- package/dist/notification.d.ts +66 -0
- package/dist/notification.js +58 -0
- package/dist/notification.js.map +1 -0
- package/dist/{types/npm.d.ts → npm.d.ts} +2 -0
- package/dist/npm.js +74 -0
- package/dist/npm.js.map +1 -0
- package/dist/path.js +21 -0
- package/dist/path.js.map +1 -0
- package/dist/{esm/post-process.js → post-process.js} +99 -110
- package/dist/post-process.js.map +1 -0
- package/dist/{types/snaps.d.ts → snaps.d.ts} +2 -9
- package/dist/snaps.js +202 -0
- package/dist/snaps.js.map +1 -0
- package/dist/{types/types.d.ts → types.d.ts} +5 -2
- package/dist/types.js +103 -0
- package/dist/types.js.map +1 -0
- package/dist/{esm/versions.js → versions.js} +18 -15
- package/dist/versions.js.map +1 -0
- package/dist/{esm/virtual-file → virtual-file}/VirtualFile.js +33 -47
- package/dist/virtual-file/VirtualFile.js.map +1 -0
- package/dist/virtual-file/index.browser.js +18 -0
- package/dist/virtual-file/index.browser.js.map +1 -0
- package/dist/virtual-file/index.js +19 -0
- package/dist/virtual-file/index.js.map +1 -0
- package/dist/virtual-file/toVirtualFile.js +30 -0
- package/dist/virtual-file/toVirtualFile.js.map +1 -0
- package/package.json +32 -61
- package/dist/cjs/array.js +0 -23
- package/dist/cjs/array.js.map +0 -1
- package/dist/cjs/caveats.js +0 -33
- package/dist/cjs/caveats.js.map +0 -1
- package/dist/cjs/checksum.js +0 -38
- package/dist/cjs/checksum.js.map +0 -1
- package/dist/cjs/cronjob.js +0 -84
- package/dist/cjs/cronjob.js.map +0 -1
- package/dist/cjs/deep-clone.js +0 -22
- package/dist/cjs/deep-clone.js.map +0 -1
- package/dist/cjs/default-endowments.js +0 -49
- package/dist/cjs/default-endowments.js.map +0 -1
- package/dist/cjs/entropy.js +0 -23
- package/dist/cjs/entropy.js.map +0 -1
- package/dist/cjs/enum.js +0 -16
- package/dist/cjs/enum.js.map +0 -1
- package/dist/cjs/eval-worker.js.map +0 -1
- package/dist/cjs/eval.js +0 -29
- package/dist/cjs/eval.js.map +0 -1
- package/dist/cjs/fs.js +0 -126
- package/dist/cjs/fs.js.map +0 -1
- package/dist/cjs/handlers.js +0 -6
- package/dist/cjs/handlers.js.map +0 -1
- package/dist/cjs/icon.js +0 -37
- package/dist/cjs/icon.js.map +0 -1
- package/dist/cjs/iframe.js +0 -59
- package/dist/cjs/iframe.js.map +0 -1
- package/dist/cjs/index.browser.js +0 -40
- package/dist/cjs/index.browser.js.map +0 -1
- package/dist/cjs/index.executionenv.js +0 -24
- package/dist/cjs/index.executionenv.js.map +0 -1
- package/dist/cjs/index.js +0 -45
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/json-rpc.js +0 -46
- package/dist/cjs/json-rpc.js.map +0 -1
- package/dist/cjs/json.js +0 -16
- package/dist/cjs/json.js.map +0 -1
- package/dist/cjs/logging.js +0 -40
- package/dist/cjs/logging.js.map +0 -1
- package/dist/cjs/manifest/index.browser.js +0 -20
- package/dist/cjs/manifest/index.browser.js.map +0 -1
- package/dist/cjs/manifest/index.js +0 -21
- package/dist/cjs/manifest/index.js.map +0 -1
- package/dist/cjs/manifest/manifest.js +0 -239
- package/dist/cjs/manifest/manifest.js.map +0 -1
- package/dist/cjs/manifest/validation.js +0 -183
- package/dist/cjs/manifest/validation.js.map +0 -1
- package/dist/cjs/mock.js +0 -128
- package/dist/cjs/mock.js.map +0 -1
- package/dist/cjs/namespace.js +0 -124
- package/dist/cjs/namespace.js.map +0 -1
- package/dist/cjs/npm.js +0 -81
- package/dist/cjs/npm.js.map +0 -1
- package/dist/cjs/path.js +0 -21
- package/dist/cjs/path.js.map +0 -1
- package/dist/cjs/post-process.js +0 -328
- package/dist/cjs/post-process.js.map +0 -1
- package/dist/cjs/snaps.js +0 -230
- package/dist/cjs/snaps.js.map +0 -1
- package/dist/cjs/types.js +0 -117
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/validation.js +0 -22
- package/dist/cjs/validation.js.map +0 -1
- package/dist/cjs/versions.js +0 -47
- package/dist/cjs/versions.js.map +0 -1
- package/dist/cjs/virtual-file/VirtualFile.js +0 -85
- package/dist/cjs/virtual-file/VirtualFile.js.map +0 -1
- package/dist/cjs/virtual-file/index.browser.js +0 -20
- package/dist/cjs/virtual-file/index.browser.js.map +0 -1
- package/dist/cjs/virtual-file/index.js +0 -21
- package/dist/cjs/virtual-file/index.js.map +0 -1
- package/dist/cjs/virtual-file/toVirtualFile.js +0 -33
- package/dist/cjs/virtual-file/toVirtualFile.js.map +0 -1
- package/dist/esm/array.js.map +0 -1
- package/dist/esm/caveats.js +0 -23
- package/dist/esm/caveats.js.map +0 -1
- package/dist/esm/checksum.js +0 -36
- package/dist/esm/checksum.js.map +0 -1
- package/dist/esm/cronjob.js +0 -66
- package/dist/esm/cronjob.js.map +0 -1
- package/dist/esm/deep-clone.js +0 -7
- package/dist/esm/deep-clone.js.map +0 -1
- package/dist/esm/default-endowments.js.map +0 -1
- package/dist/esm/entropy.js +0 -6
- package/dist/esm/entropy.js.map +0 -1
- package/dist/esm/enum.js +0 -12
- package/dist/esm/enum.js.map +0 -1
- package/dist/esm/eval-worker.js +0 -47
- package/dist/esm/eval-worker.js.map +0 -1
- package/dist/esm/eval.js +0 -25
- package/dist/esm/eval.js.map +0 -1
- package/dist/esm/fs.js.map +0 -1
- package/dist/esm/handlers.js +0 -3
- package/dist/esm/handlers.js.map +0 -1
- package/dist/esm/icon.js +0 -11
- package/dist/esm/icon.js.map +0 -1
- package/dist/esm/iframe.js.map +0 -1
- package/dist/esm/index.browser.js +0 -23
- package/dist/esm/index.browser.js.map +0 -1
- package/dist/esm/index.executionenv.js +0 -7
- package/dist/esm/index.executionenv.js.map +0 -1
- package/dist/esm/index.js +0 -28
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-rpc.js +0 -39
- package/dist/esm/json-rpc.js.map +0 -1
- package/dist/esm/json.js +0 -17
- package/dist/esm/json.js.map +0 -1
- package/dist/esm/logging.js.map +0 -1
- package/dist/esm/manifest/index.browser.js +0 -3
- package/dist/esm/manifest/index.browser.js.map +0 -1
- package/dist/esm/manifest/index.js +0 -4
- package/dist/esm/manifest/index.js.map +0 -1
- package/dist/esm/manifest/manifest.js.map +0 -1
- package/dist/esm/manifest/validation.js +0 -152
- package/dist/esm/manifest/validation.js.map +0 -1
- package/dist/esm/mock.js.map +0 -1
- package/dist/esm/namespace.js +0 -110
- package/dist/esm/namespace.js.map +0 -1
- package/dist/esm/npm.js +0 -70
- package/dist/esm/npm.js.map +0 -1
- package/dist/esm/path.js +0 -17
- package/dist/esm/path.js.map +0 -1
- package/dist/esm/post-process.js.map +0 -1
- package/dist/esm/snaps.js +0 -215
- package/dist/esm/snaps.js.map +0 -1
- package/dist/esm/types.js +0 -85
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/validation.js +0 -17
- package/dist/esm/validation.js.map +0 -1
- package/dist/esm/versions.js.map +0 -1
- package/dist/esm/virtual-file/VirtualFile.js.map +0 -1
- package/dist/esm/virtual-file/index.browser.js +0 -3
- package/dist/esm/virtual-file/index.browser.js.map +0 -1
- package/dist/esm/virtual-file/index.js +0 -4
- package/dist/esm/virtual-file/index.js.map +0 -1
- package/dist/esm/virtual-file/toVirtualFile.js +0 -26
- package/dist/esm/virtual-file/toVirtualFile.js.map +0 -1
- package/dist/types/enum.d.ts +0 -30
- package/dist/types/icon.d.ts +0 -4
- package/dist/types/json.d.ts +0 -13
- package/dist/types/namespace.d.ts +0 -124
- package/dist/types/validation.d.ts +0 -8
- /package/dist/{types/array.d.ts → array.d.ts} +0 -0
- /package/dist/{types/checksum.d.ts → checksum.d.ts} +0 -0
- /package/dist/{types/cronjob.d.ts → cronjob.d.ts} +0 -0
- /package/dist/{types/deep-clone.d.ts → deep-clone.d.ts} +0 -0
- /package/dist/{types/default-endowments.d.ts → default-endowments.d.ts} +0 -0
- /package/dist/{types/entropy.d.ts → entropy.d.ts} +0 -0
- /package/dist/{types/eval-worker.d.ts → eval-worker.d.ts} +0 -0
- /package/dist/{types/eval.d.ts → eval.d.ts} +0 -0
- /package/dist/{types/fs.d.ts → fs.d.ts} +0 -0
- /package/dist/{types/iframe.test.browser.d.ts → iframe.test.browser.d.ts} +0 -0
- /package/dist/{types/index.executionenv.d.ts → index.executionenv.d.ts} +0 -0
- /package/dist/{types/json-rpc.d.ts → json-rpc.d.ts} +0 -0
- /package/dist/{types/logging.d.ts → logging.d.ts} +0 -0
- /package/dist/{types/manifest → manifest}/index.browser.d.ts +0 -0
- /package/dist/{types/manifest → manifest}/index.d.ts +0 -0
- /package/dist/{types/manifest → manifest}/manifest.d.ts +0 -0
- /package/dist/{types/mock.d.ts → mock.d.ts} +0 -0
- /package/dist/{types/path.d.ts → path.d.ts} +0 -0
- /package/dist/{types/post-process.d.ts → post-process.d.ts} +0 -0
- /package/dist/{types/versions.d.ts → versions.d.ts} +0 -0
- /package/dist/{types/virtual-file → virtual-file}/VirtualFile.d.ts +0 -0
- /package/dist/{types/virtual-file → virtual-file}/index.browser.d.ts +0 -0
- /package/dist/{types/virtual-file → virtual-file}/index.d.ts +0 -0
- /package/dist/{types/virtual-file → virtual-file}/toVirtualFile.d.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeVirtualFile = exports.readVirtualFile = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const VirtualFile_1 = require("./VirtualFile");
|
|
6
|
+
/**
|
|
7
|
+
* Reads a file from filesystem and creates a vfile.
|
|
8
|
+
*
|
|
9
|
+
* @param path - Filesystem path to load the contents from.
|
|
10
|
+
* @param encoding - Optional encoding to pass down to fs.readFile.
|
|
11
|
+
* @returns Promise returning VFile with loaded file contents.
|
|
12
|
+
*/
|
|
13
|
+
async function readVirtualFile(path, encoding = null) {
|
|
14
|
+
return new VirtualFile_1.VirtualFile({
|
|
15
|
+
path,
|
|
16
|
+
value: await fs_1.promises.readFile(path, { encoding }),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.readVirtualFile = readVirtualFile;
|
|
20
|
+
/**
|
|
21
|
+
* Writes vfile to filesystem.
|
|
22
|
+
*
|
|
23
|
+
* @param vfile - The vfile to write.
|
|
24
|
+
* @param options - Options to pass down to fs.writeFile.
|
|
25
|
+
*/
|
|
26
|
+
async function writeVirtualFile(vfile, options) {
|
|
27
|
+
return fs_1.promises.writeFile(vfile.path, vfile.value, options);
|
|
28
|
+
}
|
|
29
|
+
exports.writeVirtualFile = writeVirtualFile;
|
|
30
|
+
//# sourceMappingURL=toVirtualFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toVirtualFile.js","sourceRoot":"","sources":["../../src/virtual-file/toVirtualFile.ts"],"names":[],"mappings":";;;AAAA,2BAA4C;AAE5C,+CAA4C;AAE5C;;;;;;GAMG;AACI,KAAK,UAAU,eAAe,CACnC,IAAY,EACZ,WAAkC,IAAI;IAEtC,OAAO,IAAI,yBAAW,CAAC;QACrB,IAAI;QACJ,KAAK,EAAE,MAAM,aAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC;KACrD,CAAC,CAAC;AACL,CAAC;AARD,0CAQC;AAOD;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,KAAkB,EAClB,OAA2B;IAE3B,OAAO,aAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AALD,4CAKC","sourcesContent":["import { promises as fsPromises } from 'fs';\n\nimport { VirtualFile } from './VirtualFile';\n\n/**\n * Reads a file from filesystem and creates a vfile.\n *\n * @param path - Filesystem path to load the contents from.\n * @param encoding - Optional encoding to pass down to fs.readFile.\n * @returns Promise returning VFile with loaded file contents.\n */\nexport async function readVirtualFile(\n path: string,\n encoding: BufferEncoding | null = null,\n) {\n return new VirtualFile({\n path,\n value: await fsPromises.readFile(path, { encoding }),\n });\n}\n\ntype WriteVFileOptions = Exclude<\n Parameters<typeof fsPromises['writeFile']>[2],\n undefined\n>;\n\n/**\n * Writes vfile to filesystem.\n *\n * @param vfile - The vfile to write.\n * @param options - Options to pass down to fs.writeFile.\n */\nexport async function writeVirtualFile(\n vfile: VirtualFile,\n options?: WriteVFileOptions,\n) {\n return fsPromises.writeFile(vfile.path, vfile.value, options);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,98 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-prerelease.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
7
7
|
},
|
|
8
|
-
"sideEffects": false,
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
10
|
"browser": {
|
|
12
|
-
"
|
|
13
|
-
"require": "./dist/cjs/index.browser.js"
|
|
11
|
+
"default": "./dist/index.browser.js"
|
|
14
12
|
},
|
|
15
|
-
"import": "./dist/
|
|
16
|
-
"require": "./dist/
|
|
17
|
-
"types": "./dist/types/index.d.ts"
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.js"
|
|
18
15
|
},
|
|
19
16
|
"./test-utils": {
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"require": "./dist/
|
|
22
|
-
"types": "./dist/types/test-utils/index.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./dist/cjs/*": {
|
|
25
|
-
"require": "./dist/cjs/*.js",
|
|
26
|
-
"types": "./dist/types/*.d.ts"
|
|
27
|
-
},
|
|
28
|
-
"./dist/esm/*": {
|
|
29
|
-
"import": "./dist/esm/*.js",
|
|
30
|
-
"types": "./dist/types/*.d.ts"
|
|
17
|
+
"import": "./dist/test-utils/index.js",
|
|
18
|
+
"require": "./dist/test-utils/index.js"
|
|
31
19
|
}
|
|
32
20
|
},
|
|
33
|
-
"main": "
|
|
34
|
-
"module": "./dist/esm/index.js",
|
|
21
|
+
"main": "dist/index.js",
|
|
35
22
|
"browser": {
|
|
36
|
-
"./dist/
|
|
37
|
-
"./dist/esm/index.js": "./dist/esm/index.browser.js"
|
|
23
|
+
"./dist/index.js": "./dist/index.browser.js"
|
|
38
24
|
},
|
|
39
|
-
"types": "./dist/types/index.d.ts",
|
|
40
25
|
"typesVersions": {
|
|
41
26
|
"*": {
|
|
42
27
|
"*": [
|
|
43
|
-
"
|
|
44
|
-
],
|
|
45
|
-
"./dist/cjs/*": [
|
|
46
|
-
"./dist/types/*"
|
|
28
|
+
"dist/index.d.ts"
|
|
47
29
|
],
|
|
48
|
-
"
|
|
49
|
-
"
|
|
30
|
+
"test-utils": [
|
|
31
|
+
"dist/test-utils/index.d.ts"
|
|
50
32
|
]
|
|
51
33
|
}
|
|
52
34
|
},
|
|
53
35
|
"files": [
|
|
54
|
-
"dist/
|
|
55
|
-
"dist/esm/**",
|
|
56
|
-
"dist/types/**"
|
|
36
|
+
"dist/"
|
|
57
37
|
],
|
|
58
38
|
"scripts": {
|
|
59
39
|
"test": "rimraf coverage && jest && yarn test:browser && yarn posttest",
|
|
60
40
|
"posttest": "ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio",
|
|
61
41
|
"test:browser": "wdio run wdio.config.ts",
|
|
62
42
|
"test:ci": "yarn test",
|
|
63
|
-
"lint:eslint": "eslint . --cache --ext js,ts
|
|
64
|
-
"lint:misc": "prettier
|
|
65
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check
|
|
43
|
+
"lint:eslint": "eslint . --cache --ext js,ts",
|
|
44
|
+
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
|
|
45
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
66
46
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
67
47
|
"lint:changelog": "yarn auto-changelog validate",
|
|
68
|
-
"build": "
|
|
69
|
-
"build:source": "yarn build:esm && yarn build:cjs",
|
|
70
|
-
"build:types": "tsc --project tsconfig.build.json",
|
|
71
|
-
"build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6",
|
|
72
|
-
"build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs",
|
|
48
|
+
"build": "tsc --project tsconfig.build.json",
|
|
73
49
|
"build:clean": "yarn clean && yarn build",
|
|
74
50
|
"clean": "rimraf '*.tsbuildinfo' 'dist/*'",
|
|
75
51
|
"prepare-manifest:preview": "../../scripts/prepare-preview-manifest.sh",
|
|
76
52
|
"publish:preview": "yarn npm publish --tag preview",
|
|
77
|
-
"
|
|
53
|
+
"publish:package": "../../scripts/publish-package.sh"
|
|
78
54
|
},
|
|
79
55
|
"dependencies": {
|
|
80
|
-
"@babel/core": "^7.
|
|
56
|
+
"@babel/core": "^7.18.6",
|
|
81
57
|
"@babel/types": "^7.18.7",
|
|
82
58
|
"@metamask/base-controller": "^3.0.0",
|
|
83
59
|
"@metamask/key-tree": "^7.1.1",
|
|
84
60
|
"@metamask/permission-controller": "^4.0.0",
|
|
85
|
-
"@metamask/providers": "^
|
|
61
|
+
"@metamask/providers": "^10.2.1",
|
|
86
62
|
"@metamask/snaps-registry": "^1.2.1",
|
|
87
|
-
"@metamask/snaps-ui": "^0.
|
|
63
|
+
"@metamask/snaps-ui": "^1.0.0-prerelease.1",
|
|
88
64
|
"@metamask/utils": "^6.0.1",
|
|
89
|
-
"@noble/hashes": "^1.3
|
|
65
|
+
"@noble/hashes": "^1.1.3",
|
|
90
66
|
"@scure/base": "^1.1.1",
|
|
91
67
|
"cron-parser": "^4.5.0",
|
|
92
68
|
"eth-rpc-errors": "^4.0.3",
|
|
93
69
|
"fast-deep-equal": "^3.1.3",
|
|
94
70
|
"fast-json-stable-stringify": "^2.1.0",
|
|
95
|
-
"is-svg": "^4.4.0",
|
|
96
71
|
"rfdc": "^1.3.0",
|
|
97
72
|
"semver": "^7.3.7",
|
|
98
73
|
"ses": "^0.18.1",
|
|
@@ -102,31 +77,26 @@
|
|
|
102
77
|
"devDependencies": {
|
|
103
78
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
104
79
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
105
|
-
"@lavamoat/allow-scripts": "^2.3
|
|
80
|
+
"@lavamoat/allow-scripts": "^2.0.3",
|
|
106
81
|
"@metamask/auto-changelog": "^3.1.0",
|
|
107
82
|
"@metamask/eslint-config": "^11.0.0",
|
|
108
83
|
"@metamask/eslint-config-jest": "^11.0.0",
|
|
109
84
|
"@metamask/eslint-config-nodejs": "^11.0.1",
|
|
110
85
|
"@metamask/eslint-config-typescript": "^11.0.0",
|
|
111
|
-
"@metamask/post-message-stream": "^6.1.
|
|
112
|
-
"@swc/cli": "^0.1.62",
|
|
113
|
-
"@swc/core": "^1.3.66",
|
|
114
|
-
"@swc/jest": "^0.2.26",
|
|
86
|
+
"@metamask/post-message-stream": "^6.1.1",
|
|
115
87
|
"@types/jest": "^27.5.1",
|
|
116
88
|
"@types/mocha": "^10.0.1",
|
|
117
|
-
"@types/node": "^20.3.1",
|
|
118
89
|
"@types/semver": "^7.3.10",
|
|
119
90
|
"@types/validate-npm-package-name": "^4.0.0",
|
|
120
91
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
121
92
|
"@typescript-eslint/parser": "^5.42.1",
|
|
122
93
|
"@wdio/browser-runner": "^8.5.2",
|
|
123
|
-
"@wdio/cli": "^8.5.
|
|
124
|
-
"@wdio/globals": "^8.5.
|
|
125
|
-
"@wdio/mocha-framework": "^8.
|
|
126
|
-
"@wdio/spec-reporter": "^8.
|
|
127
|
-
"@wdio/static-server-service": "^8.
|
|
94
|
+
"@wdio/cli": "^8.5.1",
|
|
95
|
+
"@wdio/globals": "^8.5.1",
|
|
96
|
+
"@wdio/mocha-framework": "^8.4.0",
|
|
97
|
+
"@wdio/spec-reporter": "^8.4.0",
|
|
98
|
+
"@wdio/static-server-service": "^8.4.0",
|
|
128
99
|
"deepmerge": "^4.2.2",
|
|
129
|
-
"esbuild": "^0.17.15",
|
|
130
100
|
"eslint": "^8.27.0",
|
|
131
101
|
"eslint-config-prettier": "^8.5.0",
|
|
132
102
|
"eslint-plugin-import": "^2.26.0",
|
|
@@ -139,18 +109,19 @@
|
|
|
139
109
|
"istanbul-lib-report": "^3.0.0",
|
|
140
110
|
"istanbul-reports": "^3.1.5",
|
|
141
111
|
"jest": "^29.0.2",
|
|
142
|
-
"memfs": "^3.4.
|
|
112
|
+
"memfs": "^3.4.12",
|
|
143
113
|
"prettier": "^2.7.1",
|
|
144
114
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
145
|
-
"rimraf": "^
|
|
115
|
+
"rimraf": "^3.0.2",
|
|
146
116
|
"serve-handler": "^6.1.5",
|
|
117
|
+
"ts-jest": "^29.0.0",
|
|
147
118
|
"ts-node": "^10.9.1",
|
|
148
119
|
"typescript": "~4.8.4",
|
|
149
120
|
"vite": "^4.3.9",
|
|
150
121
|
"vite-tsconfig-paths": "^4.0.5",
|
|
151
122
|
"wdio-chromedriver-service": "^8.1.1",
|
|
152
123
|
"wdio-geckodriver-service": "^4.1.0",
|
|
153
|
-
"webdriverio": "^8.5.
|
|
124
|
+
"webdriverio": "^8.5.1"
|
|
154
125
|
},
|
|
155
126
|
"engines": {
|
|
156
127
|
"node": ">=16.0.0"
|
package/dist/cjs/array.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if array `a` is equal to array `b`. Note that this does not do a deep
|
|
3
|
-
* equality check. It only checks if the arrays are the same length and if each
|
|
4
|
-
* element in `a` is equal to (`===`) the corresponding element in `b`.
|
|
5
|
-
*
|
|
6
|
-
* @param a - The first array to compare.
|
|
7
|
-
* @param b - The second array to compare.
|
|
8
|
-
* @returns `true` if the arrays are equal, `false` otherwise.
|
|
9
|
-
*/ "use strict";
|
|
10
|
-
Object.defineProperty(exports, "__esModule", {
|
|
11
|
-
value: true
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "isEqual", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function() {
|
|
16
|
-
return isEqual;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function isEqual(a, b) {
|
|
20
|
-
return a.length === b.length && a.every((value, index)=>value === b[index]);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=array.js.map
|
package/dist/cjs/array.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array.ts"],"sourcesContent":["/**\n * Checks if array `a` is equal to array `b`. Note that this does not do a deep\n * equality check. It only checks if the arrays are the same length and if each\n * element in `a` is equal to (`===`) the corresponding element in `b`.\n *\n * @param a - The first array to compare.\n * @param b - The second array to compare.\n * @returns `true` if the arrays are equal, `false` otherwise.\n */\nexport function isEqual(a: unknown[], b: unknown[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\n"],"names":["isEqual","a","b","length","every","value","index"],"mappings":"AAAA;;;;;;;;CAQC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,QAAQC,CAAY,EAAEC,CAAY;IAChD,OAAOD,EAAEE,MAAM,KAAKD,EAAEC,MAAM,IAAIF,EAAEG,KAAK,CAAC,CAACC,OAAOC,QAAUD,UAAUH,CAAC,CAACI,MAAM;AAC9E"}
|
package/dist/cjs/caveats.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "SnapCaveatType", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return SnapCaveatType;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var SnapCaveatType;
|
|
12
|
-
(function(SnapCaveatType) {
|
|
13
|
-
SnapCaveatType[/**
|
|
14
|
-
* Permitted derivation paths, used by `snap_getBip32Entropy`.
|
|
15
|
-
*/ "PermittedDerivationPaths"] = 'permittedDerivationPaths';
|
|
16
|
-
SnapCaveatType[/**
|
|
17
|
-
* Permitted coin types, used by `snap_getBip44Entropy`.
|
|
18
|
-
*/ "PermittedCoinTypes"] = 'permittedCoinTypes';
|
|
19
|
-
SnapCaveatType[/**
|
|
20
|
-
* Caveat specifying a snap cronjob.
|
|
21
|
-
*/ "SnapCronjob"] = 'snapCronjob';
|
|
22
|
-
SnapCaveatType[/**
|
|
23
|
-
* Caveat specifying access to the transaction origin, used by `endowment:transaction-insight`.
|
|
24
|
-
*/ "TransactionOrigin"] = 'transactionOrigin';
|
|
25
|
-
SnapCaveatType[/**
|
|
26
|
-
* The origins that a Snap can receive JSON-RPC messages from.
|
|
27
|
-
*/ "RpcOrigin"] = 'rpcOrigin';
|
|
28
|
-
SnapCaveatType[/**
|
|
29
|
-
* Caveat specifying the snap IDs that can be interacted with.
|
|
30
|
-
*/ "SnapIds"] = 'snapIds';
|
|
31
|
-
})(SnapCaveatType || (SnapCaveatType = {}));
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=caveats.js.map
|
package/dist/cjs/caveats.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/caveats.ts"],"sourcesContent":["export enum SnapCaveatType {\n /**\n * Permitted derivation paths, used by `snap_getBip32Entropy`.\n */\n PermittedDerivationPaths = 'permittedDerivationPaths',\n\n /**\n * Permitted coin types, used by `snap_getBip44Entropy`.\n */\n PermittedCoinTypes = 'permittedCoinTypes',\n\n /**\n * Caveat specifying a snap cronjob.\n */\n SnapCronjob = 'snapCronjob',\n\n /**\n * Caveat specifying access to the transaction origin, used by `endowment:transaction-insight`.\n */\n TransactionOrigin = 'transactionOrigin',\n\n /**\n * The origins that a Snap can receive JSON-RPC messages from.\n */\n RpcOrigin = 'rpcOrigin',\n\n /**\n * Caveat specifying the snap IDs that can be interacted with.\n */\n SnapIds = 'snapIds',\n}\n"],"names":["SnapCaveatType","PermittedDerivationPaths","PermittedCoinTypes","SnapCronjob","TransactionOrigin","RpcOrigin","SnapIds"],"mappings":";;;;;;;;;;IAAO;UAAKA,cAAc;IAAdA,eACV;;GAEC,GACDC,8BAA2B;IAJjBD,eAMV;;GAEC,GACDE,wBAAqB;IATXF,eAWV;;GAEC,GACDG,iBAAc;IAdJH,eAgBV;;GAEC,GACDI,uBAAoB;IAnBVJ,eAqBV;;GAEC,GACDK,eAAY;IAxBFL,eA0BV;;GAEC,GACDM,aAAU;GA7BAN,mBAAAA"}
|
package/dist/cjs/checksum.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
checksum: function() {
|
|
13
|
-
return checksum;
|
|
14
|
-
},
|
|
15
|
-
checksumFiles: function() {
|
|
16
|
-
return checksumFiles;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _utils = require("@metamask/utils");
|
|
20
|
-
const _sha256 = require("@noble/hashes/sha256");
|
|
21
|
-
const _VirtualFile = require("./virtual-file/VirtualFile");
|
|
22
|
-
function checksum(bytes) {
|
|
23
|
-
const value = bytes instanceof _VirtualFile.VirtualFile ? bytes.value : bytes;
|
|
24
|
-
return (0, _sha256.sha256)(value);
|
|
25
|
-
}
|
|
26
|
-
function checksumFiles(files) {
|
|
27
|
-
return checksum((0, _utils.concatBytes)([
|
|
28
|
-
...files
|
|
29
|
-
].sort((a, b)=>{
|
|
30
|
-
(0, _utils.assert)(a.path !== b.path, 'Tried to sort files with non-unique paths.');
|
|
31
|
-
if (a.path < b.path) {
|
|
32
|
-
return -1;
|
|
33
|
-
}
|
|
34
|
-
return 1;
|
|
35
|
-
}).map((file)=>checksum(file))));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=checksum.js.map
|
package/dist/cjs/checksum.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/checksum.ts"],"sourcesContent":["import { assert, concatBytes } from '@metamask/utils';\nimport { sha256 } from '@noble/hashes/sha256';\n\nimport { VirtualFile } from './virtual-file/VirtualFile';\n\n/**\n * Calculates checksum for a single byte array.\n *\n * @param bytes - The byte array to calculate the checksum for.\n * @returns A single sha-256 checksum.\n */\nexport function checksum(bytes: VirtualFile | Uint8Array | string): Uint8Array {\n const value = bytes instanceof VirtualFile ? bytes.value : bytes;\n return sha256(value);\n}\n\n/**\n * Calculates checksum over multiple files in a reproducible way.\n *\n * 1. Sort all the files by their paths.\n * 2. Calculate sha-256 checksum of each file separately.\n * 3. Concatenate all the checksums into one buffer and sha-256 that buffer.\n *\n * The sorting of paths is done using {@link https://tc39.es/ecma262/#sec-islessthan UTF-16 Code Units}.\n *\n * @param files - The files over which to calculate the checksum.\n * @returns A single sha-256 checksum.\n */\nexport function checksumFiles(files: VirtualFile[]) {\n return checksum(\n concatBytes(\n [...files]\n .sort((a, b) => {\n assert(\n a.path !== b.path,\n 'Tried to sort files with non-unique paths.',\n );\n if (a.path < b.path) {\n return -1;\n }\n return 1;\n })\n .map((file) => checksum(file)),\n ),\n );\n}\n"],"names":["checksum","checksumFiles","bytes","value","VirtualFile","sha256","files","concatBytes","sort","a","b","assert","path","map","file"],"mappings":";;;;;;;;;;;IAWgBA,QAAQ;eAARA;;IAiBAC,aAAa;eAAbA;;;uBA5BoB;wBACb;6BAEK;AAQrB,SAASD,SAASE,KAAwC;IAC/D,MAAMC,QAAQD,iBAAiBE,wBAAW,GAAGF,MAAMC,KAAK,GAAGD;IAC3D,OAAOG,IAAAA,cAAM,EAACF;AAChB;AAcO,SAASF,cAAcK,KAAoB;IAChD,OAAON,SACLO,IAAAA,kBAAW,EACT;WAAID;KAAM,CACPE,IAAI,CAAC,CAACC,GAAGC;QACRC,IAAAA,aAAM,EACJF,EAAEG,IAAI,KAAKF,EAAEE,IAAI,EACjB;QAEF,IAAIH,EAAEG,IAAI,GAAGF,EAAEE,IAAI,EAAE;YACnB,OAAO,CAAC;QACV;QACA,OAAO;IACT,GACCC,GAAG,CAAC,CAACC,OAASd,SAASc;AAGhC"}
|
package/dist/cjs/cronjob.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
CronjobRpcRequestStruct: function() {
|
|
13
|
-
return CronjobRpcRequestStruct;
|
|
14
|
-
},
|
|
15
|
-
CronExpressionStruct: function() {
|
|
16
|
-
return CronExpressionStruct;
|
|
17
|
-
},
|
|
18
|
-
parseCronExpression: function() {
|
|
19
|
-
return parseCronExpression;
|
|
20
|
-
},
|
|
21
|
-
CronjobSpecificationStruct: function() {
|
|
22
|
-
return CronjobSpecificationStruct;
|
|
23
|
-
},
|
|
24
|
-
isCronjobSpecification: function() {
|
|
25
|
-
return isCronjobSpecification;
|
|
26
|
-
},
|
|
27
|
-
CronjobSpecificationArrayStruct: function() {
|
|
28
|
-
return CronjobSpecificationArrayStruct;
|
|
29
|
-
},
|
|
30
|
-
isCronjobSpecificationArray: function() {
|
|
31
|
-
return isCronjobSpecificationArray;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const _utils = require("@metamask/utils");
|
|
35
|
-
const _cronparser = require("cron-parser");
|
|
36
|
-
const _superstruct = require("superstruct");
|
|
37
|
-
const CronjobRpcRequestStruct = (0, _superstruct.assign)((0, _superstruct.partial)((0, _superstruct.pick)(_utils.JsonRpcRequestStruct, [
|
|
38
|
-
'id',
|
|
39
|
-
'jsonrpc'
|
|
40
|
-
])), (0, _superstruct.omit)(_utils.JsonRpcRequestStruct, [
|
|
41
|
-
'id',
|
|
42
|
-
'jsonrpc'
|
|
43
|
-
]));
|
|
44
|
-
const CronExpressionStruct = (0, _superstruct.refine)((0, _superstruct.coerce)((0, _superstruct.string)(), (0, _superstruct.object)({
|
|
45
|
-
minute: (0, _superstruct.optional)((0, _superstruct.string)()),
|
|
46
|
-
hour: (0, _superstruct.optional)((0, _superstruct.string)()),
|
|
47
|
-
dayOfMonth: (0, _superstruct.optional)((0, _superstruct.string)()),
|
|
48
|
-
month: (0, _superstruct.optional)((0, _superstruct.string)()),
|
|
49
|
-
dayOfWeek: (0, _superstruct.optional)((0, _superstruct.string)())
|
|
50
|
-
}), (value)=>`${value.minute ?? '*'} ${value.hour ?? '*'} ${value.dayOfMonth ?? '*'} ${value.month ?? '*'} ${value.dayOfWeek ?? '*'}`), 'CronExpression', (value)=>{
|
|
51
|
-
try {
|
|
52
|
-
(0, _cronparser.parseExpression)(value);
|
|
53
|
-
return true;
|
|
54
|
-
} catch {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
function parseCronExpression(expression) {
|
|
59
|
-
const ensureStringExpression = (0, _superstruct.create)(expression, CronExpressionStruct);
|
|
60
|
-
return (0, _cronparser.parseExpression)(ensureStringExpression);
|
|
61
|
-
}
|
|
62
|
-
const CronjobSpecificationStruct = (0, _superstruct.object)({
|
|
63
|
-
expression: CronExpressionStruct,
|
|
64
|
-
request: CronjobRpcRequestStruct
|
|
65
|
-
});
|
|
66
|
-
function isCronjobSpecification(value) {
|
|
67
|
-
try {
|
|
68
|
-
(0, _superstruct.create)(value, CronjobSpecificationStruct);
|
|
69
|
-
return true;
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const CronjobSpecificationArrayStruct = (0, _superstruct.array)(CronjobSpecificationStruct);
|
|
75
|
-
function isCronjobSpecificationArray(value) {
|
|
76
|
-
try {
|
|
77
|
-
(0, _superstruct.create)(value, CronjobSpecificationArrayStruct);
|
|
78
|
-
return true;
|
|
79
|
-
} catch {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=cronjob.js.map
|
package/dist/cjs/cronjob.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cronjob.ts"],"sourcesContent":["import { JsonRpcRequestStruct } from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport {\n array,\n assign,\n coerce,\n create,\n Infer,\n object,\n omit,\n optional,\n partial,\n pick,\n refine,\n string,\n} from 'superstruct';\n\nexport const CronjobRpcRequestStruct = assign(\n partial(pick(JsonRpcRequestStruct, ['id', 'jsonrpc'])),\n omit(JsonRpcRequestStruct, ['id', 'jsonrpc']),\n);\nexport type CronjobRpcRequest = Infer<typeof CronjobRpcRequestStruct>;\n\nexport const CronExpressionStruct = refine(\n coerce(\n string(),\n object({\n minute: optional(string()),\n hour: optional(string()),\n dayOfMonth: optional(string()),\n month: optional(string()),\n dayOfWeek: optional(string()),\n }),\n (value) =>\n `${value.minute ?? '*'} ${value.hour ?? '*'} ${value.dayOfMonth ?? '*'} ${\n value.month ?? '*'\n } ${value.dayOfWeek ?? '*'}`,\n ),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer<typeof CronExpressionStruct>;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer<typeof CronjobSpecificationStruct>;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["CronjobRpcRequestStruct","CronExpressionStruct","parseCronExpression","CronjobSpecificationStruct","isCronjobSpecification","CronjobSpecificationArrayStruct","isCronjobSpecificationArray","assign","partial","pick","JsonRpcRequestStruct","omit","refine","coerce","string","object","minute","optional","hour","dayOfMonth","month","dayOfWeek","value","parseExpression","expression","ensureStringExpression","create","request","array"],"mappings":";;;;;;;;;;;IAiBaA,uBAAuB;eAAvBA;;IAMAC,oBAAoB;eAApBA;;IAkCGC,mBAAmB;eAAnBA;;IAKHC,0BAA0B;eAA1BA;;IAYGC,sBAAsB;eAAtBA;;IASHC,+BAA+B;eAA/BA;;IAUGC,2BAA2B;eAA3BA;;;uBA7FqB;4BACL;6BAczB;AAEA,MAAMN,0BAA0BO,IAAAA,mBAAM,EAC3CC,IAAAA,oBAAO,EAACC,IAAAA,iBAAI,EAACC,2BAAoB,EAAE;IAAC;IAAM;CAAU,IACpDC,IAAAA,iBAAI,EAACD,2BAAoB,EAAE;IAAC;IAAM;CAAU;AAIvC,MAAMT,uBAAuBW,IAAAA,mBAAM,EACxCC,IAAAA,mBAAM,EACJC,IAAAA,mBAAM,KACNC,IAAAA,mBAAM,EAAC;IACLC,QAAQC,IAAAA,qBAAQ,EAACH,IAAAA,mBAAM;IACvBI,MAAMD,IAAAA,qBAAQ,EAACH,IAAAA,mBAAM;IACrBK,YAAYF,IAAAA,qBAAQ,EAACH,IAAAA,mBAAM;IAC3BM,OAAOH,IAAAA,qBAAQ,EAACH,IAAAA,mBAAM;IACtBO,WAAWJ,IAAAA,qBAAQ,EAACH,IAAAA,mBAAM;AAC5B,IACA,CAACQ,QACC,CAAC,EAAEA,MAAMN,MAAM,IAAI,IAAI,CAAC,EAAEM,MAAMJ,IAAI,IAAI,IAAI,CAAC,EAAEI,MAAMH,UAAU,IAAI,IAAI,CAAC,EACtEG,MAAMF,KAAK,IAAI,IAChB,CAAC,EAAEE,MAAMD,SAAS,IAAI,IAAI,CAAC,GAEhC,kBACA,CAACC;IACC,IAAI;QACFC,IAAAA,2BAAe,EAACD;QAChB,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAWK,SAASpB,oBAAoBsB,UAA2B;IAC7D,MAAMC,yBAAyBC,IAAAA,mBAAM,EAACF,YAAYvB;IAClD,OAAOsB,IAAAA,2BAAe,EAACE;AACzB;AAEO,MAAMtB,6BAA6BY,IAAAA,mBAAM,EAAC;IAC/CS,YAAYvB;IACZ0B,SAAS3B;AACX;AASO,SAASI,uBAAuBkB,KAAc;IACnD,IAAI;QACFI,IAAAA,mBAAM,EAACJ,OAAOnB;QACd,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEO,MAAME,kCAAkCuB,IAAAA,kBAAK,EAClDzB;AASK,SAASG,4BAA4BgB,KAAc;IACxD,IAAI;QACFI,IAAAA,mBAAM,EAACJ,OAAOjB;QACd,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
package/dist/cjs/deep-clone.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "deepClone", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return deepClone;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _rfdc = /*#__PURE__*/ _interop_require_default(require("rfdc"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
const deepClone = (0, _rfdc.default)({
|
|
18
|
-
proto: false,
|
|
19
|
-
circles: false
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=deep-clone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/deep-clone.ts"],"sourcesContent":["import rfdc from 'rfdc';\n\nexport const deepClone = rfdc({ proto: false, circles: false });\n"],"names":["deepClone","rfdc","proto","circles"],"mappings":";;;;+BAEaA;;;eAAAA;;;6DAFI;;;;;;AAEV,MAAMA,YAAYC,IAAAA,aAAI,EAAC;IAAEC,OAAO;IAAOC,SAAS;AAAM"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Global JavaScript APIs exposed by default to all snaps.
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "DEFAULT_ENDOWMENTS", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return DEFAULT_ENDOWMENTS;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const DEFAULT_ENDOWMENTS = Object.freeze([
|
|
14
|
-
'atob',
|
|
15
|
-
'btoa',
|
|
16
|
-
'BigInt',
|
|
17
|
-
'console',
|
|
18
|
-
'crypto',
|
|
19
|
-
'Date',
|
|
20
|
-
'Math',
|
|
21
|
-
'setTimeout',
|
|
22
|
-
'clearTimeout',
|
|
23
|
-
'SubtleCrypto',
|
|
24
|
-
'TextDecoder',
|
|
25
|
-
'TextEncoder',
|
|
26
|
-
'URL',
|
|
27
|
-
'setInterval',
|
|
28
|
-
'clearInterval',
|
|
29
|
-
'Int8Array',
|
|
30
|
-
'Uint8Array',
|
|
31
|
-
'Uint8ClampedArray',
|
|
32
|
-
'Int16Array',
|
|
33
|
-
'Uint16Array',
|
|
34
|
-
'Int32Array',
|
|
35
|
-
'Uint32Array',
|
|
36
|
-
'Float32Array',
|
|
37
|
-
'Float64Array',
|
|
38
|
-
'BigInt64Array',
|
|
39
|
-
'BigUint64Array',
|
|
40
|
-
'DataView',
|
|
41
|
-
'ArrayBuffer',
|
|
42
|
-
// Used by fetch, but also as API for some packages that don't do network connections
|
|
43
|
-
// https://github.com/MetaMask/snaps-monorepo/issues/662
|
|
44
|
-
// https://github.com/MetaMask/snaps-monorepo/discussions/678
|
|
45
|
-
'AbortController',
|
|
46
|
-
'AbortSignal'
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=default-endowments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/default-endowments.ts"],"sourcesContent":["/**\n * Global JavaScript APIs exposed by default to all snaps.\n */\nexport const DEFAULT_ENDOWMENTS: readonly string[] = Object.freeze([\n 'atob',\n 'btoa',\n 'BigInt',\n 'console',\n 'crypto',\n 'Date',\n 'Math',\n 'setTimeout',\n 'clearTimeout',\n 'SubtleCrypto',\n 'TextDecoder',\n 'TextEncoder',\n 'URL',\n 'setInterval',\n 'clearInterval',\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array',\n 'BigInt64Array',\n 'BigUint64Array',\n 'DataView',\n 'ArrayBuffer',\n // Used by fetch, but also as API for some packages that don't do network connections\n // https://github.com/MetaMask/snaps-monorepo/issues/662\n // https://github.com/MetaMask/snaps-monorepo/discussions/678\n 'AbortController',\n 'AbortSignal',\n]);\n"],"names":["DEFAULT_ENDOWMENTS","Object","freeze"],"mappings":"AAAA;;CAEC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,qBAAwCC,OAAOC,MAAM,CAAC;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,qFAAqF;IACrF,wDAAwD;IACxD,6DAA6D;IAC7D;IACA;CACD"}
|
package/dist/cjs/entropy.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// 0xd36e6170 - 0x80000000
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
function _export(target, all) {
|
|
7
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: all[name]
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
SIP_6_MAGIC_VALUE: function() {
|
|
14
|
-
return SIP_6_MAGIC_VALUE;
|
|
15
|
-
},
|
|
16
|
-
STATE_ENCRYPTION_MAGIC_VALUE: function() {
|
|
17
|
-
return STATE_ENCRYPTION_MAGIC_VALUE;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const SIP_6_MAGIC_VALUE = `1399742832'`;
|
|
21
|
-
const STATE_ENCRYPTION_MAGIC_VALUE = `572232532'`;
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=entropy.js.map
|
package/dist/cjs/entropy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/entropy.ts"],"sourcesContent":["// 0xd36e6170 - 0x80000000\nexport const SIP_6_MAGIC_VALUE = `1399742832'` as `${number}'`;\n\n// `${bytesToNumber(keccak256('Snaps state encryption').slice(0, 4))}'`\nexport const STATE_ENCRYPTION_MAGIC_VALUE = `572232532'` as `${number}'`;\n\nexport type MagicValue =\n | typeof SIP_6_MAGIC_VALUE\n | typeof STATE_ENCRYPTION_MAGIC_VALUE;\n"],"names":["SIP_6_MAGIC_VALUE","STATE_ENCRYPTION_MAGIC_VALUE"],"mappings":"AAAA,0BAA0B;;;;;;;;;;;;IACbA,iBAAiB;eAAjBA;;IAGAC,4BAA4B;eAA5BA;;;AAHN,MAAMD,oBAAoB,CAAC,WAAW,CAAC;AAGvC,MAAMC,+BAA+B,CAAC,UAAU,CAAC"}
|
package/dist/cjs/enum.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "enumValue", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return enumValue;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _superstruct = require("superstruct");
|
|
12
|
-
function enumValue(constant) {
|
|
13
|
-
return (0, _superstruct.literal)(constant);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=enum.js.map
|
package/dist/cjs/enum.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/enum.ts"],"sourcesContent":["import { literal, Struct } from 'superstruct';\n\n/**\n * Get the enum values as union type. This allows using both the enum string\n * values and the enum itself as values.\n *\n * Note: This only works for string enums.\n *\n * @example\n * ```typescript\n * enum Foo {\n * Bar = 'bar',\n * Baz = 'baz',\n * }\n *\n * type FooValue = EnumToUnion<Foo>;\n * // FooValue is 'bar' | 'baz'\n *\n * const foo: FooValue = Foo.Bar; // Works\n * const foo: FooValue = 'bar'; // Also works\n * ```\n */\nexport type EnumToUnion<Type extends string> = `${Type}`;\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue<Type extends string>(\n constant: Type,\n): Struct<EnumToUnion<Type>, EnumToUnion<Type>> {\n return literal(constant as EnumToUnion<Type>);\n}\n"],"names":["enumValue","constant","literal"],"mappings":";;;;+BA+BgBA;;;eAAAA;;;6BA/BgB;AA+BzB,SAASA,UACdC,QAAc;IAEd,OAAOC,IAAAA,oBAAO,EAACD;AACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eval-worker.ts"],"sourcesContent":["// eslint-disable-next-line import/no-unassigned-import\nimport 'ses/lockdown';\n\nimport { readFileSync } from 'fs';\n\nimport { generateMockEndowments } from './mock';\nimport { HandlerType, SNAP_EXPORT_NAMES } from './types';\n\ndeclare let lockdown: any, Compartment: any;\n\nlockdown({\n consoleTaming: 'unsafe',\n errorTaming: 'unsafe',\n mathTaming: 'unsafe',\n dateTaming: 'unsafe',\n overrideTaming: 'severe',\n\n // We disable domain taming, because it does not work in certain cases when\n // running tests. This is unlikely to be a problem in production, because\n // Node.js domains are deprecated.\n domainTaming: 'unsafe',\n});\n\n/**\n * Get mock endowments that don't do anything. This is useful for running the\n * eval, for snaps that try to communicate with the extension on initialisation,\n * for example.\n *\n * @returns The mock endowments.\n */\nfunction getMockEndowments() {\n const endowments = generateMockEndowments();\n return {\n ...endowments,\n window: endowments,\n self: endowments,\n };\n}\n\nconst snapFilePath = process.argv[2];\n\nconst snapModule: { exports?: any } = { exports: {} };\n\nnew Compartment({\n ...getMockEndowments(),\n module: snapModule,\n exports: snapModule.exports,\n}).evaluate(readFileSync(snapFilePath, 'utf8'));\n\nconst invalidExports = Object.keys(snapModule.exports).filter(\n (snapExport) => !SNAP_EXPORT_NAMES.includes(snapExport as HandlerType),\n);\n\nif (invalidExports.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(`Invalid snap exports detected:\\n${invalidExports.join('\\n')}`);\n}\n\nsetTimeout(() => process.exit(0), 1000); // Hack to ensure worker exits\n"],"names":["lockdown","consoleTaming","errorTaming","mathTaming","dateTaming","overrideTaming","domainTaming","getMockEndowments","endowments","generateMockEndowments","window","self","snapFilePath","process","argv","snapModule","exports","Compartment","module","evaluate","readFileSync","invalidExports","Object","keys","filter","snapExport","SNAP_EXPORT_NAMES","includes","length","console","warn","join","setTimeout","exit"],"mappings":"AAAA,uDAAuD;;;;;QAChD;oBAEsB;sBAEU;uBACQ;AAI/CA,SAAS;IACPC,eAAe;IACfC,aAAa;IACbC,YAAY;IACZC,YAAY;IACZC,gBAAgB;IAEhB,2EAA2E;IAC3E,yEAAyE;IACzE,kCAAkC;IAClCC,cAAc;AAChB;AAEA;;;;;;CAMC,GACD,SAASC;IACP,MAAMC,aAAaC,IAAAA,4BAAsB;IACzC,OAAO;QACL,GAAGD,UAAU;QACbE,QAAQF;QACRG,MAAMH;IACR;AACF;AAEA,MAAMI,eAAeC,QAAQC,IAAI,CAAC,EAAE;AAEpC,MAAMC,aAAgC;IAAEC,SAAS,CAAC;AAAE;AAEpD,IAAIC,YAAY;IACd,GAAGV,mBAAmB;IACtBW,QAAQH;IACRC,SAASD,WAAWC,OAAO;AAC7B,GAAGG,QAAQ,CAACC,IAAAA,gBAAY,EAACR,cAAc;AAEvC,MAAMS,iBAAiBC,OAAOC,IAAI,CAACR,WAAWC,OAAO,EAAEQ,MAAM,CAC3D,CAACC,aAAe,CAACC,wBAAiB,CAACC,QAAQ,CAACF;AAG9C,IAAIJ,eAAeO,MAAM,GAAG,GAAG;IAC7B,sCAAsC;IACtCC,QAAQC,IAAI,CAAC,CAAC,gCAAgC,EAAET,eAAeU,IAAI,CAAC,MAAM,CAAC;AAC7E;AAEAC,WAAW,IAAMnB,QAAQoB,IAAI,CAAC,IAAI,OAAO,8BAA8B"}
|
package/dist/cjs/eval.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "evalBundle", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return evalBundle;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _child_process = require("child_process");
|
|
12
|
-
const _path = require("path");
|
|
13
|
-
const _fs = require("./fs");
|
|
14
|
-
async function evalBundle(bundlePath) {
|
|
15
|
-
await (0, _fs.validateFilePath)(bundlePath);
|
|
16
|
-
return new Promise((resolve, reject)=>{
|
|
17
|
-
const worker = (0, _child_process.fork)((0, _path.join)(__dirname, 'eval-worker.js'), [
|
|
18
|
-
bundlePath
|
|
19
|
-
]);
|
|
20
|
-
worker.on('exit', (exitCode)=>{
|
|
21
|
-
if (exitCode === 0) {
|
|
22
|
-
return resolve(null);
|
|
23
|
-
}
|
|
24
|
-
return reject(new Error(`Process exited with non-zero exit code: ${exitCode}`));
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=eval.js.map
|
package/dist/cjs/eval.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eval.ts"],"sourcesContent":["import { fork } from 'child_process';\nimport { join } from 'path';\n\nimport { validateFilePath } from './fs';\n\n/**\n * Spawn a new process to run the provided bundle in.\n *\n * @param bundlePath - The path to the bundle to run.\n * @returns `null` if the worker ran successfully.\n * @throws If the worker failed to run successfully.\n */\nexport async function evalBundle(bundlePath: string): Promise<null> {\n await validateFilePath(bundlePath);\n\n return new Promise((resolve, reject) => {\n const worker = fork(join(__dirname, 'eval-worker.js'), [bundlePath]);\n\n worker.on('exit', (exitCode: number) => {\n if (exitCode === 0) {\n return resolve(null);\n }\n\n return reject(\n new Error(`Process exited with non-zero exit code: ${exitCode}`),\n );\n });\n });\n}\n"],"names":["evalBundle","bundlePath","validateFilePath","Promise","resolve","reject","worker","fork","join","__dirname","on","exitCode","Error"],"mappings":";;;;+BAYsBA;;;eAAAA;;;+BAZD;sBACA;oBAEY;AAS1B,eAAeA,WAAWC,UAAkB;IACjD,MAAMC,IAAAA,oBAAgB,EAACD;IAEvB,OAAO,IAAIE,QAAQ,CAACC,SAASC;QAC3B,MAAMC,SAASC,IAAAA,mBAAI,EAACC,IAAAA,UAAI,EAACC,WAAW,mBAAmB;YAACR;SAAW;QAEnEK,OAAOI,EAAE,CAAC,QAAQ,CAACC;YACjB,IAAIA,aAAa,GAAG;gBAClB,OAAOP,QAAQ;YACjB;YAEA,OAAOC,OACL,IAAIO,MAAM,CAAC,wCAAwC,EAAED,SAAS,CAAC;QAEnE;IACF;AACF"}
|