"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useCorrectNetwork = void 0;
var react_1 = require("react");
var web3_1 = require("./web3");
var constants_1 = require("../utils/constants");
var useCorrectNetwork = function (chain) {
    var _a = __read((0, react_1.useState)(false), 2), isCorrect = _a[0], setIsCorrect = _a[1];
    var chainId = (0, web3_1.useWeb3React)().chainId;
    (0, react_1.useEffect)(function () {
        if (!chainId || !chain) {
            setIsCorrect(false);
            return;
        }
        var actualNetwork = constants_1.chainIdToNetwork[chainId];
        setIsCorrect(chain === 'ALL' || actualNetwork === chain);
    }, [chain, chainId]);
    return isCorrect;
};
exports.useCorrectNetwork = useCorrectNetwork;
//# sourceMappingURL=useCorrectNetwork.js.map