@metamask/keyring-api 21.2.0 → 21.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +7 -0
  3. package/dist/api/account.cjs +15 -1
  4. package/dist/api/account.cjs.map +1 -1
  5. package/dist/api/account.d.cts +14 -0
  6. package/dist/api/account.d.cts.map +1 -1
  7. package/dist/api/account.d.mts +14 -0
  8. package/dist/api/account.d.mts.map +1 -1
  9. package/dist/api/account.mjs +14 -0
  10. package/dist/api/account.mjs.map +1 -1
  11. package/dist/api/index.cjs +1 -0
  12. package/dist/api/index.cjs.map +1 -1
  13. package/dist/api/index.d.cts +1 -0
  14. package/dist/api/index.d.cts.map +1 -1
  15. package/dist/api/index.d.mts +1 -0
  16. package/dist/api/index.d.mts.map +1 -1
  17. package/dist/api/index.mjs +1 -0
  18. package/dist/api/index.mjs.map +1 -1
  19. package/dist/api/v2/create-account/bip44.cjs +57 -0
  20. package/dist/api/v2/create-account/bip44.cjs.map +1 -0
  21. package/dist/api/v2/create-account/bip44.d.cts +83 -0
  22. package/dist/api/v2/create-account/bip44.d.cts.map +1 -0
  23. package/dist/api/v2/create-account/bip44.d.mts +83 -0
  24. package/dist/api/v2/create-account/bip44.d.mts.map +1 -0
  25. package/dist/api/v2/create-account/bip44.mjs +54 -0
  26. package/dist/api/v2/create-account/bip44.mjs.map +1 -0
  27. package/dist/api/v2/create-account/index.cjs +72 -0
  28. package/dist/api/v2/create-account/index.cjs.map +1 -0
  29. package/dist/api/v2/create-account/index.d.cts +58 -0
  30. package/dist/api/v2/create-account/index.d.cts.map +1 -0
  31. package/dist/api/v2/create-account/index.d.mts +58 -0
  32. package/dist/api/v2/create-account/index.d.mts.map +1 -0
  33. package/dist/api/v2/create-account/index.mjs +55 -0
  34. package/dist/api/v2/create-account/index.mjs.map +1 -0
  35. package/dist/api/v2/create-account/private-key.cjs +28 -0
  36. package/dist/api/v2/create-account/private-key.cjs.map +1 -0
  37. package/dist/api/v2/create-account/private-key.d.cts +45 -0
  38. package/dist/api/v2/create-account/private-key.d.cts.map +1 -0
  39. package/dist/api/v2/create-account/private-key.d.mts +45 -0
  40. package/dist/api/v2/create-account/private-key.d.mts.map +1 -0
  41. package/dist/api/v2/create-account/private-key.mjs +25 -0
  42. package/dist/api/v2/create-account/private-key.mjs.map +1 -0
  43. package/dist/api/v2/export-account/index.cjs +38 -0
  44. package/dist/api/v2/export-account/index.cjs.map +1 -0
  45. package/dist/api/v2/export-account/index.d.cts +48 -0
  46. package/dist/api/v2/export-account/index.d.cts.map +1 -0
  47. package/dist/api/v2/export-account/index.d.mts +48 -0
  48. package/dist/api/v2/export-account/index.d.mts.map +1 -0
  49. package/dist/api/v2/export-account/index.mjs +21 -0
  50. package/dist/api/v2/export-account/index.mjs.map +1 -0
  51. package/dist/api/v2/export-account/private-key.cjs +36 -0
  52. package/dist/api/v2/export-account/private-key.cjs.map +1 -0
  53. package/dist/api/v2/export-account/private-key.d.cts +53 -0
  54. package/dist/api/v2/export-account/private-key.d.cts.map +1 -0
  55. package/dist/api/v2/export-account/private-key.d.mts +53 -0
  56. package/dist/api/v2/export-account/private-key.d.mts.map +1 -0
  57. package/dist/api/v2/export-account/private-key.mjs +33 -0
  58. package/dist/api/v2/export-account/private-key.mjs.map +1 -0
  59. package/dist/api/v2/index.cjs +22 -0
  60. package/dist/api/v2/index.cjs.map +1 -0
  61. package/dist/api/v2/index.d.cts +7 -0
  62. package/dist/api/v2/index.d.cts.map +1 -0
  63. package/dist/api/v2/index.d.mts +7 -0
  64. package/dist/api/v2/index.d.mts.map +1 -0
  65. package/dist/api/v2/index.mjs +6 -0
  66. package/dist/api/v2/index.mjs.map +1 -0
  67. package/dist/api/v2/keyring-capabilities.cjs +46 -0
  68. package/dist/api/v2/keyring-capabilities.cjs.map +1 -0
  69. package/dist/api/v2/keyring-capabilities.d.cts +128 -0
  70. package/dist/api/v2/keyring-capabilities.d.cts.map +1 -0
  71. package/dist/api/v2/keyring-capabilities.d.mts +128 -0
  72. package/dist/api/v2/keyring-capabilities.d.mts.map +1 -0
  73. package/dist/api/v2/keyring-capabilities.mjs +43 -0
  74. package/dist/api/v2/keyring-capabilities.mjs.map +1 -0
  75. package/dist/api/v2/keyring-type.cjs +44 -0
  76. package/dist/api/v2/keyring-type.cjs.map +1 -0
  77. package/dist/api/v2/keyring-type.d.cts +40 -0
  78. package/dist/api/v2/keyring-type.d.cts.map +1 -0
  79. package/dist/api/v2/keyring-type.d.mts +40 -0
  80. package/dist/api/v2/keyring-type.d.mts.map +1 -0
  81. package/dist/api/v2/keyring-type.mjs +41 -0
  82. package/dist/api/v2/keyring-type.mjs.map +1 -0
  83. package/dist/api/v2/keyring.cjs +3 -0
  84. package/dist/api/v2/keyring.cjs.map +1 -0
  85. package/dist/api/v2/keyring.d.cts +107 -0
  86. package/dist/api/v2/keyring.d.cts.map +1 -0
  87. package/dist/api/v2/keyring.d.mts +107 -0
  88. package/dist/api/v2/keyring.d.mts.map +1 -0
  89. package/dist/api/v2/keyring.mjs +2 -0
  90. package/dist/api/v2/keyring.mjs.map +1 -0
  91. package/dist/api/v2/private-key.cjs +53 -0
  92. package/dist/api/v2/private-key.cjs.map +1 -0
  93. package/dist/api/v2/private-key.d.cts +77 -0
  94. package/dist/api/v2/private-key.d.cts.map +1 -0
  95. package/dist/api/v2/private-key.d.mts +77 -0
  96. package/dist/api/v2/private-key.d.mts.map +1 -0
  97. package/dist/api/v2/private-key.mjs +50 -0
  98. package/dist/api/v2/private-key.mjs.map +1 -0
  99. package/dist/trx/types.cjs +4 -0
  100. package/dist/trx/types.cjs.map +1 -1
  101. package/dist/trx/types.d.cts +4 -0
  102. package/dist/trx/types.d.cts.map +1 -1
  103. package/dist/trx/types.d.mts +4 -0
  104. package/dist/trx/types.d.mts.map +1 -1
  105. package/dist/trx/types.mjs +4 -0
  106. package/dist/trx/types.mjs.map +1 -1
  107. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyringType = void 0;
4
+ /**
5
+ * Enum representing the different types of keyrings supported.
6
+ */
7
+ var KeyringType;
8
+ (function (KeyringType) {
9
+ /**
10
+ * Represents a hierarchical deterministic (HD) keyring.
11
+ */
12
+ KeyringType["Hd"] = "hd";
13
+ /**
14
+ * Represents a keyring that directly stores private keys.
15
+ */
16
+ KeyringType["PrivateKey"] = "private-key";
17
+ /**
18
+ * Represents a keyring that implements the QR protocol.
19
+ *
20
+ * See: https://eips.ethereum.org/EIPS/eip-4527
21
+ */
22
+ KeyringType["Qr"] = "qr";
23
+ /**
24
+ * Represents keyring backed by a Snap.
25
+ */
26
+ KeyringType["Snap"] = "snap";
27
+ /**
28
+ * Represents keyring backed by a Ledger hardware wallet.
29
+ */
30
+ KeyringType["Ledger"] = "ledger";
31
+ /**
32
+ * Represents keyring backed by a Lattice hardware wallet.
33
+ */
34
+ KeyringType["Lattice"] = "lattice";
35
+ /**
36
+ * Represents keyring backed by a Trezor hardware wallet.
37
+ */
38
+ KeyringType["Trezor"] = "trezor";
39
+ /**
40
+ * Represents keyring backed by a OneKey hardware wallet.
41
+ */
42
+ KeyringType["OneKey"] = "onekey";
43
+ })(KeyringType || (exports.KeyringType = KeyringType = {}));
44
+ //# sourceMappingURL=keyring-type.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WA0CX;AA1CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;AACnB,CAAC,EA1CW,WAAW,2BAAX,WAAW,QA0CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n}\n"]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export declare enum KeyringType {
5
+ /**
6
+ * Represents a hierarchical deterministic (HD) keyring.
7
+ */
8
+ Hd = "hd",
9
+ /**
10
+ * Represents a keyring that directly stores private keys.
11
+ */
12
+ PrivateKey = "private-key",
13
+ /**
14
+ * Represents a keyring that implements the QR protocol.
15
+ *
16
+ * See: https://eips.ethereum.org/EIPS/eip-4527
17
+ */
18
+ Qr = "qr",
19
+ /**
20
+ * Represents keyring backed by a Snap.
21
+ */
22
+ Snap = "snap",
23
+ /**
24
+ * Represents keyring backed by a Ledger hardware wallet.
25
+ */
26
+ Ledger = "ledger",
27
+ /**
28
+ * Represents keyring backed by a Lattice hardware wallet.
29
+ */
30
+ Lattice = "lattice",
31
+ /**
32
+ * Represents keyring backed by a Trezor hardware wallet.
33
+ */
34
+ Trezor = "trezor",
35
+ /**
36
+ * Represents keyring backed by a OneKey hardware wallet.
37
+ */
38
+ OneKey = "onekey"
39
+ }
40
+ //# sourceMappingURL=keyring-type.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;CAClB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export declare enum KeyringType {
5
+ /**
6
+ * Represents a hierarchical deterministic (HD) keyring.
7
+ */
8
+ Hd = "hd",
9
+ /**
10
+ * Represents a keyring that directly stores private keys.
11
+ */
12
+ PrivateKey = "private-key",
13
+ /**
14
+ * Represents a keyring that implements the QR protocol.
15
+ *
16
+ * See: https://eips.ethereum.org/EIPS/eip-4527
17
+ */
18
+ Qr = "qr",
19
+ /**
20
+ * Represents keyring backed by a Snap.
21
+ */
22
+ Snap = "snap",
23
+ /**
24
+ * Represents keyring backed by a Ledger hardware wallet.
25
+ */
26
+ Ledger = "ledger",
27
+ /**
28
+ * Represents keyring backed by a Lattice hardware wallet.
29
+ */
30
+ Lattice = "lattice",
31
+ /**
32
+ * Represents keyring backed by a Trezor hardware wallet.
33
+ */
34
+ Trezor = "trezor",
35
+ /**
36
+ * Represents keyring backed by a OneKey hardware wallet.
37
+ */
38
+ OneKey = "onekey"
39
+ }
40
+ //# sourceMappingURL=keyring-type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;CAClB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export var KeyringType;
5
+ (function (KeyringType) {
6
+ /**
7
+ * Represents a hierarchical deterministic (HD) keyring.
8
+ */
9
+ KeyringType["Hd"] = "hd";
10
+ /**
11
+ * Represents a keyring that directly stores private keys.
12
+ */
13
+ KeyringType["PrivateKey"] = "private-key";
14
+ /**
15
+ * Represents a keyring that implements the QR protocol.
16
+ *
17
+ * See: https://eips.ethereum.org/EIPS/eip-4527
18
+ */
19
+ KeyringType["Qr"] = "qr";
20
+ /**
21
+ * Represents keyring backed by a Snap.
22
+ */
23
+ KeyringType["Snap"] = "snap";
24
+ /**
25
+ * Represents keyring backed by a Ledger hardware wallet.
26
+ */
27
+ KeyringType["Ledger"] = "ledger";
28
+ /**
29
+ * Represents keyring backed by a Lattice hardware wallet.
30
+ */
31
+ KeyringType["Lattice"] = "lattice";
32
+ /**
33
+ * Represents keyring backed by a Trezor hardware wallet.
34
+ */
35
+ KeyringType["Trezor"] = "trezor";
36
+ /**
37
+ * Represents keyring backed by a OneKey hardware wallet.
38
+ */
39
+ KeyringType["OneKey"] = "onekey";
40
+ })(KeyringType || (KeyringType = {}));
41
+ //# sourceMappingURL=keyring-type.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WA0CX;AA1CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;AACnB,CAAC,EA1CW,WAAW,KAAX,WAAW,QA0CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=keyring.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { CreateAccountOptions } from './create-account';\nimport type { ExportedAccount, ExportAccountOptions } from './export-account';\nimport type { KeyringCapabilities } from './keyring-capabilities';\nimport type { KeyringType } from './keyring-type';\nimport type { KeyringAccount } from '../account';\nimport type { KeyringRequest } from '../request';\n\n/**\n * The KeyringV2 interface defines methods for managing accounts and signing\n * requests. This interface unifies the existing EVM and Snap keyring interfaces\n * to provide a consistent API for all keyring type.\n *\n * This interface supports both EVM and non-EVM chains, and includes\n * account metadata needed for features like Multi-SRP and Backup and Sync.\n */\nexport type KeyringV2 = {\n /**\n * Type of the keyring.\n */\n type: `${KeyringType}`;\n\n /**\n * List of capabilities supported by the keyring.\n */\n capabilities: KeyringCapabilities;\n\n /**\n * Serialize the keyring state to a JSON object.\n *\n * @returns A promise that resolves to a JSON-serializable representation of\n * the keyring state.\n */\n serialize(): Promise<Json>;\n\n /**\n * Restores the keyring state from a serialized JSON object.\n *\n * @param state - A JSON object representing a serialized keyring state.\n * @returns A promise that resolves when the keyring state has been restored.\n */\n deserialize(state: Json): Promise<void>;\n\n /**\n * Initialize the keyring.\n *\n * This method is called after the constructor to allow the keyring to\n * perform any necessary asynchronous initialization tasks.\n *\n * @returns A promise that resolves when initialization is complete.\n */\n init?(): Promise<void>;\n\n /**\n * Destroy the keyring.\n *\n * This method is called before the keyring is removed from the Keyring\n * Controller, allowing the keyring to perform any necessary cleanup tasks.\n *\n * @returns A promise that resolves when cleanup is complete.\n */\n destroy?(): Promise<void>;\n\n /**\n * Returns all accounts managed by the keyring.\n *\n * @returns A promise that resolves to an array of all accounts managed by\n * this keyring.\n */\n getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Returns the account with the specified ID.\n *\n * @param accountId - ID of the account to retrieve.\n * @returns A promise that resolves to the account with the given ID.\n */\n getAccount(accountId: AccountId): Promise<KeyringAccount>;\n\n /**\n * Creates one or more new accounts according to the provided options.\n *\n * Deterministic account creation MUST be idempotent, meaning that for\n * deterministic algorithms, like BIP-44, calling this method with the same\n * options should always return the same accounts, even if the accounts\n * already exist in the keyring.\n *\n * @param options - Options describing how to create the account(s).\n * @returns A promise that resolves to an array of the created account objects.\n */\n createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;\n\n /**\n * Deletes the account with the specified ID.\n *\n * @param accountId - ID of the account to delete.\n * @returns A promise that resolves when the account has been deleted.\n */\n deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Exports the private key or secret material for the specified account.\n *\n * @param accountId - ID of the account to export.\n * @param options - Optional export options.\n * @returns A promise that resolves to the exported account data.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Submits a request to the keyring.\n *\n * @param request - The `KeyringRequest` object to submit.\n * @returns A promise that resolves to the response for the request.\n */\n submitRequest(request: KeyringRequest): Promise<Json>;\n};\n"]}
@@ -0,0 +1,107 @@
1
+ import type { AccountId } from "@metamask/keyring-utils";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { CreateAccountOptions } from "./create-account/index.cjs";
4
+ import type { ExportedAccount, ExportAccountOptions } from "./export-account/index.cjs";
5
+ import type { KeyringCapabilities } from "./keyring-capabilities.cjs";
6
+ import type { KeyringType } from "./keyring-type.cjs";
7
+ import type { KeyringAccount } from "../account.cjs";
8
+ import type { KeyringRequest } from "../request.cjs";
9
+ /**
10
+ * The KeyringV2 interface defines methods for managing accounts and signing
11
+ * requests. This interface unifies the existing EVM and Snap keyring interfaces
12
+ * to provide a consistent API for all keyring type.
13
+ *
14
+ * This interface supports both EVM and non-EVM chains, and includes
15
+ * account metadata needed for features like Multi-SRP and Backup and Sync.
16
+ */
17
+ export type KeyringV2 = {
18
+ /**
19
+ * Type of the keyring.
20
+ */
21
+ type: `${KeyringType}`;
22
+ /**
23
+ * List of capabilities supported by the keyring.
24
+ */
25
+ capabilities: KeyringCapabilities;
26
+ /**
27
+ * Serialize the keyring state to a JSON object.
28
+ *
29
+ * @returns A promise that resolves to a JSON-serializable representation of
30
+ * the keyring state.
31
+ */
32
+ serialize(): Promise<Json>;
33
+ /**
34
+ * Restores the keyring state from a serialized JSON object.
35
+ *
36
+ * @param state - A JSON object representing a serialized keyring state.
37
+ * @returns A promise that resolves when the keyring state has been restored.
38
+ */
39
+ deserialize(state: Json): Promise<void>;
40
+ /**
41
+ * Initialize the keyring.
42
+ *
43
+ * This method is called after the constructor to allow the keyring to
44
+ * perform any necessary asynchronous initialization tasks.
45
+ *
46
+ * @returns A promise that resolves when initialization is complete.
47
+ */
48
+ init?(): Promise<void>;
49
+ /**
50
+ * Destroy the keyring.
51
+ *
52
+ * This method is called before the keyring is removed from the Keyring
53
+ * Controller, allowing the keyring to perform any necessary cleanup tasks.
54
+ *
55
+ * @returns A promise that resolves when cleanup is complete.
56
+ */
57
+ destroy?(): Promise<void>;
58
+ /**
59
+ * Returns all accounts managed by the keyring.
60
+ *
61
+ * @returns A promise that resolves to an array of all accounts managed by
62
+ * this keyring.
63
+ */
64
+ getAccounts(): Promise<KeyringAccount[]>;
65
+ /**
66
+ * Returns the account with the specified ID.
67
+ *
68
+ * @param accountId - ID of the account to retrieve.
69
+ * @returns A promise that resolves to the account with the given ID.
70
+ */
71
+ getAccount(accountId: AccountId): Promise<KeyringAccount>;
72
+ /**
73
+ * Creates one or more new accounts according to the provided options.
74
+ *
75
+ * Deterministic account creation MUST be idempotent, meaning that for
76
+ * deterministic algorithms, like BIP-44, calling this method with the same
77
+ * options should always return the same accounts, even if the accounts
78
+ * already exist in the keyring.
79
+ *
80
+ * @param options - Options describing how to create the account(s).
81
+ * @returns A promise that resolves to an array of the created account objects.
82
+ */
83
+ createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;
84
+ /**
85
+ * Deletes the account with the specified ID.
86
+ *
87
+ * @param accountId - ID of the account to delete.
88
+ * @returns A promise that resolves when the account has been deleted.
89
+ */
90
+ deleteAccount(accountId: AccountId): Promise<void>;
91
+ /**
92
+ * Exports the private key or secret material for the specified account.
93
+ *
94
+ * @param accountId - ID of the account to export.
95
+ * @param options - Optional export options.
96
+ * @returns A promise that resolves to the exported account data.
97
+ */
98
+ exportAccount?(accountId: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
99
+ /**
100
+ * Submits a request to the keyring.
101
+ *
102
+ * @param request - The `KeyringRequest` object to submit.
103
+ * @returns A promise that resolves to the response for the request.
104
+ */
105
+ submitRequest(request: KeyringRequest): Promise<Json>;
106
+ };
107
+ //# sourceMappingURL=keyring.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,mCAAyB;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,2BAAuB;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,GAAG,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAElC;;;;;OAKG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE1D;;;;;;;;;;OAUG;IACH,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzE;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;;OAMG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC"}
@@ -0,0 +1,107 @@
1
+ import type { AccountId } from "@metamask/keyring-utils";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { CreateAccountOptions } from "./create-account/index.mjs";
4
+ import type { ExportedAccount, ExportAccountOptions } from "./export-account/index.mjs";
5
+ import type { KeyringCapabilities } from "./keyring-capabilities.mjs";
6
+ import type { KeyringType } from "./keyring-type.mjs";
7
+ import type { KeyringAccount } from "../account.mjs";
8
+ import type { KeyringRequest } from "../request.mjs";
9
+ /**
10
+ * The KeyringV2 interface defines methods for managing accounts and signing
11
+ * requests. This interface unifies the existing EVM and Snap keyring interfaces
12
+ * to provide a consistent API for all keyring type.
13
+ *
14
+ * This interface supports both EVM and non-EVM chains, and includes
15
+ * account metadata needed for features like Multi-SRP and Backup and Sync.
16
+ */
17
+ export type KeyringV2 = {
18
+ /**
19
+ * Type of the keyring.
20
+ */
21
+ type: `${KeyringType}`;
22
+ /**
23
+ * List of capabilities supported by the keyring.
24
+ */
25
+ capabilities: KeyringCapabilities;
26
+ /**
27
+ * Serialize the keyring state to a JSON object.
28
+ *
29
+ * @returns A promise that resolves to a JSON-serializable representation of
30
+ * the keyring state.
31
+ */
32
+ serialize(): Promise<Json>;
33
+ /**
34
+ * Restores the keyring state from a serialized JSON object.
35
+ *
36
+ * @param state - A JSON object representing a serialized keyring state.
37
+ * @returns A promise that resolves when the keyring state has been restored.
38
+ */
39
+ deserialize(state: Json): Promise<void>;
40
+ /**
41
+ * Initialize the keyring.
42
+ *
43
+ * This method is called after the constructor to allow the keyring to
44
+ * perform any necessary asynchronous initialization tasks.
45
+ *
46
+ * @returns A promise that resolves when initialization is complete.
47
+ */
48
+ init?(): Promise<void>;
49
+ /**
50
+ * Destroy the keyring.
51
+ *
52
+ * This method is called before the keyring is removed from the Keyring
53
+ * Controller, allowing the keyring to perform any necessary cleanup tasks.
54
+ *
55
+ * @returns A promise that resolves when cleanup is complete.
56
+ */
57
+ destroy?(): Promise<void>;
58
+ /**
59
+ * Returns all accounts managed by the keyring.
60
+ *
61
+ * @returns A promise that resolves to an array of all accounts managed by
62
+ * this keyring.
63
+ */
64
+ getAccounts(): Promise<KeyringAccount[]>;
65
+ /**
66
+ * Returns the account with the specified ID.
67
+ *
68
+ * @param accountId - ID of the account to retrieve.
69
+ * @returns A promise that resolves to the account with the given ID.
70
+ */
71
+ getAccount(accountId: AccountId): Promise<KeyringAccount>;
72
+ /**
73
+ * Creates one or more new accounts according to the provided options.
74
+ *
75
+ * Deterministic account creation MUST be idempotent, meaning that for
76
+ * deterministic algorithms, like BIP-44, calling this method with the same
77
+ * options should always return the same accounts, even if the accounts
78
+ * already exist in the keyring.
79
+ *
80
+ * @param options - Options describing how to create the account(s).
81
+ * @returns A promise that resolves to an array of the created account objects.
82
+ */
83
+ createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;
84
+ /**
85
+ * Deletes the account with the specified ID.
86
+ *
87
+ * @param accountId - ID of the account to delete.
88
+ * @returns A promise that resolves when the account has been deleted.
89
+ */
90
+ deleteAccount(accountId: AccountId): Promise<void>;
91
+ /**
92
+ * Exports the private key or secret material for the specified account.
93
+ *
94
+ * @param accountId - ID of the account to export.
95
+ * @param options - Optional export options.
96
+ * @returns A promise that resolves to the exported account data.
97
+ */
98
+ exportAccount?(accountId: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
99
+ /**
100
+ * Submits a request to the keyring.
101
+ *
102
+ * @param request - The `KeyringRequest` object to submit.
103
+ * @returns A promise that resolves to the response for the request.
104
+ */
105
+ submitRequest(request: KeyringRequest): Promise<Json>;
106
+ };
107
+ //# sourceMappingURL=keyring.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,mCAAyB;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,2BAAuB;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,GAAG,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAElC;;;;;OAKG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE1D;;;;;;;;;;OAUG;IACH,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzE;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;;OAMG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=keyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { CreateAccountOptions } from './create-account';\nimport type { ExportedAccount, ExportAccountOptions } from './export-account';\nimport type { KeyringCapabilities } from './keyring-capabilities';\nimport type { KeyringType } from './keyring-type';\nimport type { KeyringAccount } from '../account';\nimport type { KeyringRequest } from '../request';\n\n/**\n * The KeyringV2 interface defines methods for managing accounts and signing\n * requests. This interface unifies the existing EVM and Snap keyring interfaces\n * to provide a consistent API for all keyring type.\n *\n * This interface supports both EVM and non-EVM chains, and includes\n * account metadata needed for features like Multi-SRP and Backup and Sync.\n */\nexport type KeyringV2 = {\n /**\n * Type of the keyring.\n */\n type: `${KeyringType}`;\n\n /**\n * List of capabilities supported by the keyring.\n */\n capabilities: KeyringCapabilities;\n\n /**\n * Serialize the keyring state to a JSON object.\n *\n * @returns A promise that resolves to a JSON-serializable representation of\n * the keyring state.\n */\n serialize(): Promise<Json>;\n\n /**\n * Restores the keyring state from a serialized JSON object.\n *\n * @param state - A JSON object representing a serialized keyring state.\n * @returns A promise that resolves when the keyring state has been restored.\n */\n deserialize(state: Json): Promise<void>;\n\n /**\n * Initialize the keyring.\n *\n * This method is called after the constructor to allow the keyring to\n * perform any necessary asynchronous initialization tasks.\n *\n * @returns A promise that resolves when initialization is complete.\n */\n init?(): Promise<void>;\n\n /**\n * Destroy the keyring.\n *\n * This method is called before the keyring is removed from the Keyring\n * Controller, allowing the keyring to perform any necessary cleanup tasks.\n *\n * @returns A promise that resolves when cleanup is complete.\n */\n destroy?(): Promise<void>;\n\n /**\n * Returns all accounts managed by the keyring.\n *\n * @returns A promise that resolves to an array of all accounts managed by\n * this keyring.\n */\n getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Returns the account with the specified ID.\n *\n * @param accountId - ID of the account to retrieve.\n * @returns A promise that resolves to the account with the given ID.\n */\n getAccount(accountId: AccountId): Promise<KeyringAccount>;\n\n /**\n * Creates one or more new accounts according to the provided options.\n *\n * Deterministic account creation MUST be idempotent, meaning that for\n * deterministic algorithms, like BIP-44, calling this method with the same\n * options should always return the same accounts, even if the accounts\n * already exist in the keyring.\n *\n * @param options - Options describing how to create the account(s).\n * @returns A promise that resolves to an array of the created account objects.\n */\n createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;\n\n /**\n * Deletes the account with the specified ID.\n *\n * @param accountId - ID of the account to delete.\n * @returns A promise that resolves when the account has been deleted.\n */\n deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Exports the private key or secret material for the specified account.\n *\n * @param accountId - ID of the account to export.\n * @param options - Optional export options.\n * @returns A promise that resolves to the exported account data.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Submits a request to the keyring.\n *\n * @param request - The `KeyringRequest` object to submit.\n * @returns A promise that resolves to the response for the request.\n */\n submitRequest(request: KeyringRequest): Promise<Json>;\n};\n"]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExportPrivateKeyFormatStruct = exports.ImportPrivateKeyFormatStruct = exports.PrivateKeyEncodingStruct = exports.PrivateKeyEncoding = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const account_1 = require("../account.cjs");
6
+ /**
7
+ * Supported encoding formats for private keys.
8
+ */
9
+ var PrivateKeyEncoding;
10
+ (function (PrivateKeyEncoding) {
11
+ /**
12
+ * Hexadecimal encoding format.
13
+ */
14
+ PrivateKeyEncoding["Hexadecimal"] = "hexadecimal";
15
+ /**
16
+ * Base58 encoding format.
17
+ */
18
+ PrivateKeyEncoding["Base58"] = "base58";
19
+ })(PrivateKeyEncoding || (exports.PrivateKeyEncoding = PrivateKeyEncoding = {}));
20
+ /**
21
+ * Struct for {@link PrivateKeyEncoding}.
22
+ */
23
+ exports.PrivateKeyEncodingStruct = (0, superstruct_1.enums)([
24
+ `${PrivateKeyEncoding.Hexadecimal}`,
25
+ `${PrivateKeyEncoding.Base58}`,
26
+ ]);
27
+ /**
28
+ * Struct for {@link ImportPrivateKeyFormat}.
29
+ */
30
+ exports.ImportPrivateKeyFormatStruct = (0, superstruct_1.object)({
31
+ /**
32
+ * Format used to encode the private key as a string.
33
+ */
34
+ encoding: exports.PrivateKeyEncodingStruct,
35
+ /**
36
+ * Type of the account to be created.
37
+ *
38
+ * This field is necessary when there is ambiguity about the type of account
39
+ * to be created from the private key. For example, in Bitcoin, a private key
40
+ * can be used to create multiple types of accounts, such as P2WPKH, or P2TR.
41
+ */
42
+ type: (0, superstruct_1.exactOptional)(account_1.KeyringAccountTypeStruct),
43
+ });
44
+ /**
45
+ * Struct for {@link ExportPrivateKeyFormat}.
46
+ */
47
+ exports.ExportPrivateKeyFormatStruct = (0, superstruct_1.object)({
48
+ /**
49
+ * Format used to encode the private key as a string.
50
+ */
51
+ encoding: exports.PrivateKeyEncodingStruct,
52
+ });
53
+ //# sourceMappingURL=private-key.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAK+B;AAE/B,4CAAsD;AAEtD;;GAEG;AACH,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,iDAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAVW,kBAAkB,kCAAlB,kBAAkB,QAU7B;AAED;;GAEG;AACU,QAAA,wBAAwB,GAAG,IAAA,mBAAK,EAAC;IAC5C,GAAG,kBAAkB,CAAC,WAAW,EAAE;IACnC,GAAG,kBAAkB,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,gCAAwB;IAElC;;;;;;OAMG;IACH,IAAI,EAAE,IAAA,2BAAa,EAAC,kCAAwB,CAAC;CAC9C,CAAC,CAAC;AAOH;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,gCAAwB;CACnC,CAAC,CAAC","sourcesContent":["import {\n enums,\n exactOptional,\n object,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../account';\n\n/**\n * Supported encoding formats for private keys.\n */\nexport enum PrivateKeyEncoding {\n /**\n * Hexadecimal encoding format.\n */\n Hexadecimal = 'hexadecimal',\n\n /**\n * Base58 encoding format.\n */\n Base58 = 'base58',\n}\n\n/**\n * Struct for {@link PrivateKeyEncoding}.\n */\nexport const PrivateKeyEncodingStruct = enums([\n `${PrivateKeyEncoding.Hexadecimal}`,\n `${PrivateKeyEncoding.Base58}`,\n]);\n\n/**\n * Struct for {@link ImportPrivateKeyFormat}.\n */\nexport const ImportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n\n /**\n * Type of the account to be created.\n *\n * This field is necessary when there is ambiguity about the type of account\n * to be created from the private key. For example, in Bitcoin, a private key\n * can be used to create multiple types of accounts, such as P2WPKH, or P2TR.\n */\n type: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Represents the format for importing a private key into a keyring.\n */\nexport type ImportPrivateKeyFormat = Infer<typeof ImportPrivateKeyFormatStruct>;\n\n/**\n * Struct for {@link ExportPrivateKeyFormat}.\n */\nexport const ExportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents the format for exporting a private key from a keyring.\n */\nexport type ExportPrivateKeyFormat = Infer<typeof ExportPrivateKeyFormatStruct>;\n"]}
@@ -0,0 +1,77 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Supported encoding formats for private keys.
4
+ */
5
+ export declare enum PrivateKeyEncoding {
6
+ /**
7
+ * Hexadecimal encoding format.
8
+ */
9
+ Hexadecimal = "hexadecimal",
10
+ /**
11
+ * Base58 encoding format.
12
+ */
13
+ Base58 = "base58"
14
+ }
15
+ /**
16
+ * Struct for {@link PrivateKeyEncoding}.
17
+ */
18
+ export declare const PrivateKeyEncodingStruct: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
19
+ hexadecimal: "hexadecimal";
20
+ base58: "base58";
21
+ }>;
22
+ /**
23
+ * Struct for {@link ImportPrivateKeyFormat}.
24
+ */
25
+ export declare const ImportPrivateKeyFormatStruct: import("@metamask/superstruct").Struct<{
26
+ encoding: "hexadecimal" | "base58";
27
+ type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
28
+ }, {
29
+ /**
30
+ * Format used to encode the private key as a string.
31
+ */
32
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
33
+ hexadecimal: "hexadecimal";
34
+ base58: "base58";
35
+ }>;
36
+ /**
37
+ * Type of the account to be created.
38
+ *
39
+ * This field is necessary when there is ambiguity about the type of account
40
+ * to be created from the private key. For example, in Bitcoin, a private key
41
+ * can be used to create multiple types of accounts, such as P2WPKH, or P2TR.
42
+ */
43
+ type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
44
+ "eip155:eoa": "eip155:eoa";
45
+ "eip155:erc4337": "eip155:erc4337";
46
+ "bip122:p2pkh": "bip122:p2pkh";
47
+ "bip122:p2sh": "bip122:p2sh";
48
+ "bip122:p2wpkh": "bip122:p2wpkh";
49
+ "bip122:p2tr": "bip122:p2tr";
50
+ "solana:data-account": "solana:data-account";
51
+ "tron:eoa": "tron:eoa";
52
+ "any:account": "any:account";
53
+ }>;
54
+ }>;
55
+ /**
56
+ * Represents the format for importing a private key into a keyring.
57
+ */
58
+ export type ImportPrivateKeyFormat = Infer<typeof ImportPrivateKeyFormatStruct>;
59
+ /**
60
+ * Struct for {@link ExportPrivateKeyFormat}.
61
+ */
62
+ export declare const ExportPrivateKeyFormatStruct: import("@metamask/superstruct").Struct<{
63
+ encoding: "hexadecimal" | "base58";
64
+ }, {
65
+ /**
66
+ * Format used to encode the private key as a string.
67
+ */
68
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
69
+ hexadecimal: "hexadecimal";
70
+ base58: "base58";
71
+ }>;
72
+ }>;
73
+ /**
74
+ * Represents the format for exporting a private key from a keyring.
75
+ */
76
+ export type ExportPrivateKeyFormat = Infer<typeof ExportPrivateKeyFormatStruct>;
77
+ //# sourceMappingURL=private-key.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;EAGnC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;IACvC;;OAEG;;;;;IAGH;;;;;;OAMG;;;;;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;IACvC;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}