import type { Json, JsonRpcParams, JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils'; import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from 'json-rpc-engine'; import type { CaveatSpecificationConstraint, CaveatSpecificationMap } from './Caveat'; import type { PermissionSpecificationConstraint, PermissionSpecificationMap } from './Permission'; export declare enum MethodNames { requestPermissions = "wallet_requestPermissions", getPermissions = "wallet_getPermissions" } /** * Utility type for extracting a union of all individual caveat or permission * specification types from a {@link CaveatSpecificationMap} or * {@link PermissionSpecificationMap}. * * @template SpecificationsMap - The caveat or permission specifications map * whose specification type union to extract. */ export declare type ExtractSpecifications | PermissionSpecificationMap> = SpecificationsMap[keyof SpecificationsMap]; /** * A middleware function for handling a permitted method. */ export declare type HandlerMiddlewareFunction = (req: JsonRpcRequest, res: PendingJsonRpcResponse, next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback, hooks: T) => void | Promise; /** * We use a mapped object type in order to create a type that requires the * presence of the names of all hooks for the given handler. * This can then be used to select only the necessary hooks whenever a method * is called for purposes of POLA. */ export declare type HookNames = { [Property in keyof T]: true; }; /** * A handler for a permitted method. */ export declare type PermittedHandlerExport = { implementation: HandlerMiddlewareFunction; hookNames: HookNames; methodNames: string[]; }; //# sourceMappingURL=utils.d.ts.map