import { queryClient } from '../commands/_app.js';
import { queryMappingChainById } from './chainById.js';
import { querySuperchainRegistryChainList } from './superchainRegistryChainList.js';
import { rollupChainByIdentifier } from '../util/chains/chains.js';
const getQueryParams = () => {
    return {
        queryKey: ['chainByIdentifier'],
        queryFn: async () => {
            const chainList = await querySuperchainRegistryChainList();
            const chainById = await queryMappingChainById();
            return chainList.reduce((acc, config) => {
                acc[config.identifier] = chainById[config.chainId];
                return acc;
            }, {});
        },
    };
};
export const queryMappingChainByIdentifier = async () => {
    return queryClient.fetchQuery(getQueryParams());
};
// TODO: remove this entirely
export const useMappingChainByIdentifier = () => {
    return {
        data: rollupChainByIdentifier,
        isLoading: false,
    };
};
