import type { JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine";
import type { Messenger } from "@metamask/messenger";
import type { PermissionConstraint, PermissionControllerGetPermissionsAction, PermissionControllerRequestPermissionsAction } from "@metamask/permission-controller";
import type { RequestSnapsParams, RequestSnapsResult } from "@metamask/snaps-sdk";
import type { SnapsPermissionRequest } from "@metamask/snaps-utils";
import type { PendingJsonRpcResponse } from "@metamask/utils";
import type { JsonRpcRequestWithOrigin, SnapControllerInstallSnapsAction } from "../types.cjs";
export type RequestSnapsMethodActions = SnapControllerInstallSnapsAction | PermissionControllerRequestPermissionsAction | PermissionControllerGetPermissionsAction;
/**
 * Request permission for a dapp to communicate with the specified Snaps and
 * attempt to install them if they're not already installed.
 *
 * If the Snap version range is specified, MetaMask attempts to install a
 * version of the Snap that satisfies the range. If a compatible version of the
 * Snap is already installed, the request succeeds. If an incompatible version
 * is installed, MetaMask attempts to update the Snap to the latest version that
 * satisfies the range. The request succeeds if the Snap is successfully
 * installed.
 *
 * If the installation of any Snap fails, or the user rejects the installation
 * or permission request, this method returns the error that caused the failure.
 *
 * @example
 * ```ts
 * const result = await snap.request({
 *   method: 'wallet_requestSnaps',
 *   params: {
 *     'npm:@metamask/example-snap': {},
 *     'npm:@metamask/another-snap': { version: '1.2.3' },
 *   },
 * });
 * ```
 */
export declare const requestSnapsHandler: {
    implementation: typeof requestSnapsImplementation;
    actionNames: ("SnapController:installSnaps" | "PermissionController:requestPermissions" | "PermissionController:getPermissions")[];
};
/**
 * Checks whether an origin has existing `wallet_snap` permission and
 * whether or not it has the requested snapIds caveat.
 *
 * @param existingPermissions - The existing permissions for the origin.
 * @param requestedSnaps - The requested snaps.
 * @returns True if the existing permissions satisfy the requested snaps, otherwise false.
 */
export declare function hasRequestedSnaps(existingPermissions: Record<string, PermissionConstraint>, requestedSnaps: Record<string, unknown>): boolean;
/**
 * Constructs a valid permission request with merged caveats based on existing permissions
 * and the requested snaps.
 *
 * @param existingPermissions - The existing permissions for the origin.
 * @param requestedPermissions - The permission request passed into `requestPermissions`.
 * @returns `requestedPermissions`.
 */
export declare function getSnapPermissionsRequest(existingPermissions: Record<string, PermissionConstraint>, requestedPermissions: unknown): SnapsPermissionRequest;
/**
 * The `wallet_requestSnaps` method implementation.
 * Tries to install the requested snaps 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 A promise that resolves once the JSON-RPC response has been modified.
 * @throws If the params are invalid.
 */
declare function requestSnapsImplementation(req: JsonRpcRequestWithOrigin<RequestSnapsParams>, res: PendingJsonRpcResponse<RequestSnapsResult>, _next: unknown, end: JsonRpcEngineEndCallback, _hooks: never, messenger: Messenger<string, RequestSnapsMethodActions>): Promise<void>;
export {};
//# sourceMappingURL=requestSnaps.d.cts.map