@metamask-previews/keyring-api 21.5.0-fd40efd → 22.0.0-5c366be

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 (88) hide show
  1. package/CHANGELOG.md +23 -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/v2/index.cjs +1 -1
  11. package/dist/api/v2/index.cjs.map +1 -1
  12. package/dist/api/v2/index.d.cts +1 -1
  13. package/dist/api/v2/index.d.cts.map +1 -1
  14. package/dist/api/v2/index.d.mts +1 -1
  15. package/dist/api/v2/index.d.mts.map +1 -1
  16. package/dist/api/v2/index.mjs +1 -1
  17. package/dist/api/v2/index.mjs.map +1 -1
  18. package/dist/api/v2/keyring-rpc.cjs +93 -0
  19. package/dist/api/v2/keyring-rpc.cjs.map +1 -0
  20. package/dist/api/v2/keyring-rpc.d.cts +440 -0
  21. package/dist/api/v2/keyring-rpc.d.cts.map +1 -0
  22. package/dist/api/v2/keyring-rpc.d.mts +440 -0
  23. package/dist/api/v2/keyring-rpc.d.mts.map +1 -0
  24. package/dist/api/v2/keyring-rpc.mjs +89 -0
  25. package/dist/api/v2/keyring-rpc.mjs.map +1 -0
  26. package/dist/api/v2/keyring-type.cjs +4 -0
  27. package/dist/api/v2/keyring-type.cjs.map +1 -1
  28. package/dist/api/v2/keyring-type.d.cts +5 -1
  29. package/dist/api/v2/keyring-type.d.cts.map +1 -1
  30. package/dist/api/v2/keyring-type.d.mts +5 -1
  31. package/dist/api/v2/keyring-type.d.mts.map +1 -1
  32. package/dist/api/v2/keyring-type.mjs +4 -0
  33. package/dist/api/v2/keyring-type.mjs.map +1 -1
  34. package/dist/eth/index.cjs +0 -1
  35. package/dist/eth/index.cjs.map +1 -1
  36. package/dist/eth/index.d.cts +0 -1
  37. package/dist/eth/index.d.cts.map +1 -1
  38. package/dist/eth/index.d.mts +0 -1
  39. package/dist/eth/index.d.mts.map +1 -1
  40. package/dist/eth/index.mjs +0 -1
  41. package/dist/eth/index.mjs.map +1 -1
  42. package/dist/rpc.cjs.map +1 -1
  43. package/dist/rpc.d.cts +1 -1
  44. package/dist/rpc.d.cts.map +1 -1
  45. package/dist/rpc.d.mts +1 -1
  46. package/dist/rpc.d.mts.map +1 -1
  47. package/dist/rpc.mjs.map +1 -1
  48. package/package.json +3 -8
  49. package/dist/api/v2/wrapper/index.cjs +0 -19
  50. package/dist/api/v2/wrapper/index.cjs.map +0 -1
  51. package/dist/api/v2/wrapper/index.d.cts +0 -3
  52. package/dist/api/v2/wrapper/index.d.cts.map +0 -1
  53. package/dist/api/v2/wrapper/index.d.mts +0 -3
  54. package/dist/api/v2/wrapper/index.d.mts.map +0 -1
  55. package/dist/api/v2/wrapper/index.mjs +0 -3
  56. package/dist/api/v2/wrapper/index.mjs.map +0 -1
  57. package/dist/api/v2/wrapper/keyring-account-registry.cjs +0 -135
  58. package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +0 -1
  59. package/dist/api/v2/wrapper/keyring-account-registry.d.cts +0 -88
  60. package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +0 -1
  61. package/dist/api/v2/wrapper/keyring-account-registry.d.mts +0 -88
  62. package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +0 -1
  63. package/dist/api/v2/wrapper/keyring-account-registry.mjs +0 -131
  64. package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +0 -1
  65. package/dist/api/v2/wrapper/keyring-wrapper.cjs +0 -134
  66. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +0 -1
  67. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +0 -154
  68. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +0 -1
  69. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +0 -154
  70. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +0 -1
  71. package/dist/api/v2/wrapper/keyring-wrapper.mjs +0 -130
  72. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +0 -1
  73. package/dist/eth/v2/eth-keyring-wrapper.cjs +0 -165
  74. package/dist/eth/v2/eth-keyring-wrapper.cjs.map +0 -1
  75. package/dist/eth/v2/eth-keyring-wrapper.d.cts +0 -54
  76. package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +0 -1
  77. package/dist/eth/v2/eth-keyring-wrapper.d.mts +0 -54
  78. package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +0 -1
  79. package/dist/eth/v2/eth-keyring-wrapper.mjs +0 -161
  80. package/dist/eth/v2/eth-keyring-wrapper.mjs.map +0 -1
  81. package/dist/eth/v2/index.cjs +0 -18
  82. package/dist/eth/v2/index.cjs.map +0 -1
  83. package/dist/eth/v2/index.d.cts +0 -2
  84. package/dist/eth/v2/index.d.cts.map +0 -1
  85. package/dist/eth/v2/index.d.mts +0 -2
  86. package/dist/eth/v2/index.d.mts.map +0 -1
  87. package/dist/eth/v2/index.mjs +0 -2
  88. package/dist/eth/v2/index.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
+ - Add keyring v2 RPC types and structs (`KeyringRpcV2`, `KeyringRpcV2Method`, `isKeyringRpcV2Method`, and request/response structs) ([#408](https://github.com/MetaMask/accounts/pull/408))
13
+
14
+ ### Changed
15
+
16
+ - Improve return type of `isKeyringRpcMethod` to use type predicate `method is KeyringRpcMethod` ([#408](https://github.com/MetaMask/accounts/pull/408))
17
+ - Bump `@metamask/utils` from `^11.1.0` to `^11.10.0` ([#489](https://github.com/MetaMask/accounts/pull/489))
18
+
19
+ ## [22.0.0]
20
+
21
+ ### Removed
22
+
23
+ - **BREAKING:** Remove `EthKeyringWrapper`, `EthKeyringMethod`, `KeyringWrapper`, and `KeyringAccountRegistry` exports ([#478](https://github.com/MetaMask/accounts/pull/478))
24
+ - These have been moved to the new `@metamask/keyring-sdk` package.
25
+ - `@ethereumjs/tx`, `@metamask/eth-sig-util`, and `async-mutex` are no longer dependencies of this package.
26
+
27
+ ## [21.6.0]
28
+
29
+ ### Added
30
+
31
+ - Add `KeyringType.Money` variant ([#472](https://github.com/MetaMask/accounts/pull/472))
12
32
  - Add optional `details` field to `Transaction` type ([#445](https://github.com/MetaMask/accounts/pull/445))
13
33
  - Add `SecurityAlertResponse` enum with values: `benign`, `warning`, `malicious`
14
34
  - Add optional `origin` field (string) to track transaction request source
@@ -707,7 +727,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
707
727
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
708
728
  - Helper functions to create keyring handler in the snap.
709
729
 
710
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.5.0...HEAD
730
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@22.0.0...HEAD
731
+ [22.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.6.0...@metamask/keyring-api@22.0.0
732
+ [21.6.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.5.0...@metamask/keyring-api@21.6.0
711
733
  [21.5.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.4.0...@metamask/keyring-api@21.5.0
712
734
  [21.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.3.0...@metamask/keyring-api@21.4.0
713
735
  [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,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 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,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,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,KAA/B,+BAA+B,QAqB1C;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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,cAAc,CAC9D,CAAC,KAAU,EAAE,EAAE;IACb,IAAI,CAAC,aAAa,CAAC,KAAK,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 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":"","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;;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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,cAAc,CAC9D,CAAC,KAAU,EAAE,EAAE;IACb,IAAI,CAAC,aAAa,CAAC,KAAK,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"]}
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./keyring-capabilities.cjs"), exports);
18
18
  __exportStar(require("./keyring-type.cjs"), exports);
19
+ __exportStar(require("./keyring-rpc.cjs"), exports);
19
20
  __exportStar(require("./create-account/index.cjs"), exports);
20
21
  __exportStar(require("./export-account/index.cjs"), exports);
21
22
  __exportStar(require("./private-key.cjs"), exports);
22
- __exportStar(require("./wrapper/index.cjs"), exports);
23
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B;AAC9B,sDAA0B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\nexport * from './wrapper';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,oDAA8B;AAC9B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
@@ -1,8 +1,8 @@
1
1
  export type * from "./keyring.cjs";
2
2
  export * from "./keyring-capabilities.cjs";
3
3
  export * from "./keyring-type.cjs";
4
+ export * from "./keyring-rpc.cjs";
4
5
  export * from "./create-account/index.cjs";
5
6
  export * from "./export-account/index.cjs";
6
7
  export * from "./private-key.cjs";
7
- export * from "./wrapper/index.cjs";
8
8
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
@@ -1,8 +1,8 @@
1
1
  export type * from "./keyring.mjs";
2
2
  export * from "./keyring-capabilities.mjs";
3
3
  export * from "./keyring-type.mjs";
4
+ export * from "./keyring-rpc.mjs";
4
5
  export * from "./create-account/index.mjs";
5
6
  export * from "./export-account/index.mjs";
6
7
  export * from "./private-key.mjs";
7
- export * from "./wrapper/index.mjs";
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
@@ -1,7 +1,7 @@
1
1
  export * from "./keyring-capabilities.mjs";
2
2
  export * from "./keyring-type.mjs";
3
+ export * from "./keyring-rpc.mjs";
3
4
  export * from "./create-account/index.mjs";
4
5
  export * from "./export-account/index.mjs";
5
6
  export * from "./private-key.mjs";
6
- export * from "./wrapper/index.mjs";
7
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\nexport * from './wrapper';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubmitRequestV2ResponseStruct = exports.SubmitRequestV2RequestStruct = exports.ExportAccountV2ResponseStruct = exports.ExportAccountV2RequestStruct = exports.DeleteAccountV2ResponseStruct = exports.DeleteAccountV2RequestStruct = exports.CreateAccountsV2ResponseStruct = exports.CreateAccountsV2RequestStruct = exports.GetAccountV2ResponseStruct = exports.GetAccountV2RequestStruct = exports.GetAccountsV2ResponseStruct = exports.GetAccountsV2RequestStruct = exports.KeyringRpcV2Method = void 0;
4
+ exports.isKeyringRpcV2Method = isKeyringRpcV2Method;
5
+ const keyring_utils_1 = require("@metamask/keyring-utils");
6
+ const superstruct_1 = require("@metamask/superstruct");
7
+ const utils_1 = require("@metamask/utils");
8
+ const create_account_1 = require("./create-account/index.cjs");
9
+ const export_account_1 = require("./export-account/index.cjs");
10
+ const account_1 = require("../account.cjs");
11
+ const request_1 = require("../request.cjs");
12
+ /**
13
+ * Keyring RPC methods used by the API.
14
+ */
15
+ exports.KeyringRpcV2Method = {
16
+ GetAccounts: 'keyring_getAccounts',
17
+ CreateAccounts: 'keyring_createAccounts',
18
+ // Inherited from v1 (but method signatures may differ...):
19
+ // NOTE: We use literals here to avoid circular dependencies.
20
+ GetAccount: 'keyring_getAccount',
21
+ DeleteAccount: 'keyring_deleteAccount',
22
+ ExportAccount: 'keyring_exportAccount',
23
+ SubmitRequest: 'keyring_submitRequest',
24
+ };
25
+ /**
26
+ * Check if a method is a keyring RPC method (v2).
27
+ *
28
+ * @param method - Method to check.
29
+ * @returns Whether the method is a keyring RPC method (v2).
30
+ */
31
+ function isKeyringRpcV2Method(method) {
32
+ return Object.values(exports.KeyringRpcV2Method).includes(method);
33
+ }
34
+ // ----------------------------------------------------------------------------
35
+ const CommonHeader = {
36
+ jsonrpc: (0, superstruct_1.literal)('2.0'),
37
+ id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
38
+ };
39
+ // ----------------------------------------------------------------------------
40
+ // Get accounts
41
+ exports.GetAccountsV2RequestStruct = (0, keyring_utils_1.object)({
42
+ ...CommonHeader,
43
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.GetAccounts}`),
44
+ });
45
+ exports.GetAccountsV2ResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
46
+ // ----------------------------------------------------------------------------
47
+ // Get account
48
+ exports.GetAccountV2RequestStruct = (0, keyring_utils_1.object)({
49
+ ...CommonHeader,
50
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.GetAccount}`),
51
+ params: (0, keyring_utils_1.object)({
52
+ id: keyring_utils_1.UuidStruct,
53
+ }),
54
+ });
55
+ exports.GetAccountV2ResponseStruct = account_1.KeyringAccountStruct;
56
+ // ----------------------------------------------------------------------------
57
+ // Create accounts
58
+ exports.CreateAccountsV2RequestStruct = (0, keyring_utils_1.object)({
59
+ ...CommonHeader,
60
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.CreateAccounts}`),
61
+ params: create_account_1.CreateAccountOptionsStruct,
62
+ });
63
+ exports.CreateAccountsV2ResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
64
+ // ----------------------------------------------------------------------------
65
+ // Delete account
66
+ exports.DeleteAccountV2RequestStruct = (0, keyring_utils_1.object)({
67
+ ...CommonHeader,
68
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.DeleteAccount}`),
69
+ params: (0, keyring_utils_1.object)({
70
+ id: keyring_utils_1.UuidStruct,
71
+ }),
72
+ });
73
+ exports.DeleteAccountV2ResponseStruct = (0, superstruct_1.literal)(null);
74
+ // ----------------------------------------------------------------------------
75
+ // Export account
76
+ exports.ExportAccountV2RequestStruct = (0, keyring_utils_1.object)({
77
+ ...CommonHeader,
78
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.ExportAccount}`),
79
+ params: (0, keyring_utils_1.object)({
80
+ id: keyring_utils_1.UuidStruct,
81
+ options: (0, keyring_utils_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
82
+ }),
83
+ });
84
+ exports.ExportAccountV2ResponseStruct = export_account_1.PrivateKeyExportedAccountStruct;
85
+ // ----------------------------------------------------------------------------
86
+ // Submit request
87
+ exports.SubmitRequestV2RequestStruct = (0, keyring_utils_1.object)({
88
+ ...CommonHeader,
89
+ method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.SubmitRequest}`),
90
+ params: request_1.KeyringRequestStruct,
91
+ });
92
+ exports.SubmitRequestV2ResponseStruct = utils_1.JsonStruct;
93
+ //# sourceMappingURL=keyring-rpc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-rpc.ts"],"names":[],"mappings":";;;AAqDA,oDAMC;AA3DD,2DAA4E;AAE5E,uDAA8E;AAC9E,2CAA6C;AAE7C,+DAA8D;AAC9D,+DAG0B;AAE1B,4CAAkD;AAClD,4CAAkD;AAelD;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,0BAAkB,CAAC,CAAC,QAAQ,CAC/C,MAA4B,CAC7B,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AAEF,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,WAAW,EAAE,CAAC;CACrD,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,mBAAK,EAAC,8BAAoB,CAAC,CAAC;AAIvE,+EAA+E;AAC/E,cAAc;AAED,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,UAAU,EAAE,CAAC;IACnD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,8BAAoB,CAAC;AAI/D,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,6BAA6B,GAAG,IAAA,sBAAM,EAAC;IAClD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,cAAc,EAAE,CAAC;IACvD,MAAM,EAAE,2CAA0B;CACnC,CAAC,CAAC;AAMU,QAAA,8BAA8B,GAAG,IAAA,mBAAK,EAAC,8BAAoB,CAAC,CAAC;AAM1E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,6BAA6B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAM3D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,OAAO,EAAE,IAAA,6BAAa,EAAC,2CAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,6BAA6B,GAAG,gDAA+B,CAAC;AAM7E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,6BAA6B,GAAG,kBAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { KeyringV2 } from './keyring';\nimport { KeyringAccountStruct } from '../account';\nimport { KeyringRequestStruct } from '../request';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpcV2 = {\n getAccount: KeyringV2['getAccount'];\n getAccounts: KeyringV2['getAccounts'];\n createAccounts: KeyringV2['createAccounts'];\n deleteAccount: KeyringV2['deleteAccount'];\n submitRequest: KeyringV2['submitRequest'];\n exportAccount?: KeyringV2['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcV2Method = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcV2Method =\n (typeof KeyringRpcV2Method)[keyof typeof KeyringRpcV2Method];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcV2Method(\n method: string,\n): method is KeyringRpcV2Method {\n return Object.values(KeyringRpcV2Method).includes(\n method as KeyringRpcV2Method,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccounts}`),\n});\n\nexport type GetAccountsV2Request = Infer<typeof GetAccountsV2RequestStruct>;\n\nexport const GetAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsV2Response = Infer<typeof GetAccountsV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountV2Request = Infer<typeof GetAccountV2RequestStruct>;\n\nexport const GetAccountV2ResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountV2Response = Infer<typeof GetAccountV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsV2Request = Infer<\n typeof CreateAccountsV2RequestStruct\n>;\n\nexport const CreateAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsV2Response = Infer<\n typeof CreateAccountsV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountV2Request = Infer<typeof DeleteAccountV2RequestStruct>;\n\nexport const DeleteAccountV2ResponseStruct = literal(null);\n\nexport type DeleteAccountV2Response = Infer<\n typeof DeleteAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountV2Request = Infer<typeof ExportAccountV2RequestStruct>;\n\nexport const ExportAccountV2ResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountV2Response = Infer<\n typeof ExportAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestV2Request = Infer<typeof SubmitRequestV2RequestStruct>;\n\nexport const SubmitRequestV2ResponseStruct = JsonStruct;\n\nexport type SubmitRequestV2Response = Infer<\n typeof SubmitRequestV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcV2Requests =\n | GetAccountsV2Request\n | GetAccountV2Request\n | CreateAccountsV2Request\n | DeleteAccountV2Request\n | ExportAccountV2Request\n | SubmitRequestV2Request;\n\n/**\n * Extract the proper request type for a given `KeyringRpcV2Method`.\n */\nexport type KeyringRpcV2Request<RpcMethod extends KeyringRpcV2Method> = Extract<\n KeyringRpcV2Requests,\n { method: `${RpcMethod}` }\n>;\n"]}