@metamask/keyring-api 0.2.7 → 1.0.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 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,32 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [1.0.0]
11
+
12
+ ### Added
13
+
14
+ - Add migration steps to 1.0.0 ([#149](https://github.com/MetaMask/keyring-api/pull/149)).
15
+ - Add Account Snaps security guidelines ([#143](https://github.com/MetaMask/keyring-api/pull/143)).
16
+
17
+ ### Changed
18
+
19
+ - Bump @metamask/rpc-errors from 6.0.0 to 6.1.0 ([#151](https://github.com/MetaMask/keyring-api/pull/151)).
20
+ - Bump postcss from 8.4.24 to 8.4.31 ([#150](https://github.com/MetaMask/keyring-api/pull/150)).
21
+
22
+ ## [1.0.0-rc.1]
23
+
24
+ ### Added
25
+
26
+ - Document how to migrate from API 0.1.x to 0.2.x ([#124](https://github.com/MetaMask/keyring-api/pull/124)).
27
+
28
+ ### Changed
29
+
30
+ - **BREAKING:** Use the `onKeyringRequest` snap export ([#145](https://github.com/MetaMask/keyring-api/pull/145)).
31
+ - **BREAKING:** Change the events' prefix to `notify:` ([#139](https://github.com/MetaMask/keyring-api/pull/139)).
32
+
9
33
  ## [0.2.7]
34
+
10
35
  ### Added
36
+
11
37
  - Export events types ([#125](https://github.com/MetaMask/keyring-api/pull/125))
12
38
 
13
39
  ## [0.2.6]
40
+
14
41
  ### Changed
42
+
15
43
  - Remove unused lavamoat allowed scripts ([#122](https://github.com/MetaMask/keyring-api/pull/122)).
16
44
  - Update events in sequence diagram ([#121](https://github.com/MetaMask/keyring-api/pull/121)).
17
45
  - Update Snap and ESLint dependencies ([#117](https://github.com/MetaMask/keyring-api/pull/117)).
18
46
  - Bump @metamask/rpc-methods from 0.38.1-flask.1 to 2.0.0 ([#120](https://github.com/MetaMask/keyring-api/pull/120)).
19
47
 
20
48
  ## [0.2.5]
49
+
21
50
  ### Changed
51
+
22
52
  - Remove `buildHandlersChain` ([#114](https://github.com/MetaMask/keyring-api/pull/114)).
23
53
  - Update doc for `eth_signTransaction` ([#111](https://github.com/MetaMask/keyring-api/pull/111)).
24
54
  - Remove un-versioned `eth_signTypedData` method ([#113](https://github.com/MetaMask/keyring-api/pull/113)).
25
55
 
26
56
  ## [0.2.4]
57
+
27
58
  ### Changed
59
+
28
60
  - Fix linting and compatibility with older `tsc` ([#108](https://github.com/MetaMask/keyring-api/pull/108)).
29
61
 
30
62
  ## [0.2.3]
63
+
31
64
  ### Added
65
+
32
66
  - Add redirection message to snap async response ([#102](https://github.com/MetaMask/keyring-api/pull/102)).
33
67
 
34
68
  ### Changed
69
+
35
70
  - Use `Omit` instead of `OmitUnion` ([#106](https://github.com/MetaMask/keyring-api/pull/106)).
36
71
  - Update `KeyringResponse` comment ([#103](https://github.com/MetaMask/keyring-api/pull/103)).
37
72
  - Use `KeyringRpcMethod` enum instead of string ([#105](https://github.com/MetaMask/keyring-api/pull/105)).
@@ -41,21 +76,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
41
76
  - Bump @metamask/providers from 11.1.1 to 11.1.2 ([#98](https://github.com/MetaMask/keyring-api/pull/98)).
42
77
 
43
78
  ## [0.2.2]
79
+
44
80
  ### Added
81
+
45
82
  - Add architecture and EVM methods docs ([#86](https://github.com/MetaMask/keyring-api/pull/86)).
46
83
  - Add `lastSelected` and `lastActive` to metadata ([#92](https://github.com/MetaMask/keyring-api/pull/92)).
47
84
 
48
85
  ### Changed
86
+
49
87
  - Make request `params` optional ([#96](https://github.com/MetaMask/keyring-api/pull/96)).
50
88
  - Remove `lastActive` field from internal account model ([#95](https://github.com/MetaMask/keyring-api/pull/95)).
51
89
  - Move request ID to outer request ([#94](https://github.com/MetaMask/keyring-api/pull/94)).
52
90
 
53
91
  ## [0.2.1]
92
+
54
93
  ### Changed
94
+
55
95
  - Set `snap` object keys to be mandatory and move `name` to `metadata` ([#87](https://github.com/MetaMask/keyring-api/pull/87)).
56
96
 
57
97
  ## [0.2.0]
98
+
58
99
  ### Added
100
+
59
101
  - Add `InternalAccount` type and create submodule `internal` ([#65](https://github.com/MetaMask/keyring-api/pull/65)).
60
102
  - Add keyring events and helper functions ([#74](https://github.com/MetaMask/keyring-api/pull/74)).
61
103
  - Add a `redirect` field to asynchronous request responses ([#75](https://github.com/MetaMask/keyring-api/pull/75)).
@@ -63,6 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
63
105
  - Add `getController` to client ([#43](https://github.com/MetaMask/keyring-api/pull/43)).
64
106
 
65
107
  ### Changed
108
+
66
109
  - Rename `erc4337` -> `eip4337` ([#42](https://github.com/MetaMask/keyring-api/pull/42)).
67
110
  - Make `options` a mandatory field of `KeyringAccount` ([#30](https://github.com/MetaMask/keyring-api/pull/30)).
68
111
  - Make `approveRequest` and `rejectRequest` optional ([#63](https://github.com/MetaMask/keyring-api/pull/63)).
@@ -74,29 +117,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
74
117
  - Rename `supportedMethods` to `methods` ([#35](https://github.com/MetaMask/keyring-api/pull/35)).
75
118
 
76
119
  ## [0.1.3]
120
+
77
121
  ### Changed
122
+
78
123
  - Downgrade snaps dependencies to `0.35.2-flask.1` ([#25](https://github.com/MetaMask/keyring-api/pull/25)).
79
124
 
80
125
  ## [0.1.2]
126
+
81
127
  ### Changed
128
+
82
129
  - Update snaps dependencies ([#21](https://github.com/MetaMask/keyring-api/pull/21)).
83
130
 
84
131
  ## [0.1.1]
132
+
85
133
  ### Added
134
+
86
135
  - Validate snap responses for type correctness ([#15](https://github.com/MetaMask/keyring-api/pull/15)).
87
136
 
88
137
  ### Changed
138
+
89
139
  - Rename RPC handling functions ([#16](https://github.com/MetaMask/keyring-api/pull/16)).
90
140
 
91
141
  ## [0.1.0] - 2023-06-20
142
+
92
143
  ### Added
144
+
93
145
  - Usage examples to [`README.md`](./README.md).
94
146
  - Keyring API definition.
95
- - JSON-RPC snap keyring client. It is intended to be used by a snap's companion dApp to send requests to the snap.
147
+ - JSON-RPC snap keyring client. It is intended to be used by a snap's companion dapp to send requests to the snap.
96
148
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
97
149
  - Helper functions to create keyring handler in the snap.
98
150
 
99
- [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v0.2.7...HEAD
151
+ [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v1.0.0...HEAD
152
+ [1.0.0]: https://github.com/MetaMask/keyring-api/compare/v1.0.0-rc.1...v1.0.0
153
+ [1.0.0-rc.1]: https://github.com/MetaMask/keyring-api/compare/v0.2.7...v1.0.0-rc.1
100
154
  [0.2.7]: https://github.com/MetaMask/keyring-api/compare/v0.2.6...v0.2.7
101
155
  [0.2.6]: https://github.com/MetaMask/keyring-api/compare/v0.2.5...v0.2.6
102
156
  [0.2.5]: https://github.com/MetaMask/keyring-api/compare/v0.2.4...v0.2.5
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > This TypeScript module is maintained in the style of the MetaMask team.
4
4
 
5
- This TypeScript module simplifies the integration of snaps with MetaMask using
5
+ This TypeScript module simplifies the integration of Snaps with MetaMask using
6
6
  the Keyring API.
7
7
 
8
8
  Features:
@@ -11,19 +11,19 @@ Features:
11
11
  Keyring API. Snaps can implement this interface to seamlessly interact with
12
12
  MetaMask and leverage its functionality.
13
13
 
14
- - **DApp Client**: The module includes a client that enables dApps to
15
- communicate with the Keyring snap. This client allows dApps to send requests
16
- to the snap, such as retrieving account information or submitting requests.
14
+ - **Dapp Client**: The module includes a client that enables dapps to
15
+ communicate with the Keyring Snap. This client allows dapps to send requests
16
+ to the Snap, such as retrieving account information or submitting requests.
17
17
 
18
18
  - **MetaMask Client**: The module provides a client specifically designed for
19
19
  MetaMask integration. This client enables MetaMask to send requests directly
20
- to the Keyring snap, facilitating smooth interoperability between the two
20
+ to the Keyring Snap, facilitating smooth interoperability between the two
21
21
  applications.
22
22
 
23
23
  - **Request Handler Helper Functions**: The module offers a set of helper
24
24
  functions to simplify the implementation of the request handler in the
25
- Keyring snap. These functions assist in processing incoming requests,
26
- validating data, and handling various request types from dApps and MetaMask.
25
+ Keyring Snap. These functions assist in processing incoming requests,
26
+ validating data, and handling various request types from dapps and MetaMask.
27
27
 
28
28
  ## Installation
29
29
 
@@ -33,52 +33,308 @@ or
33
33
 
34
34
  `npm install @metamask/keyring-api`
35
35
 
36
- ## Usage
36
+ ## Keyring Snaps
37
37
 
38
- ### In a snap
38
+ Starting with MetaMask 11.5, Snaps can implement the Keyring API. This allows
39
+ users to manage their accounts in a more flexible way, and enables developers
40
+ to build new types of accounts.
39
41
 
40
- Inside the snap, implement the `Keyring` API:
42
+ > [!IMPORTANT]
43
+ > Before implementing your Snap, please make sure to read the [security
44
+ > recommendations](./docs/security.md) and the [architecture
45
+ > document](./docs/architecture.md).
41
46
 
42
- ```typescript
43
- class MySnapKeyring implements Keyring {
44
- // Implement the required methods.
45
- }
46
- ```
47
+ Follow these steps to implement the Keyring API in your Snap. Please note that
48
+ these instruction assume that you are already familiar with the process of
49
+ [developing a Snap](https://docs.metamask.io/).
47
50
 
48
- Then create a handler that uses an instance of your keyring:
51
+ 1. **Implement the Keyring API:**
49
52
 
50
- ```typescript
51
- import { keyringRpcDispatcher } from '@metamask/keyring-api';
53
+ Inside your Snap, implement the `Keyring` API:
52
54
 
53
- // Create a new MySnapKeyring instance
54
- keyring = new MySnapKeyring(keyringState);
55
- // ...
55
+ ```typescript
56
+ class MySnapKeyring implements Keyring {
57
+ // Implement the required methods here...
58
+ }
59
+ ```
56
60
 
57
- // And wrap it in a handler
58
- const keyringHandler: OnRpcRequestHandler = async ({ request }) => {
59
- // Load the keyring state if needed
60
- // ...
61
- return await keyringRpcDispatcher(keyring, request);
62
- };
63
- ```
61
+ > [!WARNING]
62
+ > Ensure that your keyring implements the [methods called by
63
+ > MetaMask](./docs/security.md#limit-the-methods-exposed-to-dapps),
64
+ > otherwise some features may not work.
64
65
 
65
- Now expose this handler:
66
+ 2. **Handle requests submitted by MetaMask:**
66
67
 
67
- ```typescript
68
- export const onRpcRequest: OnRpcRequestHandler = keyringHandler;
69
- ```
68
+ MetaMask will submit requests through the `submitRequest` method of your the
69
+ Keyring API (check the supported [EVM methods](./docs/evm_methods.md)). Here
70
+ is an example of request:
70
71
 
71
- Or chain it with other handlers:
72
+ ```json
73
+ {
74
+ "id": "d6e23af6-4bea-48dd-aeb0-7d3c30ea67f9",
75
+ "scope": "",
76
+ "account": "69438371-bef3-4957-9f91-c3f22c1d75f3",
77
+ "request": {
78
+ "method": "personal_sign",
79
+ "params": [
80
+ "0x4578616d706c652060706572736f6e616c5f7369676e60206d657373616765",
81
+ "0x5874174dcf1ab6F7Efd8496f4f09404CD1c5bA84"
82
+ ]
83
+ }
84
+ }
85
+ ```
72
86
 
73
- ```typescript
74
- import { chainHandlers } from '@metamask/keyring-api';
87
+ Where:
75
88
 
76
- export const onRpcRequest: OnRpcRequestHandler = chainHandlers(
77
- // Other handlers...
78
- keyringHandler,
79
- // Other handlers...
80
- );
81
- ```
89
+ - `id` is unique identifier for the request.
90
+
91
+ - `scope` is the CAIP-2 chain ID of the selected chain. Currently, this
92
+ property is always an empty string. Your Snap should use the chain ID
93
+ present in the request object instead.
94
+
95
+ - `account` is the ID of the account that should handle the request.
96
+
97
+ - `request` is the request object.
98
+
99
+ Your Snap must respond with either a synchronous result:
100
+
101
+ ```typescript
102
+ return { pending: false, result };
103
+ ```
104
+
105
+ Or an asynchronous result:
106
+
107
+ ```typescript
108
+ return { pending: true, redirect: { message, url } };
109
+ ```
110
+
111
+ The redirect message and URL will be displayed to the user to inform them
112
+ about how to continue the transaction flow.
113
+
114
+ 3. **Notify MetaMask about events:**
115
+
116
+ The following actions must be notified to MetaMask:
117
+
118
+ 1. When an account is created:
119
+
120
+ ```typescript
121
+ try {
122
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountCreated, { account });
123
+ // Update your snap's state...
124
+ } catch (error) {
125
+ // Handle the error...
126
+ }
127
+ ```
128
+
129
+ MetaMask will return an error if the account already exists or if the
130
+ account object is invalid.
131
+
132
+ 2. When an account is updated:
133
+
134
+ ```typescript
135
+ try {
136
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountUpdated, { account });
137
+ // Update your snap's state...
138
+ } catch (error) {
139
+ // Handle the error...
140
+ }
141
+ ```
142
+
143
+ MetaMask will return an error if the account does not exist, if the
144
+ account object is invalid, or if the account address changed.
145
+
146
+ 3. When an account is deleted:
147
+
148
+ ```typescript
149
+ try {
150
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountDeleted, {
151
+ id: account.id,
152
+ });
153
+ // Update your snap's state...
154
+ } catch (error) {
155
+ // Handle the error...
156
+ }
157
+ ```
158
+
159
+ The delete event is idempotent, so it is safe to emit it even if the
160
+ account does not exist.
161
+
162
+ 4. When a request is approved:
163
+
164
+ ```typescript
165
+ try {
166
+ emitSnapKeyringEvent(snap, KeyringEvent.RequestApproved, {
167
+ id: request.id,
168
+ result,
169
+ });
170
+ // Update your snap's state...
171
+ } catch (error) {
172
+ // Handle the error...
173
+ }
174
+ ```
175
+
176
+ MetaMask will return an error if the request does not exist.
177
+
178
+ > [!NOTE]
179
+ > This only applies to Snaps that implement the [async
180
+ > flow](./docs/architecture.md#transaction-flow).
181
+
182
+ 5. When a request is rejected:
183
+
184
+ ```typescript
185
+ try {
186
+ emitSnapKeyringEvent(snap, KeyringEvent.RequestRejected, {
187
+ id: request.id,
188
+ });
189
+ // Update your snap's state...
190
+ } catch (error) {
191
+ // Handle the error...
192
+ }
193
+ ```
194
+
195
+ MetaMask will return an error if the request does not exist.
196
+
197
+ > [!NOTE]
198
+ > This only applies to Snaps that implement the [async
199
+ > flow](./docs/architecture.md#transaction-flow).
200
+
201
+ 4. **Expose the Keyring API:**
202
+
203
+ Then create a handler to expose the keyring methods to MetaMask and your dapp:
204
+
205
+ ```typescript
206
+ export const onKeyringRequest: OnKeyringRequestHandler = async ({
207
+ origin,
208
+ request,
209
+ }) => {
210
+ // Your custom logic here...
211
+ return handleKeyringRequest(keyring, request);
212
+ };
213
+ ```
214
+
215
+ 5. **Call the keyring methods from your dapp:**
216
+
217
+ Now you should be able to call your Keyring Snap from your dapp, for
218
+ example:
219
+
220
+ ```typescript
221
+ const client = new KeyringSnapRpcClient(snapId, window.ethereum);
222
+ const accounts = await client.listAccounts();
223
+ ```
224
+
225
+ ## Migrating from 0.1.x to 0.2.x
226
+
227
+ The following changes were made to the API, which may require changes to your
228
+ implementation:
229
+
230
+ - In the `KeyringAccount` type, the `supportedMethods` property was renamed to
231
+ `methods`.
232
+
233
+ ```diff
234
+ - supportedMethods: string[];
235
+ + methods: string[];
236
+ ```
237
+
238
+ - In the `KeyringAccount` type, the `name` property was removed.
239
+
240
+ ```diff
241
+ - name: string;
242
+ ```
243
+
244
+ - In the `KeyringAccount` type, add the `options` property can no longer be
245
+ null.
246
+
247
+ ```diff
248
+ - options: Record<string, unknown> | null;
249
+ + options: Record<string, unknown>;
250
+ ```
251
+
252
+ - In the `KeyringAccount` type, the `eth_signTypedData` method was removed from
253
+ the list of available methods.
254
+
255
+ ```diff
256
+ - 'eth_signTypedData',
257
+ ```
258
+
259
+ It was an alias for the `eth_signTypedData_v1` method, which is still
260
+ present.
261
+
262
+ - Snaps should now use the `emitSnapKeyringEvent()` helper function to notify
263
+ MetaMask about events:
264
+
265
+ ```ts
266
+ // Emit an event to indicate that an account was created.
267
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountCreated, { account });
268
+
269
+ // Emit an event to indicate that an account was updated.
270
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountUpdated, { account });
271
+
272
+ // Emit an event to indicate that an account was deleted.
273
+ emitSnapKeyringEvent(snap, KeyringEvent.AccountDeleted, { id: account.id });
274
+
275
+ // Emit an event to indicate that a request was approved.
276
+ emitSnapKeyringEvent(snap, KeyringEvent.RequestApproved, {
277
+ id: request.id,
278
+ result,
279
+ });
280
+
281
+ // Emit an event to indicate that a request was rejected.
282
+ emitSnapKeyringEvent(snap, KeyringEvent.RequestRejected, { id: request.id });
283
+ ```
284
+
285
+ > [!IMPORTANT]
286
+ > For all events above, MetaMask may return an error indicating that the
287
+ > event was not handled, possibly because it contains invalid arguments.
288
+
289
+ - Keyrings that implement the [async transaction
290
+ flow](./docs/architecture.md#transaction-flow) can now return an optional
291
+ `redirect` property that contains an URL and a message to be displayed to the
292
+ user. This will, in a future release of MetaMask, be used to inform the user
293
+ on how to continue the transaction flow.
294
+
295
+ ```ts
296
+ return {
297
+ pending: true,
298
+ redirect: {
299
+ message: 'Please go to the Snap Dapp to finish sining the transaction.',
300
+ url: 'https://example.com/sign?tx=1234',
301
+ },
302
+ };
303
+ ```
304
+
305
+ - The `buildHandlersChain` helper function was removed from the API. Instead,
306
+ you must implement your own handler. For example:
307
+
308
+ ```ts
309
+ export const onRpcRequest: OnRpcRequestHandler = async ({
310
+ request,
311
+ origin,
312
+ }) => {
313
+ // Check if origin is allowed to call the method.
314
+ if (!hasPermission(origin, request.method)) {
315
+ throw new Error(
316
+ `Origin '${origin}' is not allowed to call '${request.method}'`,
317
+ );
318
+ }
319
+
320
+ // Dispatch the request to the keyring.
321
+ return handleKeyringRequest(keyring, request);
322
+ };
323
+ ```
324
+
325
+ ## Migrating from 0.2.x to 1.x.x
326
+
327
+ The following changes were made to the API, which may require changes to your
328
+ implementation:
329
+
330
+ - Your Snap must expose the Keyring methods through the `onKeyringRequest`
331
+ export instead of the `onRpcRequest` export.
332
+
333
+ - Your Snap must request the new `endowment:keyring` endowment, and list any
334
+ dapp that should be allowed to call the Keyring methods.
335
+
336
+ For more details about the changes, please refer to the [security
337
+ guidelines](./docs/security.md).
82
338
 
83
339
  ## API
84
340
 
@@ -124,7 +380,7 @@ The project follows the same release process as the other libraries in the MetaM
124
380
  - Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
125
381
  - Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).
126
382
  - Consolidate related changes into one change entry if it makes it easier to explain.
127
- - Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted.
383
+ - Run `yarn auto-changelog validate --prettier --rc` to check that the changelog is correctly formatted.
128
384
 
129
385
  5. Review and QA the release.
130
386
 
@@ -18,7 +18,7 @@ export declare class KeyringSnapControllerClient extends KeyringClient {
18
18
  * @param args.controller - The `SnapController` instance to use.
19
19
  * @param args.snapId - The ID of the snap to use (default: `'undefined'`).
20
20
  * @param args.origin - The sender's origin (default: `'metamask'`).
21
- * @param args.handler - The handler type (default: `'onRpcRequest'`).
21
+ * @param args.handler - The handler type (default: `'onKeyringRequest'`).
22
22
  */
23
23
  constructor({ controller, snapId, origin, handler, }: {
24
24
  controller: SnapController;
@@ -69,9 +69,9 @@ class KeyringSnapControllerClient extends KeyringClient_1.KeyringClient {
69
69
  * @param args.controller - The `SnapController` instance to use.
70
70
  * @param args.snapId - The ID of the snap to use (default: `'undefined'`).
71
71
  * @param args.origin - The sender's origin (default: `'metamask'`).
72
- * @param args.handler - The handler type (default: `'onRpcRequest'`).
72
+ * @param args.handler - The handler type (default: `'onKeyringRequest'`).
73
73
  */
74
- constructor({ controller, snapId = 'undefined', origin = 'metamask', handler = 'onRpcRequest', }) {
74
+ constructor({ controller, snapId = 'undefined', origin = 'metamask', handler = 'onKeyringRequest', }) {
75
75
  super(new SnapControllerSender(controller, snapId, origin, handler));
76
76
  _KeyringSnapControllerClient_controller.set(this, void 0);
77
77
  __classPrivateFieldSet(this, _KeyringSnapControllerClient_controller, controller, "f");
@@ -1 +1 @@
1
- {"version":3,"file":"KeyringSnapControllerClient.js","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,mDAA6D;AAE7D;;;GAGG;AACH,MAAM,oBAAoB;IASxB;;;;;;;OAOG;IACH,YACE,UAAe,EACf,MAAc,EACd,MAAc,EACd,OAAoB;QApBtB,+CAAgB;QAEhB,+CAAgB;QAEhB,mDAA4B;QAE5B,gDAAsB;QAgBpB,uBAAA,IAAI,oCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,wCAAY,CAAC,aAAa,CAAC;YACpC,MAAM,EAAE,uBAAA,IAAI,oCAA2B;YACvC,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,OAAO,EAAE,uBAAA,IAAI,qCAAS;YACtB,OAAO;SACR,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,6BAAa;IAG5D;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,UAAU,EACV,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,UAAU,EACnB,OAAO,GAAG,cAA6B,GAMxC;QACC,KAAK,CAAC,IAAI,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QA1BvE,0DAA4B;QA2B1B,uBAAA,IAAI,2CAAe,UAAU,MAAA,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,2BAA2B,CAAC;YACrC,UAAU,EAAE,uBAAA,IAAI,+CAAY;YAC5B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,OAAO,uBAAA,IAAI,+CAAY,CAAC;IAC1B,CAAC;CACF;AAtDD,kEAsDC","sourcesContent":["import type { SnapController } from '@metamask/snaps-controllers';\nimport type { HandlerType, ValidatedSnapId } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { KeyringClient, type Sender } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through a `SnapController`.\n */\nclass SnapControllerSender implements Sender {\n #snapId: string;\n\n #origin: string;\n\n #controller: SnapController;\n\n #handler: HandlerType;\n\n /**\n * Create a new instance of `SnapControllerSender`.\n *\n * @param controller - The `SnapController` instance to send requests to.\n * @param snapId - The ID of the snap to use.\n * @param origin - The sender's origin.\n * @param handler - The handler type.\n */\n constructor(\n controller: any,\n snapId: string,\n origin: string,\n handler: HandlerType,\n ) {\n this.#controller = controller;\n this.#snapId = snapId;\n this.#origin = origin;\n this.#handler = handler;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#controller.handleRequest({\n snapId: this.#snapId as ValidatedSnapId,\n origin: this.#origin,\n handler: this.#handler,\n request,\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the\n * `SnapController`.\n */\nexport class KeyringSnapControllerClient extends KeyringClient {\n #controller: SnapController;\n\n /**\n * Create a new instance of `KeyringSnapControllerClient`.\n *\n * The `handlerType` argument has a hard-coded default `string` value instead\n * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module\n * from being required at runtime.\n *\n * @param args - Constructor arguments.\n * @param args.controller - The `SnapController` instance to use.\n * @param args.snapId - The ID of the snap to use (default: `'undefined'`).\n * @param args.origin - The sender's origin (default: `'metamask'`).\n * @param args.handler - The handler type (default: `'onRpcRequest'`).\n */\n constructor({\n controller,\n snapId = 'undefined',\n origin = 'metamask',\n handler = 'onRpcRequest' as HandlerType,\n }: {\n controller: SnapController;\n snapId?: string;\n origin?: string;\n handler?: HandlerType;\n }) {\n super(new SnapControllerSender(controller, snapId, origin, handler));\n this.#controller = controller;\n }\n\n /**\n * Create a new instance of `KeyringSnapControllerClient` with the specified\n * `snapId`.\n *\n * @param snapId - The ID of the snap to use in the new instance.\n * @returns A new instance of `KeyringSnapControllerClient` with the\n * specified snap ID.\n */\n withSnapId(snapId: string): KeyringSnapControllerClient {\n return new KeyringSnapControllerClient({\n controller: this.#controller,\n snapId,\n });\n }\n\n /**\n * Get the `SnapController` instance used by this client.\n *\n * @returns The `SnapController` instance used by this client.\n */\n getController(): SnapController {\n return this.#controller;\n }\n}\n"]}
1
+ {"version":3,"file":"KeyringSnapControllerClient.js","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,mDAA6D;AAE7D;;;GAGG;AACH,MAAM,oBAAoB;IASxB;;;;;;;OAOG;IACH,YACE,UAAe,EACf,MAAc,EACd,MAAc,EACd,OAAoB;QApBtB,+CAAgB;QAEhB,+CAAgB;QAEhB,mDAA4B;QAE5B,gDAAsB;QAgBpB,uBAAA,IAAI,oCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,wCAAY,CAAC,aAAa,CAAC;YACpC,MAAM,EAAE,uBAAA,IAAI,oCAA2B;YACvC,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,OAAO,EAAE,uBAAA,IAAI,qCAAS;YACtB,OAAO;SACR,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,6BAAa;IAG5D;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,UAAU,EACV,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,UAAU,EACnB,OAAO,GAAG,kBAAiC,GAM5C;QACC,KAAK,CAAC,IAAI,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QA1BvE,0DAA4B;QA2B1B,uBAAA,IAAI,2CAAe,UAAU,MAAA,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,2BAA2B,CAAC;YACrC,UAAU,EAAE,uBAAA,IAAI,+CAAY;YAC5B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,OAAO,uBAAA,IAAI,+CAAY,CAAC;IAC1B,CAAC;CACF;AAtDD,kEAsDC","sourcesContent":["import type { SnapController } from '@metamask/snaps-controllers';\nimport type { HandlerType, ValidatedSnapId } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { KeyringClient, type Sender } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through a `SnapController`.\n */\nclass SnapControllerSender implements Sender {\n #snapId: string;\n\n #origin: string;\n\n #controller: SnapController;\n\n #handler: HandlerType;\n\n /**\n * Create a new instance of `SnapControllerSender`.\n *\n * @param controller - The `SnapController` instance to send requests to.\n * @param snapId - The ID of the snap to use.\n * @param origin - The sender's origin.\n * @param handler - The handler type.\n */\n constructor(\n controller: any,\n snapId: string,\n origin: string,\n handler: HandlerType,\n ) {\n this.#controller = controller;\n this.#snapId = snapId;\n this.#origin = origin;\n this.#handler = handler;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#controller.handleRequest({\n snapId: this.#snapId as ValidatedSnapId,\n origin: this.#origin,\n handler: this.#handler,\n request,\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the\n * `SnapController`.\n */\nexport class KeyringSnapControllerClient extends KeyringClient {\n #controller: SnapController;\n\n /**\n * Create a new instance of `KeyringSnapControllerClient`.\n *\n * The `handlerType` argument has a hard-coded default `string` value instead\n * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module\n * from being required at runtime.\n *\n * @param args - Constructor arguments.\n * @param args.controller - The `SnapController` instance to use.\n * @param args.snapId - The ID of the snap to use (default: `'undefined'`).\n * @param args.origin - The sender's origin (default: `'metamask'`).\n * @param args.handler - The handler type (default: `'onKeyringRequest'`).\n */\n constructor({\n controller,\n snapId = 'undefined',\n origin = 'metamask',\n handler = 'onKeyringRequest' as HandlerType,\n }: {\n controller: SnapController;\n snapId?: string;\n origin?: string;\n handler?: HandlerType;\n }) {\n super(new SnapControllerSender(controller, snapId, origin, handler));\n this.#controller = controller;\n }\n\n /**\n * Create a new instance of `KeyringSnapControllerClient` with the specified\n * `snapId`.\n *\n * @param snapId - The ID of the snap to use in the new instance.\n * @returns A new instance of `KeyringSnapControllerClient` with the\n * specified snap ID.\n */\n withSnapId(snapId: string): KeyringSnapControllerClient {\n return new KeyringSnapControllerClient({\n controller: this.#controller,\n snapId,\n });\n }\n\n /**\n * Get the `SnapController` instance used by this client.\n *\n * @returns The `SnapController` instance used by this client.\n */\n getController(): SnapController {\n return this.#controller;\n }\n}\n"]}
@@ -39,7 +39,7 @@ class SnapRpcSender {
39
39
  */
40
40
  async send(request) {
41
41
  return __classPrivateFieldGet(this, _SnapRpcSender_provider, "f").request({
42
- method: 'wallet_invokeSnap',
42
+ method: 'wallet_invokeKeyring',
43
43
  params: {
44
44
  snapId: __classPrivateFieldGet(this, _SnapRpcSender_origin, "f"),
45
45
  request,
@@ -1 +1 @@
1
- {"version":3,"file":"KeyringSnapRpcClient.js","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,mDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAV5D,wCAAgB;QAEhB,0CAAkC;QAShC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;AA/BD,sCA+BC;;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,6BAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAVD,oDAUC","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n #origin: string;\n\n #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeSnap',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
1
+ {"version":3,"file":"KeyringSnapRpcClient.js","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,mDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAV5D,wCAAgB;QAEhB,0CAAkC;QAShC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;AA/BD,sCA+BC;;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,6BAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAVD,oDAUC","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n #origin: string;\n\n #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeKeyring',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
package/dist/events.d.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * Supported keyring events.
3
3
  */
4
4
  export declare enum KeyringEvent {
5
- AccountCreated = "event:accountCreated",
6
- AccountUpdated = "event:accountUpdated",
7
- AccountDeleted = "event:accountDeleted",
8
- RequestApproved = "event:requestApproved",
9
- RequestRejected = "event:requestRejected"
5
+ AccountCreated = "notify:accountCreated",
6
+ AccountUpdated = "notify:accountUpdated",
7
+ AccountDeleted = "notify:accountDeleted",
8
+ RequestApproved = "notify:requestApproved",
9
+ RequestRejected = "notify:requestRejected"
10
10
  }
package/dist/events.js CHANGED
@@ -7,11 +7,11 @@ exports.KeyringEvent = void 0;
7
7
  var KeyringEvent;
8
8
  (function (KeyringEvent) {
9
9
  // Account events
10
- KeyringEvent["AccountCreated"] = "event:accountCreated";
11
- KeyringEvent["AccountUpdated"] = "event:accountUpdated";
12
- KeyringEvent["AccountDeleted"] = "event:accountDeleted";
10
+ KeyringEvent["AccountCreated"] = "notify:accountCreated";
11
+ KeyringEvent["AccountUpdated"] = "notify:accountUpdated";
12
+ KeyringEvent["AccountDeleted"] = "notify:accountDeleted";
13
13
  // Request events
14
- KeyringEvent["RequestApproved"] = "event:requestApproved";
15
- KeyringEvent["RequestRejected"] = "event:requestRejected";
14
+ KeyringEvent["RequestApproved"] = "notify:requestApproved";
15
+ KeyringEvent["RequestRejected"] = "notify:requestRejected";
16
16
  })(KeyringEvent = exports.KeyringEvent || (exports.KeyringEvent = {}));
17
17
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,uDAAuC,CAAA;IACvC,uDAAuC,CAAA;IACvC,uDAAuC,CAAA;IAEvC,iBAAiB;IACjB,yDAAyC,CAAA;IACzC,yDAAyC,CAAA;AAC3C,CAAC,EATW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QASvB","sourcesContent":["/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'event:accountCreated',\n AccountUpdated = 'event:accountUpdated',\n AccountDeleted = 'event:accountDeleted',\n\n // Request events\n RequestApproved = 'event:requestApproved',\n RequestRejected = 'event:requestRejected',\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QASvB","sourcesContent":["/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
2
- method: "event:accountCreated";
2
+ method: "notify:accountCreated";
3
3
  params: {
4
4
  account: {
5
5
  type: "eip155:eoa" | "eip155:eip4337";
@@ -10,7 +10,7 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
10
10
  };
11
11
  };
12
12
  }, {
13
- method: import("superstruct").Struct<"event:accountCreated", "event:accountCreated">;
13
+ method: import("superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
14
14
  params: import("superstruct").Struct<{
15
15
  account: {
16
16
  type: "eip155:eoa" | "eip155:eip4337";
@@ -49,7 +49,7 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
49
49
  }>;
50
50
  }>;
51
51
  export declare const AccountUpdatedEventStruct: import("superstruct").Struct<{
52
- method: "event:accountUpdated";
52
+ method: "notify:accountUpdated";
53
53
  params: {
54
54
  account: {
55
55
  type: "eip155:eoa" | "eip155:eip4337";
@@ -60,7 +60,7 @@ export declare const AccountUpdatedEventStruct: import("superstruct").Struct<{
60
60
  };
61
61
  };
62
62
  }, {
63
- method: import("superstruct").Struct<"event:accountUpdated", "event:accountUpdated">;
63
+ method: import("superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
64
64
  params: import("superstruct").Struct<{
65
65
  account: {
66
66
  type: "eip155:eoa" | "eip155:eip4337";
@@ -99,12 +99,12 @@ export declare const AccountUpdatedEventStruct: import("superstruct").Struct<{
99
99
  }>;
100
100
  }>;
101
101
  export declare const AccountDeletedEventStruct: import("superstruct").Struct<{
102
- method: "event:accountDeleted";
102
+ method: "notify:accountDeleted";
103
103
  params: {
104
104
  id: string;
105
105
  };
106
106
  }, {
107
- method: import("superstruct").Struct<"event:accountDeleted", "event:accountDeleted">;
107
+ method: import("superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
108
108
  params: import("superstruct").Struct<{
109
109
  id: string;
110
110
  }, {
@@ -115,13 +115,13 @@ export declare const AccountDeletedEventStruct: import("superstruct").Struct<{
115
115
  }>;
116
116
  }>;
117
117
  export declare const RequestApprovedEventStruct: import("superstruct").Struct<{
118
- method: "event:requestApproved";
118
+ method: "notify:requestApproved";
119
119
  params: {
120
120
  id: string;
121
121
  result: import("@metamask/utils").Json;
122
122
  };
123
123
  }, {
124
- method: import("superstruct").Struct<"event:requestApproved", "event:requestApproved">;
124
+ method: import("superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
125
125
  params: import("superstruct").Struct<{
126
126
  id: string;
127
127
  result: import("@metamask/utils").Json;
@@ -137,12 +137,12 @@ export declare const RequestApprovedEventStruct: import("superstruct").Struct<{
137
137
  }>;
138
138
  }>;
139
139
  export declare const RequestRejectedEventStruct: import("superstruct").Struct<{
140
- method: "event:requestRejected";
140
+ method: "notify:requestRejected";
141
141
  params: {
142
142
  id: string;
143
143
  };
144
144
  }, {
145
- method: import("superstruct").Struct<"event:requestRejected", "event:requestRejected">;
145
+ method: import("superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
146
146
  params: import("superstruct").Struct<{
147
147
  id: string;
148
148
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "0.2.7",
3
+ "version": "1.0.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -25,7 +25,7 @@
25
25
  "build:clean": "rimraf dist && yarn build",
26
26
  "build:docs": "typedoc",
27
27
  "lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog",
28
- "lint:changelog": "auto-changelog validate",
28
+ "lint:changelog": "auto-changelog validate --prettier",
29
29
  "lint:constraints": "yarn constraints",
30
30
  "lint:dependencies": "depcheck && yarn dedupe",
31
31
  "lint:eslint": "eslint . --cache --ext js,ts",
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@metamask/providers": "^13.0.0",
42
- "@metamask/rpc-methods": "^2.0.0",
43
- "@metamask/snaps-controllers": "^2.0.0",
44
- "@metamask/snaps-utils": "^2.0.0",
42
+ "@metamask/rpc-methods": "^3.0.0",
43
+ "@metamask/snaps-controllers": "^3.0.0",
44
+ "@metamask/snaps-utils": "^3.0.0",
45
45
  "@metamask/utils": "^8.1.0",
46
46
  "@types/uuid": "^9.0.1",
47
47
  "superstruct": "^1.0.3",