import type { PermissionSpecificationBuilder, ValidPermissionSpecification, RestrictedMethodOptions, RestrictedMethodParameters } from "@metamask/permission-controller"; import { PermissionType } from "@metamask/permission-controller"; import type { GetPreferencesResult } from "@metamask/snaps-sdk"; import type { NonEmptyArray } from "@metamask/utils"; import type { MethodHooksObject } from "../utils.cjs"; declare const methodName = "snap_getPreferences"; export type GetPreferencesMethodHooks = { getPreferences: () => GetPreferencesResult; }; type SpecificationBuilderOptions = { allowedCaveats?: Readonly> | null; methodHooks: GetPreferencesMethodHooks; }; type Specification = ValidPermissionSpecification<{ permissionType: PermissionType.RestrictedMethod; targetName: typeof methodName; methodImplementation: ReturnType; allowedCaveats: Readonly> | null; }>; /** * The specification builder for the `snap_getPreferences` permission. * `snap_getPreferences` allows snaps to access user preferences. * * @param options - The specification builder options. * @param options.allowedCaveats - The optional allowed caveats for the permission. * @param options.methodHooks - The RPC method hooks needed by the method implementation. * @returns The specification for the `snap_getPreferences` permission. */ export declare const specificationBuilder: PermissionSpecificationBuilder; /** * Gets the user's preferences. * * @example * ```json name="Manifest" * { * "initialPermissions": { * "snap_getPreferences": {} * } * } * ``` * ```ts name="Usage" * const preferences = await snap.request({ * method: 'snap_getPreferences', * }); * * console.log(preferences); * // { * // locale: 'en', * // currency: 'usd', * // ... * // } * ``` */ export declare const getPreferencesBuilder: Readonly<{ readonly targetName: "snap_getPreferences"; readonly specificationBuilder: PermissionSpecificationBuilder; allowedCaveats: Readonly> | null; }>; readonly methodHooks: MethodHooksObject; }>; /** * Builds the method implementation for `snap_getPreferences`. * * @param hooks - The RPC method hooks. * @param hooks.getPreferences - A function that returns the user selected preferences. * @returns The user preferences. */ export declare function getImplementation({ getPreferences, }: GetPreferencesMethodHooks): (_args: RestrictedMethodOptions) => Promise; export {}; //# sourceMappingURL=getPreferences.d.cts.map