import { isCurrencySupported } from "../../currencies";
import allSpecs from "../../generated/specs";
export function getSpecsPerBots(seeds, filters = {}) {
    const filterFamilies = filters.families
        ?.split(",")
        .map(f => f.trim())
        .filter(Boolean) || [];
    const filterCurrencies = filters.currencies
        ?.split(",")
        .map(f => f.trim())
        .filter(Boolean) || [];
    // allSpecs allows to know and infer what are the coins to sync
    const specs = [];
    for (const family in allSpecs) {
        if (filterFamilies.length > 0 && !filterFamilies.includes(family))
            continue;
        const familySpecs = allSpecs[family];
        for (const key in familySpecs) {
            const spec = familySpecs[key];
            if (!isCurrencySupported(spec.currency) || spec.disabled) {
                continue;
            }
            if (filterCurrencies.length > 0 && !filterCurrencies.includes(spec.currency.id)) {
                continue;
            }
            specs.push({ spec, family, key });
        }
    }
    // prepare the jobs
    const specsPerBots = Object.keys(seeds).flatMap((seed, i) => {
        return specs.map(({ spec, family, key }, j) => {
            return {
                seed,
                env: {
                    SEED: seeds[seed],
                    SPECULOS_PID_OFFSET: String(i * specs.length + j),
                },
                spec,
                family,
                key,
            };
        });
    });
    return specsPerBots;
}
//# sourceMappingURL=logic.js.map