{
  "version": 3,
  "sources": ["../../../src/apiCalls/configuration/getNetworkConfigFromApi.ts"],
  "sourcesContent": ["import axios from 'axios';\nimport { ApiNetworkConfigType } from 'types/network.types';\nimport { NETWORK_CONFIG_ENDPOINT } from '../endpoints';\n\nconst urlIsValid = (url: string) => {\n  try {\n    return Boolean(new URL(url));\n  } catch {\n    return false;\n  }\n};\n\nexport async function getNetworkConfigFromApi(apiAddress: string) {\n  if (!urlIsValid(apiAddress)) {\n    return null;\n  }\n\n  const configUrl = `${apiAddress}/${NETWORK_CONFIG_ENDPOINT}`;\n\n  try {\n    const { data } = await axios.get<{\n      data: { config: ApiNetworkConfigType };\n    }>(configUrl);\n\n    if (data != null) {\n      return data?.data?.config;\n    }\n  } catch (_err) {\n    console.error('error fetching configuration for ', configUrl);\n  }\n  return null;\n}\n"],
  "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAElBC,EAAwC,wBAExC,MAAMC,EAAcC,GAAgB,CAClC,GAAI,CACF,MAAO,EAAQ,IAAI,IAAIA,CAAG,CAC5B,MAAQ,CACN,MAAO,EACT,CACF,EAEA,eAAsBL,EAAwBM,EAAoB,CAChE,GAAI,CAACF,EAAWE,CAAU,EACxB,OAAO,KAGT,MAAMC,EAAY,GAAGD,CAAU,IAAI,yBAAuB,GAE1D,GAAI,CACF,KAAM,CAAE,KAAAE,CAAK,EAAI,MAAM,EAAAC,QAAM,IAE1BF,CAAS,EAEZ,GAAIC,GAAQ,KACV,OAAOA,GAAM,MAAM,MAEvB,MAAe,CACb,QAAQ,MAAM,oCAAqCD,CAAS,CAC9D,CACA,OAAO,IACT",
  "names": ["getNetworkConfigFromApi_exports", "__export", "getNetworkConfigFromApi", "__toCommonJS", "import_axios", "import_endpoints", "urlIsValid", "url", "apiAddress", "configUrl", "data", "axios"]
}
