@metamask/keyring-api 0.1.3 → 0.2.1
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 +26 -1
- package/dist/JsonRpcRequest.d.ts +15 -0
- package/dist/JsonRpcRequest.js +18 -0
- package/dist/JsonRpcRequest.js.map +1 -0
- package/dist/{keyring-client.d.ts → KeyringClient.d.ts} +7 -6
- package/dist/{keyring-client.js → KeyringClient.js} +25 -20
- package/dist/KeyringClient.js.map +1 -0
- package/dist/{keyring-snap-controller-client.d.ts → KeyringSnapControllerClient.d.ts} +7 -1
- package/dist/{keyring-snap-controller-client.js → KeyringSnapControllerClient.js} +13 -7
- package/dist/KeyringSnapControllerClient.js.map +1 -0
- package/dist/{keyring-snap-rpc-client.d.ts → KeyringSnapRpcClient.d.ts} +4 -3
- package/dist/{keyring-snap-rpc-client.js → KeyringSnapRpcClient.js} +5 -7
- package/dist/KeyringSnapRpcClient.js.map +1 -0
- package/dist/{keyring-api.d.ts → api.d.ts} +72 -52
- package/dist/api.js +110 -0
- package/dist/api.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 +6 -5
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{keyring-internal-api.d.ts → internal/api.d.ts} +129 -260
- package/dist/internal/api.js +126 -0
- package/dist/internal/api.js.map +1 -0
- package/dist/internal/events.d.ts +162 -0
- package/dist/internal/events.js +58 -0
- package/dist/internal/events.js.map +1 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +19 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/types.d.ts +70 -0
- package/dist/internal/types.js +20 -0
- package/dist/internal/types.js.map +1 -0
- package/dist/{keyring-rpc-dispatcher.d.ts → rpc-handler.d.ts} +17 -2
- package/dist/rpc-handler.js +141 -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/utils.d.ts +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +14 -10
- package/dist/keyring-api.js +0 -81
- package/dist/keyring-api.js.map +0 -1
- package/dist/keyring-client.js.map +0 -1
- package/dist/keyring-internal-api.js +0 -154
- package/dist/keyring-internal-api.js.map +0 -1
- package/dist/keyring-rpc-dispatcher.js +0 -107
- package/dist/keyring-rpc-dispatcher.js.map +0 -1
- package/dist/keyring-snap-controller-client.js.map +0 -1
- package/dist/keyring-snap-rpc-client.js.map +0 -1
@@ -0,0 +1,126 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
|
4
|
+
const utils_1 = require("@metamask/utils");
|
5
|
+
const superstruct_1 = require("superstruct");
|
6
|
+
const api_1 = require("../api");
|
7
|
+
const utils_2 = require("../utils");
|
8
|
+
const CommonHeader = {
|
9
|
+
jsonrpc: (0, superstruct_1.literal)('2.0'),
|
10
|
+
id: utils_2.UuidStruct,
|
11
|
+
};
|
12
|
+
// ----------------------------------------------------------------------------
|
13
|
+
// List accounts
|
14
|
+
exports.ListAccountsRequestStruct = (0, superstruct_1.object)({
|
15
|
+
...CommonHeader,
|
16
|
+
method: (0, superstruct_1.literal)('keyring_listAccounts'),
|
17
|
+
});
|
18
|
+
exports.ListAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
|
19
|
+
// ----------------------------------------------------------------------------
|
20
|
+
// Get account
|
21
|
+
exports.GetAccountRequestStruct = (0, superstruct_1.object)({
|
22
|
+
...CommonHeader,
|
23
|
+
method: (0, superstruct_1.literal)('keyring_getAccount'),
|
24
|
+
params: (0, superstruct_1.object)({
|
25
|
+
id: (0, superstruct_1.string)(),
|
26
|
+
}),
|
27
|
+
});
|
28
|
+
exports.GetAccountResponseStruct = api_1.KeyringAccountStruct;
|
29
|
+
// ----------------------------------------------------------------------------
|
30
|
+
// Create account
|
31
|
+
exports.CreateAccountRequestStruct = (0, superstruct_1.object)({
|
32
|
+
...CommonHeader,
|
33
|
+
method: (0, superstruct_1.literal)('keyring_createAccount'),
|
34
|
+
params: (0, superstruct_1.object)({
|
35
|
+
options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
|
36
|
+
}),
|
37
|
+
});
|
38
|
+
exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
|
39
|
+
// ----------------------------------------------------------------------------
|
40
|
+
// Filter account chains
|
41
|
+
exports.FilterAccountChainsStruct = (0, superstruct_1.object)({
|
42
|
+
...CommonHeader,
|
43
|
+
method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
|
44
|
+
params: (0, superstruct_1.object)({
|
45
|
+
id: (0, superstruct_1.string)(),
|
46
|
+
chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
47
|
+
}),
|
48
|
+
});
|
49
|
+
exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
|
50
|
+
// ----------------------------------------------------------------------------
|
51
|
+
// Update account
|
52
|
+
exports.UpdateAccountRequestStruct = (0, superstruct_1.object)({
|
53
|
+
...CommonHeader,
|
54
|
+
method: (0, superstruct_1.literal)('keyring_updateAccount'),
|
55
|
+
params: (0, superstruct_1.object)({
|
56
|
+
account: api_1.KeyringAccountStruct,
|
57
|
+
}),
|
58
|
+
});
|
59
|
+
exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
|
60
|
+
// ----------------------------------------------------------------------------
|
61
|
+
// Delete account
|
62
|
+
exports.DeleteAccountRequestStruct = (0, superstruct_1.object)({
|
63
|
+
...CommonHeader,
|
64
|
+
method: (0, superstruct_1.literal)('keyring_deleteAccount'),
|
65
|
+
params: (0, superstruct_1.object)({
|
66
|
+
id: (0, superstruct_1.string)(),
|
67
|
+
}),
|
68
|
+
});
|
69
|
+
exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
|
70
|
+
// ----------------------------------------------------------------------------
|
71
|
+
// Export account
|
72
|
+
exports.ExportAccountRequestStruct = (0, superstruct_1.object)({
|
73
|
+
...CommonHeader,
|
74
|
+
method: (0, superstruct_1.literal)('keyring_exportAccount'),
|
75
|
+
params: (0, superstruct_1.object)({
|
76
|
+
id: (0, superstruct_1.string)(),
|
77
|
+
}),
|
78
|
+
});
|
79
|
+
exports.ExportAccountResponseStruct = api_1.KeyringAccountDataStruct;
|
80
|
+
// ----------------------------------------------------------------------------
|
81
|
+
// List requests
|
82
|
+
exports.ListRequestsRequestStruct = (0, superstruct_1.object)({
|
83
|
+
...CommonHeader,
|
84
|
+
method: (0, superstruct_1.literal)('keyring_listRequests'),
|
85
|
+
});
|
86
|
+
exports.ListRequestsResponseStruct = (0, superstruct_1.array)(api_1.KeyringRequestStruct);
|
87
|
+
// ----------------------------------------------------------------------------
|
88
|
+
// Get request
|
89
|
+
exports.GetRequestRequestStruct = (0, superstruct_1.object)({
|
90
|
+
...CommonHeader,
|
91
|
+
method: (0, superstruct_1.literal)('keyring_getRequest'),
|
92
|
+
params: (0, superstruct_1.object)({
|
93
|
+
id: (0, superstruct_1.string)(),
|
94
|
+
}),
|
95
|
+
});
|
96
|
+
exports.GetRequestResponseStruct = api_1.KeyringRequestStruct;
|
97
|
+
// ----------------------------------------------------------------------------
|
98
|
+
// Submit request
|
99
|
+
exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
|
100
|
+
...CommonHeader,
|
101
|
+
method: (0, superstruct_1.literal)('keyring_submitRequest'),
|
102
|
+
params: api_1.KeyringRequestStruct,
|
103
|
+
});
|
104
|
+
exports.SubmitRequestResponseStruct = api_1.KeyringResponseStruct;
|
105
|
+
// ----------------------------------------------------------------------------
|
106
|
+
// Approve request
|
107
|
+
exports.ApproveRequestRequestStruct = (0, superstruct_1.object)({
|
108
|
+
...CommonHeader,
|
109
|
+
method: (0, superstruct_1.literal)('keyring_approveRequest'),
|
110
|
+
params: (0, superstruct_1.object)({
|
111
|
+
id: (0, superstruct_1.string)(),
|
112
|
+
data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
|
113
|
+
}),
|
114
|
+
});
|
115
|
+
exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
|
116
|
+
// ----------------------------------------------------------------------------
|
117
|
+
// Reject request
|
118
|
+
exports.RejectRequestRequestStruct = (0, superstruct_1.object)({
|
119
|
+
...CommonHeader,
|
120
|
+
method: (0, superstruct_1.literal)('keyring_rejectRequest'),
|
121
|
+
params: (0, superstruct_1.object)({
|
122
|
+
id: (0, superstruct_1.string)(),
|
123
|
+
}),
|
124
|
+
});
|
125
|
+
exports.RejectRequestResponseStruct = (0, superstruct_1.literal)(null);
|
126
|
+
//# sourceMappingURL=api.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":"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","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport {\n array,\n literal,\n object,\n record,\n string,\n type Infer,\n} from 'superstruct';\n\nimport {\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: UuidStruct,\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: string(),\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: string(),\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: string(),\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: string(),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: string(),\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: string(),\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: string(),\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
|
2
|
+
method: "event:accountCreated";
|
3
|
+
params: {
|
4
|
+
account: {
|
5
|
+
id: string;
|
6
|
+
address: string;
|
7
|
+
options: Record<string, import("@metamask/utils").Json>;
|
8
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
9
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
10
|
+
};
|
11
|
+
};
|
12
|
+
}, {
|
13
|
+
method: import("superstruct").Struct<"event:accountCreated", "event:accountCreated">;
|
14
|
+
params: import("superstruct").Struct<{
|
15
|
+
account: {
|
16
|
+
id: string;
|
17
|
+
address: string;
|
18
|
+
options: Record<string, import("@metamask/utils").Json>;
|
19
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
20
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
21
|
+
};
|
22
|
+
}, {
|
23
|
+
/**
|
24
|
+
* New account object.
|
25
|
+
*/
|
26
|
+
account: import("superstruct").Struct<{
|
27
|
+
id: string;
|
28
|
+
address: string;
|
29
|
+
options: Record<string, import("@metamask/utils").Json>;
|
30
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
31
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
32
|
+
}, {
|
33
|
+
id: import("superstruct").Struct<string, null>;
|
34
|
+
address: import("superstruct").Struct<string, null>;
|
35
|
+
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
36
|
+
/**
|
37
|
+
* Request result.
|
38
|
+
*/
|
39
|
+
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
40
|
+
personal_sign: "personal_sign";
|
41
|
+
eth_sign: "eth_sign";
|
42
|
+
eth_signTransaction: "eth_signTransaction";
|
43
|
+
eth_signTypedData: "eth_signTypedData";
|
44
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
45
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
46
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
47
|
+
}>>;
|
48
|
+
type: import("superstruct").Struct<"eip155:eoa" | "eip155:eip4337", {
|
49
|
+
"eip155:eoa": "eip155:eoa";
|
50
|
+
"eip155:eip4337": "eip155:eip4337";
|
51
|
+
}>;
|
52
|
+
}>;
|
53
|
+
}>;
|
54
|
+
}>;
|
55
|
+
export declare const AccountUpdatedEventStruct: import("superstruct").Struct<{
|
56
|
+
method: "event:accountUpdated";
|
57
|
+
params: {
|
58
|
+
account: {
|
59
|
+
id: string;
|
60
|
+
address: string;
|
61
|
+
options: Record<string, import("@metamask/utils").Json>;
|
62
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
63
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
64
|
+
};
|
65
|
+
};
|
66
|
+
}, {
|
67
|
+
method: import("superstruct").Struct<"event:accountUpdated", "event:accountUpdated">;
|
68
|
+
params: import("superstruct").Struct<{
|
69
|
+
account: {
|
70
|
+
id: string;
|
71
|
+
address: string;
|
72
|
+
options: Record<string, import("@metamask/utils").Json>;
|
73
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
74
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
75
|
+
};
|
76
|
+
}, {
|
77
|
+
/**
|
78
|
+
* Updated account object.
|
79
|
+
*/
|
80
|
+
account: import("superstruct").Struct<{
|
81
|
+
id: string;
|
82
|
+
address: string;
|
83
|
+
options: Record<string, import("@metamask/utils").Json>;
|
84
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
85
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
86
|
+
}, {
|
87
|
+
id: import("superstruct").Struct<string, null>;
|
88
|
+
address: import("superstruct").Struct<string, null>;
|
89
|
+
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
90
|
+
/**
|
91
|
+
* Request result.
|
92
|
+
*/
|
93
|
+
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
94
|
+
personal_sign: "personal_sign";
|
95
|
+
eth_sign: "eth_sign";
|
96
|
+
eth_signTransaction: "eth_signTransaction";
|
97
|
+
eth_signTypedData: "eth_signTypedData";
|
98
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
99
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
100
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
101
|
+
}>>;
|
102
|
+
type: import("superstruct").Struct<"eip155:eoa" | "eip155:eip4337", {
|
103
|
+
"eip155:eoa": "eip155:eoa";
|
104
|
+
"eip155:eip4337": "eip155:eip4337";
|
105
|
+
}>;
|
106
|
+
}>;
|
107
|
+
}>;
|
108
|
+
}>;
|
109
|
+
export declare const AccountDeletedEventStruct: import("superstruct").Struct<{
|
110
|
+
method: "event:accountDeleted";
|
111
|
+
params: {
|
112
|
+
id: string;
|
113
|
+
};
|
114
|
+
}, {
|
115
|
+
method: import("superstruct").Struct<"event:accountDeleted", "event:accountDeleted">;
|
116
|
+
params: import("superstruct").Struct<{
|
117
|
+
id: string;
|
118
|
+
}, {
|
119
|
+
/**
|
120
|
+
* Deleted account ID.
|
121
|
+
*/
|
122
|
+
id: import("superstruct").Struct<string, null>;
|
123
|
+
}>;
|
124
|
+
}>;
|
125
|
+
export declare const RequestApprovedEventStruct: import("superstruct").Struct<{
|
126
|
+
method: "event:requestApproved";
|
127
|
+
params: {
|
128
|
+
id: string;
|
129
|
+
result: import("@metamask/utils").Json;
|
130
|
+
};
|
131
|
+
}, {
|
132
|
+
method: import("superstruct").Struct<"event:requestApproved", "event:requestApproved">;
|
133
|
+
params: import("superstruct").Struct<{
|
134
|
+
id: string;
|
135
|
+
result: import("@metamask/utils").Json;
|
136
|
+
}, {
|
137
|
+
/**
|
138
|
+
* Request ID.
|
139
|
+
*/
|
140
|
+
id: import("superstruct").Struct<string, null>;
|
141
|
+
/**
|
142
|
+
* Request result.
|
143
|
+
*/
|
144
|
+
result: import("superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
145
|
+
}>;
|
146
|
+
}>;
|
147
|
+
export declare const RequestRejectedEventStruct: import("superstruct").Struct<{
|
148
|
+
method: "event:requestRejected";
|
149
|
+
params: {
|
150
|
+
id: string;
|
151
|
+
};
|
152
|
+
}, {
|
153
|
+
method: import("superstruct").Struct<"event:requestRejected", "event:requestRejected">;
|
154
|
+
params: import("superstruct").Struct<{
|
155
|
+
id: string;
|
156
|
+
}, {
|
157
|
+
/**
|
158
|
+
* Request ID.
|
159
|
+
*/
|
160
|
+
id: import("superstruct").Struct<string, null>;
|
161
|
+
}>;
|
162
|
+
}>;
|
@@ -0,0 +1,58 @@
|
|
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 utils_1 = require("@metamask/utils");
|
5
|
+
const superstruct_1 = require("superstruct");
|
6
|
+
const api_1 = require("../api");
|
7
|
+
const events_1 = require("../events");
|
8
|
+
const utils_2 = require("../utils");
|
9
|
+
exports.AccountCreatedEventStruct = (0, superstruct_1.object)({
|
10
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
|
11
|
+
params: (0, superstruct_1.object)({
|
12
|
+
/**
|
13
|
+
* New account object.
|
14
|
+
*/
|
15
|
+
account: api_1.KeyringAccountStruct,
|
16
|
+
}),
|
17
|
+
});
|
18
|
+
exports.AccountUpdatedEventStruct = (0, superstruct_1.object)({
|
19
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountUpdated}`),
|
20
|
+
params: (0, superstruct_1.object)({
|
21
|
+
/**
|
22
|
+
* Updated account object.
|
23
|
+
*/
|
24
|
+
account: api_1.KeyringAccountStruct,
|
25
|
+
}),
|
26
|
+
});
|
27
|
+
exports.AccountDeletedEventStruct = (0, superstruct_1.object)({
|
28
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountDeleted}`),
|
29
|
+
params: (0, superstruct_1.object)({
|
30
|
+
/**
|
31
|
+
* Deleted account ID.
|
32
|
+
*/
|
33
|
+
id: utils_2.UuidStruct,
|
34
|
+
}),
|
35
|
+
});
|
36
|
+
exports.RequestApprovedEventStruct = (0, superstruct_1.object)({
|
37
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestApproved}`),
|
38
|
+
params: (0, superstruct_1.object)({
|
39
|
+
/**
|
40
|
+
* Request ID.
|
41
|
+
*/
|
42
|
+
id: utils_2.UuidStruct,
|
43
|
+
/**
|
44
|
+
* Request result.
|
45
|
+
*/
|
46
|
+
result: utils_1.JsonStruct,
|
47
|
+
}),
|
48
|
+
});
|
49
|
+
exports.RequestRejectedEventStruct = (0, superstruct_1.object)({
|
50
|
+
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestRejected}`),
|
51
|
+
params: (0, superstruct_1.object)({
|
52
|
+
/**
|
53
|
+
* Request ID.
|
54
|
+
*/
|
55
|
+
id: utils_2.UuidStruct,
|
56
|
+
}),
|
57
|
+
});
|
58
|
+
//# sourceMappingURL=events.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,6CAA8C;AAE9C,gCAA8C;AAC9C,sCAAyC;AACzC,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;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,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 { JsonStruct } from '@metamask/utils';\nimport { literal, object } from 'superstruct';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\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\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,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("./types"), exports);
|
19
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './api';\nexport * from './types';\n"]}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { type Infer } from 'superstruct';
|
2
|
+
export declare const InternalAccountStruct: import("superstruct").Struct<{
|
3
|
+
id: string;
|
4
|
+
address: string;
|
5
|
+
options: Record<string, import("@metamask/utils").Json>;
|
6
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
7
|
+
type: "eip155:eoa" | "eip155:eip4337";
|
8
|
+
metadata: {
|
9
|
+
name: string;
|
10
|
+
keyring: {
|
11
|
+
type: string;
|
12
|
+
};
|
13
|
+
snap?: {
|
14
|
+
id: string;
|
15
|
+
enabled: boolean;
|
16
|
+
name: string;
|
17
|
+
} | undefined;
|
18
|
+
};
|
19
|
+
}, {
|
20
|
+
metadata: import("superstruct").Struct<{
|
21
|
+
name: string;
|
22
|
+
keyring: {
|
23
|
+
type: string;
|
24
|
+
};
|
25
|
+
snap?: {
|
26
|
+
id: string;
|
27
|
+
enabled: boolean;
|
28
|
+
name: string;
|
29
|
+
} | undefined;
|
30
|
+
}, {
|
31
|
+
snap: import("superstruct").Struct<{
|
32
|
+
id: string;
|
33
|
+
enabled: boolean;
|
34
|
+
name: string;
|
35
|
+
} | undefined, {
|
36
|
+
id: import("superstruct").Struct<string, null>;
|
37
|
+
enabled: import("superstruct").Struct<boolean, null>;
|
38
|
+
name: import("superstruct").Struct<string, null>;
|
39
|
+
}>;
|
40
|
+
name: import("superstruct").Struct<string, null>;
|
41
|
+
keyring: import("superstruct").Struct<{
|
42
|
+
type: string;
|
43
|
+
}, {
|
44
|
+
type: import("superstruct").Struct<string, null>;
|
45
|
+
}>;
|
46
|
+
}>;
|
47
|
+
id: import("superstruct").Struct<string, null>;
|
48
|
+
address: import("superstruct").Struct<string, null>;
|
49
|
+
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
50
|
+
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
51
|
+
personal_sign: "personal_sign";
|
52
|
+
eth_sign: "eth_sign";
|
53
|
+
eth_signTransaction: "eth_signTransaction";
|
54
|
+
eth_signTypedData: "eth_signTypedData";
|
55
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
56
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
57
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
58
|
+
}>>;
|
59
|
+
type: import("superstruct").Struct<"eip155:eoa" | "eip155:eip4337", {
|
60
|
+
"eip155:eoa": "eip155:eoa";
|
61
|
+
"eip155:eip4337": "eip155:eip4337";
|
62
|
+
}>;
|
63
|
+
}>;
|
64
|
+
/**
|
65
|
+
* Internal account representation.
|
66
|
+
*
|
67
|
+
* This type is used internally by MetaMask to add additional metadata to the
|
68
|
+
* account object. It's should not be used by external applications.
|
69
|
+
*/
|
70
|
+
export declare type InternalAccount = Infer<typeof InternalAccountStruct>;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InternalAccountStruct = void 0;
|
4
|
+
const superstruct_1 = require("superstruct");
|
5
|
+
const api_1 = require("../api");
|
6
|
+
exports.InternalAccountStruct = (0, superstruct_1.object)({
|
7
|
+
...api_1.KeyringAccountStruct.schema,
|
8
|
+
metadata: (0, superstruct_1.object)({
|
9
|
+
snap: (0, superstruct_1.optional)((0, superstruct_1.object)({
|
10
|
+
id: (0, superstruct_1.string)(),
|
11
|
+
enabled: (0, superstruct_1.boolean)(),
|
12
|
+
name: (0, superstruct_1.string)(),
|
13
|
+
})),
|
14
|
+
name: (0, superstruct_1.string)(),
|
15
|
+
keyring: (0, superstruct_1.object)({
|
16
|
+
type: (0, superstruct_1.string)(),
|
17
|
+
}),
|
18
|
+
}),
|
19
|
+
});
|
20
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AAAA,6CAA4E;AAE5E,gCAA8C;AAEjC,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,sBAAQ,EACZ,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, object, optional, string, type Infer } from 'superstruct';\n\nimport { KeyringAccountStruct } from '../api';\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n metadata: object({\n snap: optional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n name: string(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { OnRpcRequestHandler } from '@metamask/snaps-utils';
|
2
|
-
import {
|
3
|
-
import type { Keyring } from './
|
2
|
+
import type { Json } from '@metamask/utils';
|
3
|
+
import type { Keyring } from './api';
|
4
|
+
import { type JsonRpcRequest } from './JsonRpcRequest';
|
4
5
|
/**
|
5
6
|
* Error thrown when a keyring JSON-RPC method is not supported.
|
6
7
|
*/
|
@@ -20,6 +21,20 @@ export declare class MethodNotSupportedError extends Error {
|
|
20
21
|
* @returns A handler that chains the given handlers.
|
21
22
|
*/
|
22
23
|
export declare function buildHandlersChain(...handlers: OnRpcRequestHandler[]): OnRpcRequestHandler;
|
24
|
+
export declare enum KeyringRpcMethod {
|
25
|
+
ListAccounts = "keyring_listAccounts",
|
26
|
+
GetAccount = "keyring_getAccount",
|
27
|
+
CreateAccount = "keyring_createAccount",
|
28
|
+
FilterAccountChains = "keyring_filterAccountChains",
|
29
|
+
UpdateAccount = "keyring_updateAccount",
|
30
|
+
DeleteAccount = "keyring_deleteAccount",
|
31
|
+
ExportAccount = "keyring_exportAccount",
|
32
|
+
ListRequests = "keyring_listRequests",
|
33
|
+
GetRequest = "keyring_getRequest",
|
34
|
+
SubmitRequest = "keyring_submitRequest",
|
35
|
+
ApproveRequest = "keyring_approveRequest",
|
36
|
+
RejectRequest = "keyring_rejectRequest"
|
37
|
+
}
|
23
38
|
/**
|
24
39
|
* Handles a keyring JSON-RPC request.
|
25
40
|
*
|