import { fromFoundryArtifactPath } from '../../util/forge/foundryProject.js';
import { createStandardJsonInput } from './createStandardJsonInput.js';
import { useQuery } from '@tanstack/react-query';
export const getStandardJsonInputQueryKey = (forgeArtifactPath) => [
    'standardJsonInput',
    forgeArtifactPath,
];
export const getStandardJsonInputQuery = async (forgeArtifactPath) => {
    const { foundryProject, contractFileName } = await fromFoundryArtifactPath(forgeArtifactPath);
    const standardJsonInput = await createStandardJsonInput(foundryProject.baseDir, contractFileName);
    return standardJsonInput;
};
export const useStandardJsonInputQuery = (forgeArtifactPath) => {
    return useQuery({
        queryKey: getStandardJsonInputQueryKey(forgeArtifactPath),
        queryFn: () => getStandardJsonInputQuery(forgeArtifactPath),
        staleTime: Infinity, // For the duration of the CLI session, this is cached
    });
};
