"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertBlockBasedChain = exports.isBlockBasedChain = exports.assertTimeBasedChain = exports.isTimeBasedChain = exports.assertKnownChain = exports.isKnownChain = exports.blocksPerYear = void 0;
const knownChains = [
    "hardhat",
    "bsctestnet",
    "bscmainnet",
    "sepolia",
    "ethereum",
    "opbnbtestnet",
    "opbnbmainnet",
    "arbitrumsepolia",
    "arbitrumone",
    "opsepolia",
    "opmainnet",
    "basesepolia",
    "basemainnet",
    "unichainsepolia",
    "unichainmainnet",
    "berachainbepolia",
    "zksyncsepolia",
    "zksyncmainnet",
];
exports.blocksPerYear = {
    hardhat: 100,
    bsctestnet: 21024000,
    bscmainnet: 21024000,
    sepolia: 2628000,
    ethereum: 2628000,
    opbnbtestnet: 63072000,
    opbnbmainnet: 63072000,
    arbitrumsepolia: "time-based",
    arbitrumone: "time-based",
    opsepolia: "time-based",
    opmainnet: "time-based",
    basesepolia: "time-based",
    basemainnet: "time-based",
    unichainsepolia: "time-based",
    unichainmainnet: "time-based",
    berachainbepolia: "time-based",
    zksyncsepolia: "time-based",
    zksyncmainnet: "time-based",
};
const isKnownChain = (networkName) => {
    return knownChains.includes(networkName);
};
exports.isKnownChain = isKnownChain;
const assertKnownChain = (networkName) => {
    if (!(0, exports.isKnownChain)(networkName)) {
        throw new Error(`Unsupported network ${networkName}`);
    }
    return networkName;
};
exports.assertKnownChain = assertKnownChain;
const isTimeBasedChain = (networkName) => {
    return exports.blocksPerYear[networkName] === "time-based";
};
exports.isTimeBasedChain = isTimeBasedChain;
const assertTimeBasedChain = (networkName) => {
    if (!(0, exports.isTimeBasedChain)(networkName)) {
        throw new Error(`Expected ${networkName} to be a time-based chain`);
    }
    return networkName;
};
exports.assertTimeBasedChain = assertTimeBasedChain;
const isBlockBasedChain = (networkName) => {
    return typeof exports.blocksPerYear[networkName] === "number";
};
exports.isBlockBasedChain = isBlockBasedChain;
const assertBlockBasedChain = (networkName) => {
    if (!(0, exports.isBlockBasedChain)(networkName)) {
        throw new Error(`Expected ${networkName} to be a block-based chain`);
    }
    return networkName;
};
exports.assertBlockBasedChain = assertBlockBasedChain;
