@metamask-previews/watch-only-account-service 0.0.0-preview-173a9edb1

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 ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Initial release: `WatchOnlyAccountService` with `createAccount` and `isEnabled` actions ([#10794](https://github.com/MetaMask/core/pull/10794))
13
+
14
+ [Unreleased]: https://github.com/MetaMask/core/
package/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ This project is licensed under either of
2
+
3
+ * MIT license ([LICENSE.MIT](LICENSE.MIT))
4
+ * Apache License, Version 2.0 ([LICENSE.APACHE2](LICENSE.APACHE2))
5
+
6
+ at your option.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 MetaMask
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/LICENSE.MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MetaMask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # `@metamask/watch-only-account-service`
2
+
3
+ Service for managing watch-only accounts
4
+
5
+ ## Overview
6
+
7
+ `WatchOnlyAccountService` centralizes the creation of watch-only accounts, providing a single integration point for:
8
+
9
+ - **Account creation** — Imports an EVM account by address into the `"watch-only"` keyring. No secret material is ever involved, and the resulting account cannot sign. Resolving the corresponding internal account and selecting it is left to the client.
10
+ - **Keyring plumbing** — Atomically creates the watch-only keyring if it does not exist yet.
11
+ - **Feature gating** — Takes an `isEnabled` callback and refuses to create accounts while it reports the feature as disabled. The callback is consulted on each call, so the gate can change dynamically (e.g. driven by a remote feature flag).
12
+
13
+ The service exposes its functionality through the MetaMask messenger pattern and depends on the `KeyringController`.
14
+
15
+ ## Installation
16
+
17
+ `yarn add @metamask/watch-only-account-service`
18
+
19
+ or
20
+
21
+ `npm install @metamask/watch-only-account-service`
22
+
23
+ ## Contributing
24
+
25
+ This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
@@ -0,0 +1,37 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ import type { WatchOnlyAccountService } from './WatchOnlyAccountService.js';
6
+ /**
7
+ * Returns whether the watch-only support is enabled.
8
+ *
9
+ * @returns `true` if the watch-only support is enabled.
10
+ */
11
+ export type WatchOnlyAccountServiceIsEnabledAction = {
12
+ type: `WatchOnlyAccountService:isEnabled`;
13
+ handler: WatchOnlyAccountService['isEnabled'];
14
+ };
15
+ /**
16
+ * Creates (or retrieves, if it already exists) a watch-only account for the
17
+ * given address.
18
+ *
19
+ * The watch-only keyring is created atomically if it does not exist yet.
20
+ * The account itself is imported by address: no secret material is ever
21
+ * involved, and the resulting account cannot sign.
22
+ *
23
+ * @param address - The EVM address to import.
24
+ * @returns The keyring account for the imported address.
25
+ * @throws {WatchOnlyAccountDisabledError} If the watch-only support is
26
+ * disabled.
27
+ * @throws If the address is not a valid EVM address.
28
+ */
29
+ export type WatchOnlyAccountServiceCreateAccountAction = {
30
+ type: `WatchOnlyAccountService:createAccount`;
31
+ handler: WatchOnlyAccountService['createAccount'];
32
+ };
33
+ /**
34
+ * Union of all WatchOnlyAccountService action types.
35
+ */
36
+ export type WatchOnlyAccountServiceMethodActions = WatchOnlyAccountServiceIsEnabledAction | WatchOnlyAccountServiceCreateAccountAction;
37
+ //# sourceMappingURL=WatchOnlyAccountService-method-action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOnlyAccountService-method-action-types.d.ts","sourceRoot":"","sources":["../src/WatchOnlyAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAC5C,sCAAsC,GACtC,0CAA0C,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=WatchOnlyAccountService-method-action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOnlyAccountService-method-action-types.js","sourceRoot":"","sources":["../src/WatchOnlyAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { WatchOnlyAccountService } from './WatchOnlyAccountService.js';\n\n/**\n * Returns whether the watch-only support is enabled.\n *\n * @returns `true` if the watch-only support is enabled.\n */\nexport type WatchOnlyAccountServiceIsEnabledAction = {\n type: `WatchOnlyAccountService:isEnabled`;\n handler: WatchOnlyAccountService['isEnabled'];\n};\n\n/**\n * Creates (or retrieves, if it already exists) a watch-only account for the\n * given address.\n *\n * The watch-only keyring is created atomically if it does not exist yet.\n * The account itself is imported by address: no secret material is ever\n * involved, and the resulting account cannot sign.\n *\n * @param address - The EVM address to import.\n * @returns The keyring account for the imported address.\n * @throws {WatchOnlyAccountDisabledError} If the watch-only support is\n * disabled.\n * @throws If the address is not a valid EVM address.\n */\nexport type WatchOnlyAccountServiceCreateAccountAction = {\n type: `WatchOnlyAccountService:createAccount`;\n handler: WatchOnlyAccountService['createAccount'];\n};\n\n/**\n * Union of all WatchOnlyAccountService action types.\n */\nexport type WatchOnlyAccountServiceMethodActions =\n | WatchOnlyAccountServiceIsEnabledAction\n | WatchOnlyAccountServiceCreateAccountAction;\n"]}
@@ -0,0 +1,86 @@
1
+ import type { KeyringAccount } from '@metamask/keyring-api';
2
+ import type { KeyringControllerWithControllerAction, KeyringControllerWithKeyringV2Action } from '@metamask/keyring-controller';
3
+ import type { Messenger } from '@metamask/messenger';
4
+ import type { WatchOnlyAccountServiceCreateAccountAction, WatchOnlyAccountServiceIsEnabledAction } from './WatchOnlyAccountService-method-action-types.js';
5
+ /**
6
+ * The name of the {@link WatchOnlyAccountService}, used to namespace the
7
+ * service's actions.
8
+ */
9
+ export declare const serviceName = "WatchOnlyAccountService";
10
+ /**
11
+ * Actions that {@link WatchOnlyAccountService} exposes to other consumers.
12
+ */
13
+ export type WatchOnlyAccountServiceActions = WatchOnlyAccountServiceCreateAccountAction | WatchOnlyAccountServiceIsEnabledAction;
14
+ /**
15
+ * Actions from other messengers that {@link WatchOnlyAccountService} calls.
16
+ */
17
+ type AllowedActions = KeyringControllerWithControllerAction | KeyringControllerWithKeyringV2Action;
18
+ /**
19
+ * The messenger which is restricted to actions accessed by
20
+ * {@link WatchOnlyAccountService}.
21
+ */
22
+ export type WatchOnlyAccountServiceMessenger = Messenger<typeof serviceName, WatchOnlyAccountServiceActions | AllowedActions, never>;
23
+ /**
24
+ * The options that {@link WatchOnlyAccountService} takes.
25
+ */
26
+ export type WatchOnlyAccountServiceOptions = {
27
+ /**
28
+ * The messenger suited for this service.
29
+ */
30
+ messenger: WatchOnlyAccountServiceMessenger;
31
+ /**
32
+ * A callback that determines whether the watch-only support is currently
33
+ * enabled. When disabled, the service refuses to create watch-only
34
+ * accounts. The callback is consulted on each call, so the gating decision
35
+ * can be made dynamically (e.g. driven by a remote feature flag).
36
+ */
37
+ isEnabled?: () => boolean;
38
+ };
39
+ /**
40
+ * Service responsible for managing watch-only accounts.
41
+ *
42
+ * Watch-only accounts are EVM accounts imported by address, held by the
43
+ * `"watch-only"` keyring. They cannot sign anything. This service hides the
44
+ * keyring plumbing (notably the atomic creation of the watch-only keyring if
45
+ * it does not exist yet) behind a single, simple action.
46
+ */
47
+ export declare class WatchOnlyAccountService {
48
+ #private;
49
+ /**
50
+ * The name of the service.
51
+ */
52
+ readonly name: typeof serviceName;
53
+ /**
54
+ * Constructs a new {@link WatchOnlyAccountService}.
55
+ *
56
+ * @param options - The constructor arguments.
57
+ * @param options.messenger - The messenger suited for this service.
58
+ * @param options.isEnabled - A callback that determines whether the
59
+ * watch-only support is currently enabled. Defaults to a callback that
60
+ * always returns `false`.
61
+ */
62
+ constructor({ messenger, isEnabled, }: WatchOnlyAccountServiceOptions);
63
+ /**
64
+ * Returns whether the watch-only support is enabled.
65
+ *
66
+ * @returns `true` if the watch-only support is enabled.
67
+ */
68
+ isEnabled(): boolean;
69
+ /**
70
+ * Creates (or retrieves, if it already exists) a watch-only account for the
71
+ * given address.
72
+ *
73
+ * The watch-only keyring is created atomically if it does not exist yet.
74
+ * The account itself is imported by address: no secret material is ever
75
+ * involved, and the resulting account cannot sign.
76
+ *
77
+ * @param address - The EVM address to import.
78
+ * @returns The keyring account for the imported address.
79
+ * @throws {WatchOnlyAccountDisabledError} If the watch-only support is
80
+ * disabled.
81
+ * @throws If the address is not a valid EVM address.
82
+ */
83
+ createAccount(address: string): Promise<KeyringAccount>;
84
+ }
85
+ export {};
86
+ //# sourceMappingURL=WatchOnlyAccountService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOnlyAccountService.d.ts","sourceRoot":"","sources":["../src/WatchOnlyAccountService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EACV,qCAAqC,EACrC,oCAAoC,EACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EACV,0CAA0C,EAC1C,sCAAsC,EACvC,MAAM,kDAAkD,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,WAAW,4BAA4B,CAAC;AAQrD;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,0CAA0C,GAC1C,sCAAsC,CAAC;AAE3C;;GAEG;AACH,KAAK,cAAc,GACf,qCAAqC,GACrC,oCAAoC,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG,SAAS,CACtD,OAAO,WAAW,EAClB,8BAA8B,GAAG,cAAc,EAC/C,KAAK,CACN,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,SAAS,EAAE,gCAAgC,CAAC;IAE5C;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,uBAAuB;;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,WAAW,CAAC;IAUlC;;;;;;;;OAQG;IACH,YAAY,EACV,SAAS,EACT,SAAgC,GACjC,EAAE,8BAA8B,EAShC;IAED;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAEnB;IAED;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAoB5D;CAsDF"}
@@ -0,0 +1,124 @@
1
+ import { AccountCreationType } from '@metamask/keyring-api';
2
+ import { KeyringType } from '@metamask/keyring-api/v2';
3
+ import { WatchOnlyAccountDisabledError } from './errors.js';
4
+ /**
5
+ * The name of the {@link WatchOnlyAccountService}, used to namespace the
6
+ * service's actions.
7
+ */
8
+ export const serviceName = 'WatchOnlyAccountService';
9
+ /**
10
+ * All of the methods within {@link WatchOnlyAccountService} that are exposed
11
+ * via the messenger.
12
+ */
13
+ const MESSENGER_EXPOSED_METHODS = ['createAccount', 'isEnabled'];
14
+ /**
15
+ * Service responsible for managing watch-only accounts.
16
+ *
17
+ * Watch-only accounts are EVM accounts imported by address, held by the
18
+ * `"watch-only"` keyring. They cannot sign anything. This service hides the
19
+ * keyring plumbing (notably the atomic creation of the watch-only keyring if
20
+ * it does not exist yet) behind a single, simple action.
21
+ */
22
+ export class WatchOnlyAccountService {
23
+ /**
24
+ * The name of the service.
25
+ */
26
+ name;
27
+ #messenger;
28
+ /**
29
+ * A callback that determines whether the watch-only support is currently
30
+ * enabled.
31
+ */
32
+ #isEnabled;
33
+ /**
34
+ * Constructs a new {@link WatchOnlyAccountService}.
35
+ *
36
+ * @param options - The constructor arguments.
37
+ * @param options.messenger - The messenger suited for this service.
38
+ * @param options.isEnabled - A callback that determines whether the
39
+ * watch-only support is currently enabled. Defaults to a callback that
40
+ * always returns `false`.
41
+ */
42
+ constructor({ messenger, isEnabled = () => false, }) {
43
+ this.name = serviceName;
44
+ this.#messenger = messenger;
45
+ this.#isEnabled = isEnabled;
46
+ this.#messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
47
+ }
48
+ /**
49
+ * Returns whether the watch-only support is enabled.
50
+ *
51
+ * @returns `true` if the watch-only support is enabled.
52
+ */
53
+ isEnabled() {
54
+ return this.#isEnabled();
55
+ }
56
+ /**
57
+ * Creates (or retrieves, if it already exists) a watch-only account for the
58
+ * given address.
59
+ *
60
+ * The watch-only keyring is created atomically if it does not exist yet.
61
+ * The account itself is imported by address: no secret material is ever
62
+ * involved, and the resulting account cannot sign.
63
+ *
64
+ * @param address - The EVM address to import.
65
+ * @returns The keyring account for the imported address.
66
+ * @throws {WatchOnlyAccountDisabledError} If the watch-only support is
67
+ * disabled.
68
+ * @throws If the address is not a valid EVM address.
69
+ */
70
+ async createAccount(address) {
71
+ this.#ensureWatchOnlyEnabled();
72
+ await this.#ensureWatchOnlyKeyringExists();
73
+ const accounts = await this.#withWatchOnlyKeyring(async (keyring) => keyring.createAccounts({
74
+ type: AccountCreationType.AddressImport,
75
+ address,
76
+ }));
77
+ const [account] = accounts;
78
+ if (!account) {
79
+ // NOTE: The address is deliberately not included in the error message
80
+ // to avoid leaking it.
81
+ throw new Error('No watch-only account was created.');
82
+ }
83
+ return account;
84
+ }
85
+ /**
86
+ * Ensures that the watch-only support is enabled.
87
+ *
88
+ * @throws {WatchOnlyAccountDisabledError} If the watch-only support is
89
+ * disabled.
90
+ */
91
+ #ensureWatchOnlyEnabled() {
92
+ if (!this.#isEnabled()) {
93
+ throw new WatchOnlyAccountDisabledError();
94
+ }
95
+ }
96
+ /**
97
+ * Runs an operation with the watch-only keyring (v2), selected by type.
98
+ *
99
+ * @param operation - The operation to run with the keyring.
100
+ * @returns The result of the operation.
101
+ * @template Result - The type of the value resolved by the operation.
102
+ */
103
+ async #withWatchOnlyKeyring(operation) {
104
+ // The result is cast because the callback's return type does not flow
105
+ // through the messenger's action generics.
106
+ return this.#messenger.call('KeyringController:withKeyringV2', { type: KeyringType.WatchOnly }, async ({ keyring }) => await operation(keyring));
107
+ }
108
+ /**
109
+ * Ensures that the watch-only keyring exists, creating it if needed.
110
+ *
111
+ * The check and the creation are performed within the same
112
+ * `KeyringController:withController` transaction, so concurrent callers
113
+ * cannot race each other into creating duplicate keyrings.
114
+ */
115
+ async #ensureWatchOnlyKeyringExists() {
116
+ await this.#messenger.call('KeyringController:withController', async (controller) => {
117
+ const hasKeyring = controller.keyrings.some(({ keyring }) => keyring.type === KeyringType.WatchOnly);
118
+ if (!hasKeyring) {
119
+ await controller.addNewKeyring(KeyringType.WatchOnly);
120
+ }
121
+ });
122
+ }
123
+ }
124
+ //# sourceMappingURL=WatchOnlyAccountService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOnlyAccountService.js","sourceRoot":"","sources":["../src/WatchOnlyAccountService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAM5D;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAErD;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,eAAe,EAAE,WAAW,CAAU,CAAC;AA4C1E;;;;;;;GAOG;AACH,MAAM,OAAO,uBAAuB;IAClC;;OAEG;IACM,IAAI,CAAqB;IAEzB,UAAU,CAAmC;IAEtD;;;OAGG;IACM,UAAU,CAAgB;IAEnC;;;;;;;;OAQG;IACH,YAAY,EACV,SAAS,EACT,SAAS,GAAG,GAAY,EAAE,CAAC,KAAK,GACD;QAC/B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAC1C,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/B,MAAM,IAAI,CAAC,6BAA6B,EAAE,CAAC;QAE3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAClE,OAAO,CAAC,cAAc,CAAC;YACrB,IAAI,EAAE,mBAAmB,CAAC,aAAa;YACvC,OAAO;SACR,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;QAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,sEAAsE;YACtE,uBAAuB;YACvB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,uBAAuB;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,6BAA6B,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,qBAAqB,CACzB,SAAkD;QAElD,sEAAsE;QACtE,2CAA2C;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACzB,iCAAiC,EACjC,EAAE,IAAI,EAAE,WAAW,CAAC,SAAS,EAAE,EAC/B,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,MAAM,SAAS,CAAC,OAAO,CAAC,CACtC,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,6BAA6B;QACjC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CACxB,kCAAkC,EAClC,KAAK,EAAE,UAAU,EAAE,EAAE;YACnB,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CACzC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CACxD,CAAC;YAEF,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { AccountCreationType } from '@metamask/keyring-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\nimport { KeyringType } from '@metamask/keyring-api/v2';\nimport type { Keyring as KeyringV2 } from '@metamask/keyring-api/v2';\nimport type {\n KeyringControllerWithControllerAction,\n KeyringControllerWithKeyringV2Action,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { WatchOnlyAccountDisabledError } from './errors.js';\nimport type {\n WatchOnlyAccountServiceCreateAccountAction,\n WatchOnlyAccountServiceIsEnabledAction,\n} from './WatchOnlyAccountService-method-action-types.js';\n\n/**\n * The name of the {@link WatchOnlyAccountService}, used to namespace the\n * service's actions.\n */\nexport const serviceName = 'WatchOnlyAccountService';\n\n/**\n * All of the methods within {@link WatchOnlyAccountService} that are exposed\n * via the messenger.\n */\nconst MESSENGER_EXPOSED_METHODS = ['createAccount', 'isEnabled'] as const;\n\n/**\n * Actions that {@link WatchOnlyAccountService} exposes to other consumers.\n */\nexport type WatchOnlyAccountServiceActions =\n | WatchOnlyAccountServiceCreateAccountAction\n | WatchOnlyAccountServiceIsEnabledAction;\n\n/**\n * Actions from other messengers that {@link WatchOnlyAccountService} calls.\n */\ntype AllowedActions =\n | KeyringControllerWithControllerAction\n | KeyringControllerWithKeyringV2Action;\n\n/**\n * The messenger which is restricted to actions accessed by\n * {@link WatchOnlyAccountService}.\n */\nexport type WatchOnlyAccountServiceMessenger = Messenger<\n typeof serviceName,\n WatchOnlyAccountServiceActions | AllowedActions,\n never\n>;\n\n/**\n * The options that {@link WatchOnlyAccountService} takes.\n */\nexport type WatchOnlyAccountServiceOptions = {\n /**\n * The messenger suited for this service.\n */\n messenger: WatchOnlyAccountServiceMessenger;\n\n /**\n * A callback that determines whether the watch-only support is currently\n * enabled. When disabled, the service refuses to create watch-only\n * accounts. The callback is consulted on each call, so the gating decision\n * can be made dynamically (e.g. driven by a remote feature flag).\n */\n isEnabled?: () => boolean;\n};\n\n/**\n * Service responsible for managing watch-only accounts.\n *\n * Watch-only accounts are EVM accounts imported by address, held by the\n * `\"watch-only\"` keyring. They cannot sign anything. This service hides the\n * keyring plumbing (notably the atomic creation of the watch-only keyring if\n * it does not exist yet) behind a single, simple action.\n */\nexport class WatchOnlyAccountService {\n /**\n * The name of the service.\n */\n readonly name: typeof serviceName;\n\n readonly #messenger: WatchOnlyAccountServiceMessenger;\n\n /**\n * A callback that determines whether the watch-only support is currently\n * enabled.\n */\n readonly #isEnabled: () => boolean;\n\n /**\n * Constructs a new {@link WatchOnlyAccountService}.\n *\n * @param options - The constructor arguments.\n * @param options.messenger - The messenger suited for this service.\n * @param options.isEnabled - A callback that determines whether the\n * watch-only support is currently enabled. Defaults to a callback that\n * always returns `false`.\n */\n constructor({\n messenger,\n isEnabled = (): boolean => false,\n }: WatchOnlyAccountServiceOptions) {\n this.name = serviceName;\n this.#messenger = messenger;\n this.#isEnabled = isEnabled;\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns whether the watch-only support is enabled.\n *\n * @returns `true` if the watch-only support is enabled.\n */\n isEnabled(): boolean {\n return this.#isEnabled();\n }\n\n /**\n * Creates (or retrieves, if it already exists) a watch-only account for the\n * given address.\n *\n * The watch-only keyring is created atomically if it does not exist yet.\n * The account itself is imported by address: no secret material is ever\n * involved, and the resulting account cannot sign.\n *\n * @param address - The EVM address to import.\n * @returns The keyring account for the imported address.\n * @throws {WatchOnlyAccountDisabledError} If the watch-only support is\n * disabled.\n * @throws If the address is not a valid EVM address.\n */\n async createAccount(address: string): Promise<KeyringAccount> {\n this.#ensureWatchOnlyEnabled();\n\n await this.#ensureWatchOnlyKeyringExists();\n\n const accounts = await this.#withWatchOnlyKeyring(async (keyring) =>\n keyring.createAccounts({\n type: AccountCreationType.AddressImport,\n address,\n }),\n );\n\n const [account] = accounts;\n if (!account) {\n // NOTE: The address is deliberately not included in the error message\n // to avoid leaking it.\n throw new Error('No watch-only account was created.');\n }\n\n return account;\n }\n\n /**\n * Ensures that the watch-only support is enabled.\n *\n * @throws {WatchOnlyAccountDisabledError} If the watch-only support is\n * disabled.\n */\n #ensureWatchOnlyEnabled(): void {\n if (!this.#isEnabled()) {\n throw new WatchOnlyAccountDisabledError();\n }\n }\n\n /**\n * Runs an operation with the watch-only keyring (v2), selected by type.\n *\n * @param operation - The operation to run with the keyring.\n * @returns The result of the operation.\n * @template Result - The type of the value resolved by the operation.\n */\n async #withWatchOnlyKeyring<Result>(\n operation: (keyring: KeyringV2) => Promise<Result>,\n ): Promise<Result> {\n // The result is cast because the callback's return type does not flow\n // through the messenger's action generics.\n return this.#messenger.call(\n 'KeyringController:withKeyringV2',\n { type: KeyringType.WatchOnly },\n async ({ keyring }) => await operation(keyring),\n ) as Result;\n }\n\n /**\n * Ensures that the watch-only keyring exists, creating it if needed.\n *\n * The check and the creation are performed within the same\n * `KeyringController:withController` transaction, so concurrent callers\n * cannot race each other into creating duplicate keyrings.\n */\n async #ensureWatchOnlyKeyringExists(): Promise<void> {\n await this.#messenger.call(\n 'KeyringController:withController',\n async (controller) => {\n const hasKeyring = controller.keyrings.some(\n ({ keyring }) => keyring.type === KeyringType.WatchOnly,\n );\n\n if (!hasKeyring) {\n await controller.addNewKeyring(KeyringType.WatchOnly);\n }\n },\n );\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Error thrown when trying to create a watch-only account while the
3
+ * watch-only support is disabled.
4
+ */
5
+ export declare class WatchOnlyAccountDisabledError extends Error {
6
+ constructor();
7
+ }
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,cAGC;CACF"}
package/dist/errors.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Error thrown when trying to create a watch-only account while the
3
+ * watch-only support is disabled.
4
+ */
5
+ export class WatchOnlyAccountDisabledError extends Error {
6
+ constructor() {
7
+ super('Watch-only account support is disabled');
8
+ this.name = 'WatchOnlyAccountDisabledError';
9
+ }
10
+ }
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD;QACE,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF","sourcesContent":["/**\n * Error thrown when trying to create a watch-only account while the\n * watch-only support is disabled.\n */\nexport class WatchOnlyAccountDisabledError extends Error {\n constructor() {\n super('Watch-only account support is disabled');\n this.name = 'WatchOnlyAccountDisabledError';\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { WatchOnlyAccountService, serviceName, } from './WatchOnlyAccountService.js';
2
+ export type { WatchOnlyAccountServiceActions, WatchOnlyAccountServiceMessenger, WatchOnlyAccountServiceOptions, } from './WatchOnlyAccountService.js';
3
+ export type { WatchOnlyAccountServiceCreateAccountAction, WatchOnlyAccountServiceIsEnabledAction, WatchOnlyAccountServiceMethodActions, } from './WatchOnlyAccountService-method-action-types.js';
4
+ export { WatchOnlyAccountDisabledError } from './errors.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,8BAA8B,EAC9B,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,0CAA0C,EAC1C,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { WatchOnlyAccountService, serviceName, } from './WatchOnlyAccountService.js';
2
+ export { WatchOnlyAccountDisabledError } from './errors.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export {\n WatchOnlyAccountService,\n serviceName,\n} from './WatchOnlyAccountService.js';\nexport type {\n WatchOnlyAccountServiceActions,\n WatchOnlyAccountServiceMessenger,\n WatchOnlyAccountServiceOptions,\n} from './WatchOnlyAccountService.js';\nexport type {\n WatchOnlyAccountServiceCreateAccountAction,\n WatchOnlyAccountServiceIsEnabledAction,\n WatchOnlyAccountServiceMethodActions,\n} from './WatchOnlyAccountService-method-action-types.js';\nexport { WatchOnlyAccountDisabledError } from './errors.js';\n"]}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@metamask-previews/watch-only-account-service",
3
+ "version": "0.0.0-preview-173a9edb1",
4
+ "description": "Service for managing watch-only accounts",
5
+ "keywords": [
6
+ "Ethereum",
7
+ "MetaMask"
8
+ ],
9
+ "homepage": "https://github.com/MetaMask/core/tree/main/packages/watch-only-account-service#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/MetaMask/core/issues"
12
+ },
13
+ "license": "(MIT OR Apache-2.0)",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/MetaMask/core.git"
17
+ },
18
+ "files": [
19
+ "dist/"
20
+ ],
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "registry": "https://registry.npmjs.org/"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc --project tsconfig.build.json",
36
+ "build:all": "tsc --build tsconfig.build.json --verbose",
37
+ "build:clean": "yarn build:only-clean && yarn build",
38
+ "build:docs": "typedoc",
39
+ "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
40
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/watch-only-account-service",
41
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/watch-only-account-service",
42
+ "lint:tsconfigs": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
43
+ "lint:tsconfigs:fix": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
44
+ "messenger-action-types:check": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --check",
45
+ "messenger-action-types:generate": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --generate",
46
+ "since-latest-release": "../../scripts/since-latest-release.sh",
47
+ "test": "vitest",
48
+ "test:clean": "vitest --clearCache",
49
+ "test:verbose": "vitest --reporter=verbose",
50
+ "test:watch": "vitest --watch"
51
+ },
52
+ "dependencies": {
53
+ "@metamask/keyring-api": "^24.3.0",
54
+ "@metamask/keyring-controller": "^28.2.0",
55
+ "@metamask/messenger": "^3.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@metamask/auto-changelog": "^6.2.1",
59
+ "@typescript/native": "npm:typescript@^7.0.2",
60
+ "rimraf": "^6.1.3",
61
+ "typedoc": "^0.28.20",
62
+ "typedoc-plugin-missing-exports": "^4.1.4",
63
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
64
+ "vitest": "^5.0.0"
65
+ },
66
+ "engines": {
67
+ "node": "^22.14.0 || ^24"
68
+ }
69
+ }