@metamask-previews/keyring-api 8.1.0-38c4bd5
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 +428 -0
- package/README.md +401 -0
- package/dist/JsonRpcRequest.d.ts +16 -0
- package/dist/JsonRpcRequest.js +13 -0
- package/dist/JsonRpcRequest.js.map +1 -0
- package/dist/KeyringClient.d.ts +28 -0
- package/dist/KeyringClient.js +124 -0
- package/dist/KeyringClient.js.map +1 -0
- package/dist/KeyringSnapRpcClient.d.ts +39 -0
- package/dist/KeyringSnapRpcClient.js +68 -0
- package/dist/KeyringSnapRpcClient.js.map +1 -0
- package/dist/api/account.d.ts +62 -0
- package/dist/api/account.js +56 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/balance.d.ts +9 -0
- package/dist/api/balance.js +11 -0
- package/dist/api/balance.js.map +1 -0
- package/dist/api/caip.d.ts +37 -0
- package/dist/api/caip.js +48 -0
- package/dist/api/caip.js.map +1 -0
- package/dist/api/export.d.ts +8 -0
- package/dist/api/export.js +7 -0
- package/dist/api/export.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +24 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/keyring.d.ts +159 -0
- package/dist/api/keyring.js +3 -0
- package/dist/api/keyring.js.map +1 -0
- package/dist/api/request.d.ts +39 -0
- package/dist/api/request.js +29 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/response.d.ts +24 -0
- package/dist/api/response.js +44 -0
- package/dist/api/response.js.map +1 -0
- package/dist/btc/index.d.ts +1 -0
- package/dist/btc/index.js +18 -0
- package/dist/btc/index.js.map +1 -0
- package/dist/btc/types.d.ts +33 -0
- package/dist/btc/types.js +40 -0
- package/dist/btc/types.js.map +1 -0
- package/dist/contexts.d.ts +7 -0
- package/dist/contexts.js +3 -0
- package/dist/contexts.js.map +1 -0
- package/dist/eth/erc4337/index.d.ts +1 -0
- package/dist/eth/erc4337/index.js +18 -0
- package/dist/eth/erc4337/index.js.map +1 -0
- package/dist/eth/erc4337/types.d.ts +96 -0
- package/dist/eth/erc4337/types.js +61 -0
- package/dist/eth/erc4337/types.js.map +1 -0
- package/dist/eth/index.d.ts +3 -0
- package/dist/eth/index.js +20 -0
- package/dist/eth/index.js.map +1 -0
- package/dist/eth/types.d.ts +80 -0
- package/dist/eth/types.js +73 -0
- package/dist/eth/types.js.map +1 -0
- package/dist/eth/utils.d.ts +8 -0
- package/dist/eth/utils.js +15 -0
- package/dist/eth/utils.js.map +1 -0
- package/dist/events.d.ts +10 -0
- package/dist/events.js +17 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/api.d.ts +415 -0
- package/dist/internal/api.js +139 -0
- package/dist/internal/api.js.map +1 -0
- package/dist/internal/eth/EthKeyring.d.ts +33 -0
- package/dist/internal/eth/EthKeyring.js +3 -0
- package/dist/internal/eth/EthKeyring.js.map +1 -0
- package/dist/internal/eth/index.d.ts +1 -0
- package/dist/internal/eth/index.js +18 -0
- package/dist/internal/eth/index.js.map +1 -0
- package/dist/internal/events.d.ts +159 -0
- package/dist/internal/events.js +72 -0
- package/dist/internal/events.js.map +1 -0
- package/dist/internal/index.d.ts +5 -0
- package/dist/internal/index.js +22 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/rpc.d.ts +25 -0
- package/dist/internal/rpc.js +33 -0
- package/dist/internal/rpc.js.map +1 -0
- package/dist/internal/types.d.ts +330 -0
- package/dist/internal/types.js +49 -0
- package/dist/internal/types.js.map +1 -0
- package/dist/rpc-handler.d.ts +29 -0
- package/dist/rpc-handler.js +136 -0
- package/dist/rpc-handler.js.map +1 -0
- package/dist/snap-utils.d.ts +11 -0
- package/dist/snap-utils.js +21 -0
- package/dist/snap-utils.js.map +1 -0
- package/dist/superstruct.d.ts +83 -0
- package/dist/superstruct.js +81 -0
- package/dist/superstruct.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/types.d.ts +17 -0
- package/dist/utils/types.js +29 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/typing.d.ts +32 -0
- package/dist/utils/typing.js +21 -0
- package/dist/utils/typing.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Json, Keyring } from '@metamask/utils';
|
|
2
|
+
import type { KeyringExecutionContext } from '../../contexts';
|
|
3
|
+
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from '../../eth';
|
|
4
|
+
export declare type EthKeyring<State extends Json> = Keyring<State> & {
|
|
5
|
+
/**
|
|
6
|
+
* Convert a base transaction to a base UserOperation.
|
|
7
|
+
*
|
|
8
|
+
* @param address - Address of the sender.
|
|
9
|
+
* @param transactions - Base transactions to include in the UserOperation.
|
|
10
|
+
* @param context - Keyring execution context.
|
|
11
|
+
* @returns A pseudo-UserOperation that can be used to construct a real.
|
|
12
|
+
*/
|
|
13
|
+
prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
|
|
14
|
+
/**
|
|
15
|
+
* Patches properties of a UserOperation. Currently, only the
|
|
16
|
+
* `paymasterAndData` can be patched.
|
|
17
|
+
*
|
|
18
|
+
* @param address - Address of the sender.
|
|
19
|
+
* @param userOp - UserOperation to patch.
|
|
20
|
+
* @param context - Keyring execution context.
|
|
21
|
+
* @returns A patch to apply to the UserOperation.
|
|
22
|
+
*/
|
|
23
|
+
patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
|
|
24
|
+
/**
|
|
25
|
+
* Signs an UserOperation.
|
|
26
|
+
*
|
|
27
|
+
* @param address - Address of the sender.
|
|
28
|
+
* @param userOp - UserOperation to sign.
|
|
29
|
+
* @param context - Keyring execution context.
|
|
30
|
+
* @returns The signature of the UserOperation.
|
|
31
|
+
*/
|
|
32
|
+
signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthKeyring.js","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, Keyring } from '@metamask/utils';\n\nimport type { KeyringExecutionContext } from '../../contexts';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '../../eth';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EthKeyring';
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./EthKeyring"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","sourcesContent":["export * from './EthKeyring';\n"]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
2
|
+
method: "notify:accountCreated";
|
|
3
|
+
params: {
|
|
4
|
+
account: {
|
|
5
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
6
|
+
id: string;
|
|
7
|
+
address: string;
|
|
8
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
9
|
+
methods: string[];
|
|
10
|
+
};
|
|
11
|
+
accountNameSuggestion?: string;
|
|
12
|
+
displayConfirmation?: boolean;
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
|
16
|
+
params: import("@metamask/superstruct").Struct<{
|
|
17
|
+
account: {
|
|
18
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
19
|
+
id: string;
|
|
20
|
+
address: string;
|
|
21
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
22
|
+
methods: string[];
|
|
23
|
+
};
|
|
24
|
+
accountNameSuggestion?: string;
|
|
25
|
+
displayConfirmation?: boolean;
|
|
26
|
+
}, {
|
|
27
|
+
/**
|
|
28
|
+
* New account object.
|
|
29
|
+
*/
|
|
30
|
+
account: import("@metamask/superstruct").Struct<{
|
|
31
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
32
|
+
id: string;
|
|
33
|
+
address: string;
|
|
34
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
35
|
+
methods: string[];
|
|
36
|
+
}, {
|
|
37
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
38
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
|
39
|
+
"eip155:eoa": "eip155:eoa";
|
|
40
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
41
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
42
|
+
}>;
|
|
43
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
44
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
45
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Account name suggestion provided to the MetaMask client.
|
|
49
|
+
*
|
|
50
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
51
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
52
|
+
* client decides to use a different name.
|
|
53
|
+
*/
|
|
54
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct").ExactOptionalTag, null>;
|
|
55
|
+
/**
|
|
56
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
57
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
58
|
+
*/
|
|
59
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct").ExactOptionalTag, null>;
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
63
|
+
method: "notify:accountUpdated";
|
|
64
|
+
params: {
|
|
65
|
+
account: {
|
|
66
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
67
|
+
id: string;
|
|
68
|
+
address: string;
|
|
69
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
70
|
+
methods: string[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
|
75
|
+
params: import("@metamask/superstruct").Struct<{
|
|
76
|
+
account: {
|
|
77
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
78
|
+
id: string;
|
|
79
|
+
address: string;
|
|
80
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
81
|
+
methods: string[];
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
84
|
+
/**
|
|
85
|
+
* Updated account object.
|
|
86
|
+
*/
|
|
87
|
+
account: import("@metamask/superstruct").Struct<{
|
|
88
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
89
|
+
id: string;
|
|
90
|
+
address: string;
|
|
91
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
92
|
+
methods: string[];
|
|
93
|
+
}, {
|
|
94
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
95
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
|
96
|
+
"eip155:eoa": "eip155:eoa";
|
|
97
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
98
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
99
|
+
}>;
|
|
100
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
101
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
102
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
103
|
+
}>;
|
|
104
|
+
}>;
|
|
105
|
+
}>;
|
|
106
|
+
export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
|
|
107
|
+
method: "notify:accountDeleted";
|
|
108
|
+
params: {
|
|
109
|
+
id: string;
|
|
110
|
+
};
|
|
111
|
+
}, {
|
|
112
|
+
method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
|
|
113
|
+
params: import("@metamask/superstruct").Struct<{
|
|
114
|
+
id: string;
|
|
115
|
+
}, {
|
|
116
|
+
/**
|
|
117
|
+
* Deleted account ID.
|
|
118
|
+
*/
|
|
119
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
122
|
+
export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
|
|
123
|
+
method: "notify:requestApproved";
|
|
124
|
+
params: {
|
|
125
|
+
id: string;
|
|
126
|
+
result: import("@metamask/utils").Json;
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
|
|
130
|
+
params: import("@metamask/superstruct").Struct<{
|
|
131
|
+
id: string;
|
|
132
|
+
result: import("@metamask/utils").Json;
|
|
133
|
+
}, {
|
|
134
|
+
/**
|
|
135
|
+
* Request ID.
|
|
136
|
+
*/
|
|
137
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
138
|
+
/**
|
|
139
|
+
* Request result.
|
|
140
|
+
*/
|
|
141
|
+
result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
|
142
|
+
}>;
|
|
143
|
+
}>;
|
|
144
|
+
export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
|
|
145
|
+
method: "notify:requestRejected";
|
|
146
|
+
params: {
|
|
147
|
+
id: string;
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
|
|
151
|
+
params: import("@metamask/superstruct").Struct<{
|
|
152
|
+
id: string;
|
|
153
|
+
}, {
|
|
154
|
+
/**
|
|
155
|
+
* Request ID.
|
|
156
|
+
*/
|
|
157
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
158
|
+
}>;
|
|
159
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestRejectedEventStruct = exports.RequestApprovedEventStruct = exports.AccountDeletedEventStruct = exports.AccountUpdatedEventStruct = exports.AccountCreatedEventStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const utils_1 = require("@metamask/utils");
|
|
6
|
+
const api_1 = require("../api");
|
|
7
|
+
const events_1 = require("../events");
|
|
8
|
+
const superstruct_2 = require("../superstruct");
|
|
9
|
+
const utils_2 = require("../utils");
|
|
10
|
+
exports.AccountCreatedEventStruct = (0, superstruct_2.object)({
|
|
11
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
|
|
12
|
+
params: (0, superstruct_2.object)({
|
|
13
|
+
/**
|
|
14
|
+
* New account object.
|
|
15
|
+
*/
|
|
16
|
+
account: api_1.KeyringAccountStruct,
|
|
17
|
+
/**
|
|
18
|
+
* Account name suggestion provided to the MetaMask client.
|
|
19
|
+
*
|
|
20
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
21
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
22
|
+
* client decides to use a different name.
|
|
23
|
+
*/
|
|
24
|
+
accountNameSuggestion: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
|
|
25
|
+
/**
|
|
26
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
27
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
28
|
+
*/
|
|
29
|
+
displayConfirmation: (0, superstruct_2.exactOptional)((0, superstruct_1.boolean)()),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
exports.AccountUpdatedEventStruct = (0, superstruct_2.object)({
|
|
33
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountUpdated}`),
|
|
34
|
+
params: (0, superstruct_2.object)({
|
|
35
|
+
/**
|
|
36
|
+
* Updated account object.
|
|
37
|
+
*/
|
|
38
|
+
account: api_1.KeyringAccountStruct,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
exports.AccountDeletedEventStruct = (0, superstruct_2.object)({
|
|
42
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountDeleted}`),
|
|
43
|
+
params: (0, superstruct_2.object)({
|
|
44
|
+
/**
|
|
45
|
+
* Deleted account ID.
|
|
46
|
+
*/
|
|
47
|
+
id: utils_2.UuidStruct,
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
exports.RequestApprovedEventStruct = (0, superstruct_2.object)({
|
|
51
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestApproved}`),
|
|
52
|
+
params: (0, superstruct_2.object)({
|
|
53
|
+
/**
|
|
54
|
+
* Request ID.
|
|
55
|
+
*/
|
|
56
|
+
id: utils_2.UuidStruct,
|
|
57
|
+
/**
|
|
58
|
+
* Request result.
|
|
59
|
+
*/
|
|
60
|
+
result: utils_1.JsonStruct,
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
exports.RequestRejectedEventStruct = (0, superstruct_2.object)({
|
|
64
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestRejected}`),
|
|
65
|
+
params: (0, superstruct_2.object)({
|
|
66
|
+
/**
|
|
67
|
+
* Request ID.
|
|
68
|
+
*/
|
|
69
|
+
id: utils_2.UuidStruct,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,uDAAiE;AACjE,2CAA6C;AAE7C,gCAA8C;AAC9C,sCAAyC;AACzC,gDAAuD;AACvD,oCAAsC;AAEzB,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\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("./api"), exports);
|
|
18
|
+
__exportStar(require("./eth"), exports);
|
|
19
|
+
__exportStar(require("./events"), exports);
|
|
20
|
+
__exportStar(require("./rpc"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './api';\nexport * from './eth';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyring RPC methods used by the API.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum KeyringRpcMethod {
|
|
5
|
+
ListAccounts = "keyring_listAccounts",
|
|
6
|
+
GetAccount = "keyring_getAccount",
|
|
7
|
+
CreateAccount = "keyring_createAccount",
|
|
8
|
+
GetAccountBalances = "keyring_getAccountBalances",
|
|
9
|
+
FilterAccountChains = "keyring_filterAccountChains",
|
|
10
|
+
UpdateAccount = "keyring_updateAccount",
|
|
11
|
+
DeleteAccount = "keyring_deleteAccount",
|
|
12
|
+
ExportAccount = "keyring_exportAccount",
|
|
13
|
+
ListRequests = "keyring_listRequests",
|
|
14
|
+
GetRequest = "keyring_getRequest",
|
|
15
|
+
SubmitRequest = "keyring_submitRequest",
|
|
16
|
+
ApproveRequest = "keyring_approveRequest",
|
|
17
|
+
RejectRequest = "keyring_rejectRequest"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check if a method is a keyring RPC method.
|
|
21
|
+
*
|
|
22
|
+
* @param method - Method to check.
|
|
23
|
+
* @returns Whether the method is a keyring RPC method.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isKeyringRpcMethod(method: string): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isKeyringRpcMethod = exports.KeyringRpcMethod = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Keyring RPC methods used by the API.
|
|
6
|
+
*/
|
|
7
|
+
var KeyringRpcMethod;
|
|
8
|
+
(function (KeyringRpcMethod) {
|
|
9
|
+
KeyringRpcMethod["ListAccounts"] = "keyring_listAccounts";
|
|
10
|
+
KeyringRpcMethod["GetAccount"] = "keyring_getAccount";
|
|
11
|
+
KeyringRpcMethod["CreateAccount"] = "keyring_createAccount";
|
|
12
|
+
KeyringRpcMethod["GetAccountBalances"] = "keyring_getAccountBalances";
|
|
13
|
+
KeyringRpcMethod["FilterAccountChains"] = "keyring_filterAccountChains";
|
|
14
|
+
KeyringRpcMethod["UpdateAccount"] = "keyring_updateAccount";
|
|
15
|
+
KeyringRpcMethod["DeleteAccount"] = "keyring_deleteAccount";
|
|
16
|
+
KeyringRpcMethod["ExportAccount"] = "keyring_exportAccount";
|
|
17
|
+
KeyringRpcMethod["ListRequests"] = "keyring_listRequests";
|
|
18
|
+
KeyringRpcMethod["GetRequest"] = "keyring_getRequest";
|
|
19
|
+
KeyringRpcMethod["SubmitRequest"] = "keyring_submitRequest";
|
|
20
|
+
KeyringRpcMethod["ApproveRequest"] = "keyring_approveRequest";
|
|
21
|
+
KeyringRpcMethod["RejectRequest"] = "keyring_rejectRequest";
|
|
22
|
+
})(KeyringRpcMethod = exports.KeyringRpcMethod || (exports.KeyringRpcMethod = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Check if a method is a keyring RPC method.
|
|
25
|
+
*
|
|
26
|
+
* @param method - Method to check.
|
|
27
|
+
* @returns Whether the method is a keyring RPC method.
|
|
28
|
+
*/
|
|
29
|
+
function isKeyringRpcMethod(method) {
|
|
30
|
+
return Object.values(KeyringRpcMethod).includes(method);
|
|
31
|
+
}
|
|
32
|
+
exports.isKeyringRpcMethod = isKeyringRpcMethod;
|
|
33
|
+
//# sourceMappingURL=rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAdW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAc3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAFD,gDAEC","sourcesContent":["/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
|