@metamask/snaps-rpc-methods 14.0.0 → 14.1.0
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 +9 -1
- package/dist/permitted/getClientStatus.cjs +10 -2
- package/dist/permitted/getClientStatus.cjs.map +1 -1
- package/dist/permitted/getClientStatus.d.cts +4 -0
- package/dist/permitted/getClientStatus.d.cts.map +1 -1
- package/dist/permitted/getClientStatus.d.mts +4 -0
- package/dist/permitted/getClientStatus.d.mts.map +1 -1
- package/dist/permitted/getClientStatus.mjs +10 -2
- package/dist/permitted/getClientStatus.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [14.1.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Include client and platform versions in `snap_getClientStatus` ([#3724](https://github.com/MetaMask/snaps/pull/3724))
|
|
15
|
+
- Bump `@metamask/permission-controller` from `12.0.0` to `12.1.0` ([#3714](https://github.com/MetaMask/snaps/pull/3714))
|
|
16
|
+
|
|
10
17
|
## [14.0.0]
|
|
11
18
|
|
|
12
19
|
### Changed
|
|
@@ -528,7 +535,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
528
535
|
- The version of the package no longer needs to match the version of all other
|
|
529
536
|
MetaMask Snaps packages.
|
|
530
537
|
|
|
531
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@14.
|
|
538
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@14.1.0...HEAD
|
|
539
|
+
[14.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@14.0.0...@metamask/snaps-rpc-methods@14.1.0
|
|
532
540
|
[14.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@13.5.3...@metamask/snaps-rpc-methods@14.0.0
|
|
533
541
|
[13.5.3]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@13.5.2...@metamask/snaps-rpc-methods@13.5.3
|
|
534
542
|
[13.5.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@13.5.1...@metamask/snaps-rpc-methods@13.5.2
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClientStatusHandler = void 0;
|
|
4
|
+
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
4
5
|
const hookNames = {
|
|
5
6
|
getIsLocked: true,
|
|
6
7
|
getIsActive: true,
|
|
8
|
+
getVersion: true,
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* `snap_getClientStatus` returns useful information about the client running the snap.
|
|
@@ -25,10 +27,16 @@ exports.getClientStatusHandler = {
|
|
|
25
27
|
* @param hooks - The RPC method hooks.
|
|
26
28
|
* @param hooks.getIsLocked - A function that returns whether the client is locked or not.
|
|
27
29
|
* @param hooks.getIsActive - A function that returns whether the client is opened or not.
|
|
30
|
+
* @param hooks.getVersion - A function that returns the client version.
|
|
28
31
|
* @returns Nothing.
|
|
29
32
|
*/
|
|
30
|
-
async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked, getIsActive }) {
|
|
31
|
-
response.result = {
|
|
33
|
+
async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked, getIsActive, getVersion }) {
|
|
34
|
+
response.result = {
|
|
35
|
+
locked: getIsLocked(),
|
|
36
|
+
active: getIsActive(),
|
|
37
|
+
clientVersion: getVersion(),
|
|
38
|
+
platformVersion: (0, snaps_utils_1.getPlatformVersion)(),
|
|
39
|
+
};
|
|
32
40
|
return end();
|
|
33
41
|
}
|
|
34
42
|
//# sourceMappingURL=getClientStatus.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientStatus.cjs","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getClientStatus.cjs","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":";;;AAGA,uDAA2D;AAS3D,MAAM,SAAS,GAA4C;IACzD,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;GAEG;AACU,QAAA,sBAAsB,GAI/B;IACF,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,cAAc,EAAE,6BAA6B;IAC7C,SAAS;CACV,CAAC;AAmBF;;;;;;;;;;;;;;GAcG;AACH,KAAK,UAAU,6BAA6B,CAC1C,QAAwB,EACxB,QAAuD,EACvD,KAAc,EACd,GAA6B,EAC7B,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAwB;IAE9D,QAAQ,CAAC,MAAM,GAAG;QAChB,MAAM,EAAE,WAAW,EAAE;QACrB,MAAM,EAAE,WAAW,EAAE;QACrB,aAAa,EAAE,UAAU,EAAE;QAC3B,eAAe,EAAE,IAAA,gCAAkB,GAAE;KACtC,CAAC;IACF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport type { GetClientStatusResult } from '@metamask/snaps-sdk';\nimport { getPlatformVersion } from '@metamask/snaps-utils';\nimport type {\n JsonRpcParams,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<GetClientStatusHooks> = {\n getIsLocked: true,\n getIsActive: true,\n getVersion: true,\n};\n\n/**\n * `snap_getClientStatus` returns useful information about the client running the snap.\n */\nexport const getClientStatusHandler: PermittedHandlerExport<\n GetClientStatusHooks,\n JsonRpcParams,\n GetClientStatusResult\n> = {\n methodNames: ['snap_getClientStatus'],\n implementation: getClientStatusImplementation,\n hookNames,\n};\n\nexport type GetClientStatusHooks = {\n /**\n * @returns Whether the client is locked or not.\n */\n getIsLocked: () => boolean;\n\n /**\n * @returns Whether the client is active or not.\n */\n getIsActive: () => boolean;\n\n /**\n * @returns The version string for the client.\n */\n getVersion: () => string;\n};\n\n/**\n * The `snap_getClientStatus` method implementation.\n * Returns useful information about the client running the snap.\n *\n * @param _request - The JSON-RPC request object. Not used by this function.\n * @param response - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getIsLocked - A function that returns whether the client is locked or not.\n * @param hooks.getIsActive - A function that returns whether the client is opened or not.\n * @param hooks.getVersion - A function that returns the client version.\n * @returns Nothing.\n */\nasync function getClientStatusImplementation(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<GetClientStatusResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getIsLocked, getIsActive, getVersion }: GetClientStatusHooks,\n): Promise<void> {\n response.result = {\n locked: getIsLocked(),\n active: getIsActive(),\n clientVersion: getVersion(),\n platformVersion: getPlatformVersion(),\n };\n return end();\n}\n"]}
|
|
@@ -14,5 +14,9 @@ export type GetClientStatusHooks = {
|
|
|
14
14
|
* @returns Whether the client is active or not.
|
|
15
15
|
*/
|
|
16
16
|
getIsActive: () => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @returns The version string for the client.
|
|
19
|
+
*/
|
|
20
|
+
getVersion: () => string;
|
|
17
21
|
};
|
|
18
22
|
//# sourceMappingURL=getClientStatus.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientStatus.d.cts","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B;
|
|
1
|
+
{"version":3,"file":"getClientStatus.d.cts","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B;AAEjE,OAAO,KAAK,EACV,aAAa,EAGd,wBAAwB;AAUzB;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,oBAAoB,EACpB,aAAa,EACb,qBAAqB,CAKtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;IAE3B;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;IAE3B;;OAEG;IACH,UAAU,EAAE,MAAM,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -14,5 +14,9 @@ export type GetClientStatusHooks = {
|
|
|
14
14
|
* @returns Whether the client is active or not.
|
|
15
15
|
*/
|
|
16
16
|
getIsActive: () => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @returns The version string for the client.
|
|
19
|
+
*/
|
|
20
|
+
getVersion: () => string;
|
|
17
21
|
};
|
|
18
22
|
//# sourceMappingURL=getClientStatus.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientStatus.d.mts","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B;
|
|
1
|
+
{"version":3,"file":"getClientStatus.d.mts","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B;AAEjE,OAAO,KAAK,EACV,aAAa,EAGd,wBAAwB;AAUzB;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,oBAAoB,EACpB,aAAa,EACb,qBAAqB,CAKtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;IAE3B;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;IAE3B;;OAEG;IACH,UAAU,EAAE,MAAM,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { getPlatformVersion } from "@metamask/snaps-utils";
|
|
1
2
|
const hookNames = {
|
|
2
3
|
getIsLocked: true,
|
|
3
4
|
getIsActive: true,
|
|
5
|
+
getVersion: true,
|
|
4
6
|
};
|
|
5
7
|
/**
|
|
6
8
|
* `snap_getClientStatus` returns useful information about the client running the snap.
|
|
@@ -22,10 +24,16 @@ export const getClientStatusHandler = {
|
|
|
22
24
|
* @param hooks - The RPC method hooks.
|
|
23
25
|
* @param hooks.getIsLocked - A function that returns whether the client is locked or not.
|
|
24
26
|
* @param hooks.getIsActive - A function that returns whether the client is opened or not.
|
|
27
|
+
* @param hooks.getVersion - A function that returns the client version.
|
|
25
28
|
* @returns Nothing.
|
|
26
29
|
*/
|
|
27
|
-
async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked, getIsActive }) {
|
|
28
|
-
response.result = {
|
|
30
|
+
async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked, getIsActive, getVersion }) {
|
|
31
|
+
response.result = {
|
|
32
|
+
locked: getIsLocked(),
|
|
33
|
+
active: getIsActive(),
|
|
34
|
+
clientVersion: getVersion(),
|
|
35
|
+
platformVersion: getPlatformVersion(),
|
|
36
|
+
};
|
|
29
37
|
return end();
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=getClientStatus.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientStatus.mjs","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getClientStatus.mjs","sourceRoot":"","sources":["../../src/permitted/getClientStatus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,8BAA8B;AAS3D,MAAM,SAAS,GAA4C;IACzD,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAI/B;IACF,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,cAAc,EAAE,6BAA6B;IAC7C,SAAS;CACV,CAAC;AAmBF;;;;;;;;;;;;;;GAcG;AACH,KAAK,UAAU,6BAA6B,CAC1C,QAAwB,EACxB,QAAuD,EACvD,KAAc,EACd,GAA6B,EAC7B,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAwB;IAE9D,QAAQ,CAAC,MAAM,GAAG;QAChB,MAAM,EAAE,WAAW,EAAE;QACrB,MAAM,EAAE,WAAW,EAAE;QACrB,aAAa,EAAE,UAAU,EAAE;QAC3B,eAAe,EAAE,kBAAkB,EAAE;KACtC,CAAC;IACF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport type { GetClientStatusResult } from '@metamask/snaps-sdk';\nimport { getPlatformVersion } from '@metamask/snaps-utils';\nimport type {\n JsonRpcParams,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<GetClientStatusHooks> = {\n getIsLocked: true,\n getIsActive: true,\n getVersion: true,\n};\n\n/**\n * `snap_getClientStatus` returns useful information about the client running the snap.\n */\nexport const getClientStatusHandler: PermittedHandlerExport<\n GetClientStatusHooks,\n JsonRpcParams,\n GetClientStatusResult\n> = {\n methodNames: ['snap_getClientStatus'],\n implementation: getClientStatusImplementation,\n hookNames,\n};\n\nexport type GetClientStatusHooks = {\n /**\n * @returns Whether the client is locked or not.\n */\n getIsLocked: () => boolean;\n\n /**\n * @returns Whether the client is active or not.\n */\n getIsActive: () => boolean;\n\n /**\n * @returns The version string for the client.\n */\n getVersion: () => string;\n};\n\n/**\n * The `snap_getClientStatus` method implementation.\n * Returns useful information about the client running the snap.\n *\n * @param _request - The JSON-RPC request object. Not used by this function.\n * @param response - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getIsLocked - A function that returns whether the client is locked or not.\n * @param hooks.getIsActive - A function that returns whether the client is opened or not.\n * @param hooks.getVersion - A function that returns the client version.\n * @returns Nothing.\n */\nasync function getClientStatusImplementation(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<GetClientStatusResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getIsLocked, getIsActive, getVersion }: GetClientStatusHooks,\n): Promise<void> {\n response.result = {\n locked: getIsLocked(),\n active: getIsActive(),\n clientVersion: getVersion(),\n platformVersion: getPlatformVersion(),\n };\n return end();\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-rpc-methods",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "MetaMask Snaps JSON-RPC method implementations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@metamask/key-tree": "^10.1.1",
|
|
59
|
-
"@metamask/permission-controller": "^12.
|
|
59
|
+
"@metamask/permission-controller": "^12.1.0",
|
|
60
60
|
"@metamask/rpc-errors": "^7.0.3",
|
|
61
|
-
"@metamask/snaps-sdk": "^10.
|
|
61
|
+
"@metamask/snaps-sdk": "^10.1.0",
|
|
62
62
|
"@metamask/snaps-utils": "^11.6.1",
|
|
63
63
|
"@metamask/superstruct": "^3.2.1",
|
|
64
64
|
"@metamask/utils": "^11.8.1",
|