@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.
- package/CHANGELOG.md +14 -1
- package/README.md +7 -0
- package/dist/api/account.cjs +15 -1
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +14 -0
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +14 -0
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +14 -0
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/v2/create-account/bip44.cjs +57 -0
- package/dist/api/v2/create-account/bip44.cjs.map +1 -0
- package/dist/api/v2/create-account/bip44.d.cts +83 -0
- package/dist/api/v2/create-account/bip44.d.cts.map +1 -0
- package/dist/api/v2/create-account/bip44.d.mts +83 -0
- package/dist/api/v2/create-account/bip44.d.mts.map +1 -0
- package/dist/api/v2/create-account/bip44.mjs +54 -0
- package/dist/api/v2/create-account/bip44.mjs.map +1 -0
- package/dist/api/v2/create-account/index.cjs +72 -0
- package/dist/api/v2/create-account/index.cjs.map +1 -0
- package/dist/api/v2/create-account/index.d.cts +58 -0
- package/dist/api/v2/create-account/index.d.cts.map +1 -0
- package/dist/api/v2/create-account/index.d.mts +58 -0
- package/dist/api/v2/create-account/index.d.mts.map +1 -0
- package/dist/api/v2/create-account/index.mjs +55 -0
- package/dist/api/v2/create-account/index.mjs.map +1 -0
- package/dist/api/v2/create-account/private-key.cjs +28 -0
- package/dist/api/v2/create-account/private-key.cjs.map +1 -0
- package/dist/api/v2/create-account/private-key.d.cts +45 -0
- package/dist/api/v2/create-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/create-account/private-key.d.mts +45 -0
- package/dist/api/v2/create-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/create-account/private-key.mjs +25 -0
- package/dist/api/v2/create-account/private-key.mjs.map +1 -0
- package/dist/api/v2/export-account/index.cjs +38 -0
- package/dist/api/v2/export-account/index.cjs.map +1 -0
- package/dist/api/v2/export-account/index.d.cts +48 -0
- package/dist/api/v2/export-account/index.d.cts.map +1 -0
- package/dist/api/v2/export-account/index.d.mts +48 -0
- package/dist/api/v2/export-account/index.d.mts.map +1 -0
- package/dist/api/v2/export-account/index.mjs +21 -0
- package/dist/api/v2/export-account/index.mjs.map +1 -0
- package/dist/api/v2/export-account/private-key.cjs +36 -0
- package/dist/api/v2/export-account/private-key.cjs.map +1 -0
- package/dist/api/v2/export-account/private-key.d.cts +53 -0
- package/dist/api/v2/export-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/export-account/private-key.d.mts +53 -0
- package/dist/api/v2/export-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/export-account/private-key.mjs +33 -0
- package/dist/api/v2/export-account/private-key.mjs.map +1 -0
- package/dist/api/v2/index.cjs +22 -0
- package/dist/api/v2/index.cjs.map +1 -0
- package/dist/api/v2/index.d.cts +7 -0
- package/dist/api/v2/index.d.cts.map +1 -0
- package/dist/api/v2/index.d.mts +7 -0
- package/dist/api/v2/index.d.mts.map +1 -0
- package/dist/api/v2/index.mjs +6 -0
- package/dist/api/v2/index.mjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.cjs +46 -0
- package/dist/api/v2/keyring-capabilities.cjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.cts +128 -0
- package/dist/api/v2/keyring-capabilities.d.cts.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.mts +128 -0
- package/dist/api/v2/keyring-capabilities.d.mts.map +1 -0
- package/dist/api/v2/keyring-capabilities.mjs +43 -0
- package/dist/api/v2/keyring-capabilities.mjs.map +1 -0
- package/dist/api/v2/keyring-type.cjs +44 -0
- package/dist/api/v2/keyring-type.cjs.map +1 -0
- package/dist/api/v2/keyring-type.d.cts +40 -0
- package/dist/api/v2/keyring-type.d.cts.map +1 -0
- package/dist/api/v2/keyring-type.d.mts +40 -0
- package/dist/api/v2/keyring-type.d.mts.map +1 -0
- package/dist/api/v2/keyring-type.mjs +41 -0
- package/dist/api/v2/keyring-type.mjs.map +1 -0
- package/dist/api/v2/keyring.cjs +3 -0
- package/dist/api/v2/keyring.cjs.map +1 -0
- package/dist/api/v2/keyring.d.cts +107 -0
- package/dist/api/v2/keyring.d.cts.map +1 -0
- package/dist/api/v2/keyring.d.mts +107 -0
- package/dist/api/v2/keyring.d.mts.map +1 -0
- package/dist/api/v2/keyring.mjs +2 -0
- package/dist/api/v2/keyring.mjs.map +1 -0
- package/dist/api/v2/private-key.cjs +53 -0
- package/dist/api/v2/private-key.cjs.map +1 -0
- package/dist/api/v2/private-key.d.cts +77 -0
- package/dist/api/v2/private-key.d.cts.map +1 -0
- package/dist/api/v2/private-key.d.mts +77 -0
- package/dist/api/v2/private-key.d.mts.map +1 -0
- package/dist/api/v2/private-key.mjs +50 -0
- package/dist/api/v2/private-key.mjs.map +1 -0
- package/dist/trx/types.cjs +4 -0
- package/dist/trx/types.cjs.map +1 -1
- package/dist/trx/types.d.cts +4 -0
- package/dist/trx/types.d.cts.map +1 -1
- package/dist/trx/types.d.mts +4 -0
- package/dist/trx/types.d.mts.map +1 -1
- package/dist/trx/types.mjs +4 -0
- package/dist/trx/types.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportAccountPrivateKeyOptionsStruct = exports.PrivateKeyExportedAccountStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const private_key_1 = require("../private-key.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Struct for {@link PrivateKeyExportedAccount}.
|
|
8
|
+
*/
|
|
9
|
+
exports.PrivateKeyExportedAccountStruct = (0, superstruct_1.object)({
|
|
10
|
+
/**
|
|
11
|
+
* The type of the account export.
|
|
12
|
+
*/
|
|
13
|
+
type: (0, superstruct_1.literal)('private-key'),
|
|
14
|
+
/**
|
|
15
|
+
* The private key of the exported account.
|
|
16
|
+
*/
|
|
17
|
+
privateKey: (0, superstruct_1.string)(),
|
|
18
|
+
/**
|
|
19
|
+
* The encoding of the exported private key.
|
|
20
|
+
*/
|
|
21
|
+
encoding: private_key_1.PrivateKeyEncodingStruct,
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Struct for {@link ExportAccountPrivateKeyOptions}.
|
|
25
|
+
*/
|
|
26
|
+
exports.ExportAccountPrivateKeyOptionsStruct = (0, superstruct_1.object)({
|
|
27
|
+
/**
|
|
28
|
+
* The type of the account export.
|
|
29
|
+
*/
|
|
30
|
+
type: (0, superstruct_1.literal)('private-key'),
|
|
31
|
+
/**
|
|
32
|
+
* The encoding of the exported private key.
|
|
33
|
+
*/
|
|
34
|
+
encoding: private_key_1.PrivateKeyEncodingStruct,
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=private-key.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../../src/api/v2/export-account/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAA4E;AAE5E,oDAA0D;AAE1D;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,sCAAwB;CACnC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,oCAAoC,GAAG,IAAA,oBAAM,EAAC;IACzD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,sCAAwB;CACnC,CAAC,CAAC","sourcesContent":["import { literal, object, string, type Infer } from '@metamask/superstruct';\n\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link PrivateKeyExportedAccount}.\n */\nexport const PrivateKeyExportedAccountStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The private key of the exported account.\n */\n privateKey: string(),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents an account that has been exported using a private key.\n */\nexport type PrivateKeyExportedAccount = Infer<\n typeof PrivateKeyExportedAccountStruct\n>;\n\n/**\n * Struct for {@link ExportAccountPrivateKeyOptions}.\n */\nexport const ExportAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Options for exporting an account's private key.\n */\nexport type ExportAccountPrivateKeyOptions = Infer<\n typeof ExportAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link PrivateKeyExportedAccount}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PrivateKeyExportedAccountStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "private-key";
|
|
7
|
+
encoding: "hexadecimal" | "base58";
|
|
8
|
+
privateKey: string;
|
|
9
|
+
}, {
|
|
10
|
+
/**
|
|
11
|
+
* The type of the account export.
|
|
12
|
+
*/
|
|
13
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
14
|
+
/**
|
|
15
|
+
* The private key of the exported account.
|
|
16
|
+
*/
|
|
17
|
+
privateKey: import("@metamask/superstruct").Struct<string, null>;
|
|
18
|
+
/**
|
|
19
|
+
* The encoding of the exported private key.
|
|
20
|
+
*/
|
|
21
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
22
|
+
hexadecimal: "hexadecimal";
|
|
23
|
+
base58: "base58";
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Represents an account that has been exported using a private key.
|
|
28
|
+
*/
|
|
29
|
+
export type PrivateKeyExportedAccount = Infer<typeof PrivateKeyExportedAccountStruct>;
|
|
30
|
+
/**
|
|
31
|
+
* Struct for {@link ExportAccountPrivateKeyOptions}.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ExportAccountPrivateKeyOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
34
|
+
type: "private-key";
|
|
35
|
+
encoding: "hexadecimal" | "base58";
|
|
36
|
+
}, {
|
|
37
|
+
/**
|
|
38
|
+
* The type of the account export.
|
|
39
|
+
*/
|
|
40
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
41
|
+
/**
|
|
42
|
+
* The encoding of the exported private key.
|
|
43
|
+
*/
|
|
44
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
45
|
+
hexadecimal: "hexadecimal";
|
|
46
|
+
base58: "base58";
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Options for exporting an account's private key.
|
|
51
|
+
*/
|
|
52
|
+
export type ExportAccountPrivateKeyOptions = Infer<typeof ExportAccountPrivateKeyOptionsStruct>;
|
|
53
|
+
//# sourceMappingURL=private-key.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,8BAA8B;AAI5E;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;IAC1C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;IAC/C;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link PrivateKeyExportedAccount}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PrivateKeyExportedAccountStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "private-key";
|
|
7
|
+
encoding: "hexadecimal" | "base58";
|
|
8
|
+
privateKey: string;
|
|
9
|
+
}, {
|
|
10
|
+
/**
|
|
11
|
+
* The type of the account export.
|
|
12
|
+
*/
|
|
13
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
14
|
+
/**
|
|
15
|
+
* The private key of the exported account.
|
|
16
|
+
*/
|
|
17
|
+
privateKey: import("@metamask/superstruct").Struct<string, null>;
|
|
18
|
+
/**
|
|
19
|
+
* The encoding of the exported private key.
|
|
20
|
+
*/
|
|
21
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
22
|
+
hexadecimal: "hexadecimal";
|
|
23
|
+
base58: "base58";
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Represents an account that has been exported using a private key.
|
|
28
|
+
*/
|
|
29
|
+
export type PrivateKeyExportedAccount = Infer<typeof PrivateKeyExportedAccountStruct>;
|
|
30
|
+
/**
|
|
31
|
+
* Struct for {@link ExportAccountPrivateKeyOptions}.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ExportAccountPrivateKeyOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
34
|
+
type: "private-key";
|
|
35
|
+
encoding: "hexadecimal" | "base58";
|
|
36
|
+
}, {
|
|
37
|
+
/**
|
|
38
|
+
* The type of the account export.
|
|
39
|
+
*/
|
|
40
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
41
|
+
/**
|
|
42
|
+
* The encoding of the exported private key.
|
|
43
|
+
*/
|
|
44
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
45
|
+
hexadecimal: "hexadecimal";
|
|
46
|
+
base58: "base58";
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Options for exporting an account's private key.
|
|
51
|
+
*/
|
|
52
|
+
export type ExportAccountPrivateKeyOptions = Infer<typeof ExportAccountPrivateKeyOptionsStruct>;
|
|
53
|
+
//# sourceMappingURL=private-key.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,8BAA8B;AAI5E;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;IAC1C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;IAC/C;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { literal, object, string } from "@metamask/superstruct";
|
|
2
|
+
import { PrivateKeyEncodingStruct } from "../private-key.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Struct for {@link PrivateKeyExportedAccount}.
|
|
5
|
+
*/
|
|
6
|
+
export const PrivateKeyExportedAccountStruct = object({
|
|
7
|
+
/**
|
|
8
|
+
* The type of the account export.
|
|
9
|
+
*/
|
|
10
|
+
type: literal('private-key'),
|
|
11
|
+
/**
|
|
12
|
+
* The private key of the exported account.
|
|
13
|
+
*/
|
|
14
|
+
privateKey: string(),
|
|
15
|
+
/**
|
|
16
|
+
* The encoding of the exported private key.
|
|
17
|
+
*/
|
|
18
|
+
encoding: PrivateKeyEncodingStruct,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Struct for {@link ExportAccountPrivateKeyOptions}.
|
|
22
|
+
*/
|
|
23
|
+
export const ExportAccountPrivateKeyOptionsStruct = object({
|
|
24
|
+
/**
|
|
25
|
+
* The type of the account export.
|
|
26
|
+
*/
|
|
27
|
+
type: literal('private-key'),
|
|
28
|
+
/**
|
|
29
|
+
* The encoding of the exported private key.
|
|
30
|
+
*/
|
|
31
|
+
encoding: PrivateKeyEncodingStruct,
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=private-key.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../../src/api/v2/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAc,8BAA8B;AAE5E,OAAO,EAAE,wBAAwB,EAAE,2BAAuB;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;IACpD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC","sourcesContent":["import { literal, object, string, type Infer } from '@metamask/superstruct';\n\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link PrivateKeyExportedAccount}.\n */\nexport const PrivateKeyExportedAccountStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The private key of the exported account.\n */\n privateKey: string(),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents an account that has been exported using a private key.\n */\nexport type PrivateKeyExportedAccount = Infer<\n typeof PrivateKeyExportedAccountStruct\n>;\n\n/**\n * Struct for {@link ExportAccountPrivateKeyOptions}.\n */\nexport const ExportAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Options for exporting an account's private key.\n */\nexport type ExportAccountPrivateKeyOptions = Infer<\n typeof ExportAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./keyring-capabilities.cjs"), exports);
|
|
18
|
+
__exportStar(require("./keyring-type.cjs"), exports);
|
|
19
|
+
__exportStar(require("./create-account/index.cjs"), exports);
|
|
20
|
+
__exportStar(require("./export-account/index.cjs"), exports);
|
|
21
|
+
__exportStar(require("./private-key.cjs"), exports);
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type * from "./keyring.cjs";
|
|
2
|
+
export * from "./keyring-capabilities.cjs";
|
|
3
|
+
export * from "./keyring-type.cjs";
|
|
4
|
+
export * from "./create-account/index.cjs";
|
|
5
|
+
export * from "./export-account/index.cjs";
|
|
6
|
+
export * from "./private-key.cjs";
|
|
7
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type * from "./keyring.mjs";
|
|
2
|
+
export * from "./keyring-capabilities.mjs";
|
|
3
|
+
export * from "./keyring-type.mjs";
|
|
4
|
+
export * from "./create-account/index.mjs";
|
|
5
|
+
export * from "./export-account/index.mjs";
|
|
6
|
+
export * from "./private-key.mjs";
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyringCapabilitiesStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const private_key_1 = require("./private-key.cjs");
|
|
6
|
+
const caip_1 = require("../caip.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Struct for {@link KeyringCapabilities}.
|
|
9
|
+
*/
|
|
10
|
+
exports.KeyringCapabilitiesStruct = (0, superstruct_1.object)({
|
|
11
|
+
/**
|
|
12
|
+
* List of CAIP-2 chain IDs that this keyring supports.
|
|
13
|
+
*/
|
|
14
|
+
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)(caip_1.CaipChainIdStruct)),
|
|
15
|
+
/**
|
|
16
|
+
* BIP-44 capabilities supported by this keyring.
|
|
17
|
+
*/
|
|
18
|
+
bip44: (0, superstruct_1.exactOptional)((0, superstruct_1.object)({
|
|
19
|
+
/**
|
|
20
|
+
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
|
|
21
|
+
*/
|
|
22
|
+
derivePath: (0, superstruct_1.boolean)(),
|
|
23
|
+
/**
|
|
24
|
+
* Whether the keyring supports deriving accounts from a BIP-44 account index.
|
|
25
|
+
*/
|
|
26
|
+
deriveIndex: (0, superstruct_1.boolean)(),
|
|
27
|
+
/**
|
|
28
|
+
* Whether the keyring supports BIP-44 account discovery.
|
|
29
|
+
*/
|
|
30
|
+
discover: (0, superstruct_1.boolean)(),
|
|
31
|
+
})),
|
|
32
|
+
/**
|
|
33
|
+
* Private key capabilities supported by this keyring.
|
|
34
|
+
*/
|
|
35
|
+
privateKey: (0, superstruct_1.exactOptional)((0, superstruct_1.object)({
|
|
36
|
+
/**
|
|
37
|
+
* List of supported formats for importing private keys.
|
|
38
|
+
*/
|
|
39
|
+
importFormats: (0, superstruct_1.exactOptional)((0, superstruct_1.array)(private_key_1.ImportPrivateKeyFormatStruct)),
|
|
40
|
+
/**
|
|
41
|
+
* List of supported formats for exporting private keys.
|
|
42
|
+
*/
|
|
43
|
+
exportFormats: (0, superstruct_1.exactOptional)((0, superstruct_1.array)(private_key_1.ExportPrivateKeyFormatStruct)),
|
|
44
|
+
})),
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=keyring-capabilities.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B,mDAGuB;AACvB,sCAA4C;AAE5C;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,IAAA,2BAAa,EAClB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,UAAU,EAAE,IAAA,qBAAO,GAAE;QACrB;;WAEG;QACH,WAAW,EAAE,IAAA,qBAAO,GAAE;QACtB;;WAEG;QACH,QAAQ,EAAE,IAAA,qBAAO,GAAE;KACpB,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,IAAA,2BAAa,EACvB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;KAClE,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: boolean(),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: boolean(),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: boolean(),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link KeyringCapabilities}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
scopes: `${string}:${string}`[];
|
|
7
|
+
bip44?: {
|
|
8
|
+
derivePath: boolean;
|
|
9
|
+
deriveIndex: boolean;
|
|
10
|
+
discover: boolean;
|
|
11
|
+
};
|
|
12
|
+
privateKey?: {
|
|
13
|
+
importFormats?: {
|
|
14
|
+
encoding: "hexadecimal" | "base58";
|
|
15
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
16
|
+
}[];
|
|
17
|
+
exportFormats?: {
|
|
18
|
+
encoding: "hexadecimal" | "base58";
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
/**
|
|
23
|
+
* List of CAIP-2 chain IDs that this keyring supports.
|
|
24
|
+
*/
|
|
25
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
26
|
+
/**
|
|
27
|
+
* BIP-44 capabilities supported by this keyring.
|
|
28
|
+
*/
|
|
29
|
+
bip44: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
30
|
+
derivePath: boolean;
|
|
31
|
+
deriveIndex: boolean;
|
|
32
|
+
discover: boolean;
|
|
33
|
+
}, {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
|
|
36
|
+
*/
|
|
37
|
+
derivePath: import("@metamask/superstruct").Struct<boolean, null>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the keyring supports deriving accounts from a BIP-44 account index.
|
|
40
|
+
*/
|
|
41
|
+
deriveIndex: import("@metamask/superstruct").Struct<boolean, null>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the keyring supports BIP-44 account discovery.
|
|
44
|
+
*/
|
|
45
|
+
discover: import("@metamask/superstruct").Struct<boolean, null>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Private key capabilities supported by this keyring.
|
|
49
|
+
*/
|
|
50
|
+
privateKey: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
51
|
+
importFormats?: {
|
|
52
|
+
encoding: "hexadecimal" | "base58";
|
|
53
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
54
|
+
}[];
|
|
55
|
+
exportFormats?: {
|
|
56
|
+
encoding: "hexadecimal" | "base58";
|
|
57
|
+
}[];
|
|
58
|
+
}, {
|
|
59
|
+
/**
|
|
60
|
+
* List of supported formats for importing private keys.
|
|
61
|
+
*/
|
|
62
|
+
importFormats: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
63
|
+
encoding: "hexadecimal" | "base58";
|
|
64
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
65
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
66
|
+
encoding: "hexadecimal" | "base58";
|
|
67
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
68
|
+
}, {
|
|
69
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
70
|
+
hexadecimal: "hexadecimal";
|
|
71
|
+
base58: "base58";
|
|
72
|
+
}>;
|
|
73
|
+
type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
74
|
+
"eip155:eoa": "eip155:eoa";
|
|
75
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
76
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
77
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
78
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
79
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
80
|
+
"solana:data-account": "solana:data-account";
|
|
81
|
+
"tron:eoa": "tron:eoa";
|
|
82
|
+
"any:account": "any:account";
|
|
83
|
+
}>;
|
|
84
|
+
}>>;
|
|
85
|
+
/**
|
|
86
|
+
* List of supported formats for exporting private keys.
|
|
87
|
+
*/
|
|
88
|
+
exportFormats: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
89
|
+
encoding: "hexadecimal" | "base58";
|
|
90
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
91
|
+
encoding: "hexadecimal" | "base58";
|
|
92
|
+
}, {
|
|
93
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
94
|
+
hexadecimal: "hexadecimal";
|
|
95
|
+
base58: "base58";
|
|
96
|
+
}>;
|
|
97
|
+
}>>;
|
|
98
|
+
}>;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Type representing the capabilities supported by a keyring.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const capabilities: KeyringCapabilities = {
|
|
106
|
+
* scopes: ['bip122:_'],
|
|
107
|
+
* bip44: {
|
|
108
|
+
* derivePath: true,
|
|
109
|
+
* deriveIndex: true,
|
|
110
|
+
* discover: true,
|
|
111
|
+
* },
|
|
112
|
+
* privateKey: {
|
|
113
|
+
* importFormats: [
|
|
114
|
+
* { encoding: 'base58', type: 'bip122:p2sh' },
|
|
115
|
+
* { encoding: 'base58', type: 'bip122:p2tr' },
|
|
116
|
+
* { encoding: 'base58', type: 'bip122:p2pkh' },
|
|
117
|
+
* { encoding: 'base58', type: 'bip122:p2wpkh' },
|
|
118
|
+
* ],
|
|
119
|
+
* exportFormats: [
|
|
120
|
+
* { encoding: 'base58' },
|
|
121
|
+
* { encoding: 'base58' },
|
|
122
|
+
* ],
|
|
123
|
+
* },
|
|
124
|
+
* };
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;
|
|
128
|
+
//# sourceMappingURL=keyring-capabilities.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link KeyringCapabilities}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
scopes: `${string}:${string}`[];
|
|
7
|
+
bip44?: {
|
|
8
|
+
derivePath: boolean;
|
|
9
|
+
deriveIndex: boolean;
|
|
10
|
+
discover: boolean;
|
|
11
|
+
};
|
|
12
|
+
privateKey?: {
|
|
13
|
+
importFormats?: {
|
|
14
|
+
encoding: "hexadecimal" | "base58";
|
|
15
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
16
|
+
}[];
|
|
17
|
+
exportFormats?: {
|
|
18
|
+
encoding: "hexadecimal" | "base58";
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
/**
|
|
23
|
+
* List of CAIP-2 chain IDs that this keyring supports.
|
|
24
|
+
*/
|
|
25
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
26
|
+
/**
|
|
27
|
+
* BIP-44 capabilities supported by this keyring.
|
|
28
|
+
*/
|
|
29
|
+
bip44: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
30
|
+
derivePath: boolean;
|
|
31
|
+
deriveIndex: boolean;
|
|
32
|
+
discover: boolean;
|
|
33
|
+
}, {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
|
|
36
|
+
*/
|
|
37
|
+
derivePath: import("@metamask/superstruct").Struct<boolean, null>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the keyring supports deriving accounts from a BIP-44 account index.
|
|
40
|
+
*/
|
|
41
|
+
deriveIndex: import("@metamask/superstruct").Struct<boolean, null>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the keyring supports BIP-44 account discovery.
|
|
44
|
+
*/
|
|
45
|
+
discover: import("@metamask/superstruct").Struct<boolean, null>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Private key capabilities supported by this keyring.
|
|
49
|
+
*/
|
|
50
|
+
privateKey: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
51
|
+
importFormats?: {
|
|
52
|
+
encoding: "hexadecimal" | "base58";
|
|
53
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
54
|
+
}[];
|
|
55
|
+
exportFormats?: {
|
|
56
|
+
encoding: "hexadecimal" | "base58";
|
|
57
|
+
}[];
|
|
58
|
+
}, {
|
|
59
|
+
/**
|
|
60
|
+
* List of supported formats for importing private keys.
|
|
61
|
+
*/
|
|
62
|
+
importFormats: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
63
|
+
encoding: "hexadecimal" | "base58";
|
|
64
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
65
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
66
|
+
encoding: "hexadecimal" | "base58";
|
|
67
|
+
type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
68
|
+
}, {
|
|
69
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
70
|
+
hexadecimal: "hexadecimal";
|
|
71
|
+
base58: "base58";
|
|
72
|
+
}>;
|
|
73
|
+
type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
74
|
+
"eip155:eoa": "eip155:eoa";
|
|
75
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
76
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
77
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
78
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
79
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
80
|
+
"solana:data-account": "solana:data-account";
|
|
81
|
+
"tron:eoa": "tron:eoa";
|
|
82
|
+
"any:account": "any:account";
|
|
83
|
+
}>;
|
|
84
|
+
}>>;
|
|
85
|
+
/**
|
|
86
|
+
* List of supported formats for exporting private keys.
|
|
87
|
+
*/
|
|
88
|
+
exportFormats: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
89
|
+
encoding: "hexadecimal" | "base58";
|
|
90
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
91
|
+
encoding: "hexadecimal" | "base58";
|
|
92
|
+
}, {
|
|
93
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
94
|
+
hexadecimal: "hexadecimal";
|
|
95
|
+
base58: "base58";
|
|
96
|
+
}>;
|
|
97
|
+
}>>;
|
|
98
|
+
}>;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Type representing the capabilities supported by a keyring.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const capabilities: KeyringCapabilities = {
|
|
106
|
+
* scopes: ['bip122:_'],
|
|
107
|
+
* bip44: {
|
|
108
|
+
* derivePath: true,
|
|
109
|
+
* deriveIndex: true,
|
|
110
|
+
* discover: true,
|
|
111
|
+
* },
|
|
112
|
+
* privateKey: {
|
|
113
|
+
* importFormats: [
|
|
114
|
+
* { encoding: 'base58', type: 'bip122:p2sh' },
|
|
115
|
+
* { encoding: 'base58', type: 'bip122:p2tr' },
|
|
116
|
+
* { encoding: 'base58', type: 'bip122:p2pkh' },
|
|
117
|
+
* { encoding: 'base58', type: 'bip122:p2wpkh' },
|
|
118
|
+
* ],
|
|
119
|
+
* exportFormats: [
|
|
120
|
+
* { encoding: 'base58' },
|
|
121
|
+
* { encoding: 'base58' },
|
|
122
|
+
* ],
|
|
123
|
+
* },
|
|
124
|
+
* };
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;
|
|
128
|
+
//# sourceMappingURL=keyring-capabilities.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { array, boolean, exactOptional, nonempty, object } from "@metamask/superstruct";
|
|
2
|
+
import { ExportPrivateKeyFormatStruct, ImportPrivateKeyFormatStruct } from "./private-key.mjs";
|
|
3
|
+
import { CaipChainIdStruct } from "../caip.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Struct for {@link KeyringCapabilities}.
|
|
6
|
+
*/
|
|
7
|
+
export const KeyringCapabilitiesStruct = object({
|
|
8
|
+
/**
|
|
9
|
+
* List of CAIP-2 chain IDs that this keyring supports.
|
|
10
|
+
*/
|
|
11
|
+
scopes: nonempty(array(CaipChainIdStruct)),
|
|
12
|
+
/**
|
|
13
|
+
* BIP-44 capabilities supported by this keyring.
|
|
14
|
+
*/
|
|
15
|
+
bip44: exactOptional(object({
|
|
16
|
+
/**
|
|
17
|
+
* Whether the keyring supports deriving accounts from a specific BIP-44 path.
|
|
18
|
+
*/
|
|
19
|
+
derivePath: boolean(),
|
|
20
|
+
/**
|
|
21
|
+
* Whether the keyring supports deriving accounts from a BIP-44 account index.
|
|
22
|
+
*/
|
|
23
|
+
deriveIndex: boolean(),
|
|
24
|
+
/**
|
|
25
|
+
* Whether the keyring supports BIP-44 account discovery.
|
|
26
|
+
*/
|
|
27
|
+
discover: boolean(),
|
|
28
|
+
})),
|
|
29
|
+
/**
|
|
30
|
+
* Private key capabilities supported by this keyring.
|
|
31
|
+
*/
|
|
32
|
+
privateKey: exactOptional(object({
|
|
33
|
+
/**
|
|
34
|
+
* List of supported formats for importing private keys.
|
|
35
|
+
*/
|
|
36
|
+
importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),
|
|
37
|
+
/**
|
|
38
|
+
* List of supported formats for exporting private keys.
|
|
39
|
+
*/
|
|
40
|
+
exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),
|
|
41
|
+
})),
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=keyring-capabilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,OAAO,EAAE;QACrB;;WAEG;QACH,WAAW,EAAE,OAAO,EAAE;QACtB;;WAEG;QACH,QAAQ,EAAE,OAAO,EAAE;KACpB,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: boolean(),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: boolean(),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: boolean(),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
|