@metamask-previews/keyring-api 8.1.0-672cc7b

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.
@@ -0,0 +1,24 @@
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("./account"), exports);
18
+ __exportStar(require("./balance"), exports);
19
+ __exportStar(require("./caip"), exports);
20
+ __exportStar(require("./export"), exports);
21
+ __exportStar(require("./keyring"), exports);
22
+ __exportStar(require("./request"), exports);
23
+ __exportStar(require("./response"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './keyring';\nexport * from './request';\nexport * from './response';\n"]}
@@ -0,0 +1,159 @@
1
+ import type { Json } from '@metamask/utils';
2
+ import type { KeyringAccount } from './account';
3
+ import type { Balance } from './balance';
4
+ import type { CaipAssetType } from './caip';
5
+ import type { KeyringAccountData } from './export';
6
+ import type { KeyringRequest } from './request';
7
+ import type { KeyringResponse } from './response';
8
+ /**
9
+ * Keyring interface.
10
+ *
11
+ * Represents the functionality and operations related to managing accounts and
12
+ * handling requests.
13
+ */
14
+ export declare type Keyring = {
15
+ /**
16
+ * List accounts.
17
+ *
18
+ * Retrieves an array of KeyringAccount objects representing the available
19
+ * accounts.
20
+ *
21
+ * @returns A promise that resolves to an array of KeyringAccount objects.
22
+ */
23
+ listAccounts(): Promise<KeyringAccount[]>;
24
+ /**
25
+ * Get an account.
26
+ *
27
+ * Retrieves the KeyringAccount object for the given account ID.
28
+ *
29
+ * @param id - The ID of the account to retrieve.
30
+ * @returns A promise that resolves to the KeyringAccount object if found, or
31
+ * undefined otherwise.
32
+ */
33
+ getAccount(id: string): Promise<KeyringAccount | undefined>;
34
+ /**
35
+ * Create an account.
36
+ *
37
+ * Creates a new account with optional, keyring-defined, account options.
38
+ *
39
+ * @param options - Keyring-defined options for the account (optional).
40
+ * @returns A promise that resolves to the newly created KeyringAccount
41
+ * object without any private information.
42
+ */
43
+ createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
44
+ /**
45
+ * Retrieve the balances of a given account.
46
+ *
47
+ * This method fetches the balances of specified assets for a given account
48
+ * ID. It returns a promise that resolves to an object where the keys are
49
+ * asset types and the values are balance objects containing the amount and
50
+ * unit.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * await keyring.getAccountBalances(
55
+ * '43550276-c7d6-4fac-87c7-00390ad0ce90',
56
+ * ['bip122:000000000019d6689c085ae165831e93/slip44:0']
57
+ * );
58
+ * // Returns something similar to:
59
+ * // {
60
+ * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {
61
+ * // amount: '0.0001',
62
+ * // unit: 'BTC',
63
+ * // }
64
+ * // }
65
+ * ```
66
+ * @param id - ID of the account to retrieve the balances for.
67
+ * @param assets - Array of asset types (CAIP-19) to retrieve balances for.
68
+ * @returns A promise that resolves to an object mapping asset types to their
69
+ * respective balances.
70
+ */
71
+ getAccountBalances?(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
72
+ /**
73
+ * Filter supported chains for a given account.
74
+ *
75
+ * @param id - ID of the account to be checked.
76
+ * @param chains - List of chains (CAIP-2) to be checked.
77
+ * @returns A Promise that resolves to a filtered list of CAIP-2 IDs
78
+ * representing the supported chains.
79
+ */
80
+ filterAccountChains(id: string, chains: string[]): Promise<string[]>;
81
+ /**
82
+ * Update an account.
83
+ *
84
+ * Updates the account with the given account object. Does nothing if the
85
+ * account does not exist.
86
+ *
87
+ * @param account - The updated account object.
88
+ * @returns A promise that resolves when the account is successfully updated.
89
+ */
90
+ updateAccount(account: KeyringAccount): Promise<void>;
91
+ /**
92
+ * Delete an account from the keyring.
93
+ *
94
+ * Deletes the account with the given ID from the keyring.
95
+ *
96
+ * @param id - The ID of the account to delete.
97
+ * @returns A promise that resolves when the account is successfully deleted.
98
+ */
99
+ deleteAccount(id: string): Promise<void>;
100
+ /**
101
+ * Exports an account's private key.
102
+ *
103
+ * If the keyring cannot export a private key, this function should throw an
104
+ * error.
105
+ *
106
+ * @param id - The ID of the account to export.
107
+ * @returns A promise that resolves to the exported account.
108
+ */
109
+ exportAccount?(id: string): Promise<KeyringAccountData>;
110
+ /**
111
+ * List all submitted requests.
112
+ *
113
+ * Retrieves an array of KeyringRequest objects representing the submitted
114
+ * requests.
115
+ *
116
+ * @returns A promise that resolves to an array of KeyringRequest objects.
117
+ */
118
+ listRequests?(): Promise<KeyringRequest[]>;
119
+ /**
120
+ * Get a request.
121
+ *
122
+ * Retrieves the KeyringRequest object for the given request ID.
123
+ *
124
+ * @param id - The ID of the request to retrieve.
125
+ * @returns A promise that resolves to the KeyringRequest object if found, or
126
+ * undefined otherwise.
127
+ */
128
+ getRequest?(id: string): Promise<KeyringRequest | undefined>;
129
+ /**
130
+ * Submit a request.
131
+ *
132
+ * Submits the given KeyringRequest object.
133
+ *
134
+ * @param request - The KeyringRequest object to submit.
135
+ * @returns A promise that resolves to the request response.
136
+ */
137
+ submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
138
+ /**
139
+ * Approve a request.
140
+ *
141
+ * Approves the request with the given ID and sets the response if provided.
142
+ *
143
+ * @param id - The ID of the request to approve.
144
+ * @param data - The response to the request (optional).
145
+ * @returns A promise that resolves when the request is successfully
146
+ * approved.
147
+ */
148
+ approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;
149
+ /**
150
+ * Reject a request.
151
+ *
152
+ * Rejects the request with the given ID.
153
+ *
154
+ * @param id - The ID of the request to reject.
155
+ * @returns A promise that resolves when the request is successfully
156
+ * rejected.
157
+ */
158
+ rejectRequest?(id: string): Promise<void>;
159
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=keyring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.js","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\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).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\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 * 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"]}
@@ -0,0 +1,39 @@
1
+ import type { Infer } from '@metamask/superstruct';
2
+ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
+ id: string;
4
+ scope: string;
5
+ account: string;
6
+ request: {
7
+ method: string;
8
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
9
+ };
10
+ }, {
11
+ /**
12
+ * Keyring request ID (UUIDv4).
13
+ */
14
+ id: import("@metamask/superstruct").Struct<string, null>;
15
+ /**
16
+ * Request's scope (CAIP-2 chain ID).
17
+ */
18
+ scope: import("@metamask/superstruct").Struct<string, null>;
19
+ /**
20
+ * Account ID (UUIDv4).
21
+ */
22
+ account: import("@metamask/superstruct").Struct<string, null>;
23
+ /**
24
+ * Inner request sent by the client application.
25
+ */
26
+ request: import("@metamask/superstruct").Struct<{
27
+ method: string;
28
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
29
+ }, {
30
+ method: import("@metamask/superstruct").Struct<string, null>;
31
+ params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[], null>;
32
+ }>;
33
+ }>;
34
+ /**
35
+ * Keyring request.
36
+ *
37
+ * Represents a request made to the keyring for account-related operations.
38
+ */
39
+ export declare type KeyringRequest = Infer<typeof KeyringRequestStruct>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyringRequestStruct = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const utils_1 = require("@metamask/utils");
6
+ const keyring_utils_1 = require("@metamask/keyring-utils");
7
+ exports.KeyringRequestStruct = (0, keyring_utils_1.object)({
8
+ /**
9
+ * Keyring request ID (UUIDv4).
10
+ */
11
+ id: keyring_utils_1.UuidStruct,
12
+ /**
13
+ * Request's scope (CAIP-2 chain ID).
14
+ */
15
+ scope: (0, superstruct_1.string)(),
16
+ /**
17
+ * Account ID (UUIDv4).
18
+ */
19
+ account: keyring_utils_1.UuidStruct,
20
+ /**
21
+ * Inner request sent by the client application.
22
+ */
23
+ request: (0, keyring_utils_1.object)({
24
+ method: (0, superstruct_1.string)(),
25
+ params: (0, keyring_utils_1.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
26
+ }),
27
+ });
28
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,2DAA4E;AAE/D,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,0BAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,sBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,6BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
@@ -0,0 +1,24 @@
1
+ import type { Infer } from '@metamask/superstruct';
2
+ export declare const KeyringResponseStruct: import("@metamask/superstruct").Struct<{
3
+ pending: true;
4
+ redirect?: {
5
+ message?: string;
6
+ url?: string;
7
+ };
8
+ } | {
9
+ pending: false;
10
+ result: import("@metamask/utils").Json;
11
+ }, null>;
12
+ /**
13
+ * Response to a call to `submitRequest`.
14
+ *
15
+ * Keyring implementations must return a response with `pending: true` if the
16
+ * request will be handled asynchronously. Otherwise, the response must contain
17
+ * the result of the request and `pending: false`.
18
+ *
19
+ * In the asynchronous case, the keyring can return a redirect URL and message
20
+ * to be shown to the user. The user can choose to follow the link or cancel
21
+ * the request. The main use case for this is to redirect the user to the snap
22
+ * dapp to review the request.
23
+ */
24
+ export declare type KeyringResponse = Infer<typeof KeyringResponseStruct>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyringResponseStruct = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const utils_1 = require("@metamask/utils");
6
+ const keyring_utils_1 = require("@metamask/keyring-utils");
7
+ exports.KeyringResponseStruct = (0, superstruct_1.union)([
8
+ (0, keyring_utils_1.object)({
9
+ /**
10
+ * Pending flag.
11
+ *
12
+ * Setting the pending flag to true indicates that the request will be
13
+ * handled asynchronously. The keyring must be called with `approveRequest`
14
+ * or `rejectRequest` to resolve the request.
15
+ */
16
+ pending: (0, superstruct_1.literal)(true),
17
+ /**
18
+ * Redirect URL.
19
+ *
20
+ * If present in the response, MetaMask will display a confirmation dialog
21
+ * with a link to the redirect URL. The user can choose to follow the link
22
+ * or cancel the request.
23
+ */
24
+ redirect: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
25
+ message: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
26
+ url: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
27
+ })),
28
+ }),
29
+ (0, keyring_utils_1.object)({
30
+ /**
31
+ * Pending flag.
32
+ *
33
+ * Setting the pending flag to false indicates that the request will be
34
+ * handled synchronously. The keyring must return the result of the
35
+ * request execution.
36
+ */
37
+ pending: (0, superstruct_1.literal)(false),
38
+ /**
39
+ * Request result.
40
+ */
41
+ result: utils_1.JsonStruct,
42
+ }),
43
+ ]);
44
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAC/D,2CAA6C;AAE7C,2DAAgE;AAEnD,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,6BAAa,EACrB,IAAA,sBAAM,EAAC;YACL,OAAO,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '@metamask/keyring-utils';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Context used by a Keyring implementation.
3
+ */
4
+ export declare type KeyringExecutionContext = {
5
+ /** The chain ID. */
6
+ chainId: string;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=contexts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts.js","sourceRoot":"","sources":["../src/contexts.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Context used by a Keyring implementation.\n */\nexport type KeyringExecutionContext = {\n /** The chain ID. */\n chainId: string;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './api';
2
+ export * from './contexts';
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
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("./api"), exports);
18
+ __exportStar(require("./contexts"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B","sourcesContent":["export * from './api';\nexport * from './contexts';\n"]}
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@metamask-previews/keyring-api",
3
+ "version": "8.1.0-672cc7b",
4
+ "description": "MetaMask Keyring API",
5
+ "keywords": [
6
+ "metamask",
7
+ "keyring",
8
+ "snaps"
9
+ ],
10
+ "homepage": "https://github.com/MetaMask/keyring-api#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/MetaMask/keyring-api/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/MetaMask/keyring-api.git"
17
+ },
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "files": [
21
+ "dist/"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc --build tsconfig.build.json",
25
+ "build:clean": "rimraf dist && yarn build",
26
+ "build:docs": "typedoc",
27
+ "build:force": "tsc --build tsconfig.build.json --force",
28
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-api",
29
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-api",
30
+ "publish:preview": "yarn npm publish --tag preview",
31
+ "test": "yarn test:source && yarn test:types",
32
+ "test:clean": "jest --clearCache",
33
+ "test:source": "jest && jest-it-up",
34
+ "test:types": "tsd",
35
+ "test:verbose": "jest --verbose",
36
+ "test:watch": "jest --watch"
37
+ },
38
+ "dependencies": {
39
+ "@metamask/snaps-sdk": "^6.1.0",
40
+ "@metamask/superstruct": "^3.1.0",
41
+ "@metamask/utils": "^9.1.0",
42
+ "bech32": "^2.0.0",
43
+ "deepmerge": "^4.2.2",
44
+ "uuid": "^9.0.1"
45
+ },
46
+ "devDependencies": {
47
+ "@lavamoat/allow-scripts": "^3.0.4",
48
+ "@lavamoat/preinstall-always-fail": "^2.0.0",
49
+ "@metamask/auto-changelog": "^3.4.4",
50
+ "@metamask/keyring-utils": "0.0.1",
51
+ "@metamask/providers": "^17.1.1",
52
+ "@types/jest": "^29.5.12",
53
+ "@types/node": "^20.12.12",
54
+ "depcheck": "^1.4.7",
55
+ "jest": "^28.1.3",
56
+ "jest-it-up": "^3.1.0",
57
+ "rimraf": "^5.0.7",
58
+ "ts-jest": "^28.0.8",
59
+ "ts-node": "^10.9.2",
60
+ "tsd": "^0.31.0",
61
+ "typedoc": "^0.25.13",
62
+ "typescript": "~4.8.4"
63
+ },
64
+ "peerDependencies": {
65
+ "@metamask/providers": ">=15 <18"
66
+ },
67
+ "engines": {
68
+ "node": "^18.18 || >=20"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public",
72
+ "registry": "https://registry.npmjs.org/"
73
+ },
74
+ "lavamoat": {
75
+ "allowScripts": {
76
+ "@lavamoat/preinstall-always-fail": false,
77
+ "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>keccak": false,
78
+ "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>secp256k1": false
79
+ }
80
+ },
81
+ "tsd": {
82
+ "directory": "src"
83
+ }
84
+ }