@metamask-previews/keyring-api 8.1.0-preview-46bb5ff → 8.1.3-d5a036e
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 +2 -2
- package/dist/JsonRpcRequest.js +3 -3
- package/dist/JsonRpcRequest.js.map +1 -1
- package/dist/KeyringClient.d.ts +1 -1
- package/dist/KeyringClient.js +10 -10
- package/dist/KeyringClient.js.map +1 -1
- package/dist/KeyringSnapRpcClient.js.map +1 -1
- package/dist/api/account.d.ts +3 -3
- package/dist/api/account.js +6 -5
- package/dist/api/account.js.map +1 -1
- package/dist/api/balance.d.ts +1 -1
- package/dist/api/balance.js +4 -3
- package/dist/api/balance.js.map +1 -1
- package/dist/api/caip.d.ts +2 -2
- package/dist/api/caip.js +3 -3
- package/dist/api/caip.js.map +1 -1
- package/dist/api/export.d.ts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/keyring.d.ts +1 -1
- package/dist/api/request.d.ts +2 -2
- package/dist/api/request.js +7 -6
- package/dist/api/request.js.map +1 -1
- package/dist/api/response.d.ts +1 -1
- package/dist/api/response.js +6 -6
- package/dist/api/response.js.map +1 -1
- package/dist/btc/types.d.ts +2 -2
- package/dist/btc/types.js +3 -3
- package/dist/btc/types.js.map +1 -1
- package/dist/contexts.d.ts +1 -1
- package/dist/eth/erc4337/types.d.ts +10 -9
- package/dist/eth/erc4337/types.js +12 -10
- package/dist/eth/erc4337/types.js.map +1 -1
- package/dist/eth/types.d.ts +4 -4
- package/dist/eth/types.js +7 -7
- package/dist/eth/types.js.map +1 -1
- package/dist/events.js +1 -1
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/api.d.ts +36 -36
- package/dist/internal/api.js +34 -33
- package/dist/internal/api.js.map +1 -1
- package/dist/internal/eth/EthKeyring.d.ts +1 -1
- package/dist/internal/eth/index.d.ts +1 -1
- package/dist/internal/eth/index.js +0 -15
- package/dist/internal/eth/index.js.map +1 -1
- package/dist/internal/events.d.ts +8 -8
- package/dist/internal/events.js +17 -16
- package/dist/internal/events.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +0 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/rpc.js +1 -1
- package/dist/internal/rpc.js.map +1 -1
- package/dist/internal/types.d.ts +58 -61
- package/dist/internal/types.js +20 -23
- package/dist/internal/types.js.map +1 -1
- package/dist/rpc-handler.js +13 -13
- package/dist/rpc-handler.js.map +1 -1
- 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 +16 -14
package/dist/internal/api.js
CHANGED
|
@@ -3,112 +3,113 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
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.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const utils_1 = require("@metamask/utils");
|
|
6
|
-
const api_1 = require("../api");
|
|
7
|
-
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
8
6
|
const rpc_1 = require("./rpc");
|
|
7
|
+
const api_1 = require("../api");
|
|
8
|
+
const superstruct_2 = require("../superstruct");
|
|
9
|
+
const utils_2 = require("../utils");
|
|
9
10
|
const CommonHeader = {
|
|
10
11
|
jsonrpc: (0, superstruct_1.literal)('2.0'),
|
|
11
12
|
id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
|
|
12
13
|
};
|
|
13
14
|
// ----------------------------------------------------------------------------
|
|
14
15
|
// List accounts
|
|
15
|
-
exports.ListAccountsRequestStruct = (0,
|
|
16
|
+
exports.ListAccountsRequestStruct = (0, superstruct_2.object)({
|
|
16
17
|
...CommonHeader,
|
|
17
18
|
method: (0, superstruct_1.literal)('keyring_listAccounts'),
|
|
18
19
|
});
|
|
19
20
|
exports.ListAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
|
|
20
21
|
// ----------------------------------------------------------------------------
|
|
21
22
|
// Get account
|
|
22
|
-
exports.GetAccountRequestStruct = (0,
|
|
23
|
+
exports.GetAccountRequestStruct = (0, superstruct_2.object)({
|
|
23
24
|
...CommonHeader,
|
|
24
25
|
method: (0, superstruct_1.literal)('keyring_getAccount'),
|
|
25
|
-
params: (0,
|
|
26
|
-
id:
|
|
26
|
+
params: (0, superstruct_2.object)({
|
|
27
|
+
id: utils_2.UuidStruct,
|
|
27
28
|
}),
|
|
28
29
|
});
|
|
29
30
|
exports.GetAccountResponseStruct = api_1.KeyringAccountStruct;
|
|
30
31
|
// ----------------------------------------------------------------------------
|
|
31
32
|
// Create account
|
|
32
|
-
exports.CreateAccountRequestStruct = (0,
|
|
33
|
+
exports.CreateAccountRequestStruct = (0, superstruct_2.object)({
|
|
33
34
|
...CommonHeader,
|
|
34
35
|
method: (0, superstruct_1.literal)('keyring_createAccount'),
|
|
35
|
-
params: (0,
|
|
36
|
+
params: (0, superstruct_2.object)({
|
|
36
37
|
options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
|
|
37
38
|
}),
|
|
38
39
|
});
|
|
39
40
|
exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
|
|
40
41
|
// ----------------------------------------------------------------------------
|
|
41
42
|
// Get account balances
|
|
42
|
-
exports.GetAccountBalancesRequestStruct = (0,
|
|
43
|
+
exports.GetAccountBalancesRequestStruct = (0, superstruct_2.object)({
|
|
43
44
|
...CommonHeader,
|
|
44
45
|
method: (0, superstruct_1.literal)(`${rpc_1.KeyringRpcMethod.GetAccountBalances}`),
|
|
45
|
-
params: (0,
|
|
46
|
-
id:
|
|
46
|
+
params: (0, superstruct_2.object)({
|
|
47
|
+
id: utils_2.UuidStruct,
|
|
47
48
|
assets: (0, superstruct_1.array)(api_1.CaipAssetTypeStruct),
|
|
48
49
|
}),
|
|
49
50
|
});
|
|
50
51
|
exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(api_1.CaipAssetTypeStruct, api_1.BalanceStruct);
|
|
51
52
|
// ----------------------------------------------------------------------------
|
|
52
53
|
// Filter account chains
|
|
53
|
-
exports.FilterAccountChainsStruct = (0,
|
|
54
|
+
exports.FilterAccountChainsStruct = (0, superstruct_2.object)({
|
|
54
55
|
...CommonHeader,
|
|
55
56
|
method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
|
|
56
|
-
params: (0,
|
|
57
|
-
id:
|
|
57
|
+
params: (0, superstruct_2.object)({
|
|
58
|
+
id: utils_2.UuidStruct,
|
|
58
59
|
chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
|
59
60
|
}),
|
|
60
61
|
});
|
|
61
62
|
exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
|
|
62
63
|
// ----------------------------------------------------------------------------
|
|
63
64
|
// Update account
|
|
64
|
-
exports.UpdateAccountRequestStruct = (0,
|
|
65
|
+
exports.UpdateAccountRequestStruct = (0, superstruct_2.object)({
|
|
65
66
|
...CommonHeader,
|
|
66
67
|
method: (0, superstruct_1.literal)('keyring_updateAccount'),
|
|
67
|
-
params: (0,
|
|
68
|
+
params: (0, superstruct_2.object)({
|
|
68
69
|
account: api_1.KeyringAccountStruct,
|
|
69
70
|
}),
|
|
70
71
|
});
|
|
71
72
|
exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
|
|
72
73
|
// ----------------------------------------------------------------------------
|
|
73
74
|
// Delete account
|
|
74
|
-
exports.DeleteAccountRequestStruct = (0,
|
|
75
|
+
exports.DeleteAccountRequestStruct = (0, superstruct_2.object)({
|
|
75
76
|
...CommonHeader,
|
|
76
77
|
method: (0, superstruct_1.literal)('keyring_deleteAccount'),
|
|
77
|
-
params: (0,
|
|
78
|
-
id:
|
|
78
|
+
params: (0, superstruct_2.object)({
|
|
79
|
+
id: utils_2.UuidStruct,
|
|
79
80
|
}),
|
|
80
81
|
});
|
|
81
82
|
exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
|
|
82
83
|
// ----------------------------------------------------------------------------
|
|
83
84
|
// Export account
|
|
84
|
-
exports.ExportAccountRequestStruct = (0,
|
|
85
|
+
exports.ExportAccountRequestStruct = (0, superstruct_2.object)({
|
|
85
86
|
...CommonHeader,
|
|
86
87
|
method: (0, superstruct_1.literal)('keyring_exportAccount'),
|
|
87
|
-
params: (0,
|
|
88
|
-
id:
|
|
88
|
+
params: (0, superstruct_2.object)({
|
|
89
|
+
id: utils_2.UuidStruct,
|
|
89
90
|
}),
|
|
90
91
|
});
|
|
91
92
|
exports.ExportAccountResponseStruct = api_1.KeyringAccountDataStruct;
|
|
92
93
|
// ----------------------------------------------------------------------------
|
|
93
94
|
// List requests
|
|
94
|
-
exports.ListRequestsRequestStruct = (0,
|
|
95
|
+
exports.ListRequestsRequestStruct = (0, superstruct_2.object)({
|
|
95
96
|
...CommonHeader,
|
|
96
97
|
method: (0, superstruct_1.literal)('keyring_listRequests'),
|
|
97
98
|
});
|
|
98
99
|
exports.ListRequestsResponseStruct = (0, superstruct_1.array)(api_1.KeyringRequestStruct);
|
|
99
100
|
// ----------------------------------------------------------------------------
|
|
100
101
|
// Get request
|
|
101
|
-
exports.GetRequestRequestStruct = (0,
|
|
102
|
+
exports.GetRequestRequestStruct = (0, superstruct_2.object)({
|
|
102
103
|
...CommonHeader,
|
|
103
104
|
method: (0, superstruct_1.literal)('keyring_getRequest'),
|
|
104
|
-
params: (0,
|
|
105
|
-
id:
|
|
105
|
+
params: (0, superstruct_2.object)({
|
|
106
|
+
id: utils_2.UuidStruct,
|
|
106
107
|
}),
|
|
107
108
|
});
|
|
108
109
|
exports.GetRequestResponseStruct = api_1.KeyringRequestStruct;
|
|
109
110
|
// ----------------------------------------------------------------------------
|
|
110
111
|
// Submit request
|
|
111
|
-
exports.SubmitRequestRequestStruct = (0,
|
|
112
|
+
exports.SubmitRequestRequestStruct = (0, superstruct_2.object)({
|
|
112
113
|
...CommonHeader,
|
|
113
114
|
method: (0, superstruct_1.literal)('keyring_submitRequest'),
|
|
114
115
|
params: api_1.KeyringRequestStruct,
|
|
@@ -116,22 +117,22 @@ exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
|
|
|
116
117
|
exports.SubmitRequestResponseStruct = api_1.KeyringResponseStruct;
|
|
117
118
|
// ----------------------------------------------------------------------------
|
|
118
119
|
// Approve request
|
|
119
|
-
exports.ApproveRequestRequestStruct = (0,
|
|
120
|
+
exports.ApproveRequestRequestStruct = (0, superstruct_2.object)({
|
|
120
121
|
...CommonHeader,
|
|
121
122
|
method: (0, superstruct_1.literal)('keyring_approveRequest'),
|
|
122
|
-
params: (0,
|
|
123
|
-
id:
|
|
123
|
+
params: (0, superstruct_2.object)({
|
|
124
|
+
id: utils_2.UuidStruct,
|
|
124
125
|
data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
|
|
125
126
|
}),
|
|
126
127
|
});
|
|
127
128
|
exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
|
|
128
129
|
// ----------------------------------------------------------------------------
|
|
129
130
|
// Reject request
|
|
130
|
-
exports.RejectRequestRequestStruct = (0,
|
|
131
|
+
exports.RejectRequestRequestStruct = (0, superstruct_2.object)({
|
|
131
132
|
...CommonHeader,
|
|
132
133
|
method: (0, superstruct_1.literal)('keyring_rejectRequest'),
|
|
133
|
-
params: (0,
|
|
134
|
-
id:
|
|
134
|
+
params: (0, superstruct_2.object)({
|
|
135
|
+
id: utils_2.UuidStruct,
|
|
135
136
|
}),
|
|
136
137
|
});
|
|
137
138
|
exports.RejectRequestResponseStruct = (0, superstruct_1.literal)(null);
|
package/dist/internal/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,gCAOgB;AAChB,2DAA6D;AAC7D,+BAAyC;AAEzC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACxC,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,mBAAK,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ent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport { KeyringRpcMethod } from './rpc';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\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: UuidStruct,\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// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
|
1
|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f,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\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: UuidStruct,\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// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\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: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Json, Keyring } from '@metamask/utils';
|
|
2
2
|
import type { KeyringExecutionContext } from '../../contexts';
|
|
3
3
|
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from '../../eth';
|
|
4
|
-
export
|
|
4
|
+
export type EthKeyring<State extends Json> = Keyring<State> & {
|
|
5
5
|
/**
|
|
6
6
|
* Convert a base transaction to a base UserOperation.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './EthKeyring';
|
|
1
|
+
export type * from './EthKeyring';
|
|
@@ -1,18 +1,3 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./EthKeyring"), exports);
|
|
18
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
|
|
@@ -2,8 +2,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
2
2
|
method: "notify:accountCreated";
|
|
3
3
|
params: {
|
|
4
4
|
account: {
|
|
5
|
-
id: string;
|
|
6
5
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
6
|
+
id: string;
|
|
7
7
|
address: string;
|
|
8
8
|
options: Record<string, import("@metamask/utils").Json>;
|
|
9
9
|
methods: string[];
|
|
@@ -15,8 +15,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
15
15
|
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
|
16
16
|
params: import("@metamask/superstruct").Struct<{
|
|
17
17
|
account: {
|
|
18
|
-
id: string;
|
|
19
18
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
19
|
+
id: string;
|
|
20
20
|
address: string;
|
|
21
21
|
options: Record<string, import("@metamask/utils").Json>;
|
|
22
22
|
methods: string[];
|
|
@@ -28,8 +28,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
28
28
|
* New account object.
|
|
29
29
|
*/
|
|
30
30
|
account: import("@metamask/superstruct").Struct<{
|
|
31
|
-
id: string;
|
|
32
31
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
32
|
+
id: string;
|
|
33
33
|
address: string;
|
|
34
34
|
options: Record<string, import("@metamask/utils").Json>;
|
|
35
35
|
methods: string[];
|
|
@@ -51,20 +51,20 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
51
51
|
* client to decide whether to use it. The keyring won't be informed if the
|
|
52
52
|
* client decides to use a different name.
|
|
53
53
|
*/
|
|
54
|
-
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("
|
|
54
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct").ExactOptionalTag, null>;
|
|
55
55
|
/**
|
|
56
56
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
57
57
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
58
58
|
*/
|
|
59
|
-
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("
|
|
59
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct").ExactOptionalTag, null>;
|
|
60
60
|
}>;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
63
63
|
method: "notify:accountUpdated";
|
|
64
64
|
params: {
|
|
65
65
|
account: {
|
|
66
|
-
id: string;
|
|
67
66
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
67
|
+
id: string;
|
|
68
68
|
address: string;
|
|
69
69
|
options: Record<string, import("@metamask/utils").Json>;
|
|
70
70
|
methods: string[];
|
|
@@ -74,8 +74,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
|
74
74
|
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
|
75
75
|
params: import("@metamask/superstruct").Struct<{
|
|
76
76
|
account: {
|
|
77
|
-
id: string;
|
|
78
77
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
78
|
+
id: string;
|
|
79
79
|
address: string;
|
|
80
80
|
options: Record<string, import("@metamask/utils").Json>;
|
|
81
81
|
methods: string[];
|
|
@@ -85,8 +85,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
|
85
85
|
* Updated account object.
|
|
86
86
|
*/
|
|
87
87
|
account: import("@metamask/superstruct").Struct<{
|
|
88
|
-
id: string;
|
|
89
88
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
89
|
+
id: string;
|
|
90
90
|
address: string;
|
|
91
91
|
options: Record<string, import("@metamask/utils").Json>;
|
|
92
92
|
methods: string[];
|
package/dist/internal/events.js
CHANGED
|
@@ -5,10 +5,11 @@ const superstruct_1 = require("@metamask/superstruct");
|
|
|
5
5
|
const utils_1 = require("@metamask/utils");
|
|
6
6
|
const api_1 = require("../api");
|
|
7
7
|
const events_1 = require("../events");
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const superstruct_2 = require("../superstruct");
|
|
9
|
+
const utils_2 = require("../utils");
|
|
10
|
+
exports.AccountCreatedEventStruct = (0, superstruct_2.object)({
|
|
10
11
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
|
|
11
|
-
params: (0,
|
|
12
|
+
params: (0, superstruct_2.object)({
|
|
12
13
|
/**
|
|
13
14
|
* New account object.
|
|
14
15
|
*/
|
|
@@ -20,52 +21,52 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
|
|
20
21
|
* client to decide whether to use it. The keyring won't be informed if the
|
|
21
22
|
* client decides to use a different name.
|
|
22
23
|
*/
|
|
23
|
-
accountNameSuggestion: (0,
|
|
24
|
+
accountNameSuggestion: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
|
|
24
25
|
/**
|
|
25
26
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
26
27
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
27
28
|
*/
|
|
28
|
-
displayConfirmation: (0,
|
|
29
|
+
displayConfirmation: (0, superstruct_2.exactOptional)((0, superstruct_1.boolean)()),
|
|
29
30
|
}),
|
|
30
31
|
});
|
|
31
|
-
exports.AccountUpdatedEventStruct = (0,
|
|
32
|
+
exports.AccountUpdatedEventStruct = (0, superstruct_2.object)({
|
|
32
33
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountUpdated}`),
|
|
33
|
-
params: (0,
|
|
34
|
+
params: (0, superstruct_2.object)({
|
|
34
35
|
/**
|
|
35
36
|
* Updated account object.
|
|
36
37
|
*/
|
|
37
38
|
account: api_1.KeyringAccountStruct,
|
|
38
39
|
}),
|
|
39
40
|
});
|
|
40
|
-
exports.AccountDeletedEventStruct = (0,
|
|
41
|
+
exports.AccountDeletedEventStruct = (0, superstruct_2.object)({
|
|
41
42
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountDeleted}`),
|
|
42
|
-
params: (0,
|
|
43
|
+
params: (0, superstruct_2.object)({
|
|
43
44
|
/**
|
|
44
45
|
* Deleted account ID.
|
|
45
46
|
*/
|
|
46
|
-
id:
|
|
47
|
+
id: utils_2.UuidStruct,
|
|
47
48
|
}),
|
|
48
49
|
});
|
|
49
|
-
exports.RequestApprovedEventStruct = (0,
|
|
50
|
+
exports.RequestApprovedEventStruct = (0, superstruct_2.object)({
|
|
50
51
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestApproved}`),
|
|
51
|
-
params: (0,
|
|
52
|
+
params: (0, superstruct_2.object)({
|
|
52
53
|
/**
|
|
53
54
|
* Request ID.
|
|
54
55
|
*/
|
|
55
|
-
id:
|
|
56
|
+
id: utils_2.UuidStruct,
|
|
56
57
|
/**
|
|
57
58
|
* Request result.
|
|
58
59
|
*/
|
|
59
60
|
result: utils_1.JsonStruct,
|
|
60
61
|
}),
|
|
61
62
|
});
|
|
62
|
-
exports.RequestRejectedEventStruct = (0,
|
|
63
|
+
exports.RequestRejectedEventStruct = (0, superstruct_2.object)({
|
|
63
64
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestRejected}`),
|
|
64
|
-
params: (0,
|
|
65
|
+
params: (0, superstruct_2.object)({
|
|
65
66
|
/**
|
|
66
67
|
* Request ID.
|
|
67
68
|
*/
|
|
68
|
-
id:
|
|
69
|
+
id: utils_2.UuidStruct,
|
|
69
70
|
}),
|
|
70
71
|
});
|
|
71
72
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,uDAAiE;AACjE,2CAA6C;AAE7C,gCAA8C;AAC9C,sCAAyC;AACzC,
|
|
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"]}
|
package/dist/internal/index.d.ts
CHANGED
package/dist/internal/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
|
-
__exportStar(require("./eth"), exports);
|
|
19
18
|
__exportStar(require("./events"), exports);
|
|
20
19
|
__exportStar(require("./rpc"), exports);
|
|
21
20
|
__exportStar(require("./types"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AAEtB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './api';\nexport type * from './eth';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
|
package/dist/internal/rpc.js
CHANGED
|
@@ -19,7 +19,7 @@ var KeyringRpcMethod;
|
|
|
19
19
|
KeyringRpcMethod["SubmitRequest"] = "keyring_submitRequest";
|
|
20
20
|
KeyringRpcMethod["ApproveRequest"] = "keyring_approveRequest";
|
|
21
21
|
KeyringRpcMethod["RejectRequest"] = "keyring_rejectRequest";
|
|
22
|
-
})(KeyringRpcMethod
|
|
22
|
+
})(KeyringRpcMethod || (exports.KeyringRpcMethod = KeyringRpcMethod = {}));
|
|
23
23
|
/**
|
|
24
24
|
* Check if a method is a keyring RPC method.
|
|
25
25
|
*
|
package/dist/internal/rpc.js.map
CHANGED
|
@@ -1 +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,
|
|
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,gCAAhB,gBAAgB,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"]}
|