@metamask/snaps-controllers 9.7.0 → 9.9.0

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +142 -1
  2. package/dist/cronjob/CronjobController.cjs +21 -34
  3. package/dist/cronjob/CronjobController.cjs.map +1 -1
  4. package/dist/cronjob/CronjobController.mjs +21 -34
  5. package/dist/cronjob/CronjobController.mjs.map +1 -1
  6. package/dist/insights/SnapInsightsController.cjs +194 -144
  7. package/dist/insights/SnapInsightsController.cjs.map +1 -1
  8. package/dist/insights/SnapInsightsController.mjs +193 -143
  9. package/dist/insights/SnapInsightsController.mjs.map +1 -1
  10. package/dist/interface/SnapInterfaceController.cjs +90 -65
  11. package/dist/interface/SnapInterfaceController.cjs.map +1 -1
  12. package/dist/interface/SnapInterfaceController.d.cts +2 -1
  13. package/dist/interface/SnapInterfaceController.d.cts.map +1 -1
  14. package/dist/interface/SnapInterfaceController.d.mts +2 -1
  15. package/dist/interface/SnapInterfaceController.d.mts.map +1 -1
  16. package/dist/interface/SnapInterfaceController.mjs +90 -65
  17. package/dist/interface/SnapInterfaceController.mjs.map +1 -1
  18. package/dist/services/AbstractExecutionService.cjs +71 -77
  19. package/dist/services/AbstractExecutionService.cjs.map +1 -1
  20. package/dist/services/AbstractExecutionService.mjs +71 -77
  21. package/dist/services/AbstractExecutionService.mjs.map +1 -1
  22. package/dist/services/ProxyPostMessageStream.cjs +19 -26
  23. package/dist/services/ProxyPostMessageStream.cjs.map +1 -1
  24. package/dist/services/ProxyPostMessageStream.mjs +19 -26
  25. package/dist/services/ProxyPostMessageStream.mjs.map +1 -1
  26. package/dist/services/iframe/IframeExecutionService.cjs +1 -0
  27. package/dist/services/iframe/IframeExecutionService.cjs.map +1 -1
  28. package/dist/services/iframe/IframeExecutionService.mjs +1 -0
  29. package/dist/services/iframe/IframeExecutionService.mjs.map +1 -1
  30. package/dist/services/offscreen/OffscreenExecutionService.cjs +3 -16
  31. package/dist/services/offscreen/OffscreenExecutionService.cjs.map +1 -1
  32. package/dist/services/offscreen/OffscreenExecutionService.mjs +3 -16
  33. package/dist/services/offscreen/OffscreenExecutionService.mjs.map +1 -1
  34. package/dist/services/proxy/ProxyExecutionService.cjs +4 -17
  35. package/dist/services/proxy/ProxyExecutionService.cjs.map +1 -1
  36. package/dist/services/proxy/ProxyExecutionService.mjs +4 -17
  37. package/dist/services/proxy/ProxyExecutionService.mjs.map +1 -1
  38. package/dist/services/webview/WebViewExecutionService.cjs +9 -23
  39. package/dist/services/webview/WebViewExecutionService.cjs.map +1 -1
  40. package/dist/services/webview/WebViewExecutionService.mjs +9 -23
  41. package/dist/services/webview/WebViewExecutionService.mjs.map +1 -1
  42. package/dist/services/webview/WebViewMessageStream.cjs +12 -25
  43. package/dist/services/webview/WebViewMessageStream.cjs.map +1 -1
  44. package/dist/services/webview/WebViewMessageStream.d.cts +1 -2
  45. package/dist/services/webview/WebViewMessageStream.d.cts.map +1 -1
  46. package/dist/services/webview/WebViewMessageStream.d.mts +1 -2
  47. package/dist/services/webview/WebViewMessageStream.d.mts.map +1 -1
  48. package/dist/services/webview/WebViewMessageStream.mjs +12 -25
  49. package/dist/services/webview/WebViewMessageStream.mjs.map +1 -1
  50. package/dist/services/webview/index.cjs +1 -0
  51. package/dist/services/webview/index.cjs.map +1 -1
  52. package/dist/services/webview/index.d.cts +1 -0
  53. package/dist/services/webview/index.d.cts.map +1 -1
  54. package/dist/services/webview/index.d.mts +1 -0
  55. package/dist/services/webview/index.d.mts.map +1 -1
  56. package/dist/services/webview/index.mjs +1 -0
  57. package/dist/services/webview/index.mjs.map +1 -1
  58. package/dist/services/webworker/WebWorkerExecutionService.cjs +10 -23
  59. package/dist/services/webworker/WebWorkerExecutionService.cjs.map +1 -1
  60. package/dist/services/webworker/WebWorkerExecutionService.mjs +10 -23
  61. package/dist/services/webworker/WebWorkerExecutionService.mjs.map +1 -1
  62. package/dist/snaps/RequestQueue.cjs +2 -0
  63. package/dist/snaps/RequestQueue.cjs.map +1 -1
  64. package/dist/snaps/RequestQueue.mjs +2 -0
  65. package/dist/snaps/RequestQueue.mjs.map +1 -1
  66. package/dist/snaps/SnapController.cjs +1141 -1001
  67. package/dist/snaps/SnapController.cjs.map +1 -1
  68. package/dist/snaps/SnapController.mjs +1140 -1000
  69. package/dist/snaps/SnapController.mjs.map +1 -1
  70. package/dist/snaps/Timer.cjs +1 -0
  71. package/dist/snaps/Timer.cjs.map +1 -1
  72. package/dist/snaps/Timer.mjs +1 -0
  73. package/dist/snaps/Timer.mjs.map +1 -1
  74. package/dist/snaps/location/http.cjs +11 -7
  75. package/dist/snaps/location/http.cjs.map +1 -1
  76. package/dist/snaps/location/http.mjs +11 -7
  77. package/dist/snaps/location/http.mjs.map +1 -1
  78. package/dist/snaps/location/local.cjs +4 -17
  79. package/dist/snaps/location/local.cjs.map +1 -1
  80. package/dist/snaps/location/local.mjs +4 -17
  81. package/dist/snaps/location/local.mjs.map +1 -1
  82. package/dist/snaps/location/npm.cjs +25 -37
  83. package/dist/snaps/location/npm.cjs.map +1 -1
  84. package/dist/snaps/location/npm.mjs +25 -37
  85. package/dist/snaps/location/npm.mjs.map +1 -1
  86. package/dist/snaps/registry/json.cjs +172 -173
  87. package/dist/snaps/registry/json.cjs.map +1 -1
  88. package/dist/snaps/registry/json.mjs +171 -172
  89. package/dist/snaps/registry/json.mjs.map +1 -1
  90. package/package.json +38 -23
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,18 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [9.9.0]
11
+
12
+ ### Added
13
+
14
+ - Add support for `metamask:` schemed URLs ([#2719](https://github.com/MetaMask/snaps/pull/2719))
15
+
16
+ ## [9.8.0]
17
+
18
+ ### Added
19
+
20
+ - Export `WebViewMessageStream` and related types ([#2746](https://github.com/MetaMask/snaps/pull/2746))
21
+
22
+ ### Fixed
23
+
24
+ - Fix invalid `exports` field ([#2740](https://github.com/MetaMask/snaps/pull/2740))
25
+
9
26
  ## [9.7.0]
27
+
10
28
  ### Added
29
+
11
30
  - Add `hideSnapBranding` flag for preinstalled Snaps ([#2713](https://github.com/MetaMask/snaps/pull/2713), [#2717](https://github.com/MetaMask/snaps/pull/2717))
12
31
 
13
32
  ### Fixed
33
+
14
34
  - Fix invalid types in type declaration in some cases ([#2714](https://github.com/MetaMask/snaps/pull/2714))
15
35
 
16
36
  ## [9.6.0]
37
+
17
38
  ### Added
39
+
18
40
  - Add `stopAllSnaps` function to `SnapController` ([#2674](https://github.com/MetaMask/snaps/pull/2674))
19
41
 
20
42
  ### Fixed
43
+
21
44
  - Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
22
45
  - This fixes the ESM version of the package to be fully compliant with the ESM
23
46
  standard.
@@ -25,22 +48,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
25
48
  - Bump other MetaMask dependencies ([#2703](https://github.com/MetaMask/snaps/pull/2703))
26
49
 
27
50
  ## [9.5.0]
51
+
28
52
  ### Added
53
+
29
54
  - Add `Selector` component ([#2645](https://github.com/MetaMask/snaps/pull/2645))
30
55
  - Add missing types for `getState` action & `stateChange` event ([#2655](https://github.com/MetaMask/snaps/pull/2655), [#2659](https://github.com/MetaMask/snaps/pull/2659))
31
56
 
32
57
  ### Fixed
58
+
33
59
  - Fix `fetch` binding under LavaMoat ([#2642](https://github.com/MetaMask/snaps/pull/2642))
34
60
 
35
61
  ## [9.4.0]
62
+
36
63
  ### Added
64
+
37
65
  - Add `RadioGroup` component ([#2592](https://github.com/MetaMask/snaps/pull/2592))
38
66
 
39
67
  ### Changed
68
+
40
69
  - Persist `severity` property in `SnapInsightsController` ([#2612](https://github.com/MetaMask/snaps/pull/2612))
41
70
 
42
71
  ## [9.3.1]
72
+
43
73
  ### Changed
74
+
44
75
  - Bump `@metamask/approval-controller` from `^7.0.0` to `^7.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
45
76
  - Bump `@metamask/base-controller` from `^6.0.1` to `^6.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
46
77
  - Bump `@metamask/json-rpc-engine` from `^9.0.0` to `^9.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
@@ -50,11 +81,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
50
81
  - Bump `@metamask/snaps-utils` from `^7.8.0` to `^7.8.1` ([#2595](https://github.com/MetaMask/snaps/pull/2595))
51
82
 
52
83
  ## [9.3.0]
84
+
53
85
  ### Added
86
+
54
87
  - Add `snap_resolveInterface` RPC method to the `SnapInterfaceController` ([#2509](https://github.com/metamask/snaps/pull/2509))
55
88
  - Add `SnapInsightsController` ([#2555](https://github.com/metamask/snaps/pull/2555))
56
89
 
57
90
  ### Changed
91
+
58
92
  - Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
59
93
  - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
60
94
  - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
@@ -66,6 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
100
  - Bump peer dependency `@metamask/snaps-execution-environments` to `^6.6.1` ([#2589](https://github.com/MetaMask/snaps/pull/2589))
67
101
 
68
102
  ### Fixed
103
+
69
104
  - Handle initial connections for preinstalled Snaps ([#2591](https://github.com/MetaMask/snaps/pull/2591))
70
105
  - Account for revoked origins when calculating the difference in `initialConnections` ([#2535](https://github.com/metamask/snaps/pull/2535))
71
106
  - Fixes issue of revoking permissions that are already revoked.
@@ -74,71 +109,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
74
109
  - Prevent communication failures by enabling compliance with JSON-RPC extension message requirements.
75
110
 
76
111
  ## [9.2.0]
112
+
77
113
  ### Added
114
+
78
115
  - Add feature flag to disable Snap installation ([#2521](https://github.com/MetaMask/snaps/pull/2521))
79
116
 
80
117
  ## [9.1.0]
118
+
81
119
  ### Added
120
+
82
121
  - Add `Checkbox` component ([#2501](https://github.com/MetaMask/snaps/pull/2501))
83
122
  - Add `FileInput` component ([#2469](https://github.com/MetaMask/snaps/pull/2469))
84
123
  - Support additional components inside forms ([#2497](https://github.com/MetaMask/snaps/pull/2497))
85
124
 
86
125
  ## [9.0.0]
126
+
87
127
  ### Changed
128
+
88
129
  - **BREAKING:** Defer creation of offscreen document in `OffscreenExecutionService` ([#2473](https://github.com/MetaMask/snaps/pull/2473))
89
130
  - Update `onNameLookup` response to include `domainName` ([#2484](https://github.com/MetaMask/snaps/pull/2484))
90
131
  - Bump MetaMask dependencies ([#2460](https://github.com/MetaMask/snaps/pull/2460))
91
132
 
92
133
  ### Fixed
134
+
93
135
  - Properly decrypt legacy state blobs ([#2472](https://github.com/MetaMask/snaps/pull/2472))
94
136
 
95
137
  ## [8.4.0]
138
+
96
139
  ### Added
140
+
97
141
  - Add `hidden` flag for preinstalled Snaps ([#2463](https://github.com/MetaMask/snaps/pull/2463))
98
142
 
99
143
  ### Fixed
144
+
100
145
  - Use first Dropdown option as the default value ([#2465](https://github.com/MetaMask/snaps/pull/2465))
101
146
 
102
147
  ## [8.3.1]
148
+
103
149
  ### Fixed
150
+
104
151
  - Fix `react-native` export for tools that don't support `package.json` exports ([#2451](https://github.com/MetaMask/snaps/pull/2451))
105
152
 
106
153
  ## [8.3.0]
154
+
107
155
  ### Added
156
+
108
157
  - Add origin to lifecycle hooks ([#2441](https://github.com/MetaMask/snaps/pull/2441))
109
158
  - Lifecycle hooks can now use the `origin` parameter to determine the origin
110
159
  of the installation or update.
111
160
 
112
161
  ## [8.2.0]
162
+
113
163
  ### Added
164
+
114
165
  - Add `context` field to `snap_createInterface` ([#2413](https://github.com/MetaMask/snaps/pull/2413))
115
166
  - Add feature flag to disable platform ([#2434](https://github.com/MetaMask/snaps/pull/2434))
116
167
  - Add support for `Dropdown` component ([#2420](https://github.com/MetaMask/snaps/pull/2420))
117
168
  - Add `initialConnections` diff calculations needed for Snap update ([#2424](https://github.com/MetaMask/snaps/pull/2424))
118
169
 
119
170
  ### Fixed
171
+
120
172
  - Correctly merge caveats when using initial connections ([#2419](https://github.com/MetaMask/snaps/pull/2419))
121
173
 
122
174
  ## [8.1.1]
175
+
123
176
  ### Fixed
177
+
124
178
  - Re-instantiate preinstalled Snaps after clearing state ([#2393](https://github.com/MetaMask/snaps/pull/2393))
125
179
 
126
180
  ## [8.1.0]
181
+
127
182
  ### Added
183
+
128
184
  - Add JSX support for custom UI ([#2258](https://github.com/MetaMask/snaps/pull/2258))
129
185
 
130
186
  ### Changed
187
+
131
188
  - Bump `@metamask/approval-controller` from `6.0.1` to `6.0.2` ([#2380](https://github.com/MetaMask/snaps/pull/2380))
132
189
  - Bump `@metamask/base-controller` from `5.0.1` to `5.0.2` ([#2375](https://github.com/MetaMask/snaps/pull/2375))
133
190
 
134
191
  ### Fixed
192
+
135
193
  - Fix an issue where certain types of executors would be timed out too quickly ([#2389](https://github.com/MetaMask/snaps/pull/2389))
136
194
 
137
195
  ## [8.0.0]
196
+
138
197
  ### Changed
198
+
139
199
  - **BREAKING:** Move `maxInitTime` constructor argument from `SnapController` to `ExecutionService` ([#2348](https://github.com/MetaMask/snaps/pull/2348))
140
200
 
141
201
  ### Fixed
202
+
142
203
  - Increase max UI size limit from 250 KB to 10 MB ([#2342](https://github.com/MetaMask/snaps/pull/2342))
143
204
  - Consider caveats in permissions difference calculation ([#2345](https://github.com/MetaMask/snaps/pull/2345))
144
205
  - This fixes a bug where certain caveats would not be correctly applied when updating Snaps.
@@ -147,38 +208,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
147
208
  - Properly tear down partially initialized executors and improve stability when executor initialization fails ([#2348](https://github.com/MetaMask/snaps/pull/2348))
148
209
 
149
210
  ## [7.0.1]
211
+
150
212
  ### Fixed
213
+
151
214
  - Fix encryption key caching issues ([#2326](https://github.com/MetaMask/snaps/pull/2326))
152
215
 
153
216
  ## [7.0.0]
217
+
154
218
  ### Changed
219
+
155
220
  - **BREAKING:** Refactor encryption to enable caching ([#2316](https://github.com/MetaMask/snaps/pull/2316))
156
221
  - New required constructor arguments `encryptor` and `getMnemonic` have been added.
157
222
  - Include `initialConnections` in approval `requestState` ([#2322](https://github.com/MetaMask/snaps/pull/2322))
158
223
 
159
224
  ### Fixed
225
+
160
226
  - Delete unencrypted state when uninstalling a Snap ([#2311](https://github.com/MetaMask/snaps/pull/2311))
161
227
 
162
228
  ## [6.0.4]
229
+
163
230
  ### Changed
231
+
164
232
  - Bump MetaMask dependencies ([#2270](https://github.com/MetaMask/snaps/pull/2270))
165
233
 
166
234
  ## [6.0.3]
235
+
167
236
  ### Changed
237
+
168
238
  - Handle unavailable registry more gracefully ([#2256](https://github.com/MetaMask/snaps/pull/2256))
169
239
  - Bump `@metamask/snaps-registry` to `^3.0.1` ([#2255](https://github.com/MetaMask/snaps/pull/2255))
170
240
  - Bump `@metamask/json-rpc-engine` to `^7.3.3` ([#2247](https://github.com/MetaMask/snaps/pull/2247))
171
241
 
172
242
  ## [6.0.2]
243
+
173
244
  ### Changed
245
+
174
246
  - Improve timeout handling when the execution environment fails to load ([#2242](https://github.com/MetaMask/snaps/pull/2242))
175
247
 
176
248
  ## [6.0.1]
249
+
177
250
  ### Fixed
251
+
178
252
  - Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
179
253
 
180
254
  ## [6.0.0]
255
+
181
256
  ### Changed
257
+
182
258
  - **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
183
259
  - **BREAKING:** Move Node.js exports to separate export ([#2210](https://github.com/MetaMask/snaps/pull/2210))
184
260
  - The default export is now browser-compatible.
@@ -186,20 +262,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
186
262
  - Bump `@metamask/rpc-errors` to `^6.2.1` ([#2209](https://github.com/MetaMask/snaps/pull/2209))
187
263
 
188
264
  ### Fixed
265
+
189
266
  - Add sizing limits for custom UI ([#2199](https://github.com/MetaMask/snaps/pull/2199))
190
267
 
191
268
  ## [5.0.1]
269
+
192
270
  ### Fixed
271
+
193
272
  - Fix issue installing non-allowlisted Snaps in allowlist mode ([#2196](https://github.com/MetaMask/snaps/pull/2196))
194
273
 
195
274
  ## [5.0.0]
275
+
196
276
  ### Added
277
+
197
278
  - Add support for dynamic user interfaces ([#1465](https://github.com/MetaMask/snaps/pull/1465), [#2126](https://github.com/MetaMask/snaps/pull/2126), [#2144](https://github.com/MetaMask/snaps/pull/2144), [#2152](https://github.com/MetaMask/snaps/pull/2152), [#2143](https://github.com/MetaMask/snaps/pull/2143))
198
279
  - Add support for Snap defined execution timeouts ([#2098](https://github.com/MetaMask/snaps/pull/2098))
199
280
  - A Snap can now define `maxRequestTime` to extend or shorten its execution timeout.
200
281
  - Add `WebViewExecutionService` for mobile execution ([#2005](https://github.com/MetaMask/snaps/pull/2005))
201
282
 
202
283
  ### Changed
284
+
203
285
  - Loosen allowlist requirements ([#1672](https://github.com/MetaMask/snaps/pull/1672))
204
286
  - Snaps with certain permissions can now be installed without being allowlisted.
205
287
  - Reintroduce `DecompressionStream` for improved installation performance ([#2110](https://github.com/MetaMask/snaps/pull/2110))
@@ -209,60 +291,79 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
209
291
  - Pass localized snap name to SubjectMetadataController ([#2157](https://github.com/MetaMask/snaps/pull/2157))
210
292
 
211
293
  ### Removed
294
+
212
295
  - **BREAKING:** Remove endowment permission specifications from this package ([#2155](https://github.com/MetaMask/snaps/pull/2155))
213
296
  - They can now be found in `snaps-rpc-methods`.
214
297
 
215
298
  ## [4.1.0]
299
+
216
300
  ### Added
301
+
217
302
  - Add support for signature insights ([#2074](https://github.com/MetaMask/snaps/pull/2074))
218
303
  - Add support for initial connections ([#2048](https://github.com/MetaMask/snaps/pull/2048))
219
304
  - Add support for preinstalled snaps ([#2008](https://github.com/MetaMask/snaps/pull/2008))
220
305
  - Add additional install events ([#2087](https://github.com/MetaMask/snaps/pull/2087))
221
306
 
222
307
  ### Changed
308
+
223
309
  - Bump several MetaMask dependencies ([#2086](https://github.com/MetaMask/snaps/pull/2086), [#2100](https://github.com/MetaMask/snaps/pull/2100))
224
310
 
225
311
  ## [4.0.0]
312
+
226
313
  ### Changed
314
+
227
315
  - **BREAKING:** Remove `:snapAdded` event ([#2073](https://github.com/MetaMask/snaps/pull/2073))
228
316
  - **BREAKING:** Remove `:snapRemoved` event ([#2076](https://github.com/MetaMask/snaps/pull/2076))
229
317
  - Populate subject metadata when snaps are added to state ([#2069](https://github.com/MetaMask/snaps/pull/2069))
230
318
 
231
319
  ## [3.6.0]
320
+
232
321
  ### Changed
322
+
233
323
  - Revert usage of `DecompressionStream` ([#2052](https://github.com/MetaMask/snaps/pull/2052))
234
324
  - Refactor `NpmLocation` class ([#2038](https://github.com/MetaMask/snaps/pull/2038))
235
325
  - Most logic is now located in `BaseNpmLocation`, making it easier to extend without duplication.
236
326
  - Bump several MetaMask dependencies ([#2053](https://github.com/MetaMask/snaps/pull/2053), [#2061](https://github.com/MetaMask/snaps/pull/2061), [#2064](https://github.com/MetaMask/snaps/pull/2064), [#2065](https://github.com/MetaMask/snaps/pull/2065), [#2067](https://github.com/MetaMask/snaps/pull/2067))
237
327
 
238
328
  ### Removed
329
+
239
330
  - Remove support for object-like syntax for cronjobs ([#2057](https://github.com/MetaMask/snaps/pull/2057))
240
331
  - Since this never worked in the first place we aren't marking it as breaking.
241
332
 
242
333
  ## [3.5.1]
334
+
243
335
  ### Changed
336
+
244
337
  - Improve `SnapController` constructor types ([#2023](https://github.com/MetaMask/snaps/pull/2023))
245
338
  - Bump `snaps-registry` ([#2020](https://github.com/MetaMask/snaps/pull/2020))
246
339
 
247
340
  ## [3.5.0]
341
+
248
342
  ### Changed
343
+
249
344
  - Reduce memory usage by removing source code and state from runtime ([#2009](https://github.com/MetaMask/snaps/pull/2009))
250
345
  - Improve base64 encoding/decoding speeds ([#1985](https://github.com/MetaMask/snaps/pull/1985))
251
346
  - Use `DecompressionStream` for NPM fetching when available ([#1971](https://github.com/MetaMask/snaps/pull/1971))
252
347
  - Bump several MetaMask dependencies ([#1989](https://github.com/MetaMask/snaps/pull/1989), [#1993](https://github.com/MetaMask/snaps/pull/1993), [#1987](https://github.com/MetaMask/snaps/pull/1987), [#1983](https://github.com/MetaMask/snaps/pull/1983))
253
348
 
254
349
  ### Fixed
350
+
255
351
  - Fix idle snap timeout for unused snap ([#2010](https://github.com/MetaMask/snaps/pull/2010))
256
352
 
257
353
  ## [3.4.1]
354
+
258
355
  ### Changed
356
+
259
357
  - Bump several MetaMask dependencies ([#1964](https://github.com/MetaMask/snaps/pull/1964), [#1961](https://github.com/MetaMask/snaps/pull/1961))
260
358
 
261
359
  ### Fixed
360
+
262
361
  - Fix a few issues with passing non-JSON-serializable values ([#1974](https://github.com/MetaMask/snaps/pull/1974))
263
362
 
264
363
  ## [3.4.0]
364
+
265
365
  ### Changed
366
+
266
367
  - Use `SubtleCrypto` for checksum calculation if available ([#1953](https://github.com/MetaMask/snaps/pull/1953))
267
368
  - This reduces the time of the checksum calculation by up to 95% in some
268
369
  environments.
@@ -271,32 +372,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
271
372
  - `@metamask/snaps-ui` packages.
272
373
 
273
374
  ### Fixed
375
+
274
376
  - Fix support for transaction insight Snaps returning `null` ([#1952](https://github.com/MetaMask/snaps/pull/1952))
275
377
 
276
378
  ## [3.3.0]
379
+
277
380
  ### Added
381
+
278
382
  - Add manifest localization functionality ([#1889](https://github.com/MetaMask/snaps/pull/1889))
279
383
  - Add support for unencrypted storage using `snap_manageState` ([#1902](https://github.com/MetaMask/snaps/pull/1902))
280
384
  - Add `OnHomePage` export ([#1896](https://github.com/MetaMask/snaps/pull/1896))
281
385
 
282
386
  ## [3.2.0]
387
+
283
388
  ### Added
389
+
284
390
  - Add support for links in custom UI and notifications ([#1814](https://github.com/MetaMask/snaps/pull/1814))
285
391
 
286
392
  ### Fixed
393
+
287
394
  - Fix an issue where snaps throwing a `SnapError` would be allowed to run for longer than expected ([#1897](https://github.com/MetaMask/snaps/pull/1897))
288
395
 
289
396
  ## [3.1.1]
397
+
290
398
  ### Fixed
399
+
291
400
  - Fix a few issues with allowlist version resolving ([#1888](https://github.com/MetaMask/snaps/pull/1888))
292
401
 
293
402
  ## [3.1.0]
403
+
294
404
  ### Added
405
+
295
406
  - Add static file API ([#1836](https://github.com/MetaMask/snaps/pull/1836))
296
407
  - This adds a `snap_getFile` method, which Snaps can use to load files.
297
408
  - Add `origin` parameter to `snapInstalled` and `snapUpdated` events ([#1867](https://github.com/MetaMask/snaps/pull/1867))
298
409
 
299
410
  ### Changed
411
+
300
412
  - Improve error handling ([#1841](https://github.com/MetaMask/snaps/pull/1841))
301
413
  - Snaps can now throw a `SnapError`, without causing the Snap to crash.
302
414
  - Bump `tar-stream` from `^2.2.0` to `^3.1.6` ([#1853](https://github.com/MetaMask/snaps/pull/1853))
@@ -304,77 +416,106 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
304
416
  - Remove snap errors from state ([#1837](https://github.com/MetaMask/snaps/pull/1837))
305
417
 
306
418
  ### Fixed
419
+
307
420
  - Try to match requested versions with an allowlisted version ([#1877](https://github.com/MetaMask/snaps/pull/1877))
308
421
  - Improve performance when installing snaps with a static version ([#1878](https://github.com/MetaMask/snaps/pull/1878))
309
422
  - Stop persisting snaps in the installing state ([#1876](https://github.com/MetaMask/snaps/pull/1876))
310
423
 
311
424
  ## [3.0.0]
425
+
312
426
  ### Added
427
+
313
428
  - Add keyring export and endowment ([#1787](https://github.com/MetaMask/snaps/pull/1787))
314
429
  - Add optional `allowedOrigins` field to `endowment:rpc` ([#1822](https://github.com/MetaMask/snaps/pull/1822))
315
430
  - This can be used to only accept certain origins in your Snap.
316
431
 
317
432
  ### Changed
433
+
318
434
  - **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741))
319
435
 
320
436
  ## [2.0.2]
437
+
321
438
  ### Added
439
+
322
440
  - Add `SnapController:snapUninstalled` event ([#1800](https://github.com/MetaMask/snaps/pull/1800))
323
441
 
324
442
  ### Fixed
443
+
325
444
  - Fix some issues with SnapController events ([#1800](https://github.com/MetaMask/snaps/pull/1800))
326
445
  - Fix an issue where cronjobs would continually be executed on init ([#1790](https://github.com/MetaMask/snaps/pull/1790))
327
446
 
328
447
  ## [2.0.1]
448
+
329
449
  ### Changed
450
+
330
451
  - Remove deprecated `endowment:long-running` ([#1751](https://github.com/MetaMask/snaps/pull/1751))
331
452
 
332
453
  ## [2.0.0]
454
+
333
455
  ### Changed
456
+
334
457
  - Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
335
458
 
336
459
  ## [0.39.0-flask.1]
460
+
337
461
  ### Added
462
+
338
463
  - Add `onNameLookup` export ([#1394](https://github.com/MetaMask/snaps/pull/1394))
339
464
 
340
465
  ### Changed
466
+
341
467
  - Remove `pump` ([#1730](https://github.com/MetaMask/snaps/pull/1730))
342
468
  - Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738))
343
469
 
344
470
  ### Fixed
471
+
345
472
  - Fix cronjob running on disabled snaps ([#1743](https://github.com/MetaMask/snaps/pull/1743))
346
473
 
347
474
  ## [0.38.3-flask.1]
475
+
348
476
  ### Changed
477
+
349
478
  - 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))
350
479
  - Bump `@metamask/utils` and `@metamask/snaps-registry` ([#1694](https://github.com/MetaMask/snaps/pull/1694))
351
480
 
352
481
  ### Fixed
482
+
353
483
  - Fix unpacking zero byte files from NPM ([#1708](https://github.com/MetaMask/snaps/pull/1708))
354
484
 
355
485
  ## [0.38.2-flask.1]
486
+
356
487
  ### Fixed
488
+
357
489
  - Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
358
490
 
359
491
  ## [0.38.1-flask.1]
492
+
360
493
  ### Fixed
494
+
361
495
  - Fix parallel usage of registry ([#1669](https://github.com/MetaMask/snaps/pull/1669))
362
496
 
363
497
  ## [0.38.0-flask.1]
498
+
364
499
  ### Added
500
+
365
501
  - Add `onInstall` and `onUpdate` lifecycle hooks ([#1643](https://github.com/MetaMask/snaps/pull/1643))
366
502
 
367
503
  ### Changed
504
+
368
505
  - Make `updateBlockedSnaps` update the registry ([#1625](https://github.com/MetaMask/snaps/pull/1625))
369
506
  - Move source code and snap state back to controller state ([#1634](https://github.com/MetaMask/snaps/pull/1634))
370
507
 
371
508
  ## [0.37.2-flask.1]
509
+
372
510
  ### Changed
511
+
373
512
  - Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
374
513
  - The version of the package no longer needs to match the version of all other
375
514
  MetaMask Snaps packages.
376
515
 
377
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.7.0...HEAD
516
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.9.0...HEAD
517
+ [9.9.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.8.0...@metamask/snaps-controllers@9.9.0
518
+ [9.8.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.7.0...@metamask/snaps-controllers@9.8.0
378
519
  [9.7.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.6.0...@metamask/snaps-controllers@9.7.0
379
520
  [9.6.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.5.0...@metamask/snaps-controllers@9.6.0
380
521
  [9.5.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.4.0...@metamask/snaps-controllers@9.5.0
@@ -1,16 +1,4 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _CronjobController_messenger, _CronjobController_dailyTimer, _CronjobController_timers, _CronjobController_snapIds;
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.CronjobController = exports.DAILY_TIMEOUT = void 0;
16
4
  const base_controller_1 = require("@metamask/base-controller");
@@ -26,6 +14,11 @@ const controllerName = 'CronjobController';
26
14
  * using RPC method hooks.
27
15
  */
28
16
  class CronjobController extends base_controller_1.BaseController {
17
+ #messenger;
18
+ #dailyTimer;
19
+ #timers;
20
+ // Mapping from jobId to snapId
21
+ #snapIds;
29
22
  constructor({ messenger, state }) {
30
23
  super({
31
24
  messenger,
@@ -38,14 +31,9 @@ class CronjobController extends base_controller_1.BaseController {
38
31
  ...state,
39
32
  },
40
33
  });
41
- _CronjobController_messenger.set(this, void 0);
42
- _CronjobController_dailyTimer.set(this, void 0);
43
- _CronjobController_timers.set(this, void 0);
44
- // Mapping from jobId to snapId
45
- _CronjobController_snapIds.set(this, void 0);
46
- __classPrivateFieldSet(this, _CronjobController_timers, new Map(), "f");
47
- __classPrivateFieldSet(this, _CronjobController_snapIds, new Map(), "f");
48
- __classPrivateFieldSet(this, _CronjobController_messenger, messenger, "f");
34
+ this.#timers = new Map();
35
+ this.#snapIds = new Map();
36
+ this.#messenger = messenger;
49
37
  this._handleSnapRegisterEvent = this._handleSnapRegisterEvent.bind(this);
50
38
  this._handleSnapUnregisterEvent =
51
39
  this._handleSnapUnregisterEvent.bind(this);
@@ -81,7 +69,7 @@ class CronjobController extends base_controller_1.BaseController {
81
69
  * @returns Array of Cronjob specifications.
82
70
  */
83
71
  getSnapJobs(snapId) {
84
- const permissions = __classPrivateFieldGet(this, _CronjobController_messenger, "f").call('PermissionController:getPermissions', snapId);
72
+ const permissions = this.#messenger.call('PermissionController:getPermissions', snapId);
85
73
  const permission = permissions?.[snaps_rpc_methods_1.SnapEndowments.Cronjob];
86
74
  const definitions = (0, snaps_rpc_methods_1.getCronjobCaveatJobs)(permission);
87
75
  return definitions?.map((definition, idx) => {
@@ -110,7 +98,7 @@ class CronjobController extends base_controller_1.BaseController {
110
98
  * @param job - Cronjob specification.
111
99
  */
112
100
  schedule(job) {
113
- if (__classPrivateFieldGet(this, _CronjobController_timers, "f").has(job.id)) {
101
+ if (this.#timers.has(job.id)) {
114
102
  return;
115
103
  }
116
104
  const parsed = (0, snaps_utils_1.parseCronExpression)(job.expression);
@@ -127,14 +115,14 @@ class CronjobController extends base_controller_1.BaseController {
127
115
  // TODO: Decide how to handle errors.
128
116
  (0, snaps_utils_1.logError)(error);
129
117
  });
130
- __classPrivateFieldGet(this, _CronjobController_timers, "f").delete(job.id);
118
+ this.#timers.delete(job.id);
131
119
  this.schedule(job);
132
120
  });
133
121
  if (!this.state.jobs[job.id]?.lastRun) {
134
122
  this.updateJobLastRunState(job.id, 0); // 0 for init, never ran actually
135
123
  }
136
- __classPrivateFieldGet(this, _CronjobController_timers, "f").set(job.id, timer);
137
- __classPrivateFieldGet(this, _CronjobController_snapIds, "f").set(job.id, job.snapId);
124
+ this.#timers.set(job.id, timer);
125
+ this.#snapIds.set(job.id, job.snapId);
138
126
  }
139
127
  /**
140
128
  * Execute job.
@@ -143,7 +131,7 @@ class CronjobController extends base_controller_1.BaseController {
143
131
  */
144
132
  async executeCronjob(job) {
145
133
  this.updateJobLastRunState(job.id, Date.now());
146
- await __classPrivateFieldGet(this, _CronjobController_messenger, "f").call('SnapController:handleRequest', {
134
+ await this.#messenger.call('SnapController:handleRequest', {
147
135
  snapId: job.snapId,
148
136
  origin: '',
149
137
  handler: snaps_utils_1.HandlerType.OnCronjob,
@@ -156,14 +144,14 @@ class CronjobController extends base_controller_1.BaseController {
156
144
  * @param snapId - ID of a snap.
157
145
  */
158
146
  unregister(snapId) {
159
- const jobs = [...__classPrivateFieldGet(this, _CronjobController_snapIds, "f").entries()].filter(([_, jobSnapId]) => jobSnapId === snapId);
147
+ const jobs = [...this.#snapIds.entries()].filter(([_, jobSnapId]) => jobSnapId === snapId);
160
148
  if (jobs.length) {
161
149
  jobs.forEach(([id]) => {
162
- const timer = __classPrivateFieldGet(this, _CronjobController_timers, "f").get(id);
150
+ const timer = this.#timers.get(id);
163
151
  if (timer) {
164
152
  timer.cancel();
165
- __classPrivateFieldGet(this, _CronjobController_timers, "f").delete(id);
166
- __classPrivateFieldGet(this, _CronjobController_snapIds, "f").delete(id);
153
+ this.#timers.delete(id);
154
+ this.#snapIds.delete(id);
167
155
  }
168
156
  });
169
157
  }
@@ -200,8 +188,8 @@ class CronjobController extends base_controller_1.BaseController {
200
188
  // Try scheduling, will fail if an existing scheduled job is found
201
189
  this.schedule(job);
202
190
  }
203
- __classPrivateFieldSet(this, _CronjobController_dailyTimer, new Timer_1.Timer(exports.DAILY_TIMEOUT), "f");
204
- __classPrivateFieldGet(this, _CronjobController_dailyTimer, "f").start(() => {
191
+ this.#dailyTimer = new Timer_1.Timer(exports.DAILY_TIMEOUT);
192
+ this.#dailyTimer.start(() => {
205
193
  this.dailyCheckIn().catch((error) => {
206
194
  // TODO: Decide how to handle errors.
207
195
  (0, snaps_utils_1.logError)(error);
@@ -220,7 +208,7 @@ class CronjobController extends base_controller_1.BaseController {
220
208
  this.messagingSystem.unsubscribe('SnapController:snapDisabled', this._handleSnapUnregisterEvent);
221
209
  this.messagingSystem.unsubscribe('SnapController:snapUpdated', this._handleEventSnapUpdated);
222
210
  /* eslint-enable @typescript-eslint/unbound-method */
223
- __classPrivateFieldGet(this, _CronjobController_snapIds, "f").forEach((snapId) => {
211
+ this.#snapIds.forEach((snapId) => {
224
212
  this.unregister(snapId);
225
213
  });
226
214
  }
@@ -251,5 +239,4 @@ class CronjobController extends base_controller_1.BaseController {
251
239
  }
252
240
  }
253
241
  exports.CronjobController = CronjobController;
254
- _CronjobController_messenger = new WeakMap(), _CronjobController_dailyTimer = new WeakMap(), _CronjobController_timers = new WeakMap(), _CronjobController_snapIds = new WeakMap();
255
242
  //# sourceMappingURL=CronjobController.cjs.map