"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDeployments = void 0;
const deployments_json_1 = __importDefault(require("../../../../deployments.json"));
const helpers_1 = require("../../helpers");
const types_1 = require("./types");
const Deployments = deployments_json_1.default;
const getDeployments = (chainId, env) => {
    const [deployments] = Deployments[chainId];
    if (!deployments) {
        throw new Error(`No deployments found for chain ${chainId}!`);
    }
    const contracts = deployments.contracts;
    if (!contracts) {
        throw new Error(`No contracts found under deployments for chain ${chainId}!`);
    }
    const isStaging = env === "staging";
    const facets = {};
    types_1.FACET_CONTRACTS.forEach((name) => {
        if (name === "DiamondLoupeFacet") {
            facets[name] = (0, helpers_1.getContract)("_DefaultDiamondLoupeFacet", chainId, false);
            return;
        }
        facets[name] = (0, helpers_1.getContract)(name, chainId, isStaging);
    });
    // Get all the facets
    return {
        Connext: (0, helpers_1.getContract)("Connext_DiamondProxy", chainId, isStaging),
        ...facets,
    };
};
exports.getDeployments = getDeployments;
//# sourceMappingURL=deployments.js.map