UNPKG

@metamask/snaps-rpc-methods

Version:
49 lines 1.85 kB
import type { JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine"; import type { Messenger } from "@metamask/messenger"; import type { GetSnapsResult } from "@metamask/snaps-sdk"; import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils"; import type { SnapControllerGetPermittedSnapsAction } from "../types.mjs"; export type GetSnapsMethodActions = SnapControllerGetPermittedSnapsAction; /** * Get permitted and installed Snaps for the requesting origin. * * @example * ```ts * const snaps = await snap.request({ * method: 'wallet_getSnaps', * }); * console.log(snaps); * // { * // 'npm:example-snap': { * // id: 'npm:example-snap', * // version: '1.0.0', * // initialPermissions: { ... }, * // blocked: false, * // enabled: true, * // }, * // ..., * // } * ``` */ export declare const getSnapsHandler: { implementation: typeof getSnapsImplementation; actionNames: "SnapController:getPermittedSnaps"[]; }; /** * The `wallet_getSnaps` method implementation. * Fetches available snaps for the requesting origin and adds them to the JSON-RPC response. * * @param req - The JSON-RPC request object. * @param res - 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. Not used by this function. * @param messenger - The messenger used to call controller actions. * @returns Nothing. */ declare function getSnapsImplementation(req: JsonRpcRequest & { origin: string; }, res: PendingJsonRpcResponse<GetSnapsResult>, _next: unknown, end: JsonRpcEngineEndCallback, _hooks: never, messenger: Messenger<string, GetSnapsMethodActions>): Promise<void>; export {}; //# sourceMappingURL=getSnaps.d.mts.map