import type { AccountState } from "../store/types.js"; import type { AlchemyAccountsConfig, SupportedAccountTypes } from "../types"; import { type CreateAccountParams } from "./createAccount.js"; import { getChain } from "./getChain.js"; export type GetAccountResult = AccountState; export type GetAccountParams = CreateAccountParams; export const getAccount = ( { type }: GetAccountParams, config: AlchemyAccountsConfig ): GetAccountResult => { const accounts = config.clientStore.getState().accounts; const chain = getChain(config); const account = accounts?.[chain.id]?.[type]; if (!account) { return { account: undefined, status: "DISCONNECTED", }; } return account; };