@metamask/keyring-api 24.1.0 → 24.2.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/api/account-options.cjs +34 -3
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts +42 -3
  5. package/dist/api/account-options.d.cts.map +1 -1
  6. package/dist/api/account-options.d.mts +42 -3
  7. package/dist/api/account-options.d.mts.map +1 -1
  8. package/dist/api/account-options.mjs +33 -2
  9. package/dist/api/account-options.mjs.map +1 -1
  10. package/dist/api/account.d.cts +4 -0
  11. package/dist/api/account.d.cts.map +1 -1
  12. package/dist/api/account.d.mts +4 -0
  13. package/dist/api/account.d.mts.map +1 -1
  14. package/dist/btc/types.d.cts +16 -0
  15. package/dist/btc/types.d.cts.map +1 -1
  16. package/dist/btc/types.d.mts +16 -0
  17. package/dist/btc/types.d.mts.map +1 -1
  18. package/dist/eth/types.d.cts +8 -0
  19. package/dist/eth/types.d.cts.map +1 -1
  20. package/dist/eth/types.d.mts +8 -0
  21. package/dist/eth/types.d.mts.map +1 -1
  22. package/dist/events.d.cts +16 -0
  23. package/dist/events.d.cts.map +1 -1
  24. package/dist/events.d.mts +16 -0
  25. package/dist/events.d.mts.map +1 -1
  26. package/dist/rpc.d.cts +43 -0
  27. package/dist/rpc.d.cts.map +1 -1
  28. package/dist/rpc.d.mts +43 -0
  29. package/dist/rpc.d.mts.map +1 -1
  30. package/dist/sol/types.d.cts +4 -0
  31. package/dist/sol/types.d.cts.map +1 -1
  32. package/dist/sol/types.d.mts +4 -0
  33. package/dist/sol/types.d.mts.map +1 -1
  34. package/dist/trx/types.d.cts +4 -0
  35. package/dist/trx/types.d.cts.map +1 -1
  36. package/dist/trx/types.d.mts +4 -0
  37. package/dist/trx/types.d.mts.map +1 -1
  38. package/dist/v2/api/create-account/address-import.cjs +39 -0
  39. package/dist/v2/api/create-account/address-import.cjs.map +1 -0
  40. package/dist/v2/api/create-account/address-import.d.cts +54 -0
  41. package/dist/v2/api/create-account/address-import.d.cts.map +1 -0
  42. package/dist/v2/api/create-account/address-import.d.mts +54 -0
  43. package/dist/v2/api/create-account/address-import.d.mts.map +1 -0
  44. package/dist/v2/api/create-account/address-import.mjs +36 -0
  45. package/dist/v2/api/create-account/address-import.mjs.map +1 -0
  46. package/dist/v2/api/create-account/index.cjs +8 -0
  47. package/dist/v2/api/create-account/index.cjs.map +1 -1
  48. package/dist/v2/api/create-account/index.d.cts +10 -0
  49. package/dist/v2/api/create-account/index.d.cts.map +1 -1
  50. package/dist/v2/api/create-account/index.d.mts +10 -0
  51. package/dist/v2/api/create-account/index.d.mts.map +1 -1
  52. package/dist/v2/api/create-account/index.mjs +8 -0
  53. package/dist/v2/api/create-account/index.mjs.map +1 -1
  54. package/dist/v2/api/keyring-capabilities.cjs +10 -0
  55. package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
  56. package/dist/v2/api/keyring-capabilities.d.cts +15 -0
  57. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
  58. package/dist/v2/api/keyring-capabilities.d.mts +15 -0
  59. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
  60. package/dist/v2/api/keyring-capabilities.mjs +10 -0
  61. package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
  62. package/dist/v2/api/keyring-rpc.d.cts +26 -0
  63. package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
  64. package/dist/v2/api/keyring-rpc.d.mts +26 -0
  65. package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
  66. package/dist/v2/api/keyring-type.cjs +10 -0
  67. package/dist/v2/api/keyring-type.cjs.map +1 -1
  68. package/dist/v2/api/keyring-type.d.cts +11 -1
  69. package/dist/v2/api/keyring-type.d.cts.map +1 -1
  70. package/dist/v2/api/keyring-type.d.mts +11 -1
  71. package/dist/v2/api/keyring-type.d.mts.map +1 -1
  72. package/dist/v2/api/keyring-type.mjs +10 -0
  73. package/dist/v2/api/keyring-type.mjs.map +1 -1
  74. package/dist/xlm/types.d.cts +4 -0
  75. package/dist/xlm/types.d.cts.map +1 -1
  76. package/dist/xlm/types.d.mts +4 -0
  77. package/dist/xlm/types.d.mts.map +1 -1
  78. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [24.2.0]
11
+
12
+ ### Added
13
+
14
+ - Add `AccountCreationType.AddressImport` (`address:import`) create account option for importing watch-only accounts by address ([#643](https://github.com/MetaMask/accounts/pull/643))
15
+ - Includes an optional `accountType` field, matching `private-key:import`, since the account type cannot always be detected from the address alone.
16
+ - Includes an optional `scopes` field, since the scope cannot always be detected from the address alone (e.g. an EVM address is valid on every EVM chain). When omitted, the keyring decides the scopes.
17
+ - Add `address` capability to `KeyringCapabilities`, declaring whether a keyring supports importing watch-only accounts by address ([#643](https://github.com/MetaMask/accounts/pull/643))
18
+ - Add `KeyringType.WatchOnly` keyring type ([#644](https://github.com/MetaMask/accounts/pull/644))
19
+ - Add `KeyringType.Mpc` keyring type ([#641](https://github.com/MetaMask/accounts/pull/641))
20
+ - Add `KeyringAccountEntropyTypeOption.Mpc` (`'mpc'`) entropy option, and the related `KeyringAccountEntropyMpcOptions` type, for accounts derived from an MPC key share ([#653](https://github.com/MetaMask/accounts/pull/653))
21
+
10
22
  ## [24.1.0]
11
23
 
12
24
  ### Added
@@ -828,7 +840,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
828
840
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
829
841
  - Helper functions to create keyring handler in the snap.
830
842
 
831
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.1.0...HEAD
843
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.2.0...HEAD
844
+ [24.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.1.0...@metamask/keyring-api@24.2.0
832
845
  [24.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.0.0...@metamask/keyring-api@24.1.0
833
846
  [24.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.7.0...@metamask/keyring-api@24.0.0
834
847
  [23.7.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.6.0...@metamask/keyring-api@23.7.0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = exports.KeyringAccountEntropyCustomOptionsStruct = exports.KeyringAccountEntropyPrivateKeyOptionsStruct = exports.KeyringAccountEntropyMnemonicOptionsStruct = exports.KeyringAccountEntropyTypeOption = void 0;
3
+ exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = exports.KeyringAccountEntropyMpcOptionsStruct = exports.KeyringAccountEntropyCustomOptionsStruct = exports.KeyringAccountEntropyPrivateKeyOptionsStruct = exports.KeyringAccountEntropyMnemonicOptionsStruct = exports.KeyringAccountEntropyTypeOption = void 0;
4
4
  const keyring_utils_1 = require("@metamask/keyring-utils");
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
6
  const utils_1 = require("@metamask/utils");
@@ -22,6 +22,12 @@ var KeyringAccountEntropyTypeOption;
22
22
  * This is an opaque type where the entropy source is managed internally by the keyring.
23
23
  */
24
24
  KeyringAccountEntropyTypeOption["Custom"] = "custom";
25
+ /**
26
+ * Indicates that the account was created from an MPC (multi-party
27
+ * computation) key share. This is an opaque type where the entropy source
28
+ * is managed internally by the keyring.
29
+ */
30
+ KeyringAccountEntropyTypeOption["Mpc"] = "mpc";
25
31
  })(KeyringAccountEntropyTypeOption || (exports.KeyringAccountEntropyTypeOption = KeyringAccountEntropyTypeOption = {}));
26
32
  /**
27
33
  * Keyring account options struct for mnemonics (BIP-44).
@@ -69,6 +75,19 @@ exports.KeyringAccountEntropyCustomOptionsStruct = (0, superstruct_1.object)({
69
75
  */
70
76
  type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.Custom}`),
71
77
  });
78
+ /**
79
+ * Keyring account options struct for MPC (multi-party computation) entropy.
80
+ *
81
+ * This is an opaque type where the entropy source is managed internally by the
82
+ * keyring. The account is derived from an MPC key share, and no additional
83
+ * entropy metadata is exposed.
84
+ */
85
+ exports.KeyringAccountEntropyMpcOptionsStruct = (0, superstruct_1.object)({
86
+ /**
87
+ * Indicates that the account was created from an MPC key share.
88
+ */
89
+ type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.Mpc}`),
90
+ });
72
91
  /**
73
92
  * Keyring account entropy options struct.
74
93
  */
@@ -81,6 +100,8 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
81
100
  return exports.KeyringAccountEntropyPrivateKeyOptionsStruct;
82
101
  case KeyringAccountEntropyTypeOption.Custom:
83
102
  return exports.KeyringAccountEntropyCustomOptionsStruct;
103
+ case KeyringAccountEntropyTypeOption.Mpc:
104
+ return exports.KeyringAccountEntropyMpcOptionsStruct;
84
105
  case KeyringAccountEntropyTypeOption.Mnemonic:
85
106
  return exports.KeyringAccountEntropyMnemonicOptionsStruct;
86
107
  default:
@@ -91,8 +112,9 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
91
112
  * Keyring options struct. This represents various options for a Keyring account object.
92
113
  *
93
114
  * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
94
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
95
- * {@link KeyringAccountEntropyCustomOptionsStruct}.
115
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
116
+ * {@link KeyringAccountEntropyCustomOptionsStruct}, and
117
+ * {@link KeyringAccountEntropyMpcOptionsStruct}.
96
118
  *
97
119
  * @example
98
120
  * ```ts
@@ -128,6 +150,15 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
128
150
  * @example
129
151
  * ```ts
130
152
  * {
153
+ * entropy: {
154
+ * type: 'mpc',
155
+ * },
156
+ * }
157
+ * ```
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * {
131
162
  * some: {
132
163
  * untyped: 'options',
133
164
  * something: true,
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.cjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,uDAU+B;AAC/B,2CAA4D;AAE5D;;GAEG;AACH,IAAY,+BAgBX;AAhBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;;OAGG;IACH,oDAAiB,CAAA;AACnB,CAAC,EAhBW,+BAA+B,+CAA/B,+BAA+B,QAgB1C;AAED;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,QAAQ,EAAE,CAAC;IAE5D;;OAEG;IACH,EAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,4CAA4C;IAE1D;;OAEG;IACH,cAAc,EAAE,IAAA,oBAAM,GAAE;IAExB;;;;;OAKG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,4CAA4C,GAAG,IAAA,oBAAM,EAAC;IACjE;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,UAAU,EAAE,CAAC;CAC/D,CAAC,CAAC;AASH;;;;;;GAMG;AACU,QAAA,wCAAwC,GAAG,IAAA,oBAAM,EAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,kCAAkC,GAAG,IAAA,8BAAc,EAC9D,CAAC,KAAU,EAAE,EAAE;IACb,IAAI,CAAC,IAAA,qBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,kDAA0C,CAAC;IACpD,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,+BAA+B,CAAC,UAAU;YAC7C,OAAO,oDAA4C,CAAC;QACtD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,gDAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,kDAA0C,CAAC;QACpD;YACE,OAAO,kDAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACU,QAAA,2BAA2B,GAAG,IAAA,0BAAY,EAAC;IACtD,2CAA2C;IAC3C,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAE5B,kEAAkE;IAClE,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,uBAAuB;IACvB,uEAAuE;IACvE,oCAAoC;IACpC,IAAA,kBAAI,EAAC;QACH;;WAEG;QACH,OAAO,EAAE,IAAA,2BAAa,EAAC,0CAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and\n * {@link KeyringAccountEntropyCustomOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
1
+ {"version":3,"file":"account-options.cjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,uDAU+B;AAC/B,2CAA4D;AAE5D;;GAEG;AACH,IAAY,+BAuBX;AAvBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;;OAGG;IACH,oDAAiB,CAAA;IAEjB;;;;OAIG;IACH,8CAAW,CAAA;AACb,CAAC,EAvBW,+BAA+B,+CAA/B,+BAA+B,QAuB1C;AAED;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,QAAQ,EAAE,CAAC;IAE5D;;OAEG;IACH,EAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,4CAA4C;IAE1D;;OAEG;IACH,cAAc,EAAE,IAAA,oBAAM,GAAE;IAExB;;;;;OAKG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,4CAA4C,GAAG,IAAA,oBAAM,EAAC;IACjE;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,UAAU,EAAE,CAAC;CAC/D,CAAC,CAAC;AASH;;;;;;GAMG;AACU,QAAA,wCAAwC,GAAG,IAAA,oBAAM,EAAC;IAC7D;;OAEG;IACH,IAAI,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O,GAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n\n /**\n * Indicates that the account was created from an MPC (multi-party\n * computation) key share. This is an opaque type where the entropy source\n * is managed internally by the keyring.\n */\n Mpc = 'mpc',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account options struct for MPC (multi-party computation) entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the\n * keyring. The account is derived from an MPC key share, and no additional\n * entropy metadata is exposed.\n */\nexport const KeyringAccountEntropyMpcOptionsStruct = object({\n /**\n * Indicates that the account was created from an MPC key share.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),\n});\n\n/**\n * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.\n */\nexport type KeyringAccountEntropyMpcOptions = Infer<\n typeof KeyringAccountEntropyMpcOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mpc:\n return KeyringAccountEntropyMpcOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},\n * {@link KeyringAccountEntropyCustomOptionsStruct}, and\n * {@link KeyringAccountEntropyMpcOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mpc',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
@@ -15,7 +15,13 @@ export declare enum KeyringAccountEntropyTypeOption {
15
15
  * Indicates that the account was created with custom, keyring-specific entropy.
16
16
  * This is an opaque type where the entropy source is managed internally by the keyring.
17
17
  */
18
- Custom = "custom"
18
+ Custom = "custom",
19
+ /**
20
+ * Indicates that the account was created from an MPC (multi-party
21
+ * computation) key share. This is an opaque type where the entropy source
22
+ * is managed internally by the keyring.
23
+ */
24
+ Mpc = "mpc"
19
25
  }
20
26
  /**
21
27
  * Keyring account options struct for mnemonics (BIP-44).
@@ -84,6 +90,25 @@ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask
84
90
  * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
85
91
  */
86
92
  export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
93
+ /**
94
+ * Keyring account options struct for MPC (multi-party computation) entropy.
95
+ *
96
+ * This is an opaque type where the entropy source is managed internally by the
97
+ * keyring. The account is derived from an MPC key share, and no additional
98
+ * entropy metadata is exposed.
99
+ */
100
+ export declare const KeyringAccountEntropyMpcOptionsStruct: import("@metamask/superstruct").Struct<{
101
+ type: "mpc";
102
+ }, {
103
+ /**
104
+ * Indicates that the account was created from an MPC key share.
105
+ */
106
+ type: import("@metamask/superstruct").Struct<"mpc", "mpc">;
107
+ }>;
108
+ /**
109
+ * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.
110
+ */
111
+ export type KeyringAccountEntropyMpcOptions = Infer<typeof KeyringAccountEntropyMpcOptionsStruct>;
87
112
  /**
88
113
  * Keyring account entropy options struct.
89
114
  */
@@ -96,6 +121,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
96
121
  type: "private-key";
97
122
  } | {
98
123
  type: "custom";
124
+ } | {
125
+ type: "mpc";
99
126
  }, null>;
100
127
  /**
101
128
  * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
@@ -105,8 +132,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
105
132
  * Keyring options struct. This represents various options for a Keyring account object.
106
133
  *
107
134
  * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
108
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
109
- * {@link KeyringAccountEntropyCustomOptionsStruct}.
135
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
136
+ * {@link KeyringAccountEntropyCustomOptionsStruct}, and
137
+ * {@link KeyringAccountEntropyMpcOptionsStruct}.
110
138
  *
111
139
  * @example
112
140
  * ```ts
@@ -142,6 +170,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
142
170
  * @example
143
171
  * ```ts
144
172
  * {
173
+ * entropy: {
174
+ * type: 'mpc',
175
+ * },
176
+ * }
177
+ * ```
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * {
145
182
  * some: {
146
183
  * untyped: 'options',
147
184
  * something: true,
@@ -159,6 +196,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
159
196
  type: "private-key";
160
197
  } | {
161
198
  type: "custom";
199
+ } | {
200
+ type: "mpc";
162
201
  };
163
202
  exportable?: boolean;
164
203
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.d.cts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;IACrD;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM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KAAK,CACxD,OAAO,4CAA4C,CACpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC;;;IACnD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC;;;IAChD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;QAmB9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;QAsBtC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -15,7 +15,13 @@ export declare enum KeyringAccountEntropyTypeOption {
15
15
  * Indicates that the account was created with custom, keyring-specific entropy.
16
16
  * This is an opaque type where the entropy source is managed internally by the keyring.
17
17
  */
18
- Custom = "custom"
18
+ Custom = "custom",
19
+ /**
20
+ * Indicates that the account was created from an MPC (multi-party
21
+ * computation) key share. This is an opaque type where the entropy source
22
+ * is managed internally by the keyring.
23
+ */
24
+ Mpc = "mpc"
19
25
  }
20
26
  /**
21
27
  * Keyring account options struct for mnemonics (BIP-44).
@@ -84,6 +90,25 @@ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask
84
90
  * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
85
91
  */
86
92
  export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
93
+ /**
94
+ * Keyring account options struct for MPC (multi-party computation) entropy.
95
+ *
96
+ * This is an opaque type where the entropy source is managed internally by the
97
+ * keyring. The account is derived from an MPC key share, and no additional
98
+ * entropy metadata is exposed.
99
+ */
100
+ export declare const KeyringAccountEntropyMpcOptionsStruct: import("@metamask/superstruct").Struct<{
101
+ type: "mpc";
102
+ }, {
103
+ /**
104
+ * Indicates that the account was created from an MPC key share.
105
+ */
106
+ type: import("@metamask/superstruct").Struct<"mpc", "mpc">;
107
+ }>;
108
+ /**
109
+ * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.
110
+ */
111
+ export type KeyringAccountEntropyMpcOptions = Infer<typeof KeyringAccountEntropyMpcOptionsStruct>;
87
112
  /**
88
113
  * Keyring account entropy options struct.
89
114
  */
@@ -96,6 +121,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
96
121
  type: "private-key";
97
122
  } | {
98
123
  type: "custom";
124
+ } | {
125
+ type: "mpc";
99
126
  }, null>;
100
127
  /**
101
128
  * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
@@ -105,8 +132,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
105
132
  * Keyring options struct. This represents various options for a Keyring account object.
106
133
  *
107
134
  * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
108
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
109
- * {@link KeyringAccountEntropyCustomOptionsStruct}.
135
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
136
+ * {@link KeyringAccountEntropyCustomOptionsStruct}, and
137
+ * {@link KeyringAccountEntropyMpcOptionsStruct}.
110
138
  *
111
139
  * @example
112
140
  * ```ts
@@ -142,6 +170,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
142
170
  * @example
143
171
  * ```ts
144
172
  * {
173
+ * entropy: {
174
+ * type: 'mpc',
175
+ * },
176
+ * }
177
+ * ```
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * {
145
182
  * some: {
146
183
  * untyped: 'options',
147
184
  * something: true,
@@ -159,6 +196,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
159
196
  type: "private-key";
160
197
  } | {
161
198
  type: "custom";
199
+ } | {
200
+ type: "mpc";
162
201
  };
163
202
  exportable?: boolean;
164
203
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.d.mts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;IACrD;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;IACvD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,CACxD,OAAO,4CAA4C,CACpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC;;;IACnD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;QAiB9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;QAsBtC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"account-options.d.mts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;IAEjB;;;;OAIG;IACH,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;IACrD;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;IACvD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,CACxD,OAAO,4CAA4C,CACpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC;;;IACnD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC;;;IAChD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;QAmB9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;QAsBtC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -19,6 +19,12 @@ export var KeyringAccountEntropyTypeOption;
19
19
  * This is an opaque type where the entropy source is managed internally by the keyring.
20
20
  */
21
21
  KeyringAccountEntropyTypeOption["Custom"] = "custom";
22
+ /**
23
+ * Indicates that the account was created from an MPC (multi-party
24
+ * computation) key share. This is an opaque type where the entropy source
25
+ * is managed internally by the keyring.
26
+ */
27
+ KeyringAccountEntropyTypeOption["Mpc"] = "mpc";
22
28
  })(KeyringAccountEntropyTypeOption || (KeyringAccountEntropyTypeOption = {}));
23
29
  /**
24
30
  * Keyring account options struct for mnemonics (BIP-44).
@@ -66,6 +72,19 @@ export const KeyringAccountEntropyCustomOptionsStruct = object({
66
72
  */
67
73
  type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),
68
74
  });
75
+ /**
76
+ * Keyring account options struct for MPC (multi-party computation) entropy.
77
+ *
78
+ * This is an opaque type where the entropy source is managed internally by the
79
+ * keyring. The account is derived from an MPC key share, and no additional
80
+ * entropy metadata is exposed.
81
+ */
82
+ export const KeyringAccountEntropyMpcOptionsStruct = object({
83
+ /**
84
+ * Indicates that the account was created from an MPC key share.
85
+ */
86
+ type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),
87
+ });
69
88
  /**
70
89
  * Keyring account entropy options struct.
71
90
  */
@@ -78,6 +97,8 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
78
97
  return KeyringAccountEntropyPrivateKeyOptionsStruct;
79
98
  case KeyringAccountEntropyTypeOption.Custom:
80
99
  return KeyringAccountEntropyCustomOptionsStruct;
100
+ case KeyringAccountEntropyTypeOption.Mpc:
101
+ return KeyringAccountEntropyMpcOptionsStruct;
81
102
  case KeyringAccountEntropyTypeOption.Mnemonic:
82
103
  return KeyringAccountEntropyMnemonicOptionsStruct;
83
104
  default:
@@ -88,8 +109,9 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
88
109
  * Keyring options struct. This represents various options for a Keyring account object.
89
110
  *
90
111
  * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
91
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
92
- * {@link KeyringAccountEntropyCustomOptionsStruct}.
112
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
113
+ * {@link KeyringAccountEntropyCustomOptionsStruct}, and
114
+ * {@link KeyringAccountEntropyMpcOptionsStruct}.
93
115
  *
94
116
  * @example
95
117
  * ```ts
@@ -125,6 +147,15 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
125
147
  * @example
126
148
  * ```ts
127
149
  * {
150
+ * entropy: {
151
+ * type: 'mpc',
152
+ * },
153
+ * }
154
+ * ```
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * {
128
159
  * some: {
129
160
  * untyped: 'options',
130
161
  * something: true,
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.mjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAgC;AAEzD,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,+BAgBX;AAhBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;;OAGG;IACH,oDAAiB,CAAA;AACnB,CAAC,EAhBW,+BAA+B,KAA/B,+BAA+B,Q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D,2CAA2C;IAC3C,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAE5B,kEAAkE;IAClE,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,uBAAuB;IACvB,uEAAuE;IACvE,oCAAoC;IACpC,IAAI,CAAC;QACH;;WAEG;QACH,OAAO,EAAE,aAAa,CAAC,kCAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and\n * {@link KeyringAccountEntropyCustomOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
1
+ {"version":3,"file":"account-options.mjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAgC;AAEzD,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,+BAuBX;AAvBD,WAAY,+BAA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B,CAAC,UAAU;YAC7C,OAAO,4CAA4C,CAAC;QACtD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,wCAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,GAAG;YACtC,OAAO,qCAAqC,CAAC;QAC/C,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,0CAA0C,CAAC;QACpD;YACE,OAAO,0CAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC;IACtD,2CAA2C;IAC3C,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAE5B,kEAAkE;IAClE,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,uBAAuB;IACvB,uEAAuE;IACvE,oCAAoC;IACpC,IAAI,CAAC;QACH;;WAEG;QACH,OAAO,EAAE,aAAa,CAAC,kCAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n\n /**\n * Indicates that the account was created from an MPC (multi-party\n * computation) key share. This is an opaque type where the entropy source\n * is managed internally by the keyring.\n */\n Mpc = 'mpc',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account options struct for MPC (multi-party computation) entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the\n * keyring. The account is derived from an MPC key share, and no additional\n * entropy metadata is exposed.\n */\nexport const KeyringAccountEntropyMpcOptionsStruct = object({\n /**\n * Indicates that the account was created from an MPC key share.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),\n});\n\n/**\n * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.\n */\nexport type KeyringAccountEntropyMpcOptions = Infer<\n typeof KeyringAccountEntropyMpcOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mpc:\n return KeyringAccountEntropyMpcOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},\n * {@link KeyringAccountEntropyCustomOptionsStruct}, and\n * {@link KeyringAccountEntropyMpcOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mpc',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
@@ -84,6 +84,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
84
84
  type: "private-key";
85
85
  } | {
86
86
  type: "custom";
87
+ } | {
88
+ type: "mpc";
87
89
  };
88
90
  exportable?: boolean;
89
91
  };
@@ -131,6 +133,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
131
133
  type: "private-key";
132
134
  } | {
133
135
  type: "custom";
136
+ } | {
137
+ type: "mpc";
134
138
  };
135
139
  exportable?: boolean;
136
140
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;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Ae;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;IAcH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -84,6 +84,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
84
84
  type: "private-key";
85
85
  } | {
86
86
  type: "custom";
87
+ } | {
88
+ type: "mpc";
87
89
  };
88
90
  exportable?: boolean;
89
91
  };
@@ -131,6 +133,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
131
133
  type: "private-key";
132
134
  } | {
133
135
  type: "custom";
136
+ } | {
137
+ type: "mpc";
134
138
  };
135
139
  exportable?: boolean;
136
140
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;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OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;IAcH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -30,6 +30,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
30
30
  type: "private-key";
31
31
  } | {
32
32
  type: "custom";
33
+ } | {
34
+ type: "mpc";
33
35
  };
34
36
  exportable?: boolean;
35
37
  };
@@ -74,6 +76,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
74
76
  type: "private-key";
75
77
  } | {
76
78
  type: "custom";
79
+ } | {
80
+ type: "mpc";
77
81
  };
78
82
  exportable?: boolean;
79
83
  }, null>;
@@ -91,6 +95,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
91
95
  type: "private-key";
92
96
  } | {
93
97
  type: "custom";
98
+ } | {
99
+ type: "mpc";
94
100
  };
95
101
  exportable?: boolean;
96
102
  };
@@ -135,6 +141,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
135
141
  type: "private-key";
136
142
  } | {
137
143
  type: "custom";
144
+ } | {
145
+ type: "mpc";
138
146
  };
139
147
  exportable?: boolean;
140
148
  }, null>;
@@ -152,6 +160,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
152
160
  type: "private-key";
153
161
  } | {
154
162
  type: "custom";
163
+ } | {
164
+ type: "mpc";
155
165
  };
156
166
  exportable?: boolean;
157
167
  };
@@ -196,6 +206,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
196
206
  type: "private-key";
197
207
  } | {
198
208
  type: "custom";
209
+ } | {
210
+ type: "mpc";
199
211
  };
200
212
  exportable?: boolean;
201
213
  }, null>;
@@ -213,6 +225,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
213
225
  type: "private-key";
214
226
  } | {
215
227
  type: "custom";
228
+ } | {
229
+ type: "mpc";
216
230
  };
217
231
  exportable?: boolean;
218
232
  };
@@ -257,6 +271,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
257
271
  type: "private-key";
258
272
  } | {
259
273
  type: "custom";
274
+ } | {
275
+ type: "mpc";
260
276
  };
261
277
  exportable?: boolean;
262
278
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAmCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;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