"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useGetChains", {
    enumerable: true,
    get: function() {
        return useGetChains;
    }
});
const _react = require("react");
const _hooks = require("@orderly.network/hooks");
const _utils = require("@orderly.network/utils");
function useGetChains() {
    const { connectedChain } = (0, _hooks.useWalletConnector)();
    const [mainChains, { findByChainId }] = (0, _hooks.useChains)("mainnet", {
        pick: "network_infos",
        filter: (chain)=>chain.network_infos?.bridge_enable || chain.network_infos?.bridgeless
    });
    const chainName = (0, _react.useMemo)(()=>{
        // @ts-ignore
        const chain = findByChainId(parseInt(connectedChain?.id), "network_infos");
        if (!chain) {
            return "Unknown";
        }
        // @ts-ignore
        if ((0, _utils.isTestnet)(chain.chain_id)) {
            return "Testnet";
        }
        // @ts-ignore
        return chain.name;
    }, [
        connectedChain,
        findByChainId
    ]);
    return chainName;
}

//# sourceMappingURL=useGetChains.js.map