UNPKG

@metamask/account-api

Version:
44 lines 1.37 kB
import type { KeyringAccount } from "@metamask/keyring-api"; /** * Selector to query a specific account based on some criteria. */ export type AccountSelector<Account extends KeyringAccount> = { /** * Query by account ID. */ id?: Account['id']; /** * Query by account address. */ address?: Account['address']; /** * Query by account type. */ type?: Account['type']; /** * Query by account methods. */ methods?: Account['methods']; /** * Query by account scopes. */ scopes?: Account['scopes']; }; /** * Query an account matching the selector. * * @param accounts - List of accounts to select from. * @param selector - Query selector. * @returns The account matching the selector or undefined if not matching. * @throws If multiple accounts match the selector. */ export declare function selectOne<Account extends KeyringAccount>(accounts: Account[], selector: AccountSelector<Account>): Account | undefined; /** * Query accounts matching the selector. * * @param accounts - List of accounts to select from. * @param selector - Query selector. * @returns The accounts matching the selector. */ export declare function select<Account extends KeyringAccount>(accounts: Account[], selector: AccountSelector<Account>): Account[]; //# sourceMappingURL=selector.d.mts.map