@metamask-previews/keyring-api 22.0.0-018fb62 → 22.0.0-5c366be
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 +5 -0
- package/dist/api/v2/index.cjs +1 -0
- package/dist/api/v2/index.cjs.map +1 -1
- package/dist/api/v2/index.d.cts +1 -0
- package/dist/api/v2/index.d.cts.map +1 -1
- package/dist/api/v2/index.d.mts +1 -0
- package/dist/api/v2/index.d.mts.map +1 -1
- package/dist/api/v2/index.mjs +1 -0
- package/dist/api/v2/index.mjs.map +1 -1
- package/dist/api/v2/keyring-rpc.cjs +93 -0
- package/dist/api/v2/keyring-rpc.cjs.map +1 -0
- package/dist/api/v2/keyring-rpc.d.cts +440 -0
- package/dist/api/v2/keyring-rpc.d.cts.map +1 -0
- package/dist/api/v2/keyring-rpc.d.mts +440 -0
- package/dist/api/v2/keyring-rpc.d.mts.map +1 -0
- package/dist/api/v2/keyring-rpc.mjs +89 -0
- package/dist/api/v2/keyring-rpc.mjs.map +1 -0
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +1 -1
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add keyring v2 RPC types and structs (`KeyringRpcV2`, `KeyringRpcV2Method`, `isKeyringRpcV2Method`, and request/response structs) ([#408](https://github.com/MetaMask/accounts/pull/408))
|
|
13
|
+
|
|
10
14
|
### Changed
|
|
11
15
|
|
|
16
|
+
- Improve return type of `isKeyringRpcMethod` to use type predicate `method is KeyringRpcMethod` ([#408](https://github.com/MetaMask/accounts/pull/408))
|
|
12
17
|
- Bump `@metamask/utils` from `^11.1.0` to `^11.10.0` ([#489](https://github.com/MetaMask/accounts/pull/489))
|
|
13
18
|
|
|
14
19
|
## [22.0.0]
|
package/dist/api/v2/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./keyring-capabilities.cjs"), exports);
|
|
18
18
|
__exportStar(require("./keyring-type.cjs"), exports);
|
|
19
|
+
__exportStar(require("./keyring-rpc.cjs"), exports);
|
|
19
20
|
__exportStar(require("./create-account/index.cjs"), exports);
|
|
20
21
|
__exportStar(require("./export-account/index.cjs"), exports);
|
|
21
22
|
__exportStar(require("./private-key.cjs"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,oDAA8B;AAC9B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
package/dist/api/v2/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from "./keyring.cjs";
|
|
2
2
|
export * from "./keyring-capabilities.cjs";
|
|
3
3
|
export * from "./keyring-type.cjs";
|
|
4
|
+
export * from "./keyring-rpc.cjs";
|
|
4
5
|
export * from "./create-account/index.cjs";
|
|
5
6
|
export * from "./export-account/index.cjs";
|
|
6
7
|
export * from "./private-key.cjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
package/dist/api/v2/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from "./keyring.mjs";
|
|
2
2
|
export * from "./keyring-capabilities.mjs";
|
|
3
3
|
export * from "./keyring-type.mjs";
|
|
4
|
+
export * from "./keyring-rpc.mjs";
|
|
4
5
|
export * from "./create-account/index.mjs";
|
|
5
6
|
export * from "./export-account/index.mjs";
|
|
6
7
|
export * from "./private-key.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
package/dist/api/v2/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubmitRequestV2ResponseStruct = exports.SubmitRequestV2RequestStruct = exports.ExportAccountV2ResponseStruct = exports.ExportAccountV2RequestStruct = exports.DeleteAccountV2ResponseStruct = exports.DeleteAccountV2RequestStruct = exports.CreateAccountsV2ResponseStruct = exports.CreateAccountsV2RequestStruct = exports.GetAccountV2ResponseStruct = exports.GetAccountV2RequestStruct = exports.GetAccountsV2ResponseStruct = exports.GetAccountsV2RequestStruct = exports.KeyringRpcV2Method = void 0;
|
|
4
|
+
exports.isKeyringRpcV2Method = isKeyringRpcV2Method;
|
|
5
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
6
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
7
|
+
const utils_1 = require("@metamask/utils");
|
|
8
|
+
const create_account_1 = require("./create-account/index.cjs");
|
|
9
|
+
const export_account_1 = require("./export-account/index.cjs");
|
|
10
|
+
const account_1 = require("../account.cjs");
|
|
11
|
+
const request_1 = require("../request.cjs");
|
|
12
|
+
/**
|
|
13
|
+
* Keyring RPC methods used by the API.
|
|
14
|
+
*/
|
|
15
|
+
exports.KeyringRpcV2Method = {
|
|
16
|
+
GetAccounts: 'keyring_getAccounts',
|
|
17
|
+
CreateAccounts: 'keyring_createAccounts',
|
|
18
|
+
// Inherited from v1 (but method signatures may differ...):
|
|
19
|
+
// NOTE: We use literals here to avoid circular dependencies.
|
|
20
|
+
GetAccount: 'keyring_getAccount',
|
|
21
|
+
DeleteAccount: 'keyring_deleteAccount',
|
|
22
|
+
ExportAccount: 'keyring_exportAccount',
|
|
23
|
+
SubmitRequest: 'keyring_submitRequest',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Check if a method is a keyring RPC method (v2).
|
|
27
|
+
*
|
|
28
|
+
* @param method - Method to check.
|
|
29
|
+
* @returns Whether the method is a keyring RPC method (v2).
|
|
30
|
+
*/
|
|
31
|
+
function isKeyringRpcV2Method(method) {
|
|
32
|
+
return Object.values(exports.KeyringRpcV2Method).includes(method);
|
|
33
|
+
}
|
|
34
|
+
// ----------------------------------------------------------------------------
|
|
35
|
+
const CommonHeader = {
|
|
36
|
+
jsonrpc: (0, superstruct_1.literal)('2.0'),
|
|
37
|
+
id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
|
|
38
|
+
};
|
|
39
|
+
// ----------------------------------------------------------------------------
|
|
40
|
+
// Get accounts
|
|
41
|
+
exports.GetAccountsV2RequestStruct = (0, keyring_utils_1.object)({
|
|
42
|
+
...CommonHeader,
|
|
43
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.GetAccounts}`),
|
|
44
|
+
});
|
|
45
|
+
exports.GetAccountsV2ResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
// Get account
|
|
48
|
+
exports.GetAccountV2RequestStruct = (0, keyring_utils_1.object)({
|
|
49
|
+
...CommonHeader,
|
|
50
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.GetAccount}`),
|
|
51
|
+
params: (0, keyring_utils_1.object)({
|
|
52
|
+
id: keyring_utils_1.UuidStruct,
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
exports.GetAccountV2ResponseStruct = account_1.KeyringAccountStruct;
|
|
56
|
+
// ----------------------------------------------------------------------------
|
|
57
|
+
// Create accounts
|
|
58
|
+
exports.CreateAccountsV2RequestStruct = (0, keyring_utils_1.object)({
|
|
59
|
+
...CommonHeader,
|
|
60
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.CreateAccounts}`),
|
|
61
|
+
params: create_account_1.CreateAccountOptionsStruct,
|
|
62
|
+
});
|
|
63
|
+
exports.CreateAccountsV2ResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
|
|
64
|
+
// ----------------------------------------------------------------------------
|
|
65
|
+
// Delete account
|
|
66
|
+
exports.DeleteAccountV2RequestStruct = (0, keyring_utils_1.object)({
|
|
67
|
+
...CommonHeader,
|
|
68
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.DeleteAccount}`),
|
|
69
|
+
params: (0, keyring_utils_1.object)({
|
|
70
|
+
id: keyring_utils_1.UuidStruct,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
exports.DeleteAccountV2ResponseStruct = (0, superstruct_1.literal)(null);
|
|
74
|
+
// ----------------------------------------------------------------------------
|
|
75
|
+
// Export account
|
|
76
|
+
exports.ExportAccountV2RequestStruct = (0, keyring_utils_1.object)({
|
|
77
|
+
...CommonHeader,
|
|
78
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.ExportAccount}`),
|
|
79
|
+
params: (0, keyring_utils_1.object)({
|
|
80
|
+
id: keyring_utils_1.UuidStruct,
|
|
81
|
+
options: (0, keyring_utils_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
exports.ExportAccountV2ResponseStruct = export_account_1.PrivateKeyExportedAccountStruct;
|
|
85
|
+
// ----------------------------------------------------------------------------
|
|
86
|
+
// Submit request
|
|
87
|
+
exports.SubmitRequestV2RequestStruct = (0, keyring_utils_1.object)({
|
|
88
|
+
...CommonHeader,
|
|
89
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcV2Method.SubmitRequest}`),
|
|
90
|
+
params: request_1.KeyringRequestStruct,
|
|
91
|
+
});
|
|
92
|
+
exports.SubmitRequestV2ResponseStruct = utils_1.JsonStruct;
|
|
93
|
+
//# sourceMappingURL=keyring-rpc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-rpc.ts"],"names":[],"mappings":";;;AAqDA,oDAMC;AA3DD,2DAA4E;AAE5E,uDAA8E;AAC9E,2CAA6C;AAE7C,+DAA8D;AAC9D,+DAG0B;AAE1B,4CAAkD;AAClD,4CAAkD;AAelD;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,0BAAkB,CAAC,CAAC,QAAQ,CAC/C,MAA4B,CAC7B,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GA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E;AAC/E,iBAAiB;AAEJ,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,OAAO,EAAE,IAAA,6BAAa,EAAC,2CAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,6BAA6B,GAAG,gDAA+B,CAAC;AAM7E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,0BAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,6BAA6B,GAAG,kBAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { KeyringV2 } from './keyring';\nimport { KeyringAccountStruct } from '../account';\nimport { KeyringRequestStruct } from '../request';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpcV2 = {\n getAccount: KeyringV2['getAccount'];\n getAccounts: KeyringV2['getAccounts'];\n createAccounts: KeyringV2['createAccounts'];\n deleteAccount: KeyringV2['deleteAccount'];\n submitRequest: KeyringV2['submitRequest'];\n exportAccount?: KeyringV2['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcV2Method = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcV2Method =\n (typeof KeyringRpcV2Method)[keyof typeof KeyringRpcV2Method];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcV2Method(\n method: string,\n): method is KeyringRpcV2Method {\n return Object.values(KeyringRpcV2Method).includes(\n method as KeyringRpcV2Method,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccounts}`),\n});\n\nexport type GetAccountsV2Request = Infer<typeof GetAccountsV2RequestStruct>;\n\nexport const GetAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsV2Response = Infer<typeof GetAccountsV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountV2Request = Infer<typeof GetAccountV2RequestStruct>;\n\nexport const GetAccountV2ResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountV2Response = Infer<typeof GetAccountV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsV2Request = Infer<\n typeof CreateAccountsV2RequestStruct\n>;\n\nexport const CreateAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsV2Response = Infer<\n typeof CreateAccountsV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountV2Request = Infer<typeof DeleteAccountV2RequestStruct>;\n\nexport const DeleteAccountV2ResponseStruct = literal(null);\n\nexport type DeleteAccountV2Response = Infer<\n typeof DeleteAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountV2Request = Infer<typeof ExportAccountV2RequestStruct>;\n\nexport const ExportAccountV2ResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountV2Response = Infer<\n typeof ExportAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestV2Request = Infer<typeof SubmitRequestV2RequestStruct>;\n\nexport const SubmitRequestV2ResponseStruct = JsonStruct;\n\nexport type SubmitRequestV2Response = Infer<\n typeof SubmitRequestV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcV2Requests =\n | GetAccountsV2Request\n | GetAccountV2Request\n | CreateAccountsV2Request\n | DeleteAccountV2Request\n | ExportAccountV2Request\n | SubmitRequestV2Request;\n\n/**\n * Extract the proper request type for a given `KeyringRpcV2Method`.\n */\nexport type KeyringRpcV2Request<RpcMethod extends KeyringRpcV2Method> = Extract<\n KeyringRpcV2Requests,\n { method: `${RpcMethod}` }\n>;\n"]}
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
import type { KeyringV2 } from "./keyring.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Keyring interface for keyring methods that can be invoked through
|
|
5
|
+
* RPC calls.
|
|
6
|
+
*/
|
|
7
|
+
export type KeyringRpcV2 = {
|
|
8
|
+
getAccount: KeyringV2['getAccount'];
|
|
9
|
+
getAccounts: KeyringV2['getAccounts'];
|
|
10
|
+
createAccounts: KeyringV2['createAccounts'];
|
|
11
|
+
deleteAccount: KeyringV2['deleteAccount'];
|
|
12
|
+
submitRequest: KeyringV2['submitRequest'];
|
|
13
|
+
exportAccount?: KeyringV2['exportAccount'];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Keyring RPC methods used by the API.
|
|
17
|
+
*/
|
|
18
|
+
export declare const KeyringRpcV2Method: {
|
|
19
|
+
readonly GetAccounts: "keyring_getAccounts";
|
|
20
|
+
readonly CreateAccounts: "keyring_createAccounts";
|
|
21
|
+
readonly GetAccount: "keyring_getAccount";
|
|
22
|
+
readonly DeleteAccount: "keyring_deleteAccount";
|
|
23
|
+
readonly ExportAccount: "keyring_exportAccount";
|
|
24
|
+
readonly SubmitRequest: "keyring_submitRequest";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Keyring RPC methods used by the API.
|
|
28
|
+
*/
|
|
29
|
+
export type KeyringRpcV2Method = (typeof KeyringRpcV2Method)[keyof typeof KeyringRpcV2Method];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a method is a keyring RPC method (v2).
|
|
32
|
+
*
|
|
33
|
+
* @param method - Method to check.
|
|
34
|
+
* @returns Whether the method is a keyring RPC method (v2).
|
|
35
|
+
*/
|
|
36
|
+
export declare function isKeyringRpcV2Method(method: string): method is KeyringRpcV2Method;
|
|
37
|
+
export declare const GetAccountsV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
38
|
+
method: "keyring_getAccounts";
|
|
39
|
+
id: string | number | null;
|
|
40
|
+
jsonrpc: "2.0";
|
|
41
|
+
}, {
|
|
42
|
+
method: import("@metamask/superstruct").Struct<"keyring_getAccounts", "keyring_getAccounts">;
|
|
43
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
44
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
45
|
+
}>;
|
|
46
|
+
export type GetAccountsV2Request = Infer<typeof GetAccountsV2RequestStruct>;
|
|
47
|
+
export declare const GetAccountsV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
48
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
49
|
+
id: string;
|
|
50
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
51
|
+
entropy?: {
|
|
52
|
+
type: "mnemonic";
|
|
53
|
+
id: string;
|
|
54
|
+
derivationPath: string;
|
|
55
|
+
groupIndex: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: "private-key";
|
|
58
|
+
} | {
|
|
59
|
+
type: "custom";
|
|
60
|
+
};
|
|
61
|
+
exportable?: boolean;
|
|
62
|
+
};
|
|
63
|
+
address: string;
|
|
64
|
+
scopes: `${string}:${string}`[];
|
|
65
|
+
methods: string[];
|
|
66
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
67
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
68
|
+
id: string;
|
|
69
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
70
|
+
entropy?: {
|
|
71
|
+
type: "mnemonic";
|
|
72
|
+
id: string;
|
|
73
|
+
derivationPath: string;
|
|
74
|
+
groupIndex: number;
|
|
75
|
+
} | {
|
|
76
|
+
type: "private-key";
|
|
77
|
+
} | {
|
|
78
|
+
type: "custom";
|
|
79
|
+
};
|
|
80
|
+
exportable?: boolean;
|
|
81
|
+
};
|
|
82
|
+
address: string;
|
|
83
|
+
scopes: `${string}:${string}`[];
|
|
84
|
+
methods: string[];
|
|
85
|
+
}, {
|
|
86
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
87
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
88
|
+
"eip155:eoa": "eip155:eoa";
|
|
89
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
90
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
91
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
92
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
93
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
94
|
+
"solana:data-account": "solana:data-account";
|
|
95
|
+
"tron:eoa": "tron:eoa";
|
|
96
|
+
"any:account": "any:account";
|
|
97
|
+
}>;
|
|
98
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
99
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
100
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
101
|
+
entropy?: {
|
|
102
|
+
type: "mnemonic";
|
|
103
|
+
id: string;
|
|
104
|
+
derivationPath: string;
|
|
105
|
+
groupIndex: number;
|
|
106
|
+
} | {
|
|
107
|
+
type: "private-key";
|
|
108
|
+
} | {
|
|
109
|
+
type: "custom";
|
|
110
|
+
};
|
|
111
|
+
exportable?: boolean;
|
|
112
|
+
}, null>;
|
|
113
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
114
|
+
}>>;
|
|
115
|
+
export type GetAccountsV2Response = Infer<typeof GetAccountsV2ResponseStruct>;
|
|
116
|
+
export declare const GetAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
117
|
+
method: "keyring_getAccount";
|
|
118
|
+
id: string | number | null;
|
|
119
|
+
jsonrpc: "2.0";
|
|
120
|
+
params: {
|
|
121
|
+
id: string;
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
method: import("@metamask/superstruct").Struct<"keyring_getAccount", "keyring_getAccount">;
|
|
125
|
+
params: import("@metamask/superstruct").Struct<{
|
|
126
|
+
id: string;
|
|
127
|
+
}, {
|
|
128
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
129
|
+
}>;
|
|
130
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
131
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
132
|
+
}>;
|
|
133
|
+
export type GetAccountV2Request = Infer<typeof GetAccountV2RequestStruct>;
|
|
134
|
+
export declare const GetAccountV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
135
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
136
|
+
id: string;
|
|
137
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
138
|
+
entropy?: {
|
|
139
|
+
type: "mnemonic";
|
|
140
|
+
id: string;
|
|
141
|
+
derivationPath: string;
|
|
142
|
+
groupIndex: number;
|
|
143
|
+
} | {
|
|
144
|
+
type: "private-key";
|
|
145
|
+
} | {
|
|
146
|
+
type: "custom";
|
|
147
|
+
};
|
|
148
|
+
exportable?: boolean;
|
|
149
|
+
};
|
|
150
|
+
address: string;
|
|
151
|
+
scopes: `${string}:${string}`[];
|
|
152
|
+
methods: string[];
|
|
153
|
+
}, {
|
|
154
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
155
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
156
|
+
"eip155:eoa": "eip155:eoa";
|
|
157
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
158
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
159
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
160
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
161
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
162
|
+
"solana:data-account": "solana:data-account";
|
|
163
|
+
"tron:eoa": "tron:eoa";
|
|
164
|
+
"any:account": "any:account";
|
|
165
|
+
}>;
|
|
166
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
167
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
168
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
169
|
+
entropy?: {
|
|
170
|
+
type: "mnemonic";
|
|
171
|
+
id: string;
|
|
172
|
+
derivationPath: string;
|
|
173
|
+
groupIndex: number;
|
|
174
|
+
} | {
|
|
175
|
+
type: "private-key";
|
|
176
|
+
} | {
|
|
177
|
+
type: "custom";
|
|
178
|
+
};
|
|
179
|
+
exportable?: boolean;
|
|
180
|
+
}, null>;
|
|
181
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
182
|
+
}>;
|
|
183
|
+
export type GetAccountV2Response = Infer<typeof GetAccountV2ResponseStruct>;
|
|
184
|
+
export declare const CreateAccountsV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
185
|
+
method: "keyring_createAccounts";
|
|
186
|
+
id: string | number | null;
|
|
187
|
+
jsonrpc: "2.0";
|
|
188
|
+
params: {
|
|
189
|
+
type: "bip44:derive-path";
|
|
190
|
+
derivationPath: `m/${string}`;
|
|
191
|
+
entropySource: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "bip44:derive-index";
|
|
194
|
+
groupIndex: number;
|
|
195
|
+
entropySource: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: "bip44:discover";
|
|
198
|
+
groupIndex: number;
|
|
199
|
+
entropySource: string;
|
|
200
|
+
} | {
|
|
201
|
+
type: "bip44:derive-index-range";
|
|
202
|
+
range: {
|
|
203
|
+
from: number;
|
|
204
|
+
to: number;
|
|
205
|
+
};
|
|
206
|
+
entropySource: string;
|
|
207
|
+
} | {
|
|
208
|
+
type: "custom";
|
|
209
|
+
} | {
|
|
210
|
+
type: "private-key:import";
|
|
211
|
+
encoding: "hexadecimal" | "base58";
|
|
212
|
+
privateKey: string;
|
|
213
|
+
accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
214
|
+
};
|
|
215
|
+
}, {
|
|
216
|
+
method: import("@metamask/superstruct").Struct<"keyring_createAccounts", "keyring_createAccounts">;
|
|
217
|
+
params: import("@metamask/superstruct").Struct<{
|
|
218
|
+
type: "bip44:derive-path";
|
|
219
|
+
derivationPath: `m/${string}`;
|
|
220
|
+
entropySource: string;
|
|
221
|
+
} | {
|
|
222
|
+
type: "bip44:derive-index";
|
|
223
|
+
groupIndex: number;
|
|
224
|
+
entropySource: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: "bip44:discover";
|
|
227
|
+
groupIndex: number;
|
|
228
|
+
entropySource: string;
|
|
229
|
+
} | {
|
|
230
|
+
type: "bip44:derive-index-range";
|
|
231
|
+
range: {
|
|
232
|
+
from: number;
|
|
233
|
+
to: number;
|
|
234
|
+
};
|
|
235
|
+
entropySource: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "custom";
|
|
238
|
+
} | {
|
|
239
|
+
type: "private-key:import";
|
|
240
|
+
encoding: "hexadecimal" | "base58";
|
|
241
|
+
privateKey: string;
|
|
242
|
+
accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
243
|
+
}, null>;
|
|
244
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
245
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
246
|
+
}>;
|
|
247
|
+
export type CreateAccountsV2Request = Infer<typeof CreateAccountsV2RequestStruct>;
|
|
248
|
+
export declare const CreateAccountsV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
249
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
250
|
+
id: string;
|
|
251
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
252
|
+
entropy?: {
|
|
253
|
+
type: "mnemonic";
|
|
254
|
+
id: string;
|
|
255
|
+
derivationPath: string;
|
|
256
|
+
groupIndex: number;
|
|
257
|
+
} | {
|
|
258
|
+
type: "private-key";
|
|
259
|
+
} | {
|
|
260
|
+
type: "custom";
|
|
261
|
+
};
|
|
262
|
+
exportable?: boolean;
|
|
263
|
+
};
|
|
264
|
+
address: string;
|
|
265
|
+
scopes: `${string}:${string}`[];
|
|
266
|
+
methods: string[];
|
|
267
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
268
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
269
|
+
id: string;
|
|
270
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
271
|
+
entropy?: {
|
|
272
|
+
type: "mnemonic";
|
|
273
|
+
id: string;
|
|
274
|
+
derivationPath: string;
|
|
275
|
+
groupIndex: number;
|
|
276
|
+
} | {
|
|
277
|
+
type: "private-key";
|
|
278
|
+
} | {
|
|
279
|
+
type: "custom";
|
|
280
|
+
};
|
|
281
|
+
exportable?: boolean;
|
|
282
|
+
};
|
|
283
|
+
address: string;
|
|
284
|
+
scopes: `${string}:${string}`[];
|
|
285
|
+
methods: string[];
|
|
286
|
+
}, {
|
|
287
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
288
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
289
|
+
"eip155:eoa": "eip155:eoa";
|
|
290
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
291
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
292
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
293
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
294
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
295
|
+
"solana:data-account": "solana:data-account";
|
|
296
|
+
"tron:eoa": "tron:eoa";
|
|
297
|
+
"any:account": "any:account";
|
|
298
|
+
}>;
|
|
299
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
300
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
301
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
302
|
+
entropy?: {
|
|
303
|
+
type: "mnemonic";
|
|
304
|
+
id: string;
|
|
305
|
+
derivationPath: string;
|
|
306
|
+
groupIndex: number;
|
|
307
|
+
} | {
|
|
308
|
+
type: "private-key";
|
|
309
|
+
} | {
|
|
310
|
+
type: "custom";
|
|
311
|
+
};
|
|
312
|
+
exportable?: boolean;
|
|
313
|
+
}, null>;
|
|
314
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
315
|
+
}>>;
|
|
316
|
+
export type CreateAccountsV2Response = Infer<typeof CreateAccountsV2ResponseStruct>;
|
|
317
|
+
export declare const DeleteAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
318
|
+
method: "keyring_deleteAccount";
|
|
319
|
+
id: string | number | null;
|
|
320
|
+
jsonrpc: "2.0";
|
|
321
|
+
params: {
|
|
322
|
+
id: string;
|
|
323
|
+
};
|
|
324
|
+
}, {
|
|
325
|
+
method: import("@metamask/superstruct").Struct<"keyring_deleteAccount", "keyring_deleteAccount">;
|
|
326
|
+
params: import("@metamask/superstruct").Struct<{
|
|
327
|
+
id: string;
|
|
328
|
+
}, {
|
|
329
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
330
|
+
}>;
|
|
331
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
332
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
333
|
+
}>;
|
|
334
|
+
export type DeleteAccountV2Request = Infer<typeof DeleteAccountV2RequestStruct>;
|
|
335
|
+
export declare const DeleteAccountV2ResponseStruct: import("@metamask/superstruct").Struct<null, null>;
|
|
336
|
+
export type DeleteAccountV2Response = Infer<typeof DeleteAccountV2ResponseStruct>;
|
|
337
|
+
export declare const ExportAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
338
|
+
method: "keyring_exportAccount";
|
|
339
|
+
id: string | number | null;
|
|
340
|
+
jsonrpc: "2.0";
|
|
341
|
+
params: {
|
|
342
|
+
id: string;
|
|
343
|
+
options?: {
|
|
344
|
+
type: "private-key";
|
|
345
|
+
encoding: "hexadecimal" | "base58";
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
}, {
|
|
349
|
+
method: import("@metamask/superstruct").Struct<"keyring_exportAccount", "keyring_exportAccount">;
|
|
350
|
+
params: import("@metamask/superstruct").Struct<{
|
|
351
|
+
id: string;
|
|
352
|
+
options?: {
|
|
353
|
+
type: "private-key";
|
|
354
|
+
encoding: "hexadecimal" | "base58";
|
|
355
|
+
};
|
|
356
|
+
}, {
|
|
357
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
358
|
+
options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
359
|
+
type: "private-key";
|
|
360
|
+
encoding: "hexadecimal" | "base58";
|
|
361
|
+
}, {
|
|
362
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
363
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
364
|
+
hexadecimal: "hexadecimal";
|
|
365
|
+
base58: "base58";
|
|
366
|
+
}>;
|
|
367
|
+
}>;
|
|
368
|
+
}>;
|
|
369
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
370
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
371
|
+
}>;
|
|
372
|
+
export type ExportAccountV2Request = Infer<typeof ExportAccountV2RequestStruct>;
|
|
373
|
+
export declare const ExportAccountV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
374
|
+
type: "private-key";
|
|
375
|
+
encoding: "hexadecimal" | "base58";
|
|
376
|
+
privateKey: string;
|
|
377
|
+
}, {
|
|
378
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
379
|
+
privateKey: import("@metamask/superstruct").Struct<string, null>;
|
|
380
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
381
|
+
hexadecimal: "hexadecimal";
|
|
382
|
+
base58: "base58";
|
|
383
|
+
}>;
|
|
384
|
+
}>;
|
|
385
|
+
export type ExportAccountV2Response = Infer<typeof ExportAccountV2ResponseStruct>;
|
|
386
|
+
export declare const SubmitRequestV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
387
|
+
method: "keyring_submitRequest";
|
|
388
|
+
id: string | number | null;
|
|
389
|
+
jsonrpc: "2.0";
|
|
390
|
+
params: {
|
|
391
|
+
id: string;
|
|
392
|
+
origin: string;
|
|
393
|
+
request: {
|
|
394
|
+
method: string;
|
|
395
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
396
|
+
};
|
|
397
|
+
scope: string;
|
|
398
|
+
account: string;
|
|
399
|
+
};
|
|
400
|
+
}, {
|
|
401
|
+
method: import("@metamask/superstruct").Struct<"keyring_submitRequest", "keyring_submitRequest">;
|
|
402
|
+
params: import("@metamask/superstruct").Struct<{
|
|
403
|
+
id: string;
|
|
404
|
+
origin: string;
|
|
405
|
+
request: {
|
|
406
|
+
method: string;
|
|
407
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
408
|
+
};
|
|
409
|
+
scope: string;
|
|
410
|
+
account: string;
|
|
411
|
+
}, {
|
|
412
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
413
|
+
scope: import("@metamask/superstruct").Struct<string, null>;
|
|
414
|
+
account: import("@metamask/superstruct").Struct<string, null>;
|
|
415
|
+
origin: import("@metamask/superstruct").Struct<string, null>;
|
|
416
|
+
request: import("@metamask/superstruct").Struct<{
|
|
417
|
+
method: string;
|
|
418
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
419
|
+
}, {
|
|
420
|
+
method: import("@metamask/superstruct").Struct<string, null>;
|
|
421
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
422
|
+
}>;
|
|
423
|
+
}>;
|
|
424
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
425
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
426
|
+
}>;
|
|
427
|
+
export type SubmitRequestV2Request = Infer<typeof SubmitRequestV2RequestStruct>;
|
|
428
|
+
export declare const SubmitRequestV2ResponseStruct: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
|
429
|
+
export type SubmitRequestV2Response = Infer<typeof SubmitRequestV2ResponseStruct>;
|
|
430
|
+
/**
|
|
431
|
+
* Keyring RPC requests.
|
|
432
|
+
*/
|
|
433
|
+
export type KeyringRpcV2Requests = GetAccountsV2Request | GetAccountV2Request | CreateAccountsV2Request | DeleteAccountV2Request | ExportAccountV2Request | SubmitRequestV2Request;
|
|
434
|
+
/**
|
|
435
|
+
* Extract the proper request type for a given `KeyringRpcV2Method`.
|
|
436
|
+
*/
|
|
437
|
+
export type KeyringRpcV2Request<RpcMethod extends KeyringRpcV2Method> = Extract<KeyringRpcV2Requests, {
|
|
438
|
+
method: `${RpcMethod}`;
|
|
439
|
+
}>;
|
|
440
|
+
//# sourceMappingURL=keyring-rpc.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-rpc.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AASnD,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAkB;AAI3C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACpC,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1C,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;CASrB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAA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