@metamask/keyring-api 8.0.2 → 8.1.1
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 +56 -35
- package/dist/internal/types.d.ts +15 -0
- package/dist/internal/types.js +1 -0
- package/dist/internal/types.js.map +1 -1
- package/package.json +9 -27
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [8.1.1]
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Convert to monorepo
|
15
|
+
- Package name does not change (`@metamask/keyring-api`) and sources have been moved to: `packages/keyring-api`.
|
16
|
+
- You can find all the changes [here](https://github.com/MetaMask/accounts/compare/6da58b4...38794aa).
|
17
|
+
|
18
|
+
## [8.1.0]
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
- Add optional `nameLastUpdatedAt` metadata field ([#366](https://github.com/MetaMask/keyring-api/pull/366))
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
|
26
|
+
- Bump @metamask/snaps-sdk from 6.1.0 to 6.2.0 ([#367](https://github.com/MetaMask/keyring-api/pull/367))
|
27
|
+
- Bump @metamask/providers from 17.1.1 to 17.1.2 ([#362](https://github.com/MetaMask/keyring-api/pull/362))
|
28
|
+
|
10
29
|
## [8.0.2]
|
11
30
|
|
12
31
|
### Changed
|
@@ -379,38 +398,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
379
398
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
380
399
|
- Helper functions to create keyring handler in the snap.
|
381
400
|
|
382
|
-
[Unreleased]: https://github.com/MetaMask/keyring-api
|
383
|
-
[8.
|
384
|
-
[8.0
|
385
|
-
[8.0.
|
386
|
-
[
|
387
|
-
[
|
388
|
-
[
|
389
|
-
[6.
|
390
|
-
[6.
|
391
|
-
[6.
|
392
|
-
[6.
|
393
|
-
[6.
|
394
|
-
[6.
|
395
|
-
[
|
396
|
-
[
|
397
|
-
[
|
398
|
-
[
|
399
|
-
[4.0.
|
400
|
-
[
|
401
|
-
[
|
402
|
-
[
|
403
|
-
[
|
404
|
-
[1.
|
405
|
-
[0.
|
406
|
-
[0.
|
407
|
-
[0.2.
|
408
|
-
[0.2.
|
409
|
-
[0.2.
|
410
|
-
[0.2.
|
411
|
-
[0.2.
|
412
|
-
[0.2.
|
413
|
-
[0.1
|
414
|
-
[0.
|
415
|
-
[0.1.
|
416
|
-
[0.1.
|
401
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.1...HEAD
|
402
|
+
[8.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.0...@metamask/keyring-api@8.1.1
|
403
|
+
[8.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.0.2...@metamask/keyring-api@8.1.0
|
404
|
+
[8.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.0.1...@metamask/keyring-api@8.0.2
|
405
|
+
[8.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.0.0...@metamask/keyring-api@8.0.1
|
406
|
+
[8.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@7.0.0...@metamask/keyring-api@8.0.0
|
407
|
+
[7.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.4.0...@metamask/keyring-api@7.0.0
|
408
|
+
[6.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.3.1...@metamask/keyring-api@6.4.0
|
409
|
+
[6.3.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.3.0...@metamask/keyring-api@6.3.1
|
410
|
+
[6.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.2.1...@metamask/keyring-api@6.3.0
|
411
|
+
[6.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.2.0...@metamask/keyring-api@6.2.1
|
412
|
+
[6.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.1.1...@metamask/keyring-api@6.2.0
|
413
|
+
[6.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.1.0...@metamask/keyring-api@6.1.1
|
414
|
+
[6.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@6.0.0...@metamask/keyring-api@6.1.0
|
415
|
+
[6.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@5.1.0...@metamask/keyring-api@6.0.0
|
416
|
+
[5.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@5.0.0...@metamask/keyring-api@5.1.0
|
417
|
+
[5.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@4.0.2...@metamask/keyring-api@5.0.0
|
418
|
+
[4.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@4.0.1...@metamask/keyring-api@4.0.2
|
419
|
+
[4.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@4.0.0...@metamask/keyring-api@4.0.1
|
420
|
+
[4.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@3.0.0...@metamask/keyring-api@4.0.0
|
421
|
+
[3.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@2.0.0...@metamask/keyring-api@3.0.0
|
422
|
+
[2.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@1.1.0...@metamask/keyring-api@2.0.0
|
423
|
+
[1.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@1.0.0...@metamask/keyring-api@1.1.0
|
424
|
+
[1.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@1.0.0-rc.1...@metamask/keyring-api@1.0.0
|
425
|
+
[1.0.0-rc.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.7...@metamask/keyring-api@1.0.0-rc.1
|
426
|
+
[0.2.7]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.6...@metamask/keyring-api@0.2.7
|
427
|
+
[0.2.6]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.5...@metamask/keyring-api@0.2.6
|
428
|
+
[0.2.5]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.4...@metamask/keyring-api@0.2.5
|
429
|
+
[0.2.4]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.3...@metamask/keyring-api@0.2.4
|
430
|
+
[0.2.3]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.2...@metamask/keyring-api@0.2.3
|
431
|
+
[0.2.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.1...@metamask/keyring-api@0.2.2
|
432
|
+
[0.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.2.0...@metamask/keyring-api@0.2.1
|
433
|
+
[0.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.1.3...@metamask/keyring-api@0.2.0
|
434
|
+
[0.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.1.2...@metamask/keyring-api@0.1.3
|
435
|
+
[0.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.1.1...@metamask/keyring-api@0.1.2
|
436
|
+
[0.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@0.1.0...@metamask/keyring-api@0.1.1
|
437
|
+
[0.1.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/keyring-api@0.1.0
|
package/dist/internal/types.d.ts
CHANGED
@@ -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;
|
package/dist/internal/types.js
CHANGED
@@ -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.
|
3
|
+
"version": "8.1.1",
|
4
4
|
"description": "MetaMask Keyring API",
|
5
5
|
"keywords": [
|
6
6
|
"metamask",
|
@@ -21,20 +21,18 @@
|
|
21
21
|
"dist/"
|
22
22
|
],
|
23
23
|
"scripts": {
|
24
|
-
"build": "tsc --
|
24
|
+
"build": "tsc --build tsconfig.build.json",
|
25
25
|
"build:clean": "rimraf dist && yarn build",
|
26
26
|
"build:docs": "typedoc",
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"lint:eslint": "eslint . --cache --ext js,ts",
|
32
|
-
"lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog --fix",
|
33
|
-
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
|
34
|
-
"prepack": "./scripts/prepack.sh",
|
27
|
+
"build:force": "tsc --build tsconfig.build.json --force",
|
28
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-api",
|
29
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-api",
|
30
|
+
"publish:preview": "yarn npm publish --tag preview",
|
35
31
|
"test": "yarn test:source && yarn test:types",
|
32
|
+
"test:clean": "jest --clearCache",
|
36
33
|
"test:source": "jest && jest-it-up",
|
37
34
|
"test:types": "tsd",
|
35
|
+
"test:verbose": "jest --verbose",
|
38
36
|
"test:watch": "jest --watch"
|
39
37
|
},
|
40
38
|
"dependencies": {
|
@@ -43,34 +41,19 @@
|
|
43
41
|
"@metamask/utils": "^9.1.0",
|
44
42
|
"@types/uuid": "^9.0.8",
|
45
43
|
"bech32": "^2.0.0",
|
44
|
+
"deepmerge": "^4.2.2",
|
46
45
|
"uuid": "^9.0.1"
|
47
46
|
},
|
48
47
|
"devDependencies": {
|
49
48
|
"@lavamoat/allow-scripts": "^3.0.4",
|
50
49
|
"@lavamoat/preinstall-always-fail": "^2.0.0",
|
51
50
|
"@metamask/auto-changelog": "^3.4.4",
|
52
|
-
"@metamask/eslint-config": "^12.2.0",
|
53
|
-
"@metamask/eslint-config-jest": "^12.1.0",
|
54
|
-
"@metamask/eslint-config-nodejs": "^12.1.0",
|
55
|
-
"@metamask/eslint-config-typescript": "^12.1.0",
|
56
51
|
"@metamask/providers": "^17.1.1",
|
57
52
|
"@types/jest": "^29.5.12",
|
58
53
|
"@types/node": "^20.12.12",
|
59
|
-
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
60
|
-
"@typescript-eslint/parser": "^5.62.0",
|
61
54
|
"depcheck": "^1.4.7",
|
62
|
-
"eslint": "^8.57.0",
|
63
|
-
"eslint-config-prettier": "^8.10.0",
|
64
|
-
"eslint-plugin-import": "~2.26.0",
|
65
|
-
"eslint-plugin-jest": "^27.9.0",
|
66
|
-
"eslint-plugin-jsdoc": "^39.9.1",
|
67
|
-
"eslint-plugin-n": "^15.7.0",
|
68
|
-
"eslint-plugin-prettier": "^4.2.1",
|
69
|
-
"eslint-plugin-promise": "^6.1.1",
|
70
55
|
"jest": "^28.1.3",
|
71
56
|
"jest-it-up": "^3.1.0",
|
72
|
-
"prettier": "^2.8.8",
|
73
|
-
"prettier-plugin-packagejson": "^2.5.0",
|
74
57
|
"rimraf": "^5.0.7",
|
75
58
|
"ts-jest": "^28.0.8",
|
76
59
|
"ts-node": "^10.9.2",
|
@@ -81,7 +64,6 @@
|
|
81
64
|
"peerDependencies": {
|
82
65
|
"@metamask/providers": ">=15 <18"
|
83
66
|
},
|
84
|
-
"packageManager": "yarn@3.2.1",
|
85
67
|
"engines": {
|
86
68
|
"node": "^18.18 || >=20"
|
87
69
|
},
|