@metamask/snaps-utils 1.0.2 → 2.0.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 +36 -221
- package/dist/cjs/array.js +23 -0
- package/dist/cjs/array.js.map +1 -0
- package/dist/cjs/caveats.js +36 -0
- package/dist/cjs/caveats.js.map +1 -0
- package/dist/cjs/checksum.js +38 -0
- package/dist/cjs/checksum.js.map +1 -0
- package/dist/cjs/cronjob.js +84 -0
- package/dist/cjs/cronjob.js.map +1 -0
- package/dist/cjs/deep-clone.js +22 -0
- package/dist/cjs/deep-clone.js.map +1 -0
- package/dist/cjs/default-endowments.js +49 -0
- package/dist/cjs/default-endowments.js.map +1 -0
- package/dist/cjs/entropy.js +23 -0
- package/dist/cjs/entropy.js.map +1 -0
- package/dist/cjs/enum.js +16 -0
- package/dist/cjs/enum.js.map +1 -0
- package/dist/cjs/errors.js +19 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/{eval-worker.js → cjs/eval-worker.js} +22 -21
- package/dist/cjs/eval-worker.js.map +1 -0
- package/dist/cjs/eval.js +77 -0
- package/dist/cjs/eval.js.map +1 -0
- package/dist/cjs/fs.js +126 -0
- package/dist/cjs/fs.js.map +1 -0
- package/dist/cjs/handlers.js +80 -0
- package/dist/cjs/handlers.js.map +1 -0
- package/dist/cjs/icon.js +37 -0
- package/dist/cjs/icon.js.map +1 -0
- package/dist/cjs/iframe.js +59 -0
- package/dist/cjs/iframe.js.map +1 -0
- package/dist/cjs/index.browser.js +43 -0
- package/dist/cjs/index.browser.js.map +1 -0
- package/dist/cjs/index.executionenv.js +24 -0
- package/dist/cjs/index.executionenv.js.map +1 -0
- package/dist/cjs/index.js +48 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/json-rpc.js +46 -0
- package/dist/cjs/json-rpc.js.map +1 -0
- package/dist/cjs/json.js +16 -0
- package/dist/cjs/json.js.map +1 -0
- package/dist/cjs/logging.js +40 -0
- package/dist/cjs/logging.js.map +1 -0
- package/dist/cjs/manifest/index.browser.js +20 -0
- package/dist/cjs/manifest/index.browser.js.map +1 -0
- package/dist/cjs/manifest/index.js +21 -0
- package/dist/cjs/manifest/index.js.map +1 -0
- package/dist/cjs/manifest/manifest.js +239 -0
- package/dist/cjs/manifest/manifest.js.map +1 -0
- package/dist/cjs/manifest/validation.js +188 -0
- package/dist/cjs/manifest/validation.js.map +1 -0
- package/dist/cjs/mock.js +128 -0
- package/dist/cjs/mock.js.map +1 -0
- package/dist/cjs/namespace.js +132 -0
- package/dist/cjs/namespace.js.map +1 -0
- package/dist/cjs/npm.js +81 -0
- package/dist/cjs/npm.js.map +1 -0
- package/dist/cjs/path.js +21 -0
- package/dist/cjs/path.js.map +1 -0
- package/dist/cjs/post-process.js +328 -0
- package/dist/cjs/post-process.js.map +1 -0
- package/dist/cjs/snaps.js +230 -0
- package/dist/cjs/snaps.js.map +1 -0
- package/dist/cjs/strings.js +21 -0
- package/dist/cjs/strings.js.map +1 -0
- package/dist/cjs/structs.js +163 -0
- package/dist/cjs/structs.js.map +1 -0
- package/dist/cjs/types.js +109 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/validation.js +22 -0
- package/dist/cjs/validation.js.map +1 -0
- package/dist/cjs/versions.js +47 -0
- package/dist/cjs/versions.js.map +1 -0
- package/dist/cjs/virtual-file/VirtualFile.js +85 -0
- package/dist/cjs/virtual-file/VirtualFile.js.map +1 -0
- package/dist/cjs/virtual-file/index.browser.js +20 -0
- package/dist/cjs/virtual-file/index.browser.js.map +1 -0
- package/dist/cjs/virtual-file/index.js +21 -0
- package/dist/cjs/virtual-file/index.js.map +1 -0
- package/dist/cjs/virtual-file/toVirtualFile.js +33 -0
- package/dist/cjs/virtual-file/toVirtualFile.js.map +1 -0
- package/dist/{array.js → esm/array.js} +3 -7
- package/dist/esm/array.js.map +1 -0
- package/dist/esm/caveats.js +26 -0
- package/dist/esm/caveats.js.map +1 -0
- package/dist/esm/checksum.js +36 -0
- package/dist/esm/checksum.js.map +1 -0
- package/dist/esm/cronjob.js +66 -0
- package/dist/esm/cronjob.js.map +1 -0
- package/dist/esm/deep-clone.js +7 -0
- package/dist/esm/deep-clone.js.map +1 -0
- package/dist/{default-endowments.js → esm/default-endowments.js} +3 -6
- package/dist/esm/default-endowments.js.map +1 -0
- package/dist/esm/entropy.js +6 -0
- package/dist/esm/entropy.js.map +1 -0
- package/dist/esm/enum.js +12 -0
- package/dist/esm/enum.js.map +1 -0
- package/dist/esm/errors.js +17 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/eval-worker.js +47 -0
- package/dist/esm/eval-worker.js.map +1 -0
- package/dist/esm/eval.js +65 -0
- package/dist/esm/eval.js.map +1 -0
- package/dist/{fs.js → esm/fs.js} +33 -56
- package/dist/esm/fs.js.map +1 -0
- package/dist/esm/handlers.js +59 -0
- package/dist/esm/handlers.js.map +1 -0
- package/dist/esm/icon.js +11 -0
- package/dist/esm/icon.js.map +1 -0
- package/dist/{iframe.js → esm/iframe.js} +16 -18
- package/dist/esm/iframe.js.map +1 -0
- package/dist/esm/index.browser.js +26 -0
- package/dist/esm/index.browser.js.map +1 -0
- package/dist/esm/index.executionenv.js +7 -0
- package/dist/esm/index.executionenv.js.map +1 -0
- package/dist/esm/index.js +31 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/json-rpc.js +39 -0
- package/dist/esm/json-rpc.js.map +1 -0
- package/dist/esm/json.js +17 -0
- package/dist/esm/json.js.map +1 -0
- package/dist/{logging.js → esm/logging.js} +6 -14
- package/dist/esm/logging.js.map +1 -0
- package/dist/esm/manifest/index.browser.js +3 -0
- package/dist/esm/manifest/index.browser.js.map +1 -0
- package/dist/esm/manifest/index.js +4 -0
- package/dist/esm/manifest/index.js.map +1 -0
- package/dist/{manifest → esm/manifest}/manifest.js +101 -115
- package/dist/esm/manifest/manifest.js.map +1 -0
- package/dist/esm/manifest/validation.js +154 -0
- package/dist/esm/manifest/validation.js.map +1 -0
- package/dist/{mock.js → esm/mock.js} +42 -40
- package/dist/esm/mock.js.map +1 -0
- package/dist/esm/namespace.js +112 -0
- package/dist/esm/namespace.js.map +1 -0
- package/dist/esm/npm.js +70 -0
- package/dist/esm/npm.js.map +1 -0
- package/dist/esm/path.js +17 -0
- package/dist/esm/path.js.map +1 -0
- package/dist/{post-process.js → esm/post-process.js} +110 -99
- package/dist/esm/post-process.js.map +1 -0
- package/dist/esm/snaps.js +215 -0
- package/dist/esm/snaps.js.map +1 -0
- package/dist/esm/strings.js +11 -0
- package/dist/esm/strings.js.map +1 -0
- package/dist/esm/structs.js +230 -0
- package/dist/esm/structs.js.map +1 -0
- package/dist/esm/types.js +80 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/validation.js +17 -0
- package/dist/esm/validation.js.map +1 -0
- package/dist/{versions.js → esm/versions.js} +15 -18
- package/dist/esm/versions.js.map +1 -0
- package/dist/{virtual-file → esm/virtual-file}/VirtualFile.js +47 -33
- package/dist/esm/virtual-file/VirtualFile.js.map +1 -0
- package/dist/esm/virtual-file/index.browser.js +3 -0
- package/dist/esm/virtual-file/index.browser.js.map +1 -0
- package/dist/esm/virtual-file/index.js +4 -0
- package/dist/esm/virtual-file/index.js.map +1 -0
- package/dist/esm/virtual-file/toVirtualFile.js +26 -0
- package/dist/esm/virtual-file/toVirtualFile.js.map +1 -0
- package/dist/{caveats.d.ts → types/caveats.d.ts} +5 -5
- package/dist/{cronjob.d.ts → types/cronjob.d.ts} +1 -1
- package/dist/types/enum.d.ts +30 -0
- package/dist/types/errors.d.ts +10 -0
- package/dist/{eval.d.ts → types/eval.d.ts} +9 -1
- package/dist/{fs.d.ts → types/fs.d.ts} +2 -2
- package/dist/types/handlers.d.ts +196 -0
- package/dist/types/icon.d.ts +4 -0
- package/dist/{iframe.d.ts → types/iframe.d.ts} +3 -2
- package/dist/{index.browser.d.ts → types/index.browser.d.ts} +5 -1
- package/dist/{index.d.ts → types/index.d.ts} +5 -1
- package/dist/{json-rpc.d.ts → types/json-rpc.d.ts} +2 -2
- package/dist/types/json.d.ts +13 -0
- package/dist/{manifest → types/manifest}/manifest.d.ts +6 -4
- package/dist/{manifest → types/manifest}/validation.d.ts +40 -81
- package/dist/types/namespace.d.ts +128 -0
- package/dist/{npm.d.ts → types/npm.d.ts} +2 -3
- package/dist/{snaps.d.ts → types/snaps.d.ts} +17 -9
- package/dist/types/strings.d.ts +8 -0
- package/dist/types/structs.d.ts +158 -0
- package/dist/{types.d.ts → types/types.d.ts} +15 -22
- package/dist/types/validation.d.ts +8 -0
- package/dist/{versions.d.ts → types/versions.d.ts} +1 -1
- package/package.json +67 -47
- package/dist/array.js.map +0 -1
- package/dist/caveats.js +0 -35
- package/dist/caveats.js.map +0 -1
- package/dist/checksum.js +0 -42
- package/dist/checksum.js.map +0 -1
- package/dist/cronjob.js +0 -71
- package/dist/cronjob.js.map +0 -1
- package/dist/deep-clone.js +0 -9
- package/dist/deep-clone.js.map +0 -1
- package/dist/default-endowments.js.map +0 -1
- package/dist/entropy.js +0 -8
- package/dist/entropy.js.map +0 -1
- package/dist/eval-worker.js.map +0 -1
- package/dist/eval.js +0 -27
- package/dist/eval.js.map +0 -1
- package/dist/fs.js.map +0 -1
- package/dist/handlers.d.ts +0 -105
- package/dist/handlers.js +0 -3
- package/dist/handlers.js.map +0 -1
- package/dist/iframe.js.map +0 -1
- package/dist/iframe.test.browser.js +0 -15
- package/dist/iframe.test.browser.js.map +0 -1
- package/dist/index.browser.js +0 -37
- package/dist/index.browser.js.map +0 -1
- package/dist/index.executionenv.js +0 -22
- package/dist/index.executionenv.js.map +0 -1
- package/dist/index.js +0 -42
- package/dist/index.js.map +0 -1
- package/dist/json-rpc.js +0 -46
- package/dist/json-rpc.js.map +0 -1
- package/dist/json.d.ts +0 -9
- package/dist/json.js +0 -18
- package/dist/json.js.map +0 -1
- package/dist/logging.js.map +0 -1
- package/dist/manifest/index.browser.js +0 -18
- package/dist/manifest/index.browser.js.map +0 -1
- package/dist/manifest/index.js +0 -19
- package/dist/manifest/index.js.map +0 -1
- package/dist/manifest/manifest.js.map +0 -1
- package/dist/manifest/validation.js +0 -141
- package/dist/manifest/validation.js.map +0 -1
- package/dist/mock.js.map +0 -1
- package/dist/namespace.d.ts +0 -275
- package/dist/namespace.js +0 -225
- package/dist/namespace.js.map +0 -1
- package/dist/notification.d.ts +0 -66
- package/dist/notification.js +0 -58
- package/dist/notification.js.map +0 -1
- package/dist/npm.js +0 -74
- package/dist/npm.js.map +0 -1
- package/dist/path.js +0 -21
- package/dist/path.js.map +0 -1
- package/dist/post-process.js.map +0 -1
- package/dist/snaps.js +0 -202
- package/dist/snaps.js.map +0 -1
- package/dist/types.js +0 -103
- package/dist/types.js.map +0 -1
- package/dist/versions.js.map +0 -1
- package/dist/virtual-file/VirtualFile.js.map +0 -1
- package/dist/virtual-file/index.browser.js +0 -18
- package/dist/virtual-file/index.browser.js.map +0 -1
- package/dist/virtual-file/index.js +0 -19
- package/dist/virtual-file/index.js.map +0 -1
- package/dist/virtual-file/toVirtualFile.js +0 -30
- package/dist/virtual-file/toVirtualFile.js.map +0 -1
- /package/dist/{array.d.ts → types/array.d.ts} +0 -0
- /package/dist/{checksum.d.ts → types/checksum.d.ts} +0 -0
- /package/dist/{deep-clone.d.ts → types/deep-clone.d.ts} +0 -0
- /package/dist/{default-endowments.d.ts → types/default-endowments.d.ts} +0 -0
- /package/dist/{entropy.d.ts → types/entropy.d.ts} +0 -0
- /package/dist/{eval-worker.d.ts → types/eval-worker.d.ts} +0 -0
- /package/dist/{iframe.test.browser.d.ts → types/iframe.test.browser.d.ts} +0 -0
- /package/dist/{index.executionenv.d.ts → types/index.executionenv.d.ts} +0 -0
- /package/dist/{logging.d.ts → types/logging.d.ts} +0 -0
- /package/dist/{manifest → types/manifest}/index.browser.d.ts +0 -0
- /package/dist/{manifest → types/manifest}/index.d.ts +0 -0
- /package/dist/{mock.d.ts → types/mock.d.ts} +0 -0
- /package/dist/{path.d.ts → types/path.d.ts} +0 -0
- /package/dist/{post-process.d.ts → types/post-process.d.ts} +0 -0
- /package/dist/{virtual-file → types/virtual-file}/VirtualFile.d.ts +0 -0
- /package/dist/{virtual-file → types/virtual-file}/index.browser.d.ts +0 -0
- /package/dist/{virtual-file → types/virtual-file}/index.d.ts +0 -0
- /package/dist/{virtual-file → types/virtual-file}/toVirtualFile.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,241 +6,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
## [
|
|
9
|
+
## [2.0.1]
|
|
10
10
|
### Changed
|
|
11
|
-
-
|
|
11
|
+
- Remove deprecated `endowment:long-running` ([#1751](https://github.com/MetaMask/snaps/pull/1751))
|
|
12
12
|
|
|
13
|
-
## [
|
|
13
|
+
## [2.0.0]
|
|
14
14
|
### Changed
|
|
15
|
-
-
|
|
15
|
+
- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
|
|
16
16
|
|
|
17
|
-
## [
|
|
18
|
-
### Changed
|
|
19
|
-
- Bump semver to `^7.5.4` ([#1631](https://github.com/MetaMask/snaps/pull/1631))
|
|
20
|
-
- Move source code and snap state back to controller state ([#1634](https://github.com/MetaMask/snaps/pull/1634))
|
|
21
|
-
|
|
22
|
-
## [1.0.0-prerelease.1]
|
|
23
|
-
### Added
|
|
24
|
-
- Add subject type restrictions to snap-specific permissions ([#1366](https://github.com/MetaMask/snaps/pull/1366))
|
|
25
|
-
|
|
26
|
-
### Changed
|
|
27
|
-
- **BREAKING:** Disallow deriving Ethereum keys ([#1217](https://github.com/MetaMask/snaps/pull/1217))
|
|
28
|
-
- Coin type `60` is now blocked for derivation.
|
|
29
|
-
|
|
30
|
-
### Fixed
|
|
31
|
-
- Improve JSON parsing safety ([#1499](https://github.com/MetaMask/snaps/pull/1499))
|
|
32
|
-
|
|
33
|
-
## [0.32.2]
|
|
34
|
-
### Changed
|
|
35
|
-
- No changes this release.
|
|
36
|
-
|
|
37
|
-
## [0.32.1]
|
|
38
|
-
### Changed
|
|
39
|
-
- No changes this release.
|
|
40
|
-
|
|
41
|
-
## [0.32.0]
|
|
42
|
-
### Changed
|
|
43
|
-
- Use side effects to install snaps via `wallet_snap` permission ([#1301](https://github.com/MetaMask/snaps-monorepo/pull/1301))
|
|
44
|
-
|
|
45
|
-
## [0.31.0]
|
|
46
|
-
### Changed
|
|
47
|
-
- **BREAKING:** Target `ES2020` ([#1247](https://github.com/MetaMask/snaps-monorepo/pull/1247))
|
|
48
|
-
- Improve validation and sanitizing of snap IDs ([#1237](https://github.com/MetaMask/snaps-monorepo/pull/1237))
|
|
49
|
-
|
|
50
|
-
## [0.30.0]
|
|
51
|
-
### Changed
|
|
52
|
-
- Properly sandbox iframe and inline SES in execution bundles ([#1193](https://github.com/MetaMask/snaps-monorepo/pull/1193))
|
|
53
|
-
|
|
54
|
-
## [0.29.0]
|
|
55
|
-
### Changed
|
|
56
|
-
- Skip writing manifest if identical ([#1171](https://github.com/MetaMask/snaps-monorepo/pull/1171))
|
|
57
|
-
- This fixes a bug on Windows where the CLI could get stuck in a loop
|
|
58
|
-
|
|
59
|
-
### Removed
|
|
60
|
-
- **BREAKING:** Remove `SnapsGlobalObject` type ([#1014](https://github.com/MetaMask/snaps-monorepo/pull/1014))
|
|
61
|
-
|
|
62
|
-
## [0.28.0]
|
|
63
|
-
### Added
|
|
64
|
-
- **BREAKING:** Add support for snap registries ([#1090](https://github.com/MetaMask/snaps-monorepo/pull/1090))
|
|
65
|
-
- This removes the `checkBlockList` constructor argument in favor of `registry`
|
|
66
|
-
- A registry implementation can be passed here, defaulting to a hosted JSON file
|
|
67
|
-
- Requiring a snap to be on the allowlist can be toggled with the feature flag `requireAllowlist`
|
|
68
|
-
- Add experimental offscreen execution environment ([#1082](https://github.com/MetaMask/snaps-monorepo/pull/1082))
|
|
69
|
-
|
|
70
|
-
### Changed
|
|
71
|
-
- **BREAKING:** Bump `key-tree` to 6.2.0 and use `Uint8Array` for secret recovery phrases ([#1137](https://github.com/MetaMask/snaps-monorepo/pull/1137))
|
|
72
|
-
|
|
73
|
-
### Removed
|
|
74
|
-
- **BREAKING:** Remove `WebSocket` endowment ([#1122](https://github.com/MetaMask/snaps-monorepo/pull/1122))
|
|
75
|
-
|
|
76
|
-
### Fixed
|
|
77
|
-
- Fix missing cronjob export ([#1134](https://github.com/MetaMask/snaps-monorepo/pull/1134))
|
|
78
|
-
|
|
79
|
-
## [0.27.1]
|
|
80
|
-
### Changed
|
|
81
|
-
- No changes this release.
|
|
82
|
-
|
|
83
|
-
## [0.27.0]
|
|
84
|
-
### Changed
|
|
85
|
-
- **BREAKING:** Use SIP-6 algorithm for state encryption ([#1055](https://github.com/MetaMask/snaps-monorepo/pull/1055))
|
|
86
|
-
- This breaks all existing snaps that use `snap_manageState`
|
|
87
|
-
- **BREAKING:** Use custom UI in transaction insights ([#1047](https://github.com/MetaMask/snaps-monorepo/pull/1047))
|
|
88
|
-
- **BREAKING:** Move all internal types from `snaps-types` to `snaps-utils` ([#1060](https://github.com/MetaMask/snaps-monorepo/pull/1060))
|
|
89
|
-
|
|
90
|
-
## [0.26.2]
|
|
91
|
-
### Changed
|
|
92
|
-
- No changes this release.
|
|
93
|
-
|
|
94
|
-
## [0.26.1]
|
|
95
|
-
### Fixed
|
|
96
|
-
- Fix some paths being wrongly normalized ([#1053](https://github.com/MetaMask/snaps-monorepo/pull/1053))
|
|
97
|
-
- Fix utils browser export ([#1049](https://github.com/MetaMask/snaps-monorepo/pull/1049))
|
|
98
|
-
|
|
99
|
-
## [0.26.0]
|
|
100
|
-
### Fixed
|
|
101
|
-
- Fix post processing issue with `object.eval` ([#1040](https://github.com/MetaMask/snaps-monorepo/pull/1040))
|
|
102
|
-
|
|
103
|
-
## [0.25.0]
|
|
104
|
-
### Added
|
|
105
|
-
- **BREAKING:** Add JSON-RPC handler permission ([#905](https://github.com/MetaMask/snaps-monorepo/pull/905))
|
|
106
|
-
- Snaps are now required to request `endowment:rpc` to receive RPC requests.
|
|
107
|
-
|
|
108
|
-
## [0.24.1]
|
|
109
|
-
### Fixed
|
|
110
|
-
- Fix `snap_getBip32PublicKey` manifest validation ([#970](https://github.com/MetaMask/snaps-monorepo/pull/970))
|
|
111
|
-
|
|
112
|
-
## [0.24.0]
|
|
17
|
+
## [0.38.4-flask.1]
|
|
113
18
|
### Added
|
|
114
|
-
- Add
|
|
115
|
-
- Add `snap_getEntropy` JSON-RPC method ([#940](https://github.com/MetaMask/snaps-monorepo/pull/940))
|
|
116
|
-
- Add permission validation to `snap.manifest.json` ([#910](https://github.com/MetaMask/snaps-monorepo/pull/910))
|
|
117
|
-
- Add compile-time warning when using `Math.random` ([#950](https://github.com/MetaMask/snaps-monorepo/pull/950))
|
|
19
|
+
- Add `onNameLookup` export ([#1394](https://github.com/MetaMask/snaps/pull/1394), [#1759](https://github.com/MetaMask/snaps/pull/1759))
|
|
118
20
|
|
|
119
21
|
### Changed
|
|
120
|
-
-
|
|
121
|
-
- **BREAKING:** Remove `wallet` global in favor of `snap` and `ethereum` ([#939](https://github.com/MetaMask/snaps-monorepo/pull/939), [#964](https://github.com/MetaMask/snaps-monorepo/pull/964))
|
|
122
|
-
|
|
123
|
-
## [0.23.0]
|
|
124
|
-
### Added
|
|
125
|
-
- Add snap cronjobs ([#651](https://github.com/MetaMask/snaps-monorepo/pull/651))
|
|
22
|
+
- Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738))
|
|
126
23
|
|
|
24
|
+
## [0.38.3-flask.1]
|
|
127
25
|
### Changed
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
- Replace JSON schema validation with structs ([#862](https://github.com/MetaMask/snaps-monorepo/pull/862))
|
|
131
|
-
|
|
132
|
-
### Removed
|
|
133
|
-
- **BREAKING:** Stop including source code in SnapController state ([#861](https://github.com/MetaMask/snaps-monorepo/pull/861))
|
|
26
|
+
- Bump `@metamask/post-message-stream` from 6.1.2 to 7.0.0 ([#1707](https://github.com/MetaMask/snaps/pull/1707), [#1724](https://github.com/MetaMask/snaps/pull/1724))
|
|
27
|
+
- Bump `@metamask/utils` and `@metamask/snaps-registry` ([#1694](https://github.com/MetaMask/snaps/pull/1694))
|
|
134
28
|
|
|
135
|
-
## [0.
|
|
29
|
+
## [0.38.2-flask.1]
|
|
136
30
|
### Fixed
|
|
137
|
-
-
|
|
31
|
+
- Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
|
|
138
32
|
|
|
139
|
-
## [0.
|
|
33
|
+
## [0.38.1-flask.1]
|
|
140
34
|
### Changed
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### Fixed
|
|
145
|
-
- Add browser entry point for `snap-utils` ([#820](https://github.com/MetaMask/snaps-monorepo/pull/820))
|
|
35
|
+
- Update transaction insights response and add severity level enum ([#1653](https://github.com/MetaMask/snaps/pull/1653))
|
|
36
|
+
- Snaps are now able to specify a `severity` for alongside their insights.
|
|
37
|
+
- See [SIP-11](https://metamask.github.io/SIPs/SIPS/sip-11) for more information.
|
|
146
38
|
|
|
147
|
-
## [0.
|
|
39
|
+
## [0.38.0-flask.1]
|
|
148
40
|
### Added
|
|
149
|
-
- Add
|
|
150
|
-
|
|
151
|
-
## [0.21.0]
|
|
152
|
-
### Changed
|
|
153
|
-
- Run eval and fix manifest in bundler plugins ([#731](https://github.com/MetaMask/snaps-monorepo/pull/731))
|
|
154
|
-
|
|
155
|
-
## [0.20.0]
|
|
156
|
-
### Added
|
|
157
|
-
- **BREAKING:** Add Transaction Insight API ([#642](https://github.com/MetaMask/snaps-monorepo/pull/642))
|
|
158
|
-
- Add internal types from `@metamask/snaps-types` ([#695](https://github.com/MetaMask/snaps-monorepo/pull/695))
|
|
159
|
-
|
|
160
|
-
### Changed
|
|
161
|
-
- **BREAKING:** Simplify manifest format for permission caveats ([#705](https://github.com/MetaMask/snaps-monorepo/pull/705))
|
|
162
|
-
- Reduce TypeScript compilation target for `snap-controllers` ([#708](https://github.com/MetaMask/snaps-monorepo/pull/708))
|
|
163
|
-
|
|
164
|
-
## [0.19.1]
|
|
165
|
-
### Added
|
|
166
|
-
- Generate source maps from modified code ([#615](https://github.com/MetaMask/snaps-monorepo/pull/615))
|
|
167
|
-
|
|
168
|
-
## [0.19.0]
|
|
169
|
-
### Changed
|
|
170
|
-
- Move eval functionality to utils package ([#666](https://github.com/MetaMask/snaps-monorepo/pull/666))
|
|
171
|
-
- Move manifest handling functionality to utils ([#652](https://github.com/MetaMask/snaps-monorepo/pull/652))
|
|
172
|
-
- Move JSON schemas and controller utils to utils package ([#623](https://github.com/MetaMask/snaps-monorepo/pull/623))
|
|
173
|
-
|
|
174
|
-
### Fixed
|
|
175
|
-
- Fixed missing AbortSignal in default endowments ([#682](https://github.com/MetaMask/snaps-monorepo/pull/682))
|
|
176
|
-
|
|
177
|
-
## [0.18.1]
|
|
178
|
-
### Changed
|
|
179
|
-
- No changes this release.
|
|
41
|
+
- Add `onInstall` and `onUpdate` lifecycle hooks ([#1643](https://github.com/MetaMask/snaps/pull/1643))
|
|
180
42
|
|
|
181
|
-
## [0.18.0]
|
|
182
43
|
### Changed
|
|
183
|
-
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
## [0.13.0]
|
|
203
|
-
### Changed
|
|
204
|
-
- No changes this release.
|
|
205
|
-
|
|
206
|
-
## [0.12.0]
|
|
207
|
-
### Added
|
|
208
|
-
- Initial release ([#410](https://github.com/MetaMask/snaps-monorepo/pull/410), [#421](https://github.com/MetaMask/snaps-monorepo/pull/421))
|
|
209
|
-
|
|
210
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/v1.0.2...HEAD
|
|
211
|
-
[1.0.2]: https://github.com/MetaMask/snaps/compare/v1.0.1...v1.0.2
|
|
212
|
-
[1.0.1]: https://github.com/MetaMask/snaps/compare/v1.0.0...v1.0.1
|
|
213
|
-
[1.0.0]: https://github.com/MetaMask/snaps/compare/v1.0.0-prerelease.1...v1.0.0
|
|
214
|
-
[1.0.0-prerelease.1]: https://github.com/MetaMask/snaps/compare/v0.32.2...v1.0.0-prerelease.1
|
|
215
|
-
[0.32.2]: https://github.com/MetaMask/snaps/compare/v0.32.1...v0.32.2
|
|
216
|
-
[0.32.1]: https://github.com/MetaMask/snaps/compare/v0.32.0...v0.32.1
|
|
217
|
-
[0.32.0]: https://github.com/MetaMask/snaps/compare/v0.31.0...v0.32.0
|
|
218
|
-
[0.31.0]: https://github.com/MetaMask/snaps/compare/v0.30.0...v0.31.0
|
|
219
|
-
[0.30.0]: https://github.com/MetaMask/snaps/compare/v0.29.0...v0.30.0
|
|
220
|
-
[0.29.0]: https://github.com/MetaMask/snaps/compare/v0.28.0...v0.29.0
|
|
221
|
-
[0.28.0]: https://github.com/MetaMask/snaps/compare/v0.27.1...v0.28.0
|
|
222
|
-
[0.27.1]: https://github.com/MetaMask/snaps/compare/v0.27.0...v0.27.1
|
|
223
|
-
[0.27.0]: https://github.com/MetaMask/snaps/compare/v0.26.2...v0.27.0
|
|
224
|
-
[0.26.2]: https://github.com/MetaMask/snaps/compare/v0.26.1...v0.26.2
|
|
225
|
-
[0.26.1]: https://github.com/MetaMask/snaps/compare/v0.26.0...v0.26.1
|
|
226
|
-
[0.26.0]: https://github.com/MetaMask/snaps/compare/v0.25.0...v0.26.0
|
|
227
|
-
[0.25.0]: https://github.com/MetaMask/snaps/compare/v0.24.1...v0.25.0
|
|
228
|
-
[0.24.1]: https://github.com/MetaMask/snaps/compare/v0.24.0...v0.24.1
|
|
229
|
-
[0.24.0]: https://github.com/MetaMask/snaps/compare/v0.23.0...v0.24.0
|
|
230
|
-
[0.23.0]: https://github.com/MetaMask/snaps/compare/v0.22.3...v0.23.0
|
|
231
|
-
[0.22.3]: https://github.com/MetaMask/snaps/compare/v0.22.2...v0.22.3
|
|
232
|
-
[0.22.2]: https://github.com/MetaMask/snaps/compare/v0.22.1...v0.22.2
|
|
233
|
-
[0.22.1]: https://github.com/MetaMask/snaps/compare/v0.22.0...v0.22.1
|
|
234
|
-
[0.22.0]: https://github.com/MetaMask/snaps/compare/v0.21.0...v0.22.0
|
|
235
|
-
[0.21.0]: https://github.com/MetaMask/snaps/compare/v0.20.0...v0.21.0
|
|
236
|
-
[0.20.0]: https://github.com/MetaMask/snaps/compare/v0.19.1...v0.20.0
|
|
237
|
-
[0.19.1]: https://github.com/MetaMask/snaps/compare/v0.19.0...v0.19.1
|
|
238
|
-
[0.19.0]: https://github.com/MetaMask/snaps/compare/v0.18.1...v0.19.0
|
|
239
|
-
[0.18.1]: https://github.com/MetaMask/snaps/compare/v0.18.0...v0.18.1
|
|
240
|
-
[0.18.0]: https://github.com/MetaMask/snaps/compare/v0.17.0...v0.18.0
|
|
241
|
-
[0.17.0]: https://github.com/MetaMask/snaps/compare/v0.16.0...v0.17.0
|
|
242
|
-
[0.16.0]: https://github.com/MetaMask/snaps/compare/v0.15.0...v0.16.0
|
|
243
|
-
[0.15.0]: https://github.com/MetaMask/snaps/compare/v0.14.0...v0.15.0
|
|
244
|
-
[0.14.0]: https://github.com/MetaMask/snaps/compare/v0.13.0...v0.14.0
|
|
245
|
-
[0.13.0]: https://github.com/MetaMask/snaps/compare/v0.12.0...v0.13.0
|
|
246
|
-
[0.12.0]: https://github.com/MetaMask/snaps/releases/tag/v0.12.0
|
|
44
|
+
- Move source code and snap state back to controller state ([#1634](https://github.com/MetaMask/snaps/pull/1634))
|
|
45
|
+
- Bump `semver` to `^7.5.4` ([#1631](https://github.com/MetaMask/snaps/pull/1631))
|
|
46
|
+
|
|
47
|
+
## [0.37.2-flask.1]
|
|
48
|
+
### Changed
|
|
49
|
+
- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
|
|
50
|
+
- The version of the package no longer needs to match the version of all other
|
|
51
|
+
MetaMask Snaps packages.
|
|
52
|
+
|
|
53
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@2.0.1...HEAD
|
|
54
|
+
[2.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@2.0.0...@metamask/snaps-utils@2.0.1
|
|
55
|
+
[2.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.38.4-flask.1...@metamask/snaps-utils@2.0.0
|
|
56
|
+
[0.38.4-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.38.3-flask.1...@metamask/snaps-utils@0.38.4-flask.1
|
|
57
|
+
[0.38.3-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.38.2-flask.1...@metamask/snaps-utils@0.38.3-flask.1
|
|
58
|
+
[0.38.2-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.38.1-flask.1...@metamask/snaps-utils@0.38.2-flask.1
|
|
59
|
+
[0.38.1-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.38.0-flask.1...@metamask/snaps-utils@0.38.1-flask.1
|
|
60
|
+
[0.38.0-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@0.37.2-flask.1...@metamask/snaps-utils@0.38.0-flask.1
|
|
61
|
+
[0.37.2-flask.1]: https://github.com/MetaMask/snaps/releases/tag/@metamask/snaps-utils@0.37.2-flask.1
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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[/**
|
|
32
|
+
* Caveat specifying the CAIP-2 chain IDs that a snap can service, currently limited to `endowment:name-lookup`.
|
|
33
|
+
*/ "ChainIds"] = 'chainIds';
|
|
34
|
+
})(SnapCaveatType || (SnapCaveatType = {}));
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=caveats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 /**\n * Caveat specifying the CAIP-2 chain IDs that a snap can service, currently limited to `endowment:name-lookup`.\n */\n ChainIds = 'chainIds',\n}\n"],"names":["SnapCaveatType","PermittedDerivationPaths","PermittedCoinTypes","SnapCronjob","TransactionOrigin","RpcOrigin","SnapIds","ChainIds"],"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;IA7BAN,eA+BV;;GAEC,GACDO,cAAW;GAlCDP,mBAAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cronjob.ts"],"sourcesContent":["import { JsonRpcRequestStruct } from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n assign,\n coerce,\n create,\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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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 _structs = require("./structs");
|
|
12
|
+
function enumValue(constant) {
|
|
13
|
+
return (0, _structs.literal)(constant);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/enum.ts"],"sourcesContent":["import type { Struct } from 'superstruct';\n\nimport { literal } from './structs';\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>, null> {\n return literal(constant as EnumToUnion<Type>);\n}\n"],"names":["enumValue","constant","literal"],"mappings":";;;;+BAiCgBA;;;eAAAA;;;yBA/BQ;AA+BjB,SAASA,UACdC,QAAc;IAEd,OAAOC,IAAAA,gBAAO,EAACD;AACjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getErrorMessage", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getErrorMessage;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _utils = require("@metamask/utils");
|
|
12
|
+
function getErrorMessage(error) {
|
|
13
|
+
if ((0, _utils.isObject)(error) && (0, _utils.hasProperty)(error, 'message') && typeof error.message === 'string') {
|
|
14
|
+
return error.message;
|
|
15
|
+
}
|
|
16
|
+
return String(error);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=errors.js.map
|