Commit 7baa5d9
refactor: base controller migration (#3611)
Closes #3315.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Replaces RestrictedMessenger with @metamask/messenger across packages,
renames metadata flag, and updates deps/tests and controller wiring with
breaking API changes.
>
> - **Core refactor (breaking)**:
> - Replace `RestrictedMessenger` with `@metamask/messenger` `Messenger`
across `snaps-controllers`, `snaps-rpc-methods`, `snaps-simulation`, and
`snaps-utils`.
> - Rename metadata `anonymous` to `includeInDebugSnapshot` in
controllers; update persistence and debug snapshot handling.
> - Switch all `messagingSystem.*` calls to `messenger.*` (`subscribe`,
`unsubscribe`, `registerActionHandler`, `call`, `publish`).
> - Update controller constructor types and exported messengers (e.g.,
`CronjobControllerMessenger`, `SnapInsightsControllerMessenger`,
`SnapInterfaceControllerMessenger`, `MultichainRouterMessenger`,
`ExecutionServiceMessenger`, `WebSocketServiceMessenger`).
> - `snaps-rpc-methods`: `handleSnapInstall` now takes `messenger` (was
`messagingSystem`).
> - Export `WithSnapKeyringFunction` from `MultichainRouter`.
> - **Dependency updates**:
> - Bump `@metamask/approval-controller` → `^8.0.0`,
`@metamask/base-controller` → `^9.0.0`,
`@metamask/permission-controller` → `^12.0.0`; add `@metamask/messenger`
where needed; remove `@metamask/base-controller` in some packages.
> - **Tests and mocks**:
> - Update test utilities to use `Messenger` delegation; adapt
expectations from `rootMessenger.call` to `controllerMessenger.call`.
> - Adjust mocks/enums (e.g., `PhishingDetectorResultType`), add
JSON-RPC `id/jsonrpc` fields, and origin constants.
> - **Misc**:
> - Minor API and typing tweaks (e.g., persistence via
`deriveStateFromMetadata`, WebSocket mock fixes).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b53fe57. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Maarten Zuidhoorn <[email protected]>
Co-authored-by: Michele Esposito <[email protected]>
Co-authored-by: Salah-Eddine Saakoun <[email protected]>1 parent 98d7c04 commit 7baa5d9
File tree
39 files changed
+679
-651
lines changed- packages
- snaps-controllers
- src
- cronjob
- insights
- interface
- multichain
- services
- snaps
- registry
- test-utils
- websocket
- snaps-jest
- src/test-utils
- snaps-rpc-methods
- src/restricted
- snaps-simulation
- src
- methods
- test-utils
- snaps-utils
- src/test-utils
39 files changed
+679
-651
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
12 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
Lines changed: 25 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
| 315 | + | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
| 321 | + | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
364 | | - | |
| 363 | + | |
| 364 | + | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
374 | | - | |
| 373 | + | |
| 374 | + | |
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
| 517 | + | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | | - | |
627 | | - | |
| 626 | + | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
641 | | - | |
| 641 | + | |
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
820 | | - | |
821 | | - | |
| 820 | + | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
| 908 | + | |
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
| |||
1111 | 1111 | | |
1112 | 1112 | | |
1113 | 1113 | | |
1114 | | - | |
| 1114 | + | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
| |||
Lines changed: 22 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 89 | + | |
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
| |||
181 | 179 | | |
182 | 180 | | |
183 | 181 | | |
184 | | - | |
| 182 | + | |
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
| |||
196 | 194 | | |
197 | 195 | | |
198 | 196 | | |
199 | | - | |
| 197 | + | |
200 | 198 | | |
201 | 199 | | |
202 | 200 | | |
203 | 201 | | |
204 | | - | |
| 202 | + | |
205 | 203 | | |
206 | 204 | | |
207 | 205 | | |
208 | 206 | | |
209 | | - | |
| 207 | + | |
210 | 208 | | |
211 | 209 | | |
212 | 210 | | |
213 | 211 | | |
214 | | - | |
| 212 | + | |
215 | 213 | | |
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
219 | | - | |
| 217 | + | |
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 222 | + | |
| 223 | + | |
227 | 224 | | |
228 | 225 | | |
229 | | - | |
| 226 | + | |
230 | 227 | | |
231 | 228 | | |
232 | 229 | | |
233 | 230 | | |
234 | | - | |
| 231 | + | |
235 | 232 | | |
236 | 233 | | |
237 | 234 | | |
238 | 235 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 236 | + | |
| 237 | + | |
242 | 238 | | |
243 | 239 | | |
244 | 240 | | |
| |||
336 | 332 | | |
337 | 333 | | |
338 | 334 | | |
339 | | - | |
| 335 | + | |
340 | 336 | | |
341 | 337 | | |
342 | 338 | | |
343 | 339 | | |
344 | | - | |
| 340 | + | |
345 | 341 | | |
346 | 342 | | |
347 | 343 | | |
348 | 344 | | |
349 | | - | |
| 345 | + | |
350 | 346 | | |
351 | 347 | | |
352 | 348 | | |
353 | 349 | | |
354 | | - | |
| 350 | + | |
355 | 351 | | |
356 | 352 | | |
357 | 353 | | |
358 | 354 | | |
359 | | - | |
| 355 | + | |
360 | 356 | | |
361 | 357 | | |
362 | 358 | | |
| |||
473 | 469 | | |
474 | 470 | | |
475 | 471 | | |
476 | | - | |
| 472 | + | |
477 | 473 | | |
478 | 474 | | |
479 | 475 | | |
| |||
529 | 525 | | |
530 | 526 | | |
531 | 527 | | |
532 | | - | |
| 528 | + | |
533 | 529 | | |
534 | 530 | | |
535 | 531 | | |
| |||
0 commit comments