@metamask/keyring-api 17.3.0 → 17.4.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 (56) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/api/derivation.cjs +6 -0
  3. package/dist/api/derivation.cjs.map +1 -0
  4. package/dist/api/derivation.d.cts +4 -0
  5. package/dist/api/derivation.d.cts.map +1 -0
  6. package/dist/api/derivation.d.mts +4 -0
  7. package/dist/api/derivation.d.mts.map +1 -0
  8. package/dist/api/derivation.mjs +3 -0
  9. package/dist/api/derivation.mjs.map +1 -0
  10. package/dist/api/discovery.cjs +40 -0
  11. package/dist/api/discovery.cjs.map +1 -0
  12. package/dist/api/discovery.d.cts +65 -0
  13. package/dist/api/discovery.d.cts.map +1 -0
  14. package/dist/api/discovery.d.mts +65 -0
  15. package/dist/api/discovery.d.mts.map +1 -0
  16. package/dist/api/discovery.mjs +37 -0
  17. package/dist/api/discovery.mjs.map +1 -0
  18. package/dist/api/entropy.cjs +3 -0
  19. package/dist/api/entropy.cjs.map +1 -0
  20. package/dist/api/entropy.d.cts +5 -0
  21. package/dist/api/entropy.d.cts.map +1 -0
  22. package/dist/api/entropy.d.mts +5 -0
  23. package/dist/api/entropy.d.mts.map +1 -0
  24. package/dist/api/entropy.mjs +2 -0
  25. package/dist/api/entropy.mjs.map +1 -0
  26. package/dist/api/index.cjs +1 -0
  27. package/dist/api/index.cjs.map +1 -1
  28. package/dist/api/index.d.cts +2 -0
  29. package/dist/api/index.d.cts.map +1 -1
  30. package/dist/api/index.d.mts +2 -0
  31. package/dist/api/index.d.mts.map +1 -1
  32. package/dist/api/index.mjs +1 -0
  33. package/dist/api/index.mjs.map +1 -1
  34. package/dist/api/keyring.cjs.map +1 -1
  35. package/dist/api/keyring.d.cts +21 -0
  36. package/dist/api/keyring.d.cts.map +1 -1
  37. package/dist/api/keyring.d.mts +21 -0
  38. package/dist/api/keyring.d.mts.map +1 -1
  39. package/dist/api/keyring.mjs.map +1 -1
  40. package/dist/events.cjs +24 -0
  41. package/dist/events.cjs.map +1 -1
  42. package/dist/events.d.cts +35 -14
  43. package/dist/events.d.cts.map +1 -1
  44. package/dist/events.d.mts +35 -14
  45. package/dist/events.d.mts.map +1 -1
  46. package/dist/events.mjs +24 -0
  47. package/dist/events.mjs.map +1 -1
  48. package/dist/rpc.cjs +14 -1
  49. package/dist/rpc.cjs.map +1 -1
  50. package/dist/rpc.d.cts +39 -0
  51. package/dist/rpc.d.cts.map +1 -1
  52. package/dist/rpc.d.mts +39 -0
  53. package/dist/rpc.d.mts.map +1 -1
  54. package/dist/rpc.mjs +14 -1
  55. package/dist/rpc.mjs.map +1 -1
  56. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [17.4.0]
11
+
12
+ ### Added
13
+
14
+ - Add `discoverAccounts` keyring method ([#266](https://github.com/MetaMask/accounts/pull/266))
15
+ - Add `KeyringEventPayload` utility type to extract payload `KeyringEvent` enum ([#203](https://github.com/MetaMask/accounts/pull/203))
16
+ - Add event payload types ([#203](https://github.com/MetaMask/accounts/pull/203))
17
+
10
18
  ## [17.3.0]
11
19
 
12
20
  ### Added
@@ -553,7 +561,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
553
561
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
554
562
  - Helper functions to create keyring handler in the snap.
555
563
 
556
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.3.0...HEAD
564
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.4.0...HEAD
565
+ [17.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.3.0...@metamask/keyring-api@17.4.0
557
566
  [17.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.1...@metamask/keyring-api@17.3.0
558
567
  [17.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.0...@metamask/keyring-api@17.2.1
559
568
  [17.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.1.0...@metamask/keyring-api@17.2.0
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DerivationPathStruct = void 0;
4
+ const utils_1 = require("@metamask/utils");
5
+ exports.DerivationPathStruct = (0, utils_1.definePattern)('DerivationPath', /^m(?:\/\d+'?)+$/u);
6
+ //# sourceMappingURL=derivation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivation.cjs","sourceRoot":"","sources":["../../src/api/derivation.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAEnC,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAC/C,gBAAgB,EAChB,kBAAkB,CACnB,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nexport const DerivationPathStruct = definePattern<`m/${string}`>(\n 'DerivationPath',\n /^m(?:\\/\\d+'?)+$/u,\n);\n\nexport type DerivationPath = Infer<typeof DerivationPathStruct>;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const DerivationPathStruct: import("@metamask/superstruct").Struct<`m/${string}`, null>;
3
+ export type DerivationPath = Infer<typeof DerivationPathStruct>;
4
+ //# sourceMappingURL=derivation.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivation.d.cts","sourceRoot":"","sources":["../../src/api/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,oBAAoB,6DAGhC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const DerivationPathStruct: import("@metamask/superstruct").Struct<`m/${string}`, null>;
3
+ export type DerivationPath = Infer<typeof DerivationPathStruct>;
4
+ //# sourceMappingURL=derivation.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivation.d.mts","sourceRoot":"","sources":["../../src/api/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,oBAAoB,6DAGhC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { definePattern } from "@metamask/utils";
2
+ export const DerivationPathStruct = definePattern('DerivationPath', /^m(?:\/\d+'?)+$/u);
3
+ //# sourceMappingURL=derivation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivation.mjs","sourceRoot":"","sources":["../../src/api/derivation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,gBAAgB,EAChB,kBAAkB,CACnB,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nexport const DerivationPathStruct = definePattern<`m/${string}`>(\n 'DerivationPath',\n /^m(?:\\/\\d+'?)+$/u,\n);\n\nexport type DerivationPath = Infer<typeof DerivationPathStruct>;\n"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscoveredAccountStruct = exports.DiscoveredBip44AccountStruct = exports.DiscoveredAccountType = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const caip_1 = require("./caip.cjs");
6
+ const derivation_1 = require("./derivation.cjs");
7
+ /**
8
+ * Account type tag.
9
+ *
10
+ * The main use of this enum is to tag the {@link DiscoveredAccount} type for
11
+ * future use.
12
+ */
13
+ var DiscoveredAccountType;
14
+ (function (DiscoveredAccountType) {
15
+ // BIP-44 compatible accounts.
16
+ DiscoveredAccountType["Bip44"] = "bip44";
17
+ })(DiscoveredAccountType || (exports.DiscoveredAccountType = DiscoveredAccountType = {}));
18
+ /**
19
+ * This struct represents a discovered BIP-44 compatible account.
20
+ *
21
+ * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at
22
+ * least 1 segment.
23
+ */
24
+ exports.DiscoveredBip44AccountStruct = (0, superstruct_1.object)({
25
+ /**
26
+ * Account type.
27
+ */
28
+ type: (0, superstruct_1.literal)(`${DiscoveredAccountType.Bip44}`),
29
+ /**
30
+ * Account supported scopes (CAIP-2 chain IDs).
31
+ */
32
+ scopes: (0, superstruct_1.array)(caip_1.CaipChainIdStruct),
33
+ /**
34
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
35
+ */
36
+ derivationPath: derivation_1.DerivationPathStruct,
37
+ });
38
+ // Could become a union if we have new discovered account type.
39
+ exports.DiscoveredAccountStruct = exports.DiscoveredBip44AccountStruct;
40
+ //# sourceMappingURL=discovery.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.cjs","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D,qCAA2C;AAC3C,iDAAoD;AAEpD;;;;;GAKG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8BAA8B;IAC9B,wCAAe,CAAA;AACjB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAED;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAE/C;;OAEG;IACH,MAAM,EAAE,IAAA,mBAAK,EAAC,wBAAiB,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH,+DAA+D;AAClD,QAAA,uBAAuB,GAAG,oCAA4B,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, literal, object } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from './caip';\nimport { DerivationPathStruct } from './derivation';\n\n/**\n * Account type tag.\n *\n * The main use of this enum is to tag the {@link DiscoveredAccount} type for\n * future use.\n */\nexport enum DiscoveredAccountType {\n // BIP-44 compatible accounts.\n Bip44 = 'bip44',\n}\n\n/**\n * This struct represents a discovered BIP-44 compatible account.\n *\n * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at\n * least 1 segment.\n */\nexport const DiscoveredBip44AccountStruct = object({\n /**\n * Account type.\n */\n type: literal(`${DiscoveredAccountType.Bip44}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: array(CaipChainIdStruct),\n\n /**\n * The derivation path for this account. It MUST HAVE at least 1 segment.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Discovered BIP-44 account object.\n *\n * See {@link TransactionStruct}.\n */\nexport type DiscoveredBip44Account = Infer<typeof DiscoveredBip44AccountStruct>;\n\n// Could become a union if we have new discovered account type.\nexport const DiscoveredAccountStruct = DiscoveredBip44AccountStruct;\n\n/**\n * Discovered account object.\n *\n * See {@link DiscoveredAccountStruct}.\n */\nexport type DiscoveredAccount = Infer<typeof DiscoveredAccountStruct>;\n"]}
@@ -0,0 +1,65 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Account type tag.
4
+ *
5
+ * The main use of this enum is to tag the {@link DiscoveredAccount} type for
6
+ * future use.
7
+ */
8
+ export declare enum DiscoveredAccountType {
9
+ Bip44 = "bip44"
10
+ }
11
+ /**
12
+ * This struct represents a discovered BIP-44 compatible account.
13
+ *
14
+ * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at
15
+ * least 1 segment.
16
+ */
17
+ export declare const DiscoveredBip44AccountStruct: import("@metamask/superstruct").Struct<{
18
+ type: "bip44";
19
+ scopes: `${string}:${string}`[];
20
+ derivationPath: `m/${string}`;
21
+ }, {
22
+ /**
23
+ * Account type.
24
+ */
25
+ type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
26
+ /**
27
+ * Account supported scopes (CAIP-2 chain IDs).
28
+ */
29
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
30
+ /**
31
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
32
+ */
33
+ derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
34
+ }>;
35
+ /**
36
+ * Discovered BIP-44 account object.
37
+ *
38
+ * See {@link TransactionStruct}.
39
+ */
40
+ export type DiscoveredBip44Account = Infer<typeof DiscoveredBip44AccountStruct>;
41
+ export declare const DiscoveredAccountStruct: import("@metamask/superstruct").Struct<{
42
+ type: "bip44";
43
+ scopes: `${string}:${string}`[];
44
+ derivationPath: `m/${string}`;
45
+ }, {
46
+ /**
47
+ * Account type.
48
+ */
49
+ type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
50
+ /**
51
+ * Account supported scopes (CAIP-2 chain IDs).
52
+ */
53
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
54
+ /**
55
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
56
+ */
57
+ derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
58
+ }>;
59
+ /**
60
+ * Discovered account object.
61
+ *
62
+ * See {@link DiscoveredAccountStruct}.
63
+ */
64
+ export type DiscoveredAccount = Infer<typeof DiscoveredAccountStruct>;
65
+ //# sourceMappingURL=discovery.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.cts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;;GAKG;AACH,oBAAY,qBAAqB;IAE/B,KAAK,UAAU;CAChB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B;;;;;IACvC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAGhF,eAAO,MAAM,uBAAuB;;;;;IAxBlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAY8D,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Account type tag.
4
+ *
5
+ * The main use of this enum is to tag the {@link DiscoveredAccount} type for
6
+ * future use.
7
+ */
8
+ export declare enum DiscoveredAccountType {
9
+ Bip44 = "bip44"
10
+ }
11
+ /**
12
+ * This struct represents a discovered BIP-44 compatible account.
13
+ *
14
+ * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at
15
+ * least 1 segment.
16
+ */
17
+ export declare const DiscoveredBip44AccountStruct: import("@metamask/superstruct").Struct<{
18
+ type: "bip44";
19
+ scopes: `${string}:${string}`[];
20
+ derivationPath: `m/${string}`;
21
+ }, {
22
+ /**
23
+ * Account type.
24
+ */
25
+ type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
26
+ /**
27
+ * Account supported scopes (CAIP-2 chain IDs).
28
+ */
29
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
30
+ /**
31
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
32
+ */
33
+ derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
34
+ }>;
35
+ /**
36
+ * Discovered BIP-44 account object.
37
+ *
38
+ * See {@link TransactionStruct}.
39
+ */
40
+ export type DiscoveredBip44Account = Infer<typeof DiscoveredBip44AccountStruct>;
41
+ export declare const DiscoveredAccountStruct: import("@metamask/superstruct").Struct<{
42
+ type: "bip44";
43
+ scopes: `${string}:${string}`[];
44
+ derivationPath: `m/${string}`;
45
+ }, {
46
+ /**
47
+ * Account type.
48
+ */
49
+ type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
50
+ /**
51
+ * Account supported scopes (CAIP-2 chain IDs).
52
+ */
53
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
54
+ /**
55
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
56
+ */
57
+ derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
58
+ }>;
59
+ /**
60
+ * Discovered account object.
61
+ *
62
+ * See {@link DiscoveredAccountStruct}.
63
+ */
64
+ export type DiscoveredAccount = Infer<typeof DiscoveredAccountStruct>;
65
+ //# sourceMappingURL=discovery.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.mts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;;GAKG;AACH,oBAAY,qBAAqB;IAE/B,KAAK,UAAU;CAChB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B;;;;;IACvC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAGhF,eAAO,MAAM,uBAAuB;;;;;IAxBlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAY8D,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { array, literal, object } from "@metamask/superstruct";
2
+ import { CaipChainIdStruct } from "./caip.mjs";
3
+ import { DerivationPathStruct } from "./derivation.mjs";
4
+ /**
5
+ * Account type tag.
6
+ *
7
+ * The main use of this enum is to tag the {@link DiscoveredAccount} type for
8
+ * future use.
9
+ */
10
+ export var DiscoveredAccountType;
11
+ (function (DiscoveredAccountType) {
12
+ // BIP-44 compatible accounts.
13
+ DiscoveredAccountType["Bip44"] = "bip44";
14
+ })(DiscoveredAccountType || (DiscoveredAccountType = {}));
15
+ /**
16
+ * This struct represents a discovered BIP-44 compatible account.
17
+ *
18
+ * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at
19
+ * least 1 segment.
20
+ */
21
+ export const DiscoveredBip44AccountStruct = object({
22
+ /**
23
+ * Account type.
24
+ */
25
+ type: literal(`${DiscoveredAccountType.Bip44}`),
26
+ /**
27
+ * Account supported scopes (CAIP-2 chain IDs).
28
+ */
29
+ scopes: array(CaipChainIdStruct),
30
+ /**
31
+ * The derivation path for this account. It MUST HAVE at least 1 segment.
32
+ */
33
+ derivationPath: DerivationPathStruct,
34
+ });
35
+ // Could become a union if we have new discovered account type.
36
+ export const DiscoveredAccountStruct = DiscoveredBip44AccountStruct;
37
+ //# sourceMappingURL=discovery.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.mjs","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/D,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAC3C,OAAO,EAAE,oBAAoB,EAAE,yBAAqB;AAEpD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8BAA8B;IAC9B,wCAAe,CAAA;AACjB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAE/C;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC;AASH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, literal, object } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from './caip';\nimport { DerivationPathStruct } from './derivation';\n\n/**\n * Account type tag.\n *\n * The main use of this enum is to tag the {@link DiscoveredAccount} type for\n * future use.\n */\nexport enum DiscoveredAccountType {\n // BIP-44 compatible accounts.\n Bip44 = 'bip44',\n}\n\n/**\n * This struct represents a discovered BIP-44 compatible account.\n *\n * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at\n * least 1 segment.\n */\nexport const DiscoveredBip44AccountStruct = object({\n /**\n * Account type.\n */\n type: literal(`${DiscoveredAccountType.Bip44}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: array(CaipChainIdStruct),\n\n /**\n * The derivation path for this account. It MUST HAVE at least 1 segment.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Discovered BIP-44 account object.\n *\n * See {@link TransactionStruct}.\n */\nexport type DiscoveredBip44Account = Infer<typeof DiscoveredBip44AccountStruct>;\n\n// Could become a union if we have new discovered account type.\nexport const DiscoveredAccountStruct = DiscoveredBip44AccountStruct;\n\n/**\n * Discovered account object.\n *\n * See {@link DiscoveredAccountStruct}.\n */\nexport type DiscoveredAccount = Infer<typeof DiscoveredAccountStruct>;\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=entropy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.cjs","sourceRoot":"","sources":["../../src/api/entropy.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Entropy source ID.\n */\nexport type EntropySourceId = string;\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Entropy source ID.
3
+ */
4
+ export type EntropySourceId = string;
5
+ //# sourceMappingURL=entropy.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.d.cts","sourceRoot":"","sources":["../../src/api/entropy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Entropy source ID.
3
+ */
4
+ export type EntropySourceId = string;
5
+ //# sourceMappingURL=entropy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.d.mts","sourceRoot":"","sources":["../../src/api/entropy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entropy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.mjs","sourceRoot":"","sources":["../../src/api/entropy.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Entropy source ID.\n */\nexport type EntropySourceId = string;\n"]}
@@ -19,6 +19,7 @@ __exportStar(require("./address.cjs"), exports);
19
19
  __exportStar(require("./asset.cjs"), exports);
20
20
  __exportStar(require("./balance.cjs"), exports);
21
21
  __exportStar(require("./caip.cjs"), exports);
22
+ __exportStar(require("./discovery.cjs"), exports);
22
23
  __exportStar(require("./export.cjs"), exports);
23
24
  __exportStar(require("./request.cjs"), exports);
24
25
  __exportStar(require("./response.cjs"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B;AAC7B,gDAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,kDAA4B;AAE5B,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B;AAC7B,gDAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
@@ -3,6 +3,8 @@ export * from "./address.cjs";
3
3
  export * from "./asset.cjs";
4
4
  export * from "./balance.cjs";
5
5
  export * from "./caip.cjs";
6
+ export * from "./discovery.cjs";
7
+ export type * from "./entropy.cjs";
6
8
  export * from "./export.cjs";
7
9
  export * from "./request.cjs";
8
10
  export * from "./response.cjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
@@ -3,6 +3,8 @@ export * from "./address.mjs";
3
3
  export * from "./asset.mjs";
4
4
  export * from "./balance.mjs";
5
5
  export * from "./caip.mjs";
6
+ export * from "./discovery.mjs";
7
+ export type * from "./entropy.mjs";
6
8
  export * from "./export.mjs";
7
9
  export * from "./request.mjs";
8
10
  export * from "./response.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
@@ -3,6 +3,7 @@ export * from "./address.mjs";
3
3
  export * from "./asset.mjs";
4
4
  export * from "./balance.mjs";
5
5
  export * from "./caip.mjs";
6
+ export * from "./discovery.mjs";
6
7
  export * from "./export.mjs";
7
8
  export * from "./request.mjs";
8
9
  export * from "./response.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAE5B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
1
+ {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { DiscoveredAccount } from './discovery';\nimport type { EntropySourceId } from './entropy';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Discover accounts.\n *\n * This method is called by the client to allow the keyring to discover\n * existing accounts based on the provided scopes and entropy source ID. Are\n * considered existing accounts, accounts that have at least one transaction,\n * as per BIP-44.\n *\n * The `groupIndex` is used to group accounts with the same value. In\n * strictly BIP-44 wallets, it matches `account_index`, but in wallets that\n * deviate from BIP-44 recommendations, it may align with a different path\n * level for compatibility.\n *\n * @param scopes - The list of scopes for account discovery.\n * @param entropySource - The ID of the entropy source used to derive the accounts.\n * @param groupIndex - The group index that should be used to derive the accounts.\n * @returns A promise resolving to a list of discovered accounts.\n */\n discoverAccounts?(\n scopes: CaipChainId[],\n entropySource: EntropySourceId,\n groupIndex: number,\n ): Promise<DiscoveredAccount[]>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -4,6 +4,8 @@ import type { KeyringAccount } from "./account.cjs";
4
4
  import type { ResolvedAccountAddress } from "./address.cjs";
5
5
  import type { Balance } from "./balance.cjs";
6
6
  import type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "./caip.cjs";
7
+ import type { DiscoveredAccount } from "./discovery.cjs";
8
+ import type { EntropySourceId } from "./entropy.cjs";
7
9
  import type { KeyringAccountData } from "./export.cjs";
8
10
  import type { MetaMaskOptions } from "./options.cjs";
9
11
  import type { Paginated, Pagination } from "./pagination.cjs";
@@ -69,6 +71,25 @@ export type Keyring = {
69
71
  * @returns A promise that resolves to the next page of transactions.
70
72
  */
71
73
  listAccountTransactions?(id: string, pagination: Pagination): Promise<Paginated<Transaction>>;
74
+ /**
75
+ * Discover accounts.
76
+ *
77
+ * This method is called by the client to allow the keyring to discover
78
+ * existing accounts based on the provided scopes and entropy source ID. Are
79
+ * considered existing accounts, accounts that have at least one transaction,
80
+ * as per BIP-44.
81
+ *
82
+ * The `groupIndex` is used to group accounts with the same value. In
83
+ * strictly BIP-44 wallets, it matches `account_index`, but in wallets that
84
+ * deviate from BIP-44 recommendations, it may align with a different path
85
+ * level for compatibility.
86
+ *
87
+ * @param scopes - The list of scopes for account discovery.
88
+ * @param entropySource - The ID of the entropy source used to derive the accounts.
89
+ * @param groupIndex - The group index that should be used to derive the accounts.
90
+ * @returns A promise resolving to a list of discovered accounts.
91
+ */
92
+ discoverAccounts?(scopes: CaipChainId[], entropySource: EntropySourceId, groupIndex: number): Promise<DiscoveredAccount[]>;
72
93
  /**
73
94
  * Retrieve the balances of a given account.
74
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAkB;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAA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ccountAddress } from "./address.mjs";
5
5
  import type { Balance } from "./balance.mjs";
6
6
  import type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "./caip.mjs";
7
+ import type { DiscoveredAccount } from "./discovery.mjs";
8
+ import type { EntropySourceId } from "./entropy.mjs";
7
9
  import type { KeyringAccountData } from "./export.mjs";
8
10
  import type { MetaMaskOptions } from "./options.mjs";
9
11
  import type { Paginated, Pagination } from "./pagination.mjs";
@@ -69,6 +71,25 @@ export type Keyring = {
69
71
  * @returns A promise that resolves to the next page of transactions.
70
72
  */
71
73
  listAccountTransactions?(id: string, pagination: Pagination): Promise<Paginated<Transaction>>;
74
+ /**
75
+ * Discover accounts.
76
+ *
77
+ * This method is called by the client to allow the keyring to discover
78
+ * existing accounts based on the provided scopes and entropy source ID. Are
79
+ * considered existing accounts, accounts that have at least one transaction,
80
+ * as per BIP-44.
81
+ *
82
+ * The `groupIndex` is used to group accounts with the same value. In
83
+ * strictly BIP-44 wallets, it matches `account_index`, but in wallets that
84
+ * deviate from BIP-44 recommendations, it may align with a different path
85
+ * level for compatibility.
86
+ *
87
+ * @param scopes - The list of scopes for account discovery.
88
+ * @param entropySource - The ID of the entropy source used to derive the accounts.
89
+ * @param groupIndex - The group index that should be used to derive the accounts.
90
+ * @returns A promise resolving to a list of discovered accounts.
91
+ */
92
+ discoverAccounts?(scopes: CaipChainId[], entropySource: EntropySourceId, groupIndex: number): Promise<DiscoveredAccount[]>;
72
93
  /**
73
94
  * Retrieve the balances of a given account.
74
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAA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MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { DiscoveredAccount } from './discovery';\nimport type { EntropySourceId } from './entropy';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Discover accounts.\n *\n * This method is called by the client to allow the keyring to discover\n * existing accounts based on the provided scopes and entropy source ID. Are\n * considered existing accounts, accounts that have at least one transaction,\n * as per BIP-44.\n *\n * The `groupIndex` is used to group accounts with the same value. In\n * strictly BIP-44 wallets, it matches `account_index`, but in wallets that\n * deviate from BIP-44 recommendations, it may align with a different path\n * level for compatibility.\n *\n * @param scopes - The list of scopes for account discovery.\n * @param entropySource - The ID of the entropy source used to derive the accounts.\n * @param groupIndex - The group index that should be used to derive the accounts.\n * @returns A promise resolving to a list of discovered accounts.\n */\n discoverAccounts?(\n scopes: CaipChainId[],\n entropySource: EntropySourceId,\n groupIndex: number,\n ): Promise<DiscoveredAccount[]>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}