UNPKG

@metamask/multichain-account-service

Version:
90 lines 3.12 kB
import { AccountGroupType } from "@metamask/account-api"; import { type MultichainAccountGroupId, type MultichainAccountGroup as MultichainAccountGroupDefinition } from "@metamask/account-api"; import type { Bip44Account } from "@metamask/account-api"; import type { AccountSelector } from "@metamask/account-api"; import type { AccountProvider } from "@metamask/account-api"; import { type KeyringAccount } from "@metamask/keyring-api"; import type { MultichainAccountWallet } from "./MultichainAccountWallet.mjs"; /** * A multichain account group that holds multiple accounts. */ export declare class MultichainAccountGroup<Account extends Bip44Account<KeyringAccount>> implements MultichainAccountGroupDefinition<Account> { #private; constructor({ groupIndex, wallet, providers, }: { groupIndex: number; wallet: MultichainAccountWallet<Account>; providers: AccountProvider<Account>[]; }); /** * Force multichain account synchronization. * * This can be used if account providers got new accounts that the multichain * account doesn't know about. */ sync(): void; /** * Gets the multichain account group ID. * * @returns The multichain account group ID. */ get id(): MultichainAccountGroupId; /** * Gets the multichain account group type. * * @returns The multichain account type. */ get type(): AccountGroupType.MultichainAccount; /** * Gets the multichain account's wallet reference (parent). * * @returns The multichain account's wallet. */ get wallet(): MultichainAccountWallet<Account>; /** * Gets the multichain account group index. * * @returns The multichain account group index. */ get groupIndex(): number; /** * Checks if there's any underlying accounts for this multichain accounts. * * @returns True if there's any underlying accounts, false otherwise. */ hasAccounts(): boolean; /** * Gets the accounts for this multichain account. * * @returns The accounts. */ getAccounts(): Account[]; /** * Gets the account for a given account ID. * * @param id - Account ID. * @returns The account or undefined if not found. */ getAccount(id: Account['id']): Account | undefined; /** * Query an account matching the selector. * * @param selector - Query selector. * @returns The account matching the selector or undefined if not matching. * @throws If multiple accounts match the selector. */ get(selector: AccountSelector<Account>): Account | undefined; /** * Query accounts matching the selector. * * @param selector - Query selector. * @returns The accounts matching the selector. */ select(selector: AccountSelector<Account>): Account[]; /** * Align the multichain account group. * * This will create accounts for providers that don't have any accounts yet. */ align(): Promise<void>; } //# sourceMappingURL=MultichainAccountGroup.d.mts.map