import type { AccountGroupType, AccountWalletType } from "@metamask/account-api"; import type { AccountGroupIdOf, AccountWalletIdOf } from "@metamask/account-api"; import type { InternalAccount } from "@metamask/keyring-internal-api"; import type { AccountGroupObject, AccountGroupObjectOf } from "./group.mjs"; import type { AccountTreeControllerMessenger } from "./types.mjs"; import type { AccountWalletObject, AccountWalletObjectOf } from "./wallet.mjs"; export type RuleResult = { wallet: { type: WalletType; id: AccountWalletIdOf; metadata: Omit['metadata'], 'name'>; }; group: { type: GroupType; id: AccountGroupIdOf; metadata: Omit['metadata'], 'name'>; }; }; export type Rule = { /** * Account wallet type for this rule. */ readonly walletType: WalletType; /** * Account group type for this rule. */ readonly groupType: GroupType; /** * Applies the rule and check if the account matches. * * If the account matches, then the rule will return a {@link RuleResult} which means * this account needs to be grouped within a wallet associated with this rule. * * If a wallet already exists for this account (based on {@link RuleResult}) then * the account will be added to that wallet instance into its proper group (different for * every wallets). * * @param account - The account to match. * @returns A {@link RuleResult} if this account is part of that rule/wallet, returns * `undefined` otherwise. */ match(account: InternalAccount): RuleResult | undefined; /** * Gets default name for a wallet. * * @param wallet - Wallet associated to this rule. * @returns The default name for that wallet. */ getDefaultAccountWalletName(wallet: AccountWalletObjectOf): string; /** * Gets computed name for a group based on its accounts. * * @param group - Group associated to this rule. * @returns The computed name based on existing accounts. */ getComputedAccountGroupName(group: AccountGroupObjectOf): string; /** * Gets default name for a group based on its position in the wallet. * * @param wallet - Wallet associated to this rule. * @returns The default name prefix for groups of that wallet. */ getDefaultAccountGroupPrefix(wallet: AccountWalletObjectOf): string; }; export declare class BaseRule { protected readonly messenger: AccountTreeControllerMessenger; constructor(messenger: AccountTreeControllerMessenger); /** * Gets computed name for a group based on its accounts. * * @param group - Group associated to this rule. * @returns The computed name based on existing accounts. */ getComputedAccountGroupName(group: AccountGroupObject): string; /** * Gets default prefix name for a group. * * @param wallet - Wallet of this group. * @returns The default prefix name for that group. */ getDefaultAccountGroupPrefix(wallet: AccountWalletObject): string; } //# sourceMappingURL=rule.d.mts.map