@metamask-previews/keyring-internal-api 0.0.1-b9b21be → 1.0.0-4685a87

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 (74) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/eth/EthKeyring.cjs +3 -0
  3. package/dist/eth/EthKeyring.cjs.map +1 -0
  4. package/dist/{internal/eth/EthKeyring.d.ts → eth/EthKeyring.d.cts} +4 -4
  5. package/dist/eth/EthKeyring.d.cts.map +1 -0
  6. package/dist/eth/EthKeyring.d.mts +33 -0
  7. package/dist/eth/EthKeyring.d.mts.map +1 -0
  8. package/dist/eth/EthKeyring.mjs +2 -0
  9. package/dist/eth/EthKeyring.mjs.map +1 -0
  10. package/dist/{internal/eth/EthKeyring.js → eth/index.cjs} +1 -1
  11. package/dist/eth/index.cjs.map +1 -0
  12. package/dist/eth/index.d.cts +2 -0
  13. package/dist/eth/index.d.cts.map +1 -0
  14. package/dist/eth/index.d.mts +2 -0
  15. package/dist/eth/index.d.mts.map +1 -0
  16. package/dist/eth/index.mjs +2 -0
  17. package/dist/eth/index.mjs.map +1 -0
  18. package/dist/{btc/index.js → index.cjs} +2 -2
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.cts +3 -0
  21. package/dist/index.d.cts.map +1 -0
  22. package/dist/index.d.mts +3 -0
  23. package/dist/index.d.mts.map +1 -0
  24. package/dist/index.mjs +2 -0
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/{internal/types.js → types.cjs} +23 -19
  27. package/dist/types.cjs.map +1 -0
  28. package/dist/{internal/types.d.ts → types.d.cts} +131 -69
  29. package/dist/types.d.cts.map +1 -0
  30. package/dist/types.d.mts +392 -0
  31. package/dist/types.d.mts.map +1 -0
  32. package/dist/types.mjs +50 -0
  33. package/dist/types.mjs.map +1 -0
  34. package/package.json +32 -21
  35. package/dist/btc/index.d.ts +0 -1
  36. package/dist/btc/index.js.map +0 -1
  37. package/dist/btc/types.d.ts +0 -33
  38. package/dist/btc/types.js +0 -40
  39. package/dist/btc/types.js.map +0 -1
  40. package/dist/eth/erc4337/index.d.ts +0 -1
  41. package/dist/eth/erc4337/index.js +0 -18
  42. package/dist/eth/erc4337/index.js.map +0 -1
  43. package/dist/eth/erc4337/types.d.ts +0 -97
  44. package/dist/eth/erc4337/types.js +0 -61
  45. package/dist/eth/erc4337/types.js.map +0 -1
  46. package/dist/eth/index.d.ts +0 -3
  47. package/dist/eth/index.js +0 -20
  48. package/dist/eth/index.js.map +0 -1
  49. package/dist/eth/types.d.ts +0 -80
  50. package/dist/eth/types.js +0 -73
  51. package/dist/eth/types.js.map +0 -1
  52. package/dist/eth/utils.d.ts +0 -8
  53. package/dist/eth/utils.js +0 -15
  54. package/dist/eth/utils.js.map +0 -1
  55. package/dist/index.d.ts +0 -3
  56. package/dist/index.js +0 -20
  57. package/dist/index.js.map +0 -1
  58. package/dist/internal/api.d.ts +0 -415
  59. package/dist/internal/api.js +0 -138
  60. package/dist/internal/api.js.map +0 -1
  61. package/dist/internal/eth/EthKeyring.js.map +0 -1
  62. package/dist/internal/eth/index.d.ts +0 -1
  63. package/dist/internal/eth/index.js +0 -18
  64. package/dist/internal/eth/index.js.map +0 -1
  65. package/dist/internal/events.d.ts +0 -169
  66. package/dist/internal/events.js +0 -83
  67. package/dist/internal/events.js.map +0 -1
  68. package/dist/internal/index.d.ts +0 -5
  69. package/dist/internal/index.js +0 -22
  70. package/dist/internal/index.js.map +0 -1
  71. package/dist/internal/rpc.d.ts +0 -25
  72. package/dist/internal/rpc.js +0 -33
  73. package/dist/internal/rpc.js.map +0 -1
  74. package/dist/internal/types.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,4 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- [Unreleased]: https://github.com/MetaMask/accounts/
10
+ ## [1.0.0]
11
+
12
+ ### Added
13
+
14
+ - Use `ts-bridge/cli@0.6.1` ([#118](https://github.com/MetaMask/accounts/pull/118))
15
+ - This new version fixes a bug with CJS re-exports.
16
+ - Initial release ([#24](https://github.com/MetaMask/accounts/pull/24))
17
+
18
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-internal-api@1.0.0...HEAD
19
+ [1.0.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/keyring-internal-api@1.0.0
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EthKeyring.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.cjs","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyringExecutionContext,\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '@metamask/keyring-api';\nimport type { Json, Keyring } from '@metamask/utils';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
@@ -1,7 +1,6 @@
1
- import type { KeyringExecutionContext } from '@metamask/keyring-api';
2
- import type { Json, Keyring } from '@metamask/utils';
3
- import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from '../../eth';
4
- export declare type EthKeyring<State extends Json> = Keyring<State> & {
1
+ import type { KeyringExecutionContext, EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "@metamask/keyring-api";
2
+ import type { Json, Keyring } from "@metamask/utils";
3
+ export type EthKeyring<State extends Json> = Keyring<State> & {
5
4
  /**
6
5
  * Convert a base transaction to a base UserOperation.
7
6
  *
@@ -31,3 +30,4 @@ export declare type EthKeyring<State extends Json> = Keyring<State> & {
31
30
  */
32
31
  signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
33
32
  };
33
+ //# sourceMappingURL=EthKeyring.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.d.cts","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { KeyringExecutionContext, EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "@metamask/keyring-api";
2
+ import type { Json, Keyring } from "@metamask/utils";
3
+ export type EthKeyring<State extends Json> = Keyring<State> & {
4
+ /**
5
+ * Convert a base transaction to a base UserOperation.
6
+ *
7
+ * @param address - Address of the sender.
8
+ * @param transactions - Base transactions to include in the UserOperation.
9
+ * @param context - Keyring execution context.
10
+ * @returns A pseudo-UserOperation that can be used to construct a real.
11
+ */
12
+ prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
13
+ /**
14
+ * Patches properties of a UserOperation. Currently, only the
15
+ * `paymasterAndData` can be patched.
16
+ *
17
+ * @param address - Address of the sender.
18
+ * @param userOp - UserOperation to patch.
19
+ * @param context - Keyring execution context.
20
+ * @returns A patch to apply to the UserOperation.
21
+ */
22
+ patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
23
+ /**
24
+ * Signs an UserOperation.
25
+ *
26
+ * @param address - Address of the sender.
27
+ * @param userOp - UserOperation to sign.
28
+ * @param context - Keyring execution context.
29
+ * @returns The signature of the UserOperation.
30
+ */
31
+ signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
32
+ };
33
+ //# sourceMappingURL=EthKeyring.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.d.mts","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EthKeyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.mjs","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyringExecutionContext,\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '@metamask/keyring-api';\nimport type { Json, Keyring } from '@metamask/utils';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EthKeyring.js.map
3
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
@@ -0,0 +1,2 @@
1
+ export type * from "./EthKeyring.cjs";
2
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
@@ -0,0 +1,2 @@
1
+ export type * from "./EthKeyring.mjs";
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- //# sourceMappingURL=index.js.map
17
+ __exportStar(require("./types.cjs"), exports);
18
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,8CAAwB","sourcesContent":["export type * from './eth';\nexport * from './types';\n"]}
@@ -0,0 +1,3 @@
1
+ export type * from "./eth/index.cjs";
2
+ export * from "./types.cjs";
3
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,4BAAwB"}
@@ -0,0 +1,3 @@
1
+ export type * from "./eth/index.mjs";
2
+ export * from "./types.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,4BAAwB"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./types.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,4BAAwB","sourcesContent":["export type * from './eth';\nexport * from './types';\n"]}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
3
+ /* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
4
+ // FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`
5
+ // and `InternalAccountTypes`.
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
7
+ exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalSolDataAccountStruct = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
4
8
  const keyring_api_1 = require("@metamask/keyring-api");
5
9
  const keyring_utils_1 = require("@metamask/keyring-utils");
6
10
  const superstruct_1 = require("@metamask/superstruct");
7
- const types_1 = require("../btc/types");
8
- const types_2 = require("../eth/types");
9
11
  exports.InternalAccountMetadataStruct = (0, keyring_utils_1.object)({
10
12
  metadata: (0, keyring_utils_1.object)({
11
13
  name: (0, superstruct_1.string)(),
@@ -22,28 +24,30 @@ exports.InternalAccountMetadataStruct = (0, keyring_utils_1.object)({
22
24
  }),
23
25
  }),
24
26
  });
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);
27
+ exports.InternalEthEoaAccountStruct = (0, keyring_utils_1.object)({
28
+ ...keyring_api_1.EthEoaAccountStruct.schema,
29
+ ...exports.InternalAccountMetadataStruct.schema,
30
+ });
31
+ exports.InternalEthErc4337AccountStruct = (0, keyring_utils_1.object)({
32
+ ...keyring_api_1.EthErc4337AccountStruct.schema,
33
+ ...exports.InternalAccountMetadataStruct.schema,
34
+ });
35
+ exports.InternalBtcP2wpkhAccountStruct = (0, keyring_utils_1.object)({
36
+ ...keyring_api_1.BtcP2wpkhAccountStruct.schema,
37
+ ...exports.InternalAccountMetadataStruct.schema,
38
+ });
39
+ exports.InternalSolDataAccountStruct = (0, keyring_utils_1.object)({
40
+ ...keyring_api_1.SolDataAccountStruct.schema,
41
+ ...exports.InternalAccountMetadataStruct.schema,
42
+ });
40
43
  exports.InternalAccountStructs = {
41
44
  [`${keyring_api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
42
45
  [`${keyring_api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
43
46
  [`${keyring_api_1.BtcAccountType.P2wpkh}`]: exports.InternalBtcP2wpkhAccountStruct,
47
+ [`${keyring_api_1.SolAccountType.DataAccount}`]: exports.InternalSolDataAccountStruct,
44
48
  };
45
49
  exports.InternalAccountStruct = (0, keyring_utils_1.object)({
46
50
  ...keyring_api_1.KeyringAccountStruct.schema,
47
51
  ...exports.InternalAccountMetadataStruct.schema,
48
52
  });
49
- //# sourceMappingURL=types.js.map
53
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4FAA4F;AAC5F,8BAA8B;;;AAE9B,uDAS+B;AAC/B,2DAAgE;AAEhE,uDAAgE;AAOnD,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;AAEU,QAAA,2BAA2B,GAAG,IAAA,sBAAM,EAAC;IAChD,GAAG,iCAAmB,CAAC,MAAM;IAC7B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,sBAAM,EAAC;IACpD,GAAG,qCAAuB,CAAC,MAAM;IACjC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,IAAA,sBAAM,EAAC;IACnD,GAAG,oCAAsB,CAAC,MAAM;IAChC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAcU,QAAA,sBAAsB,GAM/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;IAC5D,CAAC,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC,EAAE,oCAA4B;CAChE,CAAC;AAQW,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\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\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\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\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\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 type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\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"]}