@metamask/keyring-api 8.0.1 → 8.1.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
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [8.1.0]
11
+
12
+ ### Added
13
+
14
+ - Add optional `nameLastUpdatedAt` metadata field ([#366](https://github.com/MetaMask/keyring-api/pull/366))
15
+
16
+ ### Changed
17
+
18
+ - Bump @metamask/snaps-sdk from 6.1.0 to 6.2.0 ([#367](https://github.com/MetaMask/keyring-api/pull/367))
19
+ - Bump @metamask/providers from 17.1.1 to 17.1.2 ([#362](https://github.com/MetaMask/keyring-api/pull/362))
20
+
21
+ ## [8.0.2]
22
+
23
+ ### Changed
24
+
25
+ - Bump `@metamask/snaps-sdk` from `^6.0.0` to `^6.1.0` ([#358](https://github.com/MetaMask/keyring-api/pull/358))
26
+
10
27
  ## [8.0.1]
11
28
 
12
29
  ### Changed
@@ -373,7 +390,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
373
390
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
374
391
  - Helper functions to create keyring handler in the snap.
375
392
 
376
- [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v8.0.1...HEAD
393
+ [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v8.1.0...HEAD
394
+ [8.1.0]: https://github.com/MetaMask/keyring-api/compare/v8.0.2...v8.1.0
395
+ [8.0.2]: https://github.com/MetaMask/keyring-api/compare/v8.0.1...v8.0.2
377
396
  [8.0.1]: https://github.com/MetaMask/keyring-api/compare/v8.0.0...v8.0.1
378
397
  [8.0.0]: https://github.com/MetaMask/keyring-api/compare/v7.0.0...v8.0.0
379
398
  [7.0.0]: https://github.com/MetaMask/keyring-api/compare/v6.4.0...v7.0.0
@@ -8,6 +8,7 @@ export declare const InternalAccountMetadataStruct: Struct<{
8
8
  keyring: {
9
9
  type: string;
10
10
  };
11
+ nameLastUpdatedAt?: number;
11
12
  snap?: {
12
13
  id: string;
13
14
  name: string;
@@ -22,6 +23,7 @@ export declare const InternalAccountMetadataStruct: Struct<{
22
23
  keyring: {
23
24
  type: string;
24
25
  };
26
+ nameLastUpdatedAt?: number;
25
27
  snap?: {
26
28
  id: string;
27
29
  name: string;
@@ -30,6 +32,7 @@ export declare const InternalAccountMetadataStruct: Struct<{
30
32
  lastSelected?: number;
31
33
  }, {
32
34
  name: Struct<string, null>;
35
+ nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
33
36
  snap: Struct<import("../superstruct").ExactOptionalTag | {
34
37
  id: string;
35
38
  name: string;
@@ -60,6 +63,7 @@ export declare const InternalEthEoaAccountStruct: Struct<{
60
63
  keyring: {
61
64
  type: string;
62
65
  };
66
+ nameLastUpdatedAt?: number;
63
67
  snap?: {
64
68
  id: string;
65
69
  name: string;
@@ -87,6 +91,7 @@ export declare const InternalEthEoaAccountStruct: Struct<{
87
91
  keyring: {
88
92
  type: string;
89
93
  };
94
+ nameLastUpdatedAt?: number;
90
95
  snap?: {
91
96
  id: string;
92
97
  name: string;
@@ -95,6 +100,7 @@ export declare const InternalEthEoaAccountStruct: Struct<{
95
100
  lastSelected?: number;
96
101
  }, {
97
102
  name: Struct<string, null>;
103
+ nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
98
104
  snap: Struct<import("../superstruct").ExactOptionalTag | {
99
105
  id: string;
100
106
  name: string;
@@ -125,6 +131,7 @@ export declare const InternalEthErc4337AccountStruct: Struct<{
125
131
  keyring: {
126
132
  type: string;
127
133
  };
134
+ nameLastUpdatedAt?: number;
128
135
  snap?: {
129
136
  id: string;
130
137
  name: string;
@@ -154,6 +161,7 @@ export declare const InternalEthErc4337AccountStruct: Struct<{
154
161
  keyring: {
155
162
  type: string;
156
163
  };
164
+ nameLastUpdatedAt?: number;
157
165
  snap?: {
158
166
  id: string;
159
167
  name: string;
@@ -162,6 +170,7 @@ export declare const InternalEthErc4337AccountStruct: Struct<{
162
170
  lastSelected?: number;
163
171
  }, {
164
172
  name: Struct<string, null>;
173
+ nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
165
174
  snap: Struct<import("../superstruct").ExactOptionalTag | {
166
175
  id: string;
167
176
  name: string;
@@ -192,6 +201,7 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
192
201
  keyring: {
193
202
  type: string;
194
203
  };
204
+ nameLastUpdatedAt?: number;
195
205
  snap?: {
196
206
  id: string;
197
207
  name: string;
@@ -214,6 +224,7 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
214
224
  keyring: {
215
225
  type: string;
216
226
  };
227
+ nameLastUpdatedAt?: number;
217
228
  snap?: {
218
229
  id: string;
219
230
  name: string;
@@ -222,6 +233,7 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
222
233
  lastSelected?: number;
223
234
  }, {
224
235
  name: Struct<string, null>;
236
+ nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
225
237
  snap: Struct<import("../superstruct").ExactOptionalTag | {
226
238
  id: string;
227
239
  name: string;
@@ -257,6 +269,7 @@ export declare const InternalAccountStruct: Struct<{
257
269
  keyring: {
258
270
  type: string;
259
271
  };
272
+ nameLastUpdatedAt?: number;
260
273
  snap?: {
261
274
  id: string;
262
275
  name: string;
@@ -271,6 +284,7 @@ export declare const InternalAccountStruct: Struct<{
271
284
  keyring: {
272
285
  type: string;
273
286
  };
287
+ nameLastUpdatedAt?: number;
274
288
  snap?: {
275
289
  id: string;
276
290
  name: string;
@@ -279,6 +293,7 @@ export declare const InternalAccountStruct: Struct<{
279
293
  lastSelected?: number;
280
294
  }, {
281
295
  name: Struct<string, null>;
296
+ nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
282
297
  snap: Struct<import("../superstruct").ExactOptionalTag | {
283
298
  id: string;
284
299
  name: string;
@@ -9,6 +9,7 @@ const superstruct_2 = require("../superstruct");
9
9
  exports.InternalAccountMetadataStruct = (0, superstruct_2.object)({
10
10
  metadata: (0, superstruct_2.object)({
11
11
  name: (0, superstruct_1.string)(),
12
+ nameLastUpdatedAt: (0, superstruct_2.exactOptional)((0, superstruct_1.number)()),
12
13
  snap: (0, superstruct_2.exactOptional)((0, superstruct_2.object)({
13
14
  id: (0, superstruct_1.string)(),
14
15
  enabled: (0, superstruct_1.boolean)(),
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,gCAA8E;AAC9E,wCAAsD;AACtD,wCAA4E;AAC5E,gDAAuD;AAI1C,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,aAA6C;IAE7C,OAAO,IAAA,oBAAM,EAAC;QACZ,GAAG,aAAa,CAAC,MAAM;QACvB,GAAG,qCAA6B,CAAC,MAAM;KACxC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,2BAA2B,GACtC,uBAAuB,CAAC,2BAAmB,CAAC,CAAC;AAElC,QAAA,+BAA+B,GAAG,uBAAuB,CACpE,+BAAuB,CACxB,CAAC;AAEW,QAAA,8BAA8B,GAAG,uBAAuB,CACnE,8BAAsB,CACvB,CAAC;AAYW,QAAA,sBAAsB,GAK/B;IACF,CAAC,GAAG,oBAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;CAC7D,CAAC;AAOW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType = EthAccountType | BtcAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\n/**\n * Creates an `InternalAccount` from an existing account `superstruct` object.\n *\n * @param accountStruct - An account `superstruct` object.\n * @returns The `InternalAccount` associated to `accountStruct`.\n */\nfunction asInternalAccountStruct<Account, AccountSchema>(\n accountStruct: Struct<Account, AccountSchema>,\n) {\n return object({\n ...accountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n });\n}\n\nexport const InternalEthEoaAccountStruct =\n asInternalAccountStruct(EthEoaAccountStruct);\n\nexport const InternalEthErc4337AccountStruct = asInternalAccountStruct(\n EthErc4337AccountStruct,\n);\n\nexport const InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(\n BtcP2wpkhAccountStruct,\n);\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,gCAA8E;AAC9E,wCAAsD;AACtD,wCAA4E;AAC5E,gDAAuD;AAI1C,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,aAA6C;IAE7C,OAAO,IAAA,oBAAM,EAAC;QACZ,GAAG,aAAa,CAAC,MAAM;QACvB,GAAG,qCAA6B,CAAC,MAAM;KACxC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,2BAA2B,GACtC,uBAAuB,CAAC,2BAAmB,CAAC,CAAC;AAElC,QAAA,+BAA+B,GAAG,uBAAuB,CACpE,+BAAuB,CACxB,CAAC;AAEW,QAAA,8BAA8B,GAAG,uBAAuB,CACnE,8BAAsB,CACvB,CAAC;AAYW,QAAA,sBAAsB,GAK/B;IACF,CAAC,GAAG,oBAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;CAC7D,CAAC;AAOW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType = EthAccountType | BtcAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\n/**\n * Creates an `InternalAccount` from an existing account `superstruct` object.\n *\n * @param accountStruct - An account `superstruct` object.\n * @returns The `InternalAccount` associated to `accountStruct`.\n */\nfunction asInternalAccountStruct<Account, AccountSchema>(\n accountStruct: Struct<Account, AccountSchema>,\n) {\n return object({\n ...accountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n });\n}\n\nexport const InternalEthEoaAccountStruct =\n asInternalAccountStruct(EthEoaAccountStruct);\n\nexport const InternalEthErc4337AccountStruct = asInternalAccountStruct(\n EthErc4337AccountStruct,\n);\n\nexport const InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(\n BtcP2wpkhAccountStruct,\n);\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -38,7 +38,7 @@
38
38
  "test:watch": "jest --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@metamask/snaps-sdk": "^6.0.0",
41
+ "@metamask/snaps-sdk": "^6.1.0",
42
42
  "@metamask/superstruct": "^3.1.0",
43
43
  "@metamask/utils": "^9.1.0",
44
44
  "@types/uuid": "^9.0.8",