@metamask-previews/keyring-internal-api 0.0.1-672cc7b

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +15 -0
  3. package/dist/btc/index.d.ts +1 -0
  4. package/dist/btc/index.js +18 -0
  5. package/dist/btc/index.js.map +1 -0
  6. package/dist/btc/types.d.ts +33 -0
  7. package/dist/btc/types.js +40 -0
  8. package/dist/btc/types.js.map +1 -0
  9. package/dist/eth/erc4337/index.d.ts +1 -0
  10. package/dist/eth/erc4337/index.js +18 -0
  11. package/dist/eth/erc4337/index.js.map +1 -0
  12. package/dist/eth/erc4337/types.d.ts +97 -0
  13. package/dist/eth/erc4337/types.js +61 -0
  14. package/dist/eth/erc4337/types.js.map +1 -0
  15. package/dist/eth/index.d.ts +3 -0
  16. package/dist/eth/index.js +20 -0
  17. package/dist/eth/index.js.map +1 -0
  18. package/dist/eth/types.d.ts +80 -0
  19. package/dist/eth/types.js +73 -0
  20. package/dist/eth/types.js.map +1 -0
  21. package/dist/eth/utils.d.ts +8 -0
  22. package/dist/eth/utils.js +15 -0
  23. package/dist/eth/utils.js.map +1 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.js +20 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/internal/api.d.ts +415 -0
  28. package/dist/internal/api.js +138 -0
  29. package/dist/internal/api.js.map +1 -0
  30. package/dist/internal/eth/EthKeyring.d.ts +33 -0
  31. package/dist/internal/eth/EthKeyring.js +3 -0
  32. package/dist/internal/eth/EthKeyring.js.map +1 -0
  33. package/dist/internal/eth/index.d.ts +1 -0
  34. package/dist/internal/eth/index.js +18 -0
  35. package/dist/internal/eth/index.js.map +1 -0
  36. package/dist/internal/events.d.ts +169 -0
  37. package/dist/internal/events.js +83 -0
  38. package/dist/internal/events.js.map +1 -0
  39. package/dist/internal/index.d.ts +5 -0
  40. package/dist/internal/index.js +22 -0
  41. package/dist/internal/index.js.map +1 -0
  42. package/dist/internal/rpc.d.ts +25 -0
  43. package/dist/internal/rpc.js +33 -0
  44. package/dist/internal/rpc.js.map +1 -0
  45. package/dist/internal/types.d.ts +330 -0
  46. package/dist/internal/types.js +49 -0
  47. package/dist/internal/types.js.map +1 -0
  48. package/package.json +78 -0
@@ -0,0 +1,330 @@
1
+ import { BtcAccountType, EthAccountType } from '@metamask/keyring-api';
2
+ import type { Infer, Struct } from '@metamask/superstruct';
3
+ export declare type InternalAccountType = EthAccountType | BtcAccountType;
4
+ export declare const InternalAccountMetadataStruct: Struct<{
5
+ metadata: {
6
+ name: string;
7
+ importTime: number;
8
+ keyring: {
9
+ type: string;
10
+ };
11
+ nameLastUpdatedAt?: number;
12
+ snap?: {
13
+ id: string;
14
+ name: string;
15
+ enabled: boolean;
16
+ };
17
+ lastSelected?: number;
18
+ };
19
+ }, {
20
+ metadata: Struct<{
21
+ name: string;
22
+ importTime: number;
23
+ keyring: {
24
+ type: string;
25
+ };
26
+ nameLastUpdatedAt?: number;
27
+ snap?: {
28
+ id: string;
29
+ name: string;
30
+ enabled: boolean;
31
+ };
32
+ lastSelected?: number;
33
+ }, {
34
+ name: Struct<string, null>;
35
+ nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
36
+ snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
37
+ id: string;
38
+ name: string;
39
+ enabled: boolean;
40
+ }, {
41
+ id: Struct<string, null>;
42
+ enabled: Struct<boolean, null>;
43
+ name: Struct<string, null>;
44
+ }>;
45
+ lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
46
+ importTime: Struct<number, null>;
47
+ keyring: Struct<{
48
+ type: string;
49
+ }, {
50
+ type: Struct<string, null>;
51
+ }>;
52
+ }>;
53
+ }>;
54
+ export declare const InternalEthEoaAccountStruct: Struct<{
55
+ id: string;
56
+ options: Record<string, import("@metamask/utils").Json>;
57
+ address: string;
58
+ type: "eip155:eoa";
59
+ methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
60
+ metadata: {
61
+ name: string;
62
+ importTime: number;
63
+ keyring: {
64
+ type: string;
65
+ };
66
+ nameLastUpdatedAt?: number;
67
+ snap?: {
68
+ id: string;
69
+ name: string;
70
+ enabled: boolean;
71
+ };
72
+ lastSelected?: number;
73
+ };
74
+ }, {
75
+ address: Struct<string, null>;
76
+ type: Struct<"eip155:eoa", "eip155:eoa">;
77
+ methods: Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
78
+ personal_sign: "personal_sign";
79
+ eth_sign: "eth_sign";
80
+ eth_signTransaction: "eth_signTransaction";
81
+ eth_signTypedData_v1: "eth_signTypedData_v1";
82
+ eth_signTypedData_v3: "eth_signTypedData_v3";
83
+ eth_signTypedData_v4: "eth_signTypedData_v4";
84
+ }>>;
85
+ id: Struct<string, null>;
86
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
87
+ } & {
88
+ metadata: Struct<{
89
+ name: string;
90
+ importTime: number;
91
+ keyring: {
92
+ type: string;
93
+ };
94
+ nameLastUpdatedAt?: number;
95
+ snap?: {
96
+ id: string;
97
+ name: string;
98
+ enabled: boolean;
99
+ };
100
+ lastSelected?: number;
101
+ }, {
102
+ name: Struct<string, null>;
103
+ nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
104
+ snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
105
+ id: string;
106
+ name: string;
107
+ enabled: boolean;
108
+ }, {
109
+ id: Struct<string, null>;
110
+ enabled: Struct<boolean, null>;
111
+ name: Struct<string, null>;
112
+ }>;
113
+ lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
114
+ importTime: Struct<number, null>;
115
+ keyring: Struct<{
116
+ type: string;
117
+ }, {
118
+ type: Struct<string, null>;
119
+ }>;
120
+ }>;
121
+ }>;
122
+ export declare const InternalEthErc4337AccountStruct: Struct<{
123
+ id: string;
124
+ options: Record<string, import("@metamask/utils").Json>;
125
+ address: string;
126
+ type: "eip155:erc4337";
127
+ methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
128
+ metadata: {
129
+ name: string;
130
+ importTime: number;
131
+ keyring: {
132
+ type: string;
133
+ };
134
+ nameLastUpdatedAt?: number;
135
+ snap?: {
136
+ id: string;
137
+ name: string;
138
+ enabled: boolean;
139
+ };
140
+ lastSelected?: number;
141
+ };
142
+ }, {
143
+ address: Struct<string, null>;
144
+ type: Struct<"eip155:erc4337", "eip155:erc4337">;
145
+ methods: Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
146
+ personal_sign: "personal_sign";
147
+ eth_sign: "eth_sign";
148
+ eth_signTypedData_v1: "eth_signTypedData_v1";
149
+ eth_signTypedData_v3: "eth_signTypedData_v3";
150
+ eth_signTypedData_v4: "eth_signTypedData_v4";
151
+ eth_prepareUserOperation: "eth_prepareUserOperation";
152
+ eth_patchUserOperation: "eth_patchUserOperation";
153
+ eth_signUserOperation: "eth_signUserOperation";
154
+ }>>;
155
+ id: Struct<string, null>;
156
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
157
+ } & {
158
+ metadata: Struct<{
159
+ name: string;
160
+ importTime: number;
161
+ keyring: {
162
+ type: string;
163
+ };
164
+ nameLastUpdatedAt?: number;
165
+ snap?: {
166
+ id: string;
167
+ name: string;
168
+ enabled: boolean;
169
+ };
170
+ lastSelected?: number;
171
+ }, {
172
+ name: Struct<string, null>;
173
+ nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
174
+ snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
175
+ id: string;
176
+ name: string;
177
+ enabled: boolean;
178
+ }, {
179
+ id: Struct<string, null>;
180
+ enabled: Struct<boolean, null>;
181
+ name: Struct<string, null>;
182
+ }>;
183
+ lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
184
+ importTime: Struct<number, null>;
185
+ keyring: Struct<{
186
+ type: string;
187
+ }, {
188
+ type: Struct<string, null>;
189
+ }>;
190
+ }>;
191
+ }>;
192
+ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
193
+ id: string;
194
+ options: Record<string, import("@metamask/utils").Json>;
195
+ address: string;
196
+ type: "bip122:p2wpkh";
197
+ methods: "btc_sendmany"[];
198
+ metadata: {
199
+ name: string;
200
+ importTime: number;
201
+ keyring: {
202
+ type: string;
203
+ };
204
+ nameLastUpdatedAt?: number;
205
+ snap?: {
206
+ id: string;
207
+ name: string;
208
+ enabled: boolean;
209
+ };
210
+ lastSelected?: number;
211
+ };
212
+ }, {
213
+ address: Struct<string, null>;
214
+ type: Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
215
+ methods: Struct<"btc_sendmany"[], Struct<"btc_sendmany", {
216
+ btc_sendmany: "btc_sendmany";
217
+ }>>;
218
+ id: Struct<string, null>;
219
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
220
+ } & {
221
+ metadata: Struct<{
222
+ name: string;
223
+ importTime: number;
224
+ keyring: {
225
+ type: string;
226
+ };
227
+ nameLastUpdatedAt?: number;
228
+ snap?: {
229
+ id: string;
230
+ name: string;
231
+ enabled: boolean;
232
+ };
233
+ lastSelected?: number;
234
+ }, {
235
+ name: Struct<string, null>;
236
+ nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
237
+ snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
238
+ id: string;
239
+ name: string;
240
+ enabled: boolean;
241
+ }, {
242
+ id: Struct<string, null>;
243
+ enabled: Struct<boolean, null>;
244
+ name: Struct<string, null>;
245
+ }>;
246
+ lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
247
+ importTime: Struct<number, null>;
248
+ keyring: Struct<{
249
+ type: string;
250
+ }, {
251
+ type: Struct<string, null>;
252
+ }>;
253
+ }>;
254
+ }>;
255
+ export declare type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
256
+ export declare type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
257
+ export declare type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
258
+ export declare const InternalAccountStructs: Record<string, Struct<InternalEthEoaAccount> | Struct<InternalEthErc4337Account> | Struct<InternalBtcP2wpkhAccount>>;
259
+ export declare type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2wpkhAccount;
260
+ export declare const InternalAccountStruct: Struct<{
261
+ id: string;
262
+ options: Record<string, import("@metamask/utils").Json>;
263
+ address: string;
264
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
265
+ methods: string[];
266
+ metadata: {
267
+ name: string;
268
+ importTime: number;
269
+ keyring: {
270
+ type: string;
271
+ };
272
+ nameLastUpdatedAt?: number;
273
+ snap?: {
274
+ id: string;
275
+ name: string;
276
+ enabled: boolean;
277
+ };
278
+ lastSelected?: number;
279
+ };
280
+ }, {
281
+ metadata: Struct<{
282
+ name: string;
283
+ importTime: number;
284
+ keyring: {
285
+ type: string;
286
+ };
287
+ nameLastUpdatedAt?: number;
288
+ snap?: {
289
+ id: string;
290
+ name: string;
291
+ enabled: boolean;
292
+ };
293
+ lastSelected?: number;
294
+ }, {
295
+ name: Struct<string, null>;
296
+ nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
297
+ snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
298
+ id: string;
299
+ name: string;
300
+ enabled: boolean;
301
+ }, {
302
+ id: Struct<string, null>;
303
+ enabled: Struct<boolean, null>;
304
+ name: Struct<string, null>;
305
+ }>;
306
+ lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
307
+ importTime: Struct<number, null>;
308
+ keyring: Struct<{
309
+ type: string;
310
+ }, {
311
+ type: Struct<string, null>;
312
+ }>;
313
+ }>;
314
+ id: Struct<string, null>;
315
+ type: Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
316
+ "eip155:eoa": "eip155:eoa";
317
+ "eip155:erc4337": "eip155:erc4337";
318
+ "bip122:p2wpkh": "bip122:p2wpkh";
319
+ }>;
320
+ address: Struct<string, null>;
321
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
322
+ methods: Struct<string[], Struct<string, null>>;
323
+ }>;
324
+ /**
325
+ * Internal account representation.
326
+ *
327
+ * This type is used internally by MetaMask to add additional metadata to the
328
+ * account object. It's should not be used by external applications.
329
+ */
330
+ export declare type InternalAccount = Infer<typeof InternalAccountStruct>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
4
+ const keyring_api_1 = require("@metamask/keyring-api");
5
+ const keyring_utils_1 = require("@metamask/keyring-utils");
6
+ const superstruct_1 = require("@metamask/superstruct");
7
+ const types_1 = require("../btc/types");
8
+ const types_2 = require("../eth/types");
9
+ exports.InternalAccountMetadataStruct = (0, keyring_utils_1.object)({
10
+ metadata: (0, keyring_utils_1.object)({
11
+ name: (0, superstruct_1.string)(),
12
+ nameLastUpdatedAt: (0, keyring_utils_1.exactOptional)((0, superstruct_1.number)()),
13
+ snap: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
14
+ id: (0, superstruct_1.string)(),
15
+ enabled: (0, superstruct_1.boolean)(),
16
+ name: (0, superstruct_1.string)(),
17
+ })),
18
+ lastSelected: (0, keyring_utils_1.exactOptional)((0, superstruct_1.number)()),
19
+ importTime: (0, superstruct_1.number)(),
20
+ keyring: (0, keyring_utils_1.object)({
21
+ type: (0, superstruct_1.string)(),
22
+ }),
23
+ }),
24
+ });
25
+ /**
26
+ * Creates an `InternalAccount` from an existing account `superstruct` object.
27
+ *
28
+ * @param accountStruct - An account `superstruct` object.
29
+ * @returns The `InternalAccount` associated to `accountStruct`.
30
+ */
31
+ function asInternalAccountStruct(accountStruct) {
32
+ return (0, keyring_utils_1.object)({
33
+ ...accountStruct.schema,
34
+ ...exports.InternalAccountMetadataStruct.schema,
35
+ });
36
+ }
37
+ exports.InternalEthEoaAccountStruct = asInternalAccountStruct(types_2.EthEoaAccountStruct);
38
+ exports.InternalEthErc4337AccountStruct = asInternalAccountStruct(types_2.EthErc4337AccountStruct);
39
+ exports.InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(types_1.BtcP2wpkhAccountStruct);
40
+ exports.InternalAccountStructs = {
41
+ [`${keyring_api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
42
+ [`${keyring_api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
43
+ [`${keyring_api_1.BtcAccountType.P2wpkh}`]: exports.InternalBtcP2wpkhAccountStruct,
44
+ };
45
+ exports.InternalAccountStruct = (0, keyring_utils_1.object)({
46
+ ...keyring_api_1.KeyringAccountStruct.schema,
47
+ ...exports.InternalAccountMetadataStruct.schema,
48
+ });
49
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AAAA,uDAI+B;AAC/B,2DAAgE;AAEhE,uDAAgE;AAEhE,wCAAsD;AACtD,wCAA4E;AAI/D,QAAA,6BAA6B,GAAG,IAAA,sBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,sBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,6BAAa,EACjB,IAAA,sBAAM,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,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,sBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,aAA6C;IAE7C,OAAO,IAAA,sBAAM,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,4BAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,4BAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,4BAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;CAC7D,CAAC;AAOW,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\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 ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@metamask-previews/keyring-internal-api",
3
+ "version": "0.0.1-672cc7b",
4
+ "description": "MetaMask Keyring Internal API",
5
+ "keywords": [
6
+ "metamask",
7
+ "keyring"
8
+ ],
9
+ "homepage": "https://github.com/MetaMask/accounts/tree/main/packages/keyring-internal-api#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/MetaMask/accounts/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/MetaMask/accounts.git"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist/"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc --build tsconfig.build.json",
24
+ "build:clean": "rimraf dist && yarn build",
25
+ "build:docs": "typedoc",
26
+ "build:force": "tsc --build tsconfig.build.json --force",
27
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-internal-api",
28
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-internal-api",
29
+ "publish:preview": "yarn npm publish --tag preview",
30
+ "test": "yarn test:source && yarn test:types",
31
+ "test:clean": "jest --clearCache",
32
+ "test:source": "jest && jest-it-up",
33
+ "test:types": "tsd",
34
+ "test:verbose": "jest --verbose",
35
+ "test:watch": "jest --watch"
36
+ },
37
+ "dependencies": {
38
+ "@metamask/keyring-api": "^8.1.0",
39
+ "@metamask/keyring-utils": "0.0.1",
40
+ "@metamask/snaps-sdk": "^6.1.0",
41
+ "@metamask/superstruct": "^3.1.0",
42
+ "@metamask/utils": "^9.1.0",
43
+ "bech32": "^2.0.0",
44
+ "deepmerge": "^4.2.2"
45
+ },
46
+ "devDependencies": {
47
+ "@lavamoat/allow-scripts": "^3.0.4",
48
+ "@lavamoat/preinstall-always-fail": "^2.0.0",
49
+ "@metamask/auto-changelog": "^3.4.4",
50
+ "@metamask/providers": "^17.1.1",
51
+ "@types/jest": "^29.5.12",
52
+ "@types/node": "^20.12.12",
53
+ "depcheck": "^1.4.7",
54
+ "jest": "^28.1.3",
55
+ "jest-it-up": "^3.1.0",
56
+ "rimraf": "^5.0.7",
57
+ "ts-jest": "^28.0.8",
58
+ "ts-node": "^10.9.2",
59
+ "tsd": "^0.31.0",
60
+ "typedoc": "^0.25.13",
61
+ "typescript": "~4.8.4"
62
+ },
63
+ "engines": {
64
+ "node": "^18.18 || >=20"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public",
68
+ "registry": "https://registry.npmjs.org/"
69
+ },
70
+ "lavamoat": {
71
+ "allowScripts": {
72
+ "@lavamoat/preinstall-always-fail": false
73
+ }
74
+ },
75
+ "tsd": {
76
+ "directory": "src"
77
+ }
78
+ }