UNPKG

@metamask/multichain-account-service

Version:
71 lines 2.92 kB
import type { Bip44Account } from "@metamask/account-api"; import type { TraceCallback } from "@metamask/controller-utils"; import type { CreateAccountOptions, EntropySourceId, KeyringAccount } from "@metamask/keyring-api"; import type { KeyringCapabilities } from "@metamask/keyring-api/v2"; import type { InternalAccount } from "@metamask/keyring-internal-api"; import type { Provider } from "@metamask/network-controller"; import type { MultichainAccountServiceMessenger } from "../types.cjs"; import { BaseBip44AccountProvider } from "./BaseBip44AccountProvider.cjs"; export type EvmAccountProviderConfig = { discovery: { enabled?: boolean; maxAttempts: number; timeoutMs: number; backOffMs: number; }; }; export declare const EVM_ACCOUNT_PROVIDER_NAME = "EVM"; export declare const EVM_ACCOUNT_PROVIDER_DEFAULT_CONFIG: { discovery: { maxAttempts: number; timeoutMs: number; backOffMs: number; }; }; export declare class EvmAccountProvider extends BaseBip44AccountProvider { #private; static NAME: string; readonly capabilities: KeyringCapabilities; constructor(messenger: MultichainAccountServiceMessenger, config?: EvmAccountProviderConfig, trace?: TraceCallback); isAccountCompatible(account: Bip44Account<InternalAccount>): boolean; getName(): string; /** * Get the EVM provider. * * @returns The EVM provider. */ getEvmProvider(): Provider; /** * Create accounts for the EVM provider. * * @param options - The options for the creation of the accounts. * @returns The accounts for the EVM provider. */ createAccounts(options: CreateAccountOptions): Promise<Bip44Account<KeyringAccount>[]>; /** * Discover and create accounts for the EVM provider. * * @param opts - The options for the discovery and creation of accounts. * @param opts.entropySource - The entropy source to use for the discovery and creation of accounts. * @param opts.groupIndex - The index of the group to create the accounts for. * @returns The accounts for the EVM provider. */ discoverAccounts(opts: { entropySource: EntropySourceId; groupIndex: number; }): Promise<Bip44Account<KeyringAccount>[]>; resyncAccounts(): Promise<void>; /** * Delete an EVM account by id. * * Resolves the account's entropy source from the tracked account, then * forwards to the v2 HD keyring's `deleteAccount(id)`. When this is the * last account on a non-primary HD keyring, the keyring controller will * automatically prune the empty keyring (see * `KeyringController.#cleanUpEmptiedKeyringsAfter`). * * @param id - The id of the account to delete. */ deleteAccount(id: Bip44Account<KeyringAccount>['id']): Promise<void>; } //# sourceMappingURL=EvmAccountProvider.d.cts.map