@metamask/snaps-controllers 9.7.0 → 9.8.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.
- package/CHANGELOG.md +135 -1
- package/dist/services/webview/WebViewMessageStream.cjs.map +1 -1
- package/dist/services/webview/WebViewMessageStream.d.cts +1 -2
- package/dist/services/webview/WebViewMessageStream.d.cts.map +1 -1
- package/dist/services/webview/WebViewMessageStream.d.mts +1 -2
- package/dist/services/webview/WebViewMessageStream.d.mts.map +1 -1
- package/dist/services/webview/WebViewMessageStream.mjs.map +1 -1
- package/dist/services/webview/index.cjs +1 -0
- package/dist/services/webview/index.cjs.map +1 -1
- package/dist/services/webview/index.d.cts +1 -0
- package/dist/services/webview/index.d.cts.map +1 -1
- package/dist/services/webview/index.d.mts +1 -0
- package/dist/services/webview/index.d.mts.map +1 -1
- package/dist/services/webview/index.mjs +1 -0
- package/dist/services/webview/index.mjs.map +1 -1
- package/package.json +36 -21
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,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [9.8.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Export `WebViewMessageStream` and related types ([#2746](https://github.com/MetaMask/snaps/pull/2746))
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Fix invalid `exports` field ([#2740](https://github.com/MetaMask/snaps/pull/2740))
|
|
19
|
+
|
|
9
20
|
## [9.7.0]
|
|
21
|
+
|
|
10
22
|
### Added
|
|
23
|
+
|
|
11
24
|
- Add `hideSnapBranding` flag for preinstalled Snaps ([#2713](https://github.com/MetaMask/snaps/pull/2713), [#2717](https://github.com/MetaMask/snaps/pull/2717))
|
|
12
25
|
|
|
13
26
|
### Fixed
|
|
27
|
+
|
|
14
28
|
- Fix invalid types in type declaration in some cases ([#2714](https://github.com/MetaMask/snaps/pull/2714))
|
|
15
29
|
|
|
16
30
|
## [9.6.0]
|
|
31
|
+
|
|
17
32
|
### Added
|
|
33
|
+
|
|
18
34
|
- Add `stopAllSnaps` function to `SnapController` ([#2674](https://github.com/MetaMask/snaps/pull/2674))
|
|
19
35
|
|
|
20
36
|
### Fixed
|
|
37
|
+
|
|
21
38
|
- Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
|
|
22
39
|
- This fixes the ESM version of the package to be fully compliant with the ESM
|
|
23
40
|
standard.
|
|
@@ -25,22 +42,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
25
42
|
- Bump other MetaMask dependencies ([#2703](https://github.com/MetaMask/snaps/pull/2703))
|
|
26
43
|
|
|
27
44
|
## [9.5.0]
|
|
45
|
+
|
|
28
46
|
### Added
|
|
47
|
+
|
|
29
48
|
- Add `Selector` component ([#2645](https://github.com/MetaMask/snaps/pull/2645))
|
|
30
49
|
- 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
50
|
|
|
32
51
|
### Fixed
|
|
52
|
+
|
|
33
53
|
- Fix `fetch` binding under LavaMoat ([#2642](https://github.com/MetaMask/snaps/pull/2642))
|
|
34
54
|
|
|
35
55
|
## [9.4.0]
|
|
56
|
+
|
|
36
57
|
### Added
|
|
58
|
+
|
|
37
59
|
- Add `RadioGroup` component ([#2592](https://github.com/MetaMask/snaps/pull/2592))
|
|
38
60
|
|
|
39
61
|
### Changed
|
|
62
|
+
|
|
40
63
|
- Persist `severity` property in `SnapInsightsController` ([#2612](https://github.com/MetaMask/snaps/pull/2612))
|
|
41
64
|
|
|
42
65
|
## [9.3.1]
|
|
66
|
+
|
|
43
67
|
### Changed
|
|
68
|
+
|
|
44
69
|
- Bump `@metamask/approval-controller` from `^7.0.0` to `^7.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
|
|
45
70
|
- Bump `@metamask/base-controller` from `^6.0.1` to `^6.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
|
|
46
71
|
- Bump `@metamask/json-rpc-engine` from `^9.0.0` to `^9.0.2` ([#2593](https://github.com/metamask/snaps/pull/2593))
|
|
@@ -50,11 +75,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
50
75
|
- Bump `@metamask/snaps-utils` from `^7.8.0` to `^7.8.1` ([#2595](https://github.com/MetaMask/snaps/pull/2595))
|
|
51
76
|
|
|
52
77
|
## [9.3.0]
|
|
78
|
+
|
|
53
79
|
### Added
|
|
80
|
+
|
|
54
81
|
- Add `snap_resolveInterface` RPC method to the `SnapInterfaceController` ([#2509](https://github.com/metamask/snaps/pull/2509))
|
|
55
82
|
- Add `SnapInsightsController` ([#2555](https://github.com/metamask/snaps/pull/2555))
|
|
56
83
|
|
|
57
84
|
### Changed
|
|
85
|
+
|
|
58
86
|
- Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
|
|
59
87
|
- Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
|
|
60
88
|
- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
|
|
@@ -66,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
66
94
|
- Bump peer dependency `@metamask/snaps-execution-environments` to `^6.6.1` ([#2589](https://github.com/MetaMask/snaps/pull/2589))
|
|
67
95
|
|
|
68
96
|
### Fixed
|
|
97
|
+
|
|
69
98
|
- Handle initial connections for preinstalled Snaps ([#2591](https://github.com/MetaMask/snaps/pull/2591))
|
|
70
99
|
- Account for revoked origins when calculating the difference in `initialConnections` ([#2535](https://github.com/metamask/snaps/pull/2535))
|
|
71
100
|
- Fixes issue of revoking permissions that are already revoked.
|
|
@@ -74,71 +103,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
74
103
|
- Prevent communication failures by enabling compliance with JSON-RPC extension message requirements.
|
|
75
104
|
|
|
76
105
|
## [9.2.0]
|
|
106
|
+
|
|
77
107
|
### Added
|
|
108
|
+
|
|
78
109
|
- Add feature flag to disable Snap installation ([#2521](https://github.com/MetaMask/snaps/pull/2521))
|
|
79
110
|
|
|
80
111
|
## [9.1.0]
|
|
112
|
+
|
|
81
113
|
### Added
|
|
114
|
+
|
|
82
115
|
- Add `Checkbox` component ([#2501](https://github.com/MetaMask/snaps/pull/2501))
|
|
83
116
|
- Add `FileInput` component ([#2469](https://github.com/MetaMask/snaps/pull/2469))
|
|
84
117
|
- Support additional components inside forms ([#2497](https://github.com/MetaMask/snaps/pull/2497))
|
|
85
118
|
|
|
86
119
|
## [9.0.0]
|
|
120
|
+
|
|
87
121
|
### Changed
|
|
122
|
+
|
|
88
123
|
- **BREAKING:** Defer creation of offscreen document in `OffscreenExecutionService` ([#2473](https://github.com/MetaMask/snaps/pull/2473))
|
|
89
124
|
- Update `onNameLookup` response to include `domainName` ([#2484](https://github.com/MetaMask/snaps/pull/2484))
|
|
90
125
|
- Bump MetaMask dependencies ([#2460](https://github.com/MetaMask/snaps/pull/2460))
|
|
91
126
|
|
|
92
127
|
### Fixed
|
|
128
|
+
|
|
93
129
|
- Properly decrypt legacy state blobs ([#2472](https://github.com/MetaMask/snaps/pull/2472))
|
|
94
130
|
|
|
95
131
|
## [8.4.0]
|
|
132
|
+
|
|
96
133
|
### Added
|
|
134
|
+
|
|
97
135
|
- Add `hidden` flag for preinstalled Snaps ([#2463](https://github.com/MetaMask/snaps/pull/2463))
|
|
98
136
|
|
|
99
137
|
### Fixed
|
|
138
|
+
|
|
100
139
|
- Use first Dropdown option as the default value ([#2465](https://github.com/MetaMask/snaps/pull/2465))
|
|
101
140
|
|
|
102
141
|
## [8.3.1]
|
|
142
|
+
|
|
103
143
|
### Fixed
|
|
144
|
+
|
|
104
145
|
- Fix `react-native` export for tools that don't support `package.json` exports ([#2451](https://github.com/MetaMask/snaps/pull/2451))
|
|
105
146
|
|
|
106
147
|
## [8.3.0]
|
|
148
|
+
|
|
107
149
|
### Added
|
|
150
|
+
|
|
108
151
|
- Add origin to lifecycle hooks ([#2441](https://github.com/MetaMask/snaps/pull/2441))
|
|
109
152
|
- Lifecycle hooks can now use the `origin` parameter to determine the origin
|
|
110
153
|
of the installation or update.
|
|
111
154
|
|
|
112
155
|
## [8.2.0]
|
|
156
|
+
|
|
113
157
|
### Added
|
|
158
|
+
|
|
114
159
|
- Add `context` field to `snap_createInterface` ([#2413](https://github.com/MetaMask/snaps/pull/2413))
|
|
115
160
|
- Add feature flag to disable platform ([#2434](https://github.com/MetaMask/snaps/pull/2434))
|
|
116
161
|
- Add support for `Dropdown` component ([#2420](https://github.com/MetaMask/snaps/pull/2420))
|
|
117
162
|
- Add `initialConnections` diff calculations needed for Snap update ([#2424](https://github.com/MetaMask/snaps/pull/2424))
|
|
118
163
|
|
|
119
164
|
### Fixed
|
|
165
|
+
|
|
120
166
|
- Correctly merge caveats when using initial connections ([#2419](https://github.com/MetaMask/snaps/pull/2419))
|
|
121
167
|
|
|
122
168
|
## [8.1.1]
|
|
169
|
+
|
|
123
170
|
### Fixed
|
|
171
|
+
|
|
124
172
|
- Re-instantiate preinstalled Snaps after clearing state ([#2393](https://github.com/MetaMask/snaps/pull/2393))
|
|
125
173
|
|
|
126
174
|
## [8.1.0]
|
|
175
|
+
|
|
127
176
|
### Added
|
|
177
|
+
|
|
128
178
|
- Add JSX support for custom UI ([#2258](https://github.com/MetaMask/snaps/pull/2258))
|
|
129
179
|
|
|
130
180
|
### Changed
|
|
181
|
+
|
|
131
182
|
- Bump `@metamask/approval-controller` from `6.0.1` to `6.0.2` ([#2380](https://github.com/MetaMask/snaps/pull/2380))
|
|
132
183
|
- Bump `@metamask/base-controller` from `5.0.1` to `5.0.2` ([#2375](https://github.com/MetaMask/snaps/pull/2375))
|
|
133
184
|
|
|
134
185
|
### Fixed
|
|
186
|
+
|
|
135
187
|
- Fix an issue where certain types of executors would be timed out too quickly ([#2389](https://github.com/MetaMask/snaps/pull/2389))
|
|
136
188
|
|
|
137
189
|
## [8.0.0]
|
|
190
|
+
|
|
138
191
|
### Changed
|
|
192
|
+
|
|
139
193
|
- **BREAKING:** Move `maxInitTime` constructor argument from `SnapController` to `ExecutionService` ([#2348](https://github.com/MetaMask/snaps/pull/2348))
|
|
140
194
|
|
|
141
195
|
### Fixed
|
|
196
|
+
|
|
142
197
|
- Increase max UI size limit from 250 KB to 10 MB ([#2342](https://github.com/MetaMask/snaps/pull/2342))
|
|
143
198
|
- Consider caveats in permissions difference calculation ([#2345](https://github.com/MetaMask/snaps/pull/2345))
|
|
144
199
|
- This fixes a bug where certain caveats would not be correctly applied when updating Snaps.
|
|
@@ -147,38 +202,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
147
202
|
- Properly tear down partially initialized executors and improve stability when executor initialization fails ([#2348](https://github.com/MetaMask/snaps/pull/2348))
|
|
148
203
|
|
|
149
204
|
## [7.0.1]
|
|
205
|
+
|
|
150
206
|
### Fixed
|
|
207
|
+
|
|
151
208
|
- Fix encryption key caching issues ([#2326](https://github.com/MetaMask/snaps/pull/2326))
|
|
152
209
|
|
|
153
210
|
## [7.0.0]
|
|
211
|
+
|
|
154
212
|
### Changed
|
|
213
|
+
|
|
155
214
|
- **BREAKING:** Refactor encryption to enable caching ([#2316](https://github.com/MetaMask/snaps/pull/2316))
|
|
156
215
|
- New required constructor arguments `encryptor` and `getMnemonic` have been added.
|
|
157
216
|
- Include `initialConnections` in approval `requestState` ([#2322](https://github.com/MetaMask/snaps/pull/2322))
|
|
158
217
|
|
|
159
218
|
### Fixed
|
|
219
|
+
|
|
160
220
|
- Delete unencrypted state when uninstalling a Snap ([#2311](https://github.com/MetaMask/snaps/pull/2311))
|
|
161
221
|
|
|
162
222
|
## [6.0.4]
|
|
223
|
+
|
|
163
224
|
### Changed
|
|
225
|
+
|
|
164
226
|
- Bump MetaMask dependencies ([#2270](https://github.com/MetaMask/snaps/pull/2270))
|
|
165
227
|
|
|
166
228
|
## [6.0.3]
|
|
229
|
+
|
|
167
230
|
### Changed
|
|
231
|
+
|
|
168
232
|
- Handle unavailable registry more gracefully ([#2256](https://github.com/MetaMask/snaps/pull/2256))
|
|
169
233
|
- Bump `@metamask/snaps-registry` to `^3.0.1` ([#2255](https://github.com/MetaMask/snaps/pull/2255))
|
|
170
234
|
- Bump `@metamask/json-rpc-engine` to `^7.3.3` ([#2247](https://github.com/MetaMask/snaps/pull/2247))
|
|
171
235
|
|
|
172
236
|
## [6.0.2]
|
|
237
|
+
|
|
173
238
|
### Changed
|
|
239
|
+
|
|
174
240
|
- Improve timeout handling when the execution environment fails to load ([#2242](https://github.com/MetaMask/snaps/pull/2242))
|
|
175
241
|
|
|
176
242
|
## [6.0.1]
|
|
243
|
+
|
|
177
244
|
### Fixed
|
|
245
|
+
|
|
178
246
|
- Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
|
|
179
247
|
|
|
180
248
|
## [6.0.0]
|
|
249
|
+
|
|
181
250
|
### Changed
|
|
251
|
+
|
|
182
252
|
- **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
|
|
183
253
|
- **BREAKING:** Move Node.js exports to separate export ([#2210](https://github.com/MetaMask/snaps/pull/2210))
|
|
184
254
|
- The default export is now browser-compatible.
|
|
@@ -186,20 +256,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
186
256
|
- Bump `@metamask/rpc-errors` to `^6.2.1` ([#2209](https://github.com/MetaMask/snaps/pull/2209))
|
|
187
257
|
|
|
188
258
|
### Fixed
|
|
259
|
+
|
|
189
260
|
- Add sizing limits for custom UI ([#2199](https://github.com/MetaMask/snaps/pull/2199))
|
|
190
261
|
|
|
191
262
|
## [5.0.1]
|
|
263
|
+
|
|
192
264
|
### Fixed
|
|
265
|
+
|
|
193
266
|
- Fix issue installing non-allowlisted Snaps in allowlist mode ([#2196](https://github.com/MetaMask/snaps/pull/2196))
|
|
194
267
|
|
|
195
268
|
## [5.0.0]
|
|
269
|
+
|
|
196
270
|
### Added
|
|
271
|
+
|
|
197
272
|
- 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
273
|
- Add support for Snap defined execution timeouts ([#2098](https://github.com/MetaMask/snaps/pull/2098))
|
|
199
274
|
- A Snap can now define `maxRequestTime` to extend or shorten its execution timeout.
|
|
200
275
|
- Add `WebViewExecutionService` for mobile execution ([#2005](https://github.com/MetaMask/snaps/pull/2005))
|
|
201
276
|
|
|
202
277
|
### Changed
|
|
278
|
+
|
|
203
279
|
- Loosen allowlist requirements ([#1672](https://github.com/MetaMask/snaps/pull/1672))
|
|
204
280
|
- Snaps with certain permissions can now be installed without being allowlisted.
|
|
205
281
|
- Reintroduce `DecompressionStream` for improved installation performance ([#2110](https://github.com/MetaMask/snaps/pull/2110))
|
|
@@ -209,60 +285,79 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
209
285
|
- Pass localized snap name to SubjectMetadataController ([#2157](https://github.com/MetaMask/snaps/pull/2157))
|
|
210
286
|
|
|
211
287
|
### Removed
|
|
288
|
+
|
|
212
289
|
- **BREAKING:** Remove endowment permission specifications from this package ([#2155](https://github.com/MetaMask/snaps/pull/2155))
|
|
213
290
|
- They can now be found in `snaps-rpc-methods`.
|
|
214
291
|
|
|
215
292
|
## [4.1.0]
|
|
293
|
+
|
|
216
294
|
### Added
|
|
295
|
+
|
|
217
296
|
- Add support for signature insights ([#2074](https://github.com/MetaMask/snaps/pull/2074))
|
|
218
297
|
- Add support for initial connections ([#2048](https://github.com/MetaMask/snaps/pull/2048))
|
|
219
298
|
- Add support for preinstalled snaps ([#2008](https://github.com/MetaMask/snaps/pull/2008))
|
|
220
299
|
- Add additional install events ([#2087](https://github.com/MetaMask/snaps/pull/2087))
|
|
221
300
|
|
|
222
301
|
### Changed
|
|
302
|
+
|
|
223
303
|
- Bump several MetaMask dependencies ([#2086](https://github.com/MetaMask/snaps/pull/2086), [#2100](https://github.com/MetaMask/snaps/pull/2100))
|
|
224
304
|
|
|
225
305
|
## [4.0.0]
|
|
306
|
+
|
|
226
307
|
### Changed
|
|
308
|
+
|
|
227
309
|
- **BREAKING:** Remove `:snapAdded` event ([#2073](https://github.com/MetaMask/snaps/pull/2073))
|
|
228
310
|
- **BREAKING:** Remove `:snapRemoved` event ([#2076](https://github.com/MetaMask/snaps/pull/2076))
|
|
229
311
|
- Populate subject metadata when snaps are added to state ([#2069](https://github.com/MetaMask/snaps/pull/2069))
|
|
230
312
|
|
|
231
313
|
## [3.6.0]
|
|
314
|
+
|
|
232
315
|
### Changed
|
|
316
|
+
|
|
233
317
|
- Revert usage of `DecompressionStream` ([#2052](https://github.com/MetaMask/snaps/pull/2052))
|
|
234
318
|
- Refactor `NpmLocation` class ([#2038](https://github.com/MetaMask/snaps/pull/2038))
|
|
235
319
|
- Most logic is now located in `BaseNpmLocation`, making it easier to extend without duplication.
|
|
236
320
|
- 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
321
|
|
|
238
322
|
### Removed
|
|
323
|
+
|
|
239
324
|
- Remove support for object-like syntax for cronjobs ([#2057](https://github.com/MetaMask/snaps/pull/2057))
|
|
240
325
|
- Since this never worked in the first place we aren't marking it as breaking.
|
|
241
326
|
|
|
242
327
|
## [3.5.1]
|
|
328
|
+
|
|
243
329
|
### Changed
|
|
330
|
+
|
|
244
331
|
- Improve `SnapController` constructor types ([#2023](https://github.com/MetaMask/snaps/pull/2023))
|
|
245
332
|
- Bump `snaps-registry` ([#2020](https://github.com/MetaMask/snaps/pull/2020))
|
|
246
333
|
|
|
247
334
|
## [3.5.0]
|
|
335
|
+
|
|
248
336
|
### Changed
|
|
337
|
+
|
|
249
338
|
- Reduce memory usage by removing source code and state from runtime ([#2009](https://github.com/MetaMask/snaps/pull/2009))
|
|
250
339
|
- Improve base64 encoding/decoding speeds ([#1985](https://github.com/MetaMask/snaps/pull/1985))
|
|
251
340
|
- Use `DecompressionStream` for NPM fetching when available ([#1971](https://github.com/MetaMask/snaps/pull/1971))
|
|
252
341
|
- 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
342
|
|
|
254
343
|
### Fixed
|
|
344
|
+
|
|
255
345
|
- Fix idle snap timeout for unused snap ([#2010](https://github.com/MetaMask/snaps/pull/2010))
|
|
256
346
|
|
|
257
347
|
## [3.4.1]
|
|
348
|
+
|
|
258
349
|
### Changed
|
|
350
|
+
|
|
259
351
|
- Bump several MetaMask dependencies ([#1964](https://github.com/MetaMask/snaps/pull/1964), [#1961](https://github.com/MetaMask/snaps/pull/1961))
|
|
260
352
|
|
|
261
353
|
### Fixed
|
|
354
|
+
|
|
262
355
|
- Fix a few issues with passing non-JSON-serializable values ([#1974](https://github.com/MetaMask/snaps/pull/1974))
|
|
263
356
|
|
|
264
357
|
## [3.4.0]
|
|
358
|
+
|
|
265
359
|
### Changed
|
|
360
|
+
|
|
266
361
|
- Use `SubtleCrypto` for checksum calculation if available ([#1953](https://github.com/MetaMask/snaps/pull/1953))
|
|
267
362
|
- This reduces the time of the checksum calculation by up to 95% in some
|
|
268
363
|
environments.
|
|
@@ -271,32 +366,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
271
366
|
- `@metamask/snaps-ui` packages.
|
|
272
367
|
|
|
273
368
|
### Fixed
|
|
369
|
+
|
|
274
370
|
- Fix support for transaction insight Snaps returning `null` ([#1952](https://github.com/MetaMask/snaps/pull/1952))
|
|
275
371
|
|
|
276
372
|
## [3.3.0]
|
|
373
|
+
|
|
277
374
|
### Added
|
|
375
|
+
|
|
278
376
|
- Add manifest localization functionality ([#1889](https://github.com/MetaMask/snaps/pull/1889))
|
|
279
377
|
- Add support for unencrypted storage using `snap_manageState` ([#1902](https://github.com/MetaMask/snaps/pull/1902))
|
|
280
378
|
- Add `OnHomePage` export ([#1896](https://github.com/MetaMask/snaps/pull/1896))
|
|
281
379
|
|
|
282
380
|
## [3.2.0]
|
|
381
|
+
|
|
283
382
|
### Added
|
|
383
|
+
|
|
284
384
|
- Add support for links in custom UI and notifications ([#1814](https://github.com/MetaMask/snaps/pull/1814))
|
|
285
385
|
|
|
286
386
|
### Fixed
|
|
387
|
+
|
|
287
388
|
- 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
389
|
|
|
289
390
|
## [3.1.1]
|
|
391
|
+
|
|
290
392
|
### Fixed
|
|
393
|
+
|
|
291
394
|
- Fix a few issues with allowlist version resolving ([#1888](https://github.com/MetaMask/snaps/pull/1888))
|
|
292
395
|
|
|
293
396
|
## [3.1.0]
|
|
397
|
+
|
|
294
398
|
### Added
|
|
399
|
+
|
|
295
400
|
- Add static file API ([#1836](https://github.com/MetaMask/snaps/pull/1836))
|
|
296
401
|
- This adds a `snap_getFile` method, which Snaps can use to load files.
|
|
297
402
|
- Add `origin` parameter to `snapInstalled` and `snapUpdated` events ([#1867](https://github.com/MetaMask/snaps/pull/1867))
|
|
298
403
|
|
|
299
404
|
### Changed
|
|
405
|
+
|
|
300
406
|
- Improve error handling ([#1841](https://github.com/MetaMask/snaps/pull/1841))
|
|
301
407
|
- Snaps can now throw a `SnapError`, without causing the Snap to crash.
|
|
302
408
|
- Bump `tar-stream` from `^2.2.0` to `^3.1.6` ([#1853](https://github.com/MetaMask/snaps/pull/1853))
|
|
@@ -304,77 +410,105 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
304
410
|
- Remove snap errors from state ([#1837](https://github.com/MetaMask/snaps/pull/1837))
|
|
305
411
|
|
|
306
412
|
### Fixed
|
|
413
|
+
|
|
307
414
|
- Try to match requested versions with an allowlisted version ([#1877](https://github.com/MetaMask/snaps/pull/1877))
|
|
308
415
|
- Improve performance when installing snaps with a static version ([#1878](https://github.com/MetaMask/snaps/pull/1878))
|
|
309
416
|
- Stop persisting snaps in the installing state ([#1876](https://github.com/MetaMask/snaps/pull/1876))
|
|
310
417
|
|
|
311
418
|
## [3.0.0]
|
|
419
|
+
|
|
312
420
|
### Added
|
|
421
|
+
|
|
313
422
|
- Add keyring export and endowment ([#1787](https://github.com/MetaMask/snaps/pull/1787))
|
|
314
423
|
- Add optional `allowedOrigins` field to `endowment:rpc` ([#1822](https://github.com/MetaMask/snaps/pull/1822))
|
|
315
424
|
- This can be used to only accept certain origins in your Snap.
|
|
316
425
|
|
|
317
426
|
### Changed
|
|
427
|
+
|
|
318
428
|
- **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741))
|
|
319
429
|
|
|
320
430
|
## [2.0.2]
|
|
431
|
+
|
|
321
432
|
### Added
|
|
433
|
+
|
|
322
434
|
- Add `SnapController:snapUninstalled` event ([#1800](https://github.com/MetaMask/snaps/pull/1800))
|
|
323
435
|
|
|
324
436
|
### Fixed
|
|
437
|
+
|
|
325
438
|
- Fix some issues with SnapController events ([#1800](https://github.com/MetaMask/snaps/pull/1800))
|
|
326
439
|
- Fix an issue where cronjobs would continually be executed on init ([#1790](https://github.com/MetaMask/snaps/pull/1790))
|
|
327
440
|
|
|
328
441
|
## [2.0.1]
|
|
442
|
+
|
|
329
443
|
### Changed
|
|
444
|
+
|
|
330
445
|
- Remove deprecated `endowment:long-running` ([#1751](https://github.com/MetaMask/snaps/pull/1751))
|
|
331
446
|
|
|
332
447
|
## [2.0.0]
|
|
448
|
+
|
|
333
449
|
### Changed
|
|
450
|
+
|
|
334
451
|
- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
|
|
335
452
|
|
|
336
453
|
## [0.39.0-flask.1]
|
|
454
|
+
|
|
337
455
|
### Added
|
|
456
|
+
|
|
338
457
|
- Add `onNameLookup` export ([#1394](https://github.com/MetaMask/snaps/pull/1394))
|
|
339
458
|
|
|
340
459
|
### Changed
|
|
460
|
+
|
|
341
461
|
- Remove `pump` ([#1730](https://github.com/MetaMask/snaps/pull/1730))
|
|
342
462
|
- Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738))
|
|
343
463
|
|
|
344
464
|
### Fixed
|
|
465
|
+
|
|
345
466
|
- Fix cronjob running on disabled snaps ([#1743](https://github.com/MetaMask/snaps/pull/1743))
|
|
346
467
|
|
|
347
468
|
## [0.38.3-flask.1]
|
|
469
|
+
|
|
348
470
|
### Changed
|
|
471
|
+
|
|
349
472
|
- 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
473
|
- Bump `@metamask/utils` and `@metamask/snaps-registry` ([#1694](https://github.com/MetaMask/snaps/pull/1694))
|
|
351
474
|
|
|
352
475
|
### Fixed
|
|
476
|
+
|
|
353
477
|
- Fix unpacking zero byte files from NPM ([#1708](https://github.com/MetaMask/snaps/pull/1708))
|
|
354
478
|
|
|
355
479
|
## [0.38.2-flask.1]
|
|
480
|
+
|
|
356
481
|
### Fixed
|
|
482
|
+
|
|
357
483
|
- Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
|
|
358
484
|
|
|
359
485
|
## [0.38.1-flask.1]
|
|
486
|
+
|
|
360
487
|
### Fixed
|
|
488
|
+
|
|
361
489
|
- Fix parallel usage of registry ([#1669](https://github.com/MetaMask/snaps/pull/1669))
|
|
362
490
|
|
|
363
491
|
## [0.38.0-flask.1]
|
|
492
|
+
|
|
364
493
|
### Added
|
|
494
|
+
|
|
365
495
|
- Add `onInstall` and `onUpdate` lifecycle hooks ([#1643](https://github.com/MetaMask/snaps/pull/1643))
|
|
366
496
|
|
|
367
497
|
### Changed
|
|
498
|
+
|
|
368
499
|
- Make `updateBlockedSnaps` update the registry ([#1625](https://github.com/MetaMask/snaps/pull/1625))
|
|
369
500
|
- Move source code and snap state back to controller state ([#1634](https://github.com/MetaMask/snaps/pull/1634))
|
|
370
501
|
|
|
371
502
|
## [0.37.2-flask.1]
|
|
503
|
+
|
|
372
504
|
### Changed
|
|
505
|
+
|
|
373
506
|
- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
|
|
374
507
|
- The version of the package no longer needs to match the version of all other
|
|
375
508
|
MetaMask Snaps packages.
|
|
376
509
|
|
|
377
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.
|
|
510
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.8.0...HEAD
|
|
511
|
+
[9.8.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.7.0...@metamask/snaps-controllers@9.8.0
|
|
378
512
|
[9.7.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.6.0...@metamask/snaps-controllers@9.7.0
|
|
379
513
|
[9.6.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.5.0...@metamask/snaps-controllers@9.6.0
|
|
380
514
|
[9.5.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@9.4.0...@metamask/snaps-controllers@9.5.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewMessageStream.cjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uEAAsE;AACtE,uEAAgF;AAChF,uDAAiD;AACjD,2CAAuE;AAcvE;;GAEG;
|
|
1
|
+
{"version":3,"file":"WebViewMessageStream.cjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uEAAsE;AACtE,uEAAgF;AAChF,uDAAiD;AACjD,2CAAuE;AAcvE;;GAEG;AACH,MAAa,oBAAqB,SAAQ,2CAAqB;IAO7D;;;;;;;;OAQG;IACH,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAqB;QACzD,KAAK,EAAE,CAAC;QAhBV,6CAAM;QAEN,+CAAQ;QAER,gDAAuC;QAcrC,uBAAA,IAAI,8BAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QAEtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,0DAA0D;QAC1D,yFAAyF;QACzF,UAAU,EAAE;aACT,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAChB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;YACxB,gCAAgC;YAChC,6DAA6D;YAC7D,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;IAES,YAAY,CAAC,IAAa;QAClC,IAAA,cAAM,EAAC,uBAAA,IAAI,qCAAS,CAAC,CAAC;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC1B,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,IAAI;SACL,CAAC,CAAC;QAEH,oEAAoE;QACpE,8CAA8C;QAC9C,iDAAiD;QACjD,MAAM,KAAK,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAC;QACpC,uBAAA,IAAI,qCAAS,CAAC,gBAAgB,CAAC,uBAAuB,MAAM,IAAI,CAAC,CAAC;IACpE,CAAC;IAEO,UAAU,CAAC,KAAuB;QACxC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvC,gEAAgE;QAChE,0CAA0C;QAC1C,IAAI,CAAC,IAAA,4BAAoB,EAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,uBAAA,IAAI,kCAAM,EAAE,CAAC;YACpE,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,IAAA,cAAM,EAAC,uBAAA,IAAI,qCAAS,CAAC,CAAC;QACtB,gCAAgC;QAChC,6DAA6D;QAC7D,uBAAA,IAAI,qCAAS,CAAC,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3D,CAAC;CACF;AA5ED,oDA4EC","sourcesContent":["import type { PostMessageEvent } from '@metamask/post-message-stream';\nimport { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { isValidStreamMessage } from '@metamask/post-message-stream/dist/utils';\nimport { logError } from '@metamask/snaps-utils';\nimport { assert, bytesToBase64, stringToBytes } from '@metamask/utils';\n\nexport type WebViewInterface = {\n injectJavaScript(js: string): void;\n registerMessageListener(listener: (event: PostMessageEvent) => void): void;\n unregisterMessageListener(listener: (event: PostMessageEvent) => void): void;\n};\n\nexport type WebViewStreamArgs = {\n name: string;\n target: string;\n getWebView: () => Promise<WebViewInterface>;\n};\n\n/**\n * A special postMessage stream used to interface with a WebView.\n */\nexport class WebViewMessageStream extends BasePostMessageStream {\n #name;\n\n #target;\n\n #webView: WebViewInterface | undefined;\n\n /**\n * Creates a stream for communicating with other streams inside a WebView.\n *\n * @param args - Options bag.\n * @param args.name - The name of the stream. Used to differentiate between\n * multiple streams sharing the same window object.\n * @param args.target - The name of the stream to exchange messages with.\n * @param args.getWebView - A asynchronous getter for the webview.\n */\n constructor({ name, target, getWebView }: WebViewStreamArgs) {\n super();\n\n this.#name = name;\n this.#target = target;\n\n this._onMessage = this._onMessage.bind(this);\n\n // This is a bit atypical from other post-message streams.\n // We have to wait for the WebView to fully load before we can continue using the stream.\n getWebView()\n .then((webView) => {\n this.#webView = webView;\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n webView.registerMessageListener(this._onMessage);\n this._handshake();\n })\n .catch((error) => {\n logError(error);\n });\n }\n\n protected _postMessage(data: unknown): void {\n assert(this.#webView);\n const json = JSON.stringify({\n target: this.#target,\n data,\n });\n\n // To prevent XSS, we base64 encode the message before injecting it.\n // This adds significant performance overhead.\n // TODO: Should we use mobile native base64 here?\n const bytes = stringToBytes(json);\n const base64 = bytesToBase64(bytes);\n this.#webView.injectJavaScript(`window.postMessage('${base64}')`);\n }\n\n private _onMessage(event: PostMessageEvent): void {\n if (typeof event.data !== 'string') {\n return;\n }\n\n const message = JSON.parse(event.data);\n\n // Notice that we don't check targetWindow or targetOrigin here.\n // This doesn't seem possible to do in RN.\n if (!isValidStreamMessage(message) || message.target !== this.#name) {\n return;\n }\n\n this._onData(message.data);\n }\n\n _destroy() {\n assert(this.#webView);\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.#webView.unregisterMessageListener(this._onMessage);\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ export type WebViewInterface = {
|
|
|
5
5
|
registerMessageListener(listener: (event: PostMessageEvent) => void): void;
|
|
6
6
|
unregisterMessageListener(listener: (event: PostMessageEvent) => void): void;
|
|
7
7
|
};
|
|
8
|
-
type WebViewStreamArgs = {
|
|
8
|
+
export type WebViewStreamArgs = {
|
|
9
9
|
name: string;
|
|
10
10
|
target: string;
|
|
11
11
|
getWebView: () => Promise<WebViewInterface>;
|
|
@@ -29,5 +29,4 @@ export declare class WebViewMessageStream extends BasePostMessageStream {
|
|
|
29
29
|
private _onMessage;
|
|
30
30
|
_destroy(): void;
|
|
31
31
|
}
|
|
32
|
-
export {};
|
|
33
32
|
//# sourceMappingURL=WebViewMessageStream.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewMessageStream.d.cts","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sCAAsC;AACtE,OAAO,EAAE,qBAAqB,EAAE,sCAAsC;AAKtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3E,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9E,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"WebViewMessageStream.d.cts","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sCAAsC;AACtE,OAAO,EAAE,qBAAqB,EAAE,sCAAsC;AAKtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3E,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,qBAAqB;;IAO7D;;;;;;;;OAQG;gBACS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,iBAAiB;IAuB3D,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAe3C,OAAO,CAAC,UAAU;IAgBlB,QAAQ;CAMT"}
|
|
@@ -5,7 +5,7 @@ export type WebViewInterface = {
|
|
|
5
5
|
registerMessageListener(listener: (event: PostMessageEvent) => void): void;
|
|
6
6
|
unregisterMessageListener(listener: (event: PostMessageEvent) => void): void;
|
|
7
7
|
};
|
|
8
|
-
type WebViewStreamArgs = {
|
|
8
|
+
export type WebViewStreamArgs = {
|
|
9
9
|
name: string;
|
|
10
10
|
target: string;
|
|
11
11
|
getWebView: () => Promise<WebViewInterface>;
|
|
@@ -29,5 +29,4 @@ export declare class WebViewMessageStream extends BasePostMessageStream {
|
|
|
29
29
|
private _onMessage;
|
|
30
30
|
_destroy(): void;
|
|
31
31
|
}
|
|
32
|
-
export {};
|
|
33
32
|
//# sourceMappingURL=WebViewMessageStream.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewMessageStream.d.mts","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sCAAsC;AACtE,OAAO,EAAE,qBAAqB,EAAE,sCAAsC;AAKtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3E,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9E,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"WebViewMessageStream.d.mts","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sCAAsC;AACtE,OAAO,EAAE,qBAAqB,EAAE,sCAAsC;AAKtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3E,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,qBAAqB;;IAO7D;;;;;;;;OAQG;gBACS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,iBAAiB;IAuB3D,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAe3C,OAAO,CAAC,UAAU;IAgBlB,QAAQ;CAMT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewMessageStream.mjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAE,oDAAiD;AAChF,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACjD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB;AAcvE;;GAEG;
|
|
1
|
+
{"version":3,"file":"WebViewMessageStream.mjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewMessageStream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAE,oDAAiD;AAChF,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACjD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB;AAcvE;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,qBAAqB;IAO7D;;;;;;;;OAQG;IACH,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAqB;QACzD,KAAK,EAAE,CAAC;QAhBV,6CAAM;QAEN,+CAAQ;QAER,gDAAuC;QAcrC,uBAAA,IAAI,8BAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QAEtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,0DAA0D;QAC1D,yFAAyF;QACzF,UAAU,EAAE;aACT,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAChB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;YACxB,gCAAgC;YAChC,6DAA6D;YAC7D,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;IAES,YAAY,CAAC,IAAa;QAClC,MAAM,CAAC,uBAAA,IAAI,qCAAS,CAAC,CAAC;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC1B,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,IAAI;SACL,CAAC,CAAC;QAEH,oEAAoE;QACpE,8CAA8C;QAC9C,iDAAiD;QACjD,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACpC,uBAAA,IAAI,qCAAS,CAAC,gBAAgB,CAAC,uBAAuB,MAAM,IAAI,CAAC,CAAC;IACpE,CAAC;IAEO,UAAU,CAAC,KAAuB;QACxC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvC,gEAAgE;QAChE,0CAA0C;QAC1C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,uBAAA,IAAI,kCAAM,EAAE,CAAC;YACpE,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,MAAM,CAAC,uBAAA,IAAI,qCAAS,CAAC,CAAC;QACtB,gCAAgC;QAChC,6DAA6D;QAC7D,uBAAA,IAAI,qCAAS,CAAC,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["import type { PostMessageEvent } from '@metamask/post-message-stream';\nimport { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { isValidStreamMessage } from '@metamask/post-message-stream/dist/utils';\nimport { logError } from '@metamask/snaps-utils';\nimport { assert, bytesToBase64, stringToBytes } from '@metamask/utils';\n\nexport type WebViewInterface = {\n injectJavaScript(js: string): void;\n registerMessageListener(listener: (event: PostMessageEvent) => void): void;\n unregisterMessageListener(listener: (event: PostMessageEvent) => void): void;\n};\n\nexport type WebViewStreamArgs = {\n name: string;\n target: string;\n getWebView: () => Promise<WebViewInterface>;\n};\n\n/**\n * A special postMessage stream used to interface with a WebView.\n */\nexport class WebViewMessageStream extends BasePostMessageStream {\n #name;\n\n #target;\n\n #webView: WebViewInterface | undefined;\n\n /**\n * Creates a stream for communicating with other streams inside a WebView.\n *\n * @param args - Options bag.\n * @param args.name - The name of the stream. Used to differentiate between\n * multiple streams sharing the same window object.\n * @param args.target - The name of the stream to exchange messages with.\n * @param args.getWebView - A asynchronous getter for the webview.\n */\n constructor({ name, target, getWebView }: WebViewStreamArgs) {\n super();\n\n this.#name = name;\n this.#target = target;\n\n this._onMessage = this._onMessage.bind(this);\n\n // This is a bit atypical from other post-message streams.\n // We have to wait for the WebView to fully load before we can continue using the stream.\n getWebView()\n .then((webView) => {\n this.#webView = webView;\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n webView.registerMessageListener(this._onMessage);\n this._handshake();\n })\n .catch((error) => {\n logError(error);\n });\n }\n\n protected _postMessage(data: unknown): void {\n assert(this.#webView);\n const json = JSON.stringify({\n target: this.#target,\n data,\n });\n\n // To prevent XSS, we base64 encode the message before injecting it.\n // This adds significant performance overhead.\n // TODO: Should we use mobile native base64 here?\n const bytes = stringToBytes(json);\n const base64 = bytesToBase64(bytes);\n this.#webView.injectJavaScript(`window.postMessage('${base64}')`);\n }\n\n private _onMessage(event: PostMessageEvent): void {\n if (typeof event.data !== 'string') {\n return;\n }\n\n const message = JSON.parse(event.data);\n\n // Notice that we don't check targetWindow or targetOrigin here.\n // This doesn't seem possible to do in RN.\n if (!isValidStreamMessage(message) || message.target !== this.#name) {\n return;\n }\n\n this._onData(message.data);\n }\n\n _destroy() {\n assert(this.#webView);\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.#webView.unregisterMessageListener(this._onMessage);\n }\n}\n"]}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./WebViewExecutionService.cjs"), exports);
|
|
18
|
+
__exportStar(require("./WebViewMessageStream.cjs"), exports);
|
|
18
19
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA0C","sourcesContent":["export * from './WebViewExecutionService';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA0C;AAC1C,6DAAuC","sourcesContent":["export * from './WebViewExecutionService';\nexport * from './WebViewMessageStream';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C;AAC1C,2CAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C;AAC1C,2CAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C","sourcesContent":["export * from './WebViewExecutionService';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/services/webview/index.ts"],"names":[],"mappings":"AAAA,8CAA0C;AAC1C,2CAAuC","sourcesContent":["export * from './WebViewExecutionService';\nexport * from './WebViewMessageStream';\n"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-controllers",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"description": "Controllers for MetaMask Snaps
|
|
3
|
+
"version": "9.8.0",
|
|
4
|
+
"description": "Controllers for MetaMask Snaps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"MetaMask",
|
|
7
|
+
"Snaps",
|
|
8
|
+
"Ethereum"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/MetaMask/snaps/tree/main/packages/snaps-controllers#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/MetaMask/snaps/issues"
|
|
13
|
+
},
|
|
5
14
|
"repository": {
|
|
6
15
|
"type": "git",
|
|
7
16
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
8
17
|
},
|
|
18
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
9
19
|
"sideEffects": false,
|
|
10
20
|
"exports": {
|
|
11
21
|
".": {
|
|
@@ -20,21 +30,21 @@
|
|
|
20
30
|
},
|
|
21
31
|
"./node": {
|
|
22
32
|
"import": {
|
|
23
|
-
"types": "./dist/
|
|
33
|
+
"types": "./dist/node.d.mts",
|
|
24
34
|
"default": "./dist/node.mjs"
|
|
25
35
|
},
|
|
26
36
|
"require": {
|
|
27
|
-
"types": "./dist/
|
|
37
|
+
"types": "./dist/node.d.cts",
|
|
28
38
|
"default": "./dist/node.cjs"
|
|
29
39
|
}
|
|
30
40
|
},
|
|
31
41
|
"./react-native": {
|
|
32
42
|
"import": {
|
|
33
|
-
"types": "./dist/
|
|
43
|
+
"types": "./dist/react-native.d.mts",
|
|
34
44
|
"default": "./dist/react-native.mjs"
|
|
35
45
|
},
|
|
36
46
|
"require": {
|
|
37
|
-
"types": "./dist/
|
|
47
|
+
"types": "./dist/react-native.d.cts",
|
|
38
48
|
"default": "./dist/react-native.cjs"
|
|
39
49
|
}
|
|
40
50
|
},
|
|
@@ -49,20 +59,24 @@
|
|
|
49
59
|
"react-native.js"
|
|
50
60
|
],
|
|
51
61
|
"scripts": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
62
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
63
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-controllers",
|
|
64
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-controllers",
|
|
65
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies",
|
|
66
|
+
"lint:ci": "yarn lint",
|
|
67
|
+
"lint:dependencies": "depcheck",
|
|
58
68
|
"lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx",
|
|
59
|
-
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
60
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
|
|
61
69
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
62
|
-
"lint:
|
|
70
|
+
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
63
71
|
"publish:preview": "yarn npm publish --tag preview",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
72
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
73
|
+
"test": "jest --reporters=jest-silent-reporter && yarn test:browser",
|
|
74
|
+
"test:browser": "wdio run wdio.config.js",
|
|
75
|
+
"test:clean": "jest --clearCache",
|
|
76
|
+
"test:post": "ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio",
|
|
77
|
+
"test:pre": "yarn mkdirp test/fixtures && ./scripts/generate-fixtures.sh",
|
|
78
|
+
"test:verbose": "jest --verbose",
|
|
79
|
+
"test:watch": "jest --watch"
|
|
66
80
|
},
|
|
67
81
|
"dependencies": {
|
|
68
82
|
"@metamask/approval-controller": "^7.0.2",
|
|
@@ -76,7 +90,7 @@
|
|
|
76
90
|
"@metamask/rpc-errors": "^6.3.1",
|
|
77
91
|
"@metamask/snaps-registry": "^3.2.1",
|
|
78
92
|
"@metamask/snaps-rpc-methods": "^11.1.1",
|
|
79
|
-
"@metamask/snaps-sdk": "^6.5.
|
|
93
|
+
"@metamask/snaps-sdk": "^6.5.1",
|
|
80
94
|
"@metamask/snaps-utils": "^8.1.1",
|
|
81
95
|
"@metamask/utils": "^9.2.1",
|
|
82
96
|
"@xstate/fsm": "^2.0.0",
|
|
@@ -137,9 +151,10 @@
|
|
|
137
151
|
"istanbul-reports": "^3.1.5",
|
|
138
152
|
"jest": "^29.0.2",
|
|
139
153
|
"jest-fetch-mock": "^3.0.3",
|
|
154
|
+
"jest-silent-reporter": "^0.6.0",
|
|
140
155
|
"mkdirp": "^1.0.4",
|
|
141
|
-
"prettier": "^2.
|
|
142
|
-
"prettier-plugin-packagejson": "^2.2
|
|
156
|
+
"prettier": "^2.8.8",
|
|
157
|
+
"prettier-plugin-packagejson": "^2.5.2",
|
|
143
158
|
"rimraf": "^4.1.2",
|
|
144
159
|
"ts-node": "^10.9.1",
|
|
145
160
|
"typescript": "~5.3.3",
|
|
@@ -150,7 +165,7 @@
|
|
|
150
165
|
"webdriverio": "^8.19.0"
|
|
151
166
|
},
|
|
152
167
|
"peerDependencies": {
|
|
153
|
-
"@metamask/snaps-execution-environments": "^6.7.
|
|
168
|
+
"@metamask/snaps-execution-environments": "^6.7.2"
|
|
154
169
|
},
|
|
155
170
|
"peerDependenciesMeta": {
|
|
156
171
|
"@metamask/snaps-execution-environments": {
|