@metamask-previews/keyring-api 21.3.0-e40d1ad → 21.3.0-feb98c5

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 (66) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/api/account-options.cjs +44 -7
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts +41 -3
  5. package/dist/api/account-options.d.cts.map +1 -1
  6. package/dist/api/account-options.d.mts +41 -3
  7. package/dist/api/account-options.d.mts.map +1 -1
  8. package/dist/api/account-options.mjs +43 -6
  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/api/v2/create-account/custom.cjs +14 -0
  15. package/dist/api/v2/create-account/custom.cjs.map +1 -0
  16. package/dist/api/v2/create-account/custom.d.cts +25 -0
  17. package/dist/api/v2/create-account/custom.d.cts.map +1 -0
  18. package/dist/api/v2/create-account/custom.d.mts +25 -0
  19. package/dist/api/v2/create-account/custom.d.mts.map +1 -0
  20. package/dist/api/v2/create-account/custom.mjs +11 -0
  21. package/dist/api/v2/create-account/custom.mjs.map +1 -0
  22. package/dist/api/v2/create-account/index.cjs +11 -0
  23. package/dist/api/v2/create-account/index.cjs.map +1 -1
  24. package/dist/api/v2/create-account/index.d.cts +11 -1
  25. package/dist/api/v2/create-account/index.d.cts.map +1 -1
  26. package/dist/api/v2/create-account/index.d.mts +11 -1
  27. package/dist/api/v2/create-account/index.d.mts.map +1 -1
  28. package/dist/api/v2/create-account/index.mjs +11 -0
  29. package/dist/api/v2/create-account/index.mjs.map +1 -1
  30. package/dist/api/v2/keyring-capabilities.cjs +10 -0
  31. package/dist/api/v2/keyring-capabilities.cjs.map +1 -1
  32. package/dist/api/v2/keyring-capabilities.d.cts +15 -0
  33. package/dist/api/v2/keyring-capabilities.d.cts.map +1 -1
  34. package/dist/api/v2/keyring-capabilities.d.mts +15 -0
  35. package/dist/api/v2/keyring-capabilities.d.mts.map +1 -1
  36. package/dist/api/v2/keyring-capabilities.mjs +11 -1
  37. package/dist/api/v2/keyring-capabilities.mjs.map +1 -1
  38. package/dist/btc/types.d.cts +16 -0
  39. package/dist/btc/types.d.cts.map +1 -1
  40. package/dist/btc/types.d.mts +16 -0
  41. package/dist/btc/types.d.mts.map +1 -1
  42. package/dist/eth/types.d.cts +8 -0
  43. package/dist/eth/types.d.cts.map +1 -1
  44. package/dist/eth/types.d.mts +8 -0
  45. package/dist/eth/types.d.mts.map +1 -1
  46. package/dist/events.d.cts +16 -0
  47. package/dist/events.d.cts.map +1 -1
  48. package/dist/events.d.mts +16 -0
  49. package/dist/events.d.mts.map +1 -1
  50. package/dist/rpc.cjs +15 -11
  51. package/dist/rpc.cjs.map +1 -1
  52. package/dist/rpc.d.cts +34 -12
  53. package/dist/rpc.d.cts.map +1 -1
  54. package/dist/rpc.d.mts +34 -12
  55. package/dist/rpc.d.mts.map +1 -1
  56. package/dist/rpc.mjs +15 -11
  57. package/dist/rpc.mjs.map +1 -1
  58. package/dist/sol/types.d.cts +4 -0
  59. package/dist/sol/types.d.cts.map +1 -1
  60. package/dist/sol/types.d.mts +4 -0
  61. package/dist/sol/types.d.mts.map +1 -1
  62. package/dist/trx/types.d.cts +4 -0
  63. package/dist/trx/types.d.cts.map +1 -1
  64. package/dist/trx/types.d.mts +4 -0
  65. package/dist/trx/types.d.mts.map +1 -1
  66. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
+ - Add support for custom capabilities and entropy types in `KeyringV2` ([#415](https://github.com/MetaMask/accounts/pull/415))
13
+ - Add `custom` capability to `KeyringCapabilities` for keyrings with non-standard `createAccounts` method.
14
+ - Add `KeyringAccountEntropyTypeOption.Custom` for custom/opaque entropy sources.
15
+ - Add `AccountCreationType.Custom` and `CreateAccountCustomOptions` for custom account creation flows.
12
16
  - Add `EthKeyringWrapper` abstract class for Ethereum-based `KeyringV2` implementations ([#404](https://github.com/MetaMask/accounts/pull/404))
13
17
  - Provides common Ethereum signing method routing (`submitRequest`) for all Ethereum-based keyrings.
14
18
  - Add `KeyringWrapper` base class to adapt legacy keyrings to `KeyringV2` ([#398](https://github.com/MetaMask/accounts/pull/398)), ([#410](https://github.com/MetaMask/accounts/pull/410))
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = exports.KeyringAccountEntropyPrivateKeyOptionsStruct = exports.KeyringAccountEntropyMnemonicOptionsStruct = exports.KeyringAccountEntropyTypeOption = void 0;
3
+ exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = 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");
@@ -17,6 +17,11 @@ var KeyringAccountEntropyTypeOption;
17
17
  * Indicates that the account was imported from a private key.
18
18
  */
19
19
  KeyringAccountEntropyTypeOption["PrivateKey"] = "private-key";
20
+ /**
21
+ * Indicates that the account was created with custom, keyring-specific entropy.
22
+ * This is an opaque type where the entropy source is managed internally by the keyring.
23
+ */
24
+ KeyringAccountEntropyTypeOption["Custom"] = "custom";
20
25
  })(KeyringAccountEntropyTypeOption || (exports.KeyringAccountEntropyTypeOption = KeyringAccountEntropyTypeOption = {}));
21
26
  /**
22
27
  * Keyring account options struct for mnemonics (BIP-44).
@@ -51,20 +56,43 @@ exports.KeyringAccountEntropyPrivateKeyOptionsStruct = (0, superstruct_1.object)
51
56
  */
52
57
  type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.PrivateKey}`),
53
58
  });
59
+ /**
60
+ * Keyring account options struct for custom entropy.
61
+ *
62
+ * This is an opaque type where the entropy source is managed internally by the keyring.
63
+ * It behaves similarly to a private key import but allows keyrings to define their own
64
+ * entropy management strategy.
65
+ */
66
+ exports.KeyringAccountEntropyCustomOptionsStruct = (0, superstruct_1.object)({
67
+ /**
68
+ * Indicates that the account was created with custom, keyring-specific entropy.
69
+ */
70
+ type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.Custom}`),
71
+ });
54
72
  /**
55
73
  * Keyring account entropy options struct.
56
74
  */
57
75
  exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)((value) => {
58
- return (0, utils_1.isPlainObject)(value) &&
59
- value.type === KeyringAccountEntropyTypeOption.PrivateKey
60
- ? exports.KeyringAccountEntropyPrivateKeyOptionsStruct
61
- : exports.KeyringAccountEntropyMnemonicOptionsStruct;
76
+ if (!(0, utils_1.isPlainObject)(value)) {
77
+ return exports.KeyringAccountEntropyMnemonicOptionsStruct;
78
+ }
79
+ switch (value.type) {
80
+ case KeyringAccountEntropyTypeOption.PrivateKey:
81
+ return exports.KeyringAccountEntropyPrivateKeyOptionsStruct;
82
+ case KeyringAccountEntropyTypeOption.Custom:
83
+ return exports.KeyringAccountEntropyCustomOptionsStruct;
84
+ case KeyringAccountEntropyTypeOption.Mnemonic:
85
+ return exports.KeyringAccountEntropyMnemonicOptionsStruct;
86
+ default:
87
+ return exports.KeyringAccountEntropyMnemonicOptionsStruct;
88
+ }
62
89
  });
63
90
  /**
64
91
  * Keyring options struct. This represents various options for a Keyring account object.
65
92
  *
66
- * See {@link KeyringAccountEntropyMnemonicOptionsStruct} and
67
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
93
+ * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
94
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
95
+ * {@link KeyringAccountEntropyCustomOptionsStruct}.
68
96
  *
69
97
  * @example
70
98
  * ```ts
@@ -91,6 +119,15 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
91
119
  * @example
92
120
  * ```ts
93
121
  * {
122
+ * entropy: {
123
+ * type: 'custom',
124
+ * },
125
+ * }
126
+ * ```
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * {
94
131
  * some: {
95
132
  * untyped: 'options',
96
133
  * something: true,
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.cjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":";;;AAAA,2DAA8E;AAE9E,uDAQ+B;AAC/B,2CAA4D;AAE5D;;GAEG;AACH,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;AAC5B,CAAC,EAVW,+BAA+B,+CAA/B,+BAA+B,QAU1C;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;;GAEG;AACU,QAAA,kCAAkC,GAAG,IAAA,8BAAc,EAC9D,CAAC,KAAU,EAAE,EAAE;IACb,OAAO,IAAA,qBAAa,EAAC,KAAK,CAAC;QACzB,KAAK,CAAC,IAAI,KAAK,+BAA+B,CAAC,UAAU;QACzD,CAAC,CAAC,oDAA4C;QAC9C,CAAC,CAAC,kDAA0C,CAAC;AACjD,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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,oBAAI,EAAC;QACH;;WAEG;QACH,OAAO,EAAE,IAAA,6BAAa,EAAC,0CAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,IAAA,6BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, selectiveUnion, type } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n intersection,\n literal,\n number,\n object,\n record,\n string,\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/**\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 entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n return isPlainObject(value) &&\n value.type === KeyringAccountEntropyTypeOption.PrivateKey\n ? KeyringAccountEntropyPrivateKeyOptionsStruct\n : KeyringAccountEntropyMnemonicOptionsStruct;\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} and\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\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 * 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,2DAA8E;AAE9E,uDAQ+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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port type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n intersection,\n literal,\n number,\n object,\n record,\n string,\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"]}
@@ -10,7 +10,12 @@ export declare enum KeyringAccountEntropyTypeOption {
10
10
  /**
11
11
  * Indicates that the account was imported from a private key.
12
12
  */
13
- PrivateKey = "private-key"
13
+ PrivateKey = "private-key",
14
+ /**
15
+ * Indicates that the account was created with custom, keyring-specific entropy.
16
+ * This is an opaque type where the entropy source is managed internally by the keyring.
17
+ */
18
+ Custom = "custom"
14
19
  }
15
20
  /**
16
21
  * Keyring account options struct for mnemonics (BIP-44).
@@ -60,6 +65,25 @@ export declare const KeyringAccountEntropyPrivateKeyOptionsStruct: import("@meta
60
65
  * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
61
66
  */
62
67
  export type KeyringAccountEntropyPrivateKeyOptions = Infer<typeof KeyringAccountEntropyPrivateKeyOptionsStruct>;
68
+ /**
69
+ * Keyring account options struct for custom entropy.
70
+ *
71
+ * This is an opaque type where the entropy source is managed internally by the keyring.
72
+ * It behaves similarly to a private key import but allows keyrings to define their own
73
+ * entropy management strategy.
74
+ */
75
+ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask/superstruct").Struct<{
76
+ type: "custom";
77
+ }, {
78
+ /**
79
+ * Indicates that the account was created with custom, keyring-specific entropy.
80
+ */
81
+ type: import("@metamask/superstruct").Struct<"custom", "custom">;
82
+ }>;
83
+ /**
84
+ * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
85
+ */
86
+ export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
63
87
  /**
64
88
  * Keyring account entropy options struct.
65
89
  */
@@ -70,6 +94,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
70
94
  groupIndex: number;
71
95
  } | {
72
96
  type: "private-key";
97
+ } | {
98
+ type: "custom";
73
99
  }, null>;
74
100
  /**
75
101
  * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
@@ -78,8 +104,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
78
104
  /**
79
105
  * Keyring options struct. This represents various options for a Keyring account object.
80
106
  *
81
- * See {@link KeyringAccountEntropyMnemonicOptionsStruct} and
82
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
107
+ * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
108
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
109
+ * {@link KeyringAccountEntropyCustomOptionsStruct}.
83
110
  *
84
111
  * @example
85
112
  * ```ts
@@ -106,6 +133,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
106
133
  * @example
107
134
  * ```ts
108
135
  * {
136
+ * entropy: {
137
+ * type: 'custom',
138
+ * },
139
+ * }
140
+ * ```
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * {
109
145
  * some: {
110
146
  * untyped: 'options',
111
147
  * something: true,
@@ -121,6 +157,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
121
157
  groupIndex: number;
122
158
  } | {
123
159
  type: "private-key";
160
+ } | {
161
+ type: "custom";
124
162
  };
125
163
  exportable?: boolean;
126
164
  }, 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;AAYnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;CAC3B;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;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;QAO9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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.cts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAYnD;;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"}
@@ -10,7 +10,12 @@ export declare enum KeyringAccountEntropyTypeOption {
10
10
  /**
11
11
  * Indicates that the account was imported from a private key.
12
12
  */
13
- PrivateKey = "private-key"
13
+ PrivateKey = "private-key",
14
+ /**
15
+ * Indicates that the account was created with custom, keyring-specific entropy.
16
+ * This is an opaque type where the entropy source is managed internally by the keyring.
17
+ */
18
+ Custom = "custom"
14
19
  }
15
20
  /**
16
21
  * Keyring account options struct for mnemonics (BIP-44).
@@ -60,6 +65,25 @@ export declare const KeyringAccountEntropyPrivateKeyOptionsStruct: import("@meta
60
65
  * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
61
66
  */
62
67
  export type KeyringAccountEntropyPrivateKeyOptions = Infer<typeof KeyringAccountEntropyPrivateKeyOptionsStruct>;
68
+ /**
69
+ * Keyring account options struct for custom entropy.
70
+ *
71
+ * This is an opaque type where the entropy source is managed internally by the keyring.
72
+ * It behaves similarly to a private key import but allows keyrings to define their own
73
+ * entropy management strategy.
74
+ */
75
+ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask/superstruct").Struct<{
76
+ type: "custom";
77
+ }, {
78
+ /**
79
+ * Indicates that the account was created with custom, keyring-specific entropy.
80
+ */
81
+ type: import("@metamask/superstruct").Struct<"custom", "custom">;
82
+ }>;
83
+ /**
84
+ * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
85
+ */
86
+ export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
63
87
  /**
64
88
  * Keyring account entropy options struct.
65
89
  */
@@ -70,6 +94,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
70
94
  groupIndex: number;
71
95
  } | {
72
96
  type: "private-key";
97
+ } | {
98
+ type: "custom";
73
99
  }, null>;
74
100
  /**
75
101
  * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
@@ -78,8 +104,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
78
104
  /**
79
105
  * Keyring options struct. This represents various options for a Keyring account object.
80
106
  *
81
- * See {@link KeyringAccountEntropyMnemonicOptionsStruct} and
82
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
107
+ * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
108
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
109
+ * {@link KeyringAccountEntropyCustomOptionsStruct}.
83
110
  *
84
111
  * @example
85
112
  * ```ts
@@ -106,6 +133,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
106
133
  * @example
107
134
  * ```ts
108
135
  * {
136
+ * entropy: {
137
+ * type: 'custom',
138
+ * },
139
+ * }
140
+ * ```
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * {
109
145
  * some: {
110
146
  * untyped: 'options',
111
147
  * something: true,
@@ -121,6 +157,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
121
157
  groupIndex: number;
122
158
  } | {
123
159
  type: "private-key";
160
+ } | {
161
+ type: "custom";
124
162
  };
125
163
  exportable?: boolean;
126
164
  }, 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;AAYnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;CAC3B;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;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;QAO9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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;AAYnD;;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"}
@@ -14,6 +14,11 @@ export var KeyringAccountEntropyTypeOption;
14
14
  * Indicates that the account was imported from a private key.
15
15
  */
16
16
  KeyringAccountEntropyTypeOption["PrivateKey"] = "private-key";
17
+ /**
18
+ * Indicates that the account was created with custom, keyring-specific entropy.
19
+ * This is an opaque type where the entropy source is managed internally by the keyring.
20
+ */
21
+ KeyringAccountEntropyTypeOption["Custom"] = "custom";
17
22
  })(KeyringAccountEntropyTypeOption || (KeyringAccountEntropyTypeOption = {}));
18
23
  /**
19
24
  * Keyring account options struct for mnemonics (BIP-44).
@@ -48,20 +53,43 @@ export const KeyringAccountEntropyPrivateKeyOptionsStruct = object({
48
53
  */
49
54
  type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),
50
55
  });
56
+ /**
57
+ * Keyring account options struct for custom entropy.
58
+ *
59
+ * This is an opaque type where the entropy source is managed internally by the keyring.
60
+ * It behaves similarly to a private key import but allows keyrings to define their own
61
+ * entropy management strategy.
62
+ */
63
+ export const KeyringAccountEntropyCustomOptionsStruct = object({
64
+ /**
65
+ * Indicates that the account was created with custom, keyring-specific entropy.
66
+ */
67
+ type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),
68
+ });
51
69
  /**
52
70
  * Keyring account entropy options struct.
53
71
  */
54
72
  export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
55
- return isPlainObject(value) &&
56
- value.type === KeyringAccountEntropyTypeOption.PrivateKey
57
- ? KeyringAccountEntropyPrivateKeyOptionsStruct
58
- : KeyringAccountEntropyMnemonicOptionsStruct;
73
+ if (!isPlainObject(value)) {
74
+ return KeyringAccountEntropyMnemonicOptionsStruct;
75
+ }
76
+ switch (value.type) {
77
+ case KeyringAccountEntropyTypeOption.PrivateKey:
78
+ return KeyringAccountEntropyPrivateKeyOptionsStruct;
79
+ case KeyringAccountEntropyTypeOption.Custom:
80
+ return KeyringAccountEntropyCustomOptionsStruct;
81
+ case KeyringAccountEntropyTypeOption.Mnemonic:
82
+ return KeyringAccountEntropyMnemonicOptionsStruct;
83
+ default:
84
+ return KeyringAccountEntropyMnemonicOptionsStruct;
85
+ }
59
86
  });
60
87
  /**
61
88
  * Keyring options struct. This represents various options for a Keyring account object.
62
89
  *
63
- * See {@link KeyringAccountEntropyMnemonicOptionsStruct} and
64
- * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.
90
+ * See {@link KeyringAccountEntropyMnemonicOptionsStruct},
91
+ * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}, and
92
+ * {@link KeyringAccountEntropyCustomOptionsStruct}.
65
93
  *
66
94
  * @example
67
95
  * ```ts
@@ -88,6 +116,15 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
88
116
  * @example
89
117
  * ```ts
90
118
  * {
119
+ * entropy: {
120
+ * type: 'custom',
121
+ * },
122
+ * }
123
+ * ```
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * {
91
128
  * some: {
92
129
  * untyped: 'options',
93
130
  * something: true,
@@ -1 +1 @@
1
- {"version":3,"file":"account-options.mjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,gCAAgC;AAE9E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACP,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;AAC5B,CAAC,EAVW,+BAA+B,KAA/B,+BAA+B,QAU1C;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,QAAQ,EAAE,CAAC;IAE5D;;OAEG;IACH,EAAE,EAAE,MAAM,EAAE,EAAE,4CAA4C;IAE1D;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE;IAExB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,MAAM,CAAC;IACjE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,UAAU,EAAE,CAAC;CAC/D,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,cAAc,CAC9D,CAAC,KAAU,EAAE,EAAE;IACb,OAAO,aAAa,CAAC,KAAK,CAAC;QACzB,KAAK,CAAC,IAAI,KAAK,+BAA+B,CAAC,UAAU;QACzD,CAAC,CAAC,4CAA4C;QAC9C,CAAC,CAAC,0CAA0C,CAAC;AACjD,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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 { exactOptional, selectiveUnion, type } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n intersection,\n literal,\n number,\n object,\n record,\n string,\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/**\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 entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n return isPlainObject(value) &&\n value.type === KeyringAccountEntropyTypeOption.PrivateKey\n ? KeyringAccountEntropyPrivateKeyOptionsStruct\n : KeyringAccountEntropyMnemonicOptionsStruct;\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} and\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\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 * 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,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,gCAAgC;AAE9E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACP,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,QAgB1C;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;IAC/D;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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 { exactOptional, selectiveUnion, type } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n intersection,\n literal,\n number,\n object,\n record,\n string,\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"]}
@@ -70,6 +70,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
70
70
  groupIndex: number;
71
71
  } | {
72
72
  type: "private-key";
73
+ } | {
74
+ type: "custom";
73
75
  };
74
76
  exportable?: boolean;
75
77
  };
@@ -114,6 +116,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
114
116
  groupIndex: number;
115
117
  } | {
116
118
  type: "private-key";
119
+ } | {
120
+ type: "custom";
117
121
  };
118
122
  exportable?: boolean;
119
123
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,E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ACxB,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;;;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,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;EAUnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAaH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -70,6 +70,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
70
70
  groupIndex: number;
71
71
  } | {
72
72
  type: "private-key";
73
+ } | {
74
+ type: "custom";
73
75
  };
74
76
  exportable?: boolean;
75
77
  };
@@ -114,6 +116,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
114
116
  groupIndex: number;
115
117
  } | {
116
118
  type: "private-key";
119
+ } | {
120
+ type: "custom";
117
121
  };
118
122
  exportable?: boolean;
119
123
  }, 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;;;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,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;EAUnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAaH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAGH;;OAEG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AM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAccountCustomOptionsStruct = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ /**
6
+ * Struct for {@link CreateAccountCustomOptions}.
7
+ */
8
+ exports.CreateAccountCustomOptionsStruct = (0, superstruct_1.type)({
9
+ /**
10
+ * The type of the options.
11
+ */
12
+ type: (0, superstruct_1.literal)('custom'),
13
+ });
14
+ //# sourceMappingURL=custom.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAElE;;GAEG;AACU,QAAA,gCAAgC,GAAG,IAAA,kBAAI,EAAC;IACnD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
@@ -0,0 +1,25 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Struct for {@link CreateAccountCustomOptions}.
4
+ */
5
+ export declare const CreateAccountCustomOptionsStruct: import("@metamask/superstruct").Struct<{
6
+ type: "custom";
7
+ }, {
8
+ /**
9
+ * The type of the options.
10
+ */
11
+ type: import("@metamask/superstruct").Struct<"custom", "custom">;
12
+ }>;
13
+ /**
14
+ * Options for creating an account using a custom, keyring-specific method.
15
+ *
16
+ * This is an opaque type that allows keyrings with non-standard account
17
+ * creation flows to define their own options. Keyrings using this type
18
+ * should declare `custom.createAccounts: true` in their capabilities.
19
+ *
20
+ * The actual options accepted by the keyring are implementation-specific
21
+ * and not validated by this struct beyond the `type` field. Adaptors should
22
+ * handle any additional options as needed and add type intersections as necessary.
23
+ */
24
+ export type CreateAccountCustomOptions = Infer<typeof CreateAccountCustomOptionsStruct>;
25
+ //# sourceMappingURL=custom.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Struct for {@link CreateAccountCustomOptions}.
4
+ */
5
+ export declare const CreateAccountCustomOptionsStruct: import("@metamask/superstruct").Struct<{
6
+ type: "custom";
7
+ }, {
8
+ /**
9
+ * The type of the options.
10
+ */
11
+ type: import("@metamask/superstruct").Struct<"custom", "custom">;
12
+ }>;
13
+ /**
14
+ * Options for creating an account using a custom, keyring-specific method.
15
+ *
16
+ * This is an opaque type that allows keyrings with non-standard account
17
+ * creation flows to define their own options. Keyrings using this type
18
+ * should declare `custom.createAccounts: true` in their capabilities.
19
+ *
20
+ * The actual options accepted by the keyring are implementation-specific
21
+ * and not validated by this struct beyond the `type` field. Adaptors should
22
+ * handle any additional options as needed and add type intersections as necessary.
23
+ */
24
+ export type CreateAccountCustomOptions = Infer<typeof CreateAccountCustomOptionsStruct>;
25
+ //# sourceMappingURL=custom.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { literal, type } from "@metamask/superstruct";
2
+ /**
3
+ * Struct for {@link CreateAccountCustomOptions}.
4
+ */
5
+ export const CreateAccountCustomOptionsStruct = type({
6
+ /**
7
+ * The type of the options.
8
+ */
9
+ type: literal('custom'),
10
+ });
11
+ //# sourceMappingURL=custom.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.mjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,8BAA8B;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;IACnD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.CreateAccountOptionsStruct = exports.AccountCreationType = void 0;
18
18
  const keyring_utils_1 = require("@metamask/keyring-utils");
19
19
  const bip44_1 = require("./bip44.cjs");
20
+ const custom_1 = require("./custom.cjs");
20
21
  const private_key_1 = require("./private-key.cjs");
21
22
  __exportStar(require("./bip44.cjs"), exports);
23
+ __exportStar(require("./custom.cjs"), exports);
22
24
  __exportStar(require("./private-key.cjs"), exports);
23
25
  /**
24
26
  * Enum representing the different ways an account can be created.
@@ -49,6 +51,13 @@ var AccountCreationType;
49
51
  * Represents an account imported from a private key.
50
52
  */
51
53
  AccountCreationType["PrivateKeyImport"] = "private-key:import";
54
+ /**
55
+ * Represents an account created using a custom, keyring-specific method.
56
+ *
57
+ * This is used by keyrings that have non-standard account creation flows
58
+ * and declare `custom.createAccounts: true` in their capabilities.
59
+ */
60
+ AccountCreationType["Custom"] = "custom";
52
61
  })(AccountCreationType || (exports.AccountCreationType = AccountCreationType = {}));
53
62
  /**
54
63
  * Struct for {@link CreateAccountOptions}.
@@ -64,6 +73,8 @@ exports.CreateAccountOptionsStruct = (0, keyring_utils_1.selectiveUnion)((value)
64
73
  return bip44_1.CreateAccountBip44DiscoverOptionsStruct;
65
74
  case AccountCreationType.PrivateKeyImport:
66
75
  return private_key_1.CreateAccountPrivateKeyOptionsStruct;
76
+ case AccountCreationType.Custom:
77
+ return custom_1.CreateAccountCustomOptionsStruct;
67
78
  default:
68
79
  // Return first struct as fallback - validation will fail with proper error indicating the type mismatch
69
80
  return bip44_1.CreateAccountBip44DerivePathOptionsStruct;