UNPKG

@metamask/snaps-rpc-methods

Version:
46 lines 2.16 kB
import type { JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine"; import type { Messenger } from "@metamask/messenger"; import type { PermissionControllerHasPermissionAction } from "@metamask/permission-controller"; import type { ClearStateParams, ClearStateResult } from "@metamask/snaps-sdk"; import { type InferMatching } from "@metamask/snaps-utils"; import type { PendingJsonRpcResponse } from "@metamask/utils"; import type { JsonRpcRequestWithOrigin, SnapControllerClearSnapStateAction } from "../types.cjs"; export type ClearStateMethodActions = PermissionControllerHasPermissionAction | SnapControllerClearSnapStateAction; /** * Clear the entire state of the Snap. * * @example * ```ts * await snap.request({ * method: 'snap_clearState', * params: { * encrypted: true, // Optional, defaults to true * }, * }); * ``` */ export declare const clearStateHandler: { implementation: typeof clearStateImplementation; actionNames: ("SnapController:clearSnapState" | "PermissionController:hasPermission")[]; }; declare const ClearStateParametersStruct: import("@metamask/superstruct").Struct<{ encrypted?: boolean | undefined; }, { encrypted: import("@metamask/superstruct").Struct<boolean | undefined, null>; }>; export type ClearStateParameters = InferMatching<typeof ClearStateParametersStruct, ClearStateParams>; /** * The `snap_clearState` method implementation. * * @param request - The JSON-RPC request object. * @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. Not used by this function. * @param messenger - The messenger used to call controller actions. * @returns Nothing. */ declare function clearStateImplementation(request: JsonRpcRequestWithOrigin<ClearStateParameters>, response: PendingJsonRpcResponse<ClearStateResult>, _next: unknown, end: JsonRpcEngineEndCallback, _hooks: never, messenger: Messenger<string, ClearStateMethodActions>): Promise<void>; export {}; //# sourceMappingURL=clearState.d.cts.map