UNPKG

@metamask/snaps-rpc-methods

Version:
63 lines 3.18 kB
import type { CryptographicFunctions } from "@metamask/key-tree"; import type { PermissionSpecificationBuilder, PermissionValidatorConstraint, RestrictedMethodOptions } from "@metamask/permission-controller"; import { PermissionType } from "@metamask/permission-controller"; import type { GetBip44EntropyParams, GetBip44EntropyResult } from "@metamask/snaps-sdk"; import type { NonEmptyArray } from "@metamask/utils"; import type { MethodHooksObject } from "../utils.mjs"; declare const targetName = "snap_getBip44Entropy"; export type GetBip44EntropyMethodHooks = { /** * Get the mnemonic seed of the provided source. If no source is provided, the * mnemonic seed of the primary keyring will be returned. * * @param source - The optional ID of the source to get the mnemonic of. * @returns The mnemonic seed of the provided source, or the default source if no * source is provided. */ getMnemonicSeed: (source?: string | undefined) => Promise<Uint8Array>; /** * Waits for the extension to be unlocked. * * @returns A promise that resolves once the extension is unlocked. */ getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>; /** * Get the cryptographic functions to use for the client. This may return an * empty object or `undefined` to fall back to the default cryptographic * functions. * * @returns The cryptographic functions to use for the client. */ getClientCryptography: () => CryptographicFunctions | undefined; }; type GetBip44EntropySpecificationBuilderOptions = { methodHooks: GetBip44EntropyMethodHooks; }; export declare const getBip44EntropyBuilder: Readonly<{ readonly targetName: "snap_getBip44Entropy"; readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.RestrictedMethod, GetBip44EntropySpecificationBuilderOptions, { permissionType: PermissionType.RestrictedMethod; targetName: typeof targetName; methodImplementation: ReturnType<typeof getBip44EntropyImplementation>; allowedCaveats: Readonly<NonEmptyArray<string>> | null; validator: PermissionValidatorConstraint; }>; readonly methodHooks: MethodHooksObject<GetBip44EntropyMethodHooks>; }>; /** * Builds the method implementation for `snap_getBip44Entropy`. * * @param hooks - The RPC method hooks. * @param hooks.getMnemonicSeed - A function to retrieve the BIP-39 seed * of the user. * @param hooks.getUnlockPromise - A function that resolves once the MetaMask * extension is unlocked and prompts the user to unlock their MetaMask if it is * locked. * @param hooks.getClientCryptography - A function to retrieve the cryptographic * functions to use for the client. * @returns The method implementation which returns a `BIP44CoinTypeNode`. * @throws If the params are invalid. */ export declare function getBip44EntropyImplementation({ getMnemonicSeed, getUnlockPromise, getClientCryptography, }: GetBip44EntropyMethodHooks): (args: RestrictedMethodOptions<GetBip44EntropyParams>) => Promise<GetBip44EntropyResult>; export {}; //# sourceMappingURL=getBip44Entropy.d.mts.map