UNPKG

@metamask/snaps-rpc-methods

Version:
47 lines 2.41 kB
import type { JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine"; import type { Messenger } from "@metamask/messenger"; import type { PermissionControllerHasPermissionAction } from "@metamask/permission-controller"; import type { GetInterfaceStateParams, GetInterfaceStateResult } from "@metamask/snaps-sdk"; import { type InferMatching } from "@metamask/snaps-utils"; import type { PendingJsonRpcResponse } from "@metamask/utils"; import type { JsonRpcRequestWithOrigin, SnapInterfaceControllerGetInterfaceStateAction } from "../types.mjs"; export type GetInterfaceStateMethodActions = PermissionControllerHasPermissionAction | SnapInterfaceControllerGetInterfaceStateAction; /** * Get the form state of an [interface](https://docs.metamask.io/snaps/features/custom-ui/interactive-ui/) * created by [`snap_createInterface`](https://docs.metamask.io/snaps/reference/snaps-api/snap_createinterface). * * @example * ```ts * const state = await snap.request({ * method: 'snap_getInterfaceState', * params: { * id: interfaceId, * }, * }); * ``` */ export declare const getInterfaceStateHandler: { implementation: typeof getGetInterfaceStateImplementation; actionNames: ("SnapInterfaceController:getInterfaceState" | "PermissionController:hasPermission")[]; }; declare const GetInterfaceStateParametersStruct: import("@metamask/superstruct").Struct<{ id: string; }, { id: import("@metamask/superstruct").Struct<string, null>; }>; export type GetInterfaceStateParameters = InferMatching<typeof GetInterfaceStateParametersStruct, GetInterfaceStateParams>; /** * The `snap_getInterfaceState` method implementation. * * @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 getGetInterfaceStateImplementation(req: JsonRpcRequestWithOrigin<GetInterfaceStateParameters>, res: PendingJsonRpcResponse<GetInterfaceStateResult>, _next: unknown, end: JsonRpcEngineEndCallback, _hooks: never, messenger: Messenger<string, GetInterfaceStateMethodActions>): void; export {}; //# sourceMappingURL=getInterfaceState.d.mts.map