@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
34 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClientStatusHandler = void 0;
const hookNames = {
getIsLocked: true,
getIsActive: true,
};
/**
* `snap_getClientStatus` returns useful information about the client running the snap.
*/
exports.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.cjs.map