export const makeApiRequest = async (path) => {
    try {
        const response = await fetch(`https://min-api.cryptocompare.com/${path}`);
        return response.json();
    }
    catch (error) {
        if (error instanceof Error) {
            throw new Error(`CryptoCompare request error: ${error.toString()}`);
        }
    }
};
export const generateSymbol = (exchange, from, to) => {
    const short = `${from}/${to}`;
    return {
        short,
        full: `${exchange}:${short}`,
    };
};
export const parseFullSymbol = (fullSymbol) => {
    const match = fullSymbol.match(/^(\w+):(\w+)\/(\w+)$/);
    if (!match) {
        return undefined;
    }
    return { exchange: match[1], fromSymbol: match[2], toSymbol: match[3] };
};
//# sourceMappingURL=helpers.js.map