UNPKG

@metamask/snaps-rpc-methods

Version:
31 lines 1.2 kB
const hookNames = { getIsLocked: true, getIsActive: true, }; /** * `snap_getClientStatus` returns useful information about the client running the snap. */ export const getClientStatusHandler = { methodNames: ['snap_getClientStatus'], implementation: getClientStatusImplementation, hookNames, }; /** * The `snap_getClientStatus` method implementation. * Returns useful information about the client running the snap. * * @param _request - The JSON-RPC request object. Not used by this function. * @param response - The JSON-RPC response object. * @param _next - The `json-rpc-engine` "next" callback. Not used by this * function. * @param end - The `json-rpc-engine` "end" callback. * @param hooks - The RPC method hooks. * @param hooks.getIsLocked - A function that returns whether the client is locked or not. * @param hooks.getIsActive - A function that returns whether the client is opened or not. * @returns Nothing. */ async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked, getIsActive }) { response.result = { locked: getIsLocked(), active: getIsActive() }; return end(); } //# sourceMappingURL=getClientStatus.mjs.map