@metamask-previews/keyring-api 21.5.0-cd75414 → 22.0.0-8ff7ba2

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 (104) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/dist/api/account-options.cjs +0 -4
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts +0 -4
  5. package/dist/api/account-options.d.cts.map +1 -1
  6. package/dist/api/account-options.d.mts +0 -4
  7. package/dist/api/account-options.d.mts.map +1 -1
  8. package/dist/api/account-options.mjs +0 -4
  9. package/dist/api/account-options.mjs.map +1 -1
  10. package/dist/api/account.d.cts +2 -2
  11. package/dist/api/account.d.mts +2 -2
  12. package/dist/api/asset.d.cts +2 -2
  13. package/dist/api/asset.d.mts +2 -2
  14. package/dist/api/request.d.cts +3 -3
  15. package/dist/api/request.d.mts +3 -3
  16. package/dist/api/response.d.cts +1 -1
  17. package/dist/api/response.d.mts +1 -1
  18. package/dist/api/transaction.d.cts +71 -71
  19. package/dist/api/transaction.d.mts +71 -71
  20. package/dist/api/v2/create-account/bip44.d.cts +1 -1
  21. package/dist/api/v2/create-account/bip44.d.mts +1 -1
  22. package/dist/api/v2/create-account/index.d.cts +1 -1
  23. package/dist/api/v2/create-account/index.d.mts +1 -1
  24. package/dist/api/v2/index.cjs +0 -1
  25. package/dist/api/v2/index.cjs.map +1 -1
  26. package/dist/api/v2/index.d.cts +0 -1
  27. package/dist/api/v2/index.d.cts.map +1 -1
  28. package/dist/api/v2/index.d.mts +0 -1
  29. package/dist/api/v2/index.d.mts.map +1 -1
  30. package/dist/api/v2/index.mjs +0 -1
  31. package/dist/api/v2/index.mjs.map +1 -1
  32. package/dist/api/v2/keyring-type.cjs +4 -0
  33. package/dist/api/v2/keyring-type.cjs.map +1 -1
  34. package/dist/api/v2/keyring-type.d.cts +5 -1
  35. package/dist/api/v2/keyring-type.d.cts.map +1 -1
  36. package/dist/api/v2/keyring-type.d.mts +5 -1
  37. package/dist/api/v2/keyring-type.d.mts.map +1 -1
  38. package/dist/api/v2/keyring-type.mjs +4 -0
  39. package/dist/api/v2/keyring-type.mjs.map +1 -1
  40. package/dist/btc/types.d.cts +8 -8
  41. package/dist/btc/types.d.mts +8 -8
  42. package/dist/eth/erc4337/types.d.cts +3 -3
  43. package/dist/eth/erc4337/types.d.mts +3 -3
  44. package/dist/eth/index.cjs +0 -1
  45. package/dist/eth/index.cjs.map +1 -1
  46. package/dist/eth/index.d.cts +0 -1
  47. package/dist/eth/index.d.cts.map +1 -1
  48. package/dist/eth/index.d.mts +0 -1
  49. package/dist/eth/index.d.mts.map +1 -1
  50. package/dist/eth/index.mjs +0 -1
  51. package/dist/eth/index.mjs.map +1 -1
  52. package/dist/eth/rpc/params.d.cts +29 -29
  53. package/dist/eth/rpc/params.d.mts +29 -29
  54. package/dist/eth/types.d.cts +4 -4
  55. package/dist/eth/types.d.mts +4 -4
  56. package/dist/events.d.cts +50 -50
  57. package/dist/events.d.mts +50 -50
  58. package/dist/rpc.d.cts +133 -133
  59. package/dist/rpc.d.mts +133 -133
  60. package/dist/sol/types.d.cts +2 -2
  61. package/dist/sol/types.d.mts +2 -2
  62. package/dist/trx/types.d.cts +2 -2
  63. package/dist/trx/types.d.mts +2 -2
  64. package/package.json +3 -8
  65. package/dist/api/v2/wrapper/index.cjs +0 -19
  66. package/dist/api/v2/wrapper/index.cjs.map +0 -1
  67. package/dist/api/v2/wrapper/index.d.cts +0 -3
  68. package/dist/api/v2/wrapper/index.d.cts.map +0 -1
  69. package/dist/api/v2/wrapper/index.d.mts +0 -3
  70. package/dist/api/v2/wrapper/index.d.mts.map +0 -1
  71. package/dist/api/v2/wrapper/index.mjs +0 -3
  72. package/dist/api/v2/wrapper/index.mjs.map +0 -1
  73. package/dist/api/v2/wrapper/keyring-account-registry.cjs +0 -135
  74. package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +0 -1
  75. package/dist/api/v2/wrapper/keyring-account-registry.d.cts +0 -88
  76. package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +0 -1
  77. package/dist/api/v2/wrapper/keyring-account-registry.d.mts +0 -88
  78. package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +0 -1
  79. package/dist/api/v2/wrapper/keyring-account-registry.mjs +0 -131
  80. package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +0 -1
  81. package/dist/api/v2/wrapper/keyring-wrapper.cjs +0 -134
  82. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +0 -1
  83. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +0 -154
  84. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +0 -1
  85. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +0 -154
  86. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +0 -1
  87. package/dist/api/v2/wrapper/keyring-wrapper.mjs +0 -130
  88. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +0 -1
  89. package/dist/eth/v2/eth-keyring-wrapper.cjs +0 -165
  90. package/dist/eth/v2/eth-keyring-wrapper.cjs.map +0 -1
  91. package/dist/eth/v2/eth-keyring-wrapper.d.cts +0 -54
  92. package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +0 -1
  93. package/dist/eth/v2/eth-keyring-wrapper.d.mts +0 -54
  94. package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +0 -1
  95. package/dist/eth/v2/eth-keyring-wrapper.mjs +0 -161
  96. package/dist/eth/v2/eth-keyring-wrapper.mjs.map +0 -1
  97. package/dist/eth/v2/index.cjs +0 -18
  98. package/dist/eth/v2/index.cjs.map +0 -1
  99. package/dist/eth/v2/index.d.cts +0 -2
  100. package/dist/eth/v2/index.d.cts.map +0 -1
  101. package/dist/eth/v2/index.d.mts +0 -2
  102. package/dist/eth/v2/index.d.mts.map +0 -1
  103. package/dist/eth/v2/index.mjs +0 -2
  104. package/dist/eth/v2/index.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,8 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - Bump `@metamask/utils` from `^11.1.0` to `^11.10.0` ([#489](https://github.com/MetaMask/accounts/pull/489))
13
+
14
+ ## [22.0.0]
15
+
16
+ ### Removed
17
+
18
+ - **BREAKING:** Remove `EthKeyringWrapper`, `EthKeyringMethod`, `KeyringWrapper`, and `KeyringAccountRegistry` exports ([#478](https://github.com/MetaMask/accounts/pull/478))
19
+ - These have been moved to the new `@metamask/keyring-sdk` package.
20
+ - `@ethereumjs/tx`, `@metamask/eth-sig-util`, and `async-mutex` are no longer dependencies of this package.
21
+
22
+ ## [21.6.0]
23
+
10
24
  ### Added
11
25
 
26
+ - Add `KeyringType.Money` variant ([#472](https://github.com/MetaMask/accounts/pull/472))
12
27
  - Add optional `details` field to `Transaction` type ([#445](https://github.com/MetaMask/accounts/pull/445))
13
28
  - Add `SecurityAlertResponse` enum with values: `benign`, `warning`, `malicious`
14
29
  - Add optional `origin` field (string) to track transaction request source
@@ -707,7 +722,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
707
722
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
708
723
  - Helper functions to create keyring handler in the snap.
709
724
 
710
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.5.0...HEAD
725
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@22.0.0...HEAD
726
+ [22.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.6.0...@metamask/keyring-api@22.0.0
727
+ [21.6.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.5.0...@metamask/keyring-api@21.6.0
711
728
  [21.5.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.4.0...@metamask/keyring-api@21.5.0
712
729
  [21.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.3.0...@metamask/keyring-api@21.4.0
713
730
  [21.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.2.0...@metamask/keyring-api@21.3.0
@@ -17,10 +17,6 @@ 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 from a hardware wallet.
22
- */
23
- KeyringAccountEntropyTypeOption["Hardware"] = "hardware";
24
20
  /**
25
21
  * Indicates that the account was created with custom, keyring-specific entropy.
26
22
  * This is an opaque type where the entropy source is managed internally by the keyring.
@@ -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,+BAqBX;AArBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;OAEG;IACH,wDAAqB,CAAA;IAErB;;;OAGG;IACH,oDAAiB,CAAA;AACnB,CAAC,EArBW,+BAA+B,+CAA/B,+BAA+B,QAqB1C;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,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 * Indicates that the account was created from a hardware wallet.\n */\n Hardware = 'hardware',\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,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,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AC,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"]}
@@ -11,10 +11,6 @@ export declare enum KeyringAccountEntropyTypeOption {
11
11
  * Indicates that the account was imported from a private key.
12
12
  */
13
13
  PrivateKey = "private-key",
14
- /**
15
- * Indicates that the account was created from a hardware wallet.
16
- */
17
- Hardware = "hardware",
18
14
  /**
19
15
  * Indicates that the account was created with custom, keyring-specific entropy.
20
16
  * This is an opaque type where the entropy source is managed internally by the keyring.
@@ -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;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;;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.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"}
@@ -11,10 +11,6 @@ export declare enum KeyringAccountEntropyTypeOption {
11
11
  * Indicates that the account was imported from a private key.
12
12
  */
13
13
  PrivateKey = "private-key",
14
- /**
15
- * Indicates that the account was created from a hardware wallet.
16
- */
17
- Hardware = "hardware",
18
14
  /**
19
15
  * Indicates that the account was created with custom, keyring-specific entropy.
20
16
  * This is an opaque type where the entropy source is managed internally by the keyring.
@@ -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;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;;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;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,10 +14,6 @@ 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 from a hardware wallet.
19
- */
20
- KeyringAccountEntropyTypeOption["Hardware"] = "hardware";
21
17
  /**
22
18
  * Indicates that the account was created with custom, keyring-specific entropy.
23
19
  * This is an opaque type where the entropy source is managed internally by the keyring.
@@ -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,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,OAAO,wCAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,0CAA0C,CAAC;QACpD;YACE,OAAO,0CAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;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 * Indicates that the account was created from a hardware wallet.\n */\n Hardware = 'hardware',\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":"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CAAC,EAAE,CAAC;QAC1B,OAAO,0CAA0C,CAAC;IACpD,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,+BAA+B,CAAC,UAAU;YAC7C,OAAO,4CAA4C,CAAC;QACtD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,wCAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,0CAA0C,CAAC;QACpD;YACE,OAAO,0CAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;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 * 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"]}
@@ -62,8 +62,6 @@ export declare const KeyringAccountTypeStruct: import("@metamask/superstruct").S
62
62
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
63
63
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
64
64
  id: string;
65
- address: string;
66
- scopes: `${string}:${string}`[];
67
65
  options: Record<string, import("@metamask/utils").Json> & {
68
66
  entropy?: {
69
67
  type: "mnemonic";
@@ -77,6 +75,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
77
75
  };
78
76
  exportable?: boolean;
79
77
  };
78
+ address: string;
79
+ scopes: `${string}:${string}`[];
80
80
  methods: string[];
81
81
  }, {
82
82
  /**
@@ -62,8 +62,6 @@ export declare const KeyringAccountTypeStruct: import("@metamask/superstruct").S
62
62
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
63
63
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
64
64
  id: string;
65
- address: string;
66
- scopes: `${string}:${string}`[];
67
65
  options: Record<string, import("@metamask/utils").Json> & {
68
66
  entropy?: {
69
67
  type: "mnemonic";
@@ -77,6 +75,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
77
75
  };
78
76
  exportable?: boolean;
79
77
  };
78
+ address: string;
79
+ scopes: `${string}:${string}`[];
80
80
  methods: string[];
81
81
  }, {
82
82
  /**
@@ -19,8 +19,8 @@ export declare const FungibleAssetAmountStruct: import("@metamask/superstruct").
19
19
  * Fungible asset struct.
20
20
  */
21
21
  export declare const FungibleAssetStruct: import("@metamask/superstruct").Struct<{
22
- type: `${string}:${string}/${string}:${string}`;
23
22
  unit: string;
23
+ type: `${string}:${string}/${string}:${string}`;
24
24
  amount: string;
25
25
  fungible: true;
26
26
  }, {
@@ -94,8 +94,8 @@ export declare const NonFungibleAssetStruct: import("@metamask/superstruct").Str
94
94
  * ```
95
95
  */
96
96
  export declare const AssetStruct: import("@metamask/superstruct").Struct<{
97
- type: `${string}:${string}/${string}:${string}`;
98
97
  unit: string;
98
+ type: `${string}:${string}/${string}:${string}`;
99
99
  amount: string;
100
100
  fungible: true;
101
101
  } | {
@@ -19,8 +19,8 @@ export declare const FungibleAssetAmountStruct: import("@metamask/superstruct").
19
19
  * Fungible asset struct.
20
20
  */
21
21
  export declare const FungibleAssetStruct: import("@metamask/superstruct").Struct<{
22
- type: `${string}:${string}/${string}:${string}`;
23
22
  unit: string;
23
+ type: `${string}:${string}/${string}:${string}`;
24
24
  amount: string;
25
25
  fungible: true;
26
26
  }, {
@@ -94,8 +94,8 @@ export declare const NonFungibleAssetStruct: import("@metamask/superstruct").Str
94
94
  * ```
95
95
  */
96
96
  export declare const AssetStruct: import("@metamask/superstruct").Struct<{
97
- type: `${string}:${string}/${string}:${string}`;
98
97
  unit: string;
98
+ type: `${string}:${string}/${string}:${string}`;
99
99
  amount: string;
100
100
  fungible: true;
101
101
  } | {
@@ -1,13 +1,13 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  id: string;
4
- scope: string;
5
- account: string;
6
4
  origin: string;
7
5
  request: {
8
6
  method: string;
9
7
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
10
8
  };
9
+ scope: string;
10
+ account: string;
11
11
  }, {
12
12
  /**
13
13
  * Keyring request ID (UUIDv4).
@@ -33,7 +33,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
33
33
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
34
34
  }, {
35
35
  method: import("@metamask/superstruct").Struct<string, null>;
36
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[], null>;
36
+ params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
37
37
  }>;
38
38
  }>;
39
39
  /**
@@ -1,13 +1,13 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  id: string;
4
- scope: string;
5
- account: string;
6
4
  origin: string;
7
5
  request: {
8
6
  method: string;
9
7
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
10
8
  };
9
+ scope: string;
10
+ account: string;
11
11
  }, {
12
12
  /**
13
13
  * Keyring request ID (UUIDv4).
@@ -33,7 +33,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
33
33
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
34
34
  }, {
35
35
  method: import("@metamask/superstruct").Struct<string, null>;
36
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[], null>;
36
+ params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
37
37
  }>;
38
38
  }>;
39
39
  /**
@@ -6,8 +6,8 @@ export declare const KeyringResponseStruct: import("@metamask/superstruct").Stru
6
6
  url?: string;
7
7
  };
8
8
  } | {
9
- pending: false;
10
9
  result: import("@metamask/utils").Json;
10
+ pending: false;
11
11
  }, null>;
12
12
  /**
13
13
  * Response to a call to `submitRequest`.
@@ -6,8 +6,8 @@ export declare const KeyringResponseStruct: import("@metamask/superstruct").Stru
6
6
  url?: string;
7
7
  };
8
8
  } | {
9
- pending: false;
10
9
  result: import("@metamask/utils").Json;
10
+ pending: false;
11
11
  }, null>;
12
12
  /**
13
13
  * Response to a call to `submitRequest`.