import { config } from "dotenv"
import { toEcosystem } from "../src/toEcosystem"
import { benchmark7702 } from "./benchmark:7702"
import { benchmarkPrep } from "./benchmark:PREP"
import { benchmarkRegular } from "./benchmark:regular"
config()

export const main = async () => {
  const { infras, meeNode } = await toEcosystem()
  console.log(
    "benchmarking Nexus 1.2.0 initialization",
    infras[0].network.rpcUrl
  )
  await Promise.all(infras.map(benchmarkPrep))
  await Promise.all(infras.map(benchmarkRegular))
  await Promise.all(infras.map(benchmark7702))
}

main()
  .then(() => {
    console.log("success ✅")
    process.exit(0)
  })
  .catch((error) => {
    console.error(error)
    process.exit(1)
  })
